akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
#define _GLIBCXX_DEBUG

int main() {
  int x; cin >> x;
  if(x == 0) cout << 1 << endl;
  else cout << 0 << endl;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
  int N;
  int count = 0;
  int lamp = 1;
  cin >> N;
  vector<int> a(N);
  rep(i,N)
    cin >> a.at(i);
  while(1){
    lamp = a.at(lamp-1);
    count++;
    if(lamp == 2){
      cout << count << endl;
      break;
    }
    if(count == N){
      cout << -1 << endl;
      break;
    }
  }
  
}

Measured memory_bytes: 640
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int A = s.indexOf("A");
		int Z = s.lastIndexOf("Z");
		System.out.println(Z-A+1);

	}

}


Measured memory_bytes: 28456
#include <bits/stdc++.h>
#define FOR(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define FORUL(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#define FORULE(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define FOREACH(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define AUTOVAR(newvar,v) auto newvar = (v)
#else
#define AUTOVAR(newvar,v) __typeof(newvar) r = (v)
#endif
#define PB(x) push_back(x)
#define MP(x,y) make_pair((x),(y))
#define MEMSET(m,v) memset(m,v,sizeof(m))

typedef long long				 ll;
typedef unsigned long long		ull;

#define DEBUG 1

#if DEBUG
#define DOUT cout<<"["<<__LINE__<<"]:"
#else
#define DOUT 0 && cout
#endif

using namespace std;

int N;

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false);

	cin >> N;

	ll ans = 0;
	FOR(n,N) {
		ans += n;
	}

	cout << ans << endl;

	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

 
unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main(){
  string s;
  cin >> s;
  while(1) {
    s.pop_back();
    s.pop_back();
    if(s.substr(0,s.size()/2)==s.substr(s.size()/2,s.size()/2)) {
      cout << s.size();
      return 0;
    }
  }
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(kbrni,n)cout<<" "<<a[kbrni];cout<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define svecp(v) cout<<#v<<":";each(kbrni,v)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(1){
        int m,nmax,nmin;
        int val = 1;
        cin >> m >> nmin >> nmax;
        if(m == 0){
            break;
        }
        vector<int> vec(m);
        rep(i,m){
            cin >> vec[i];
        }
        int ans = -1;
        srep(i,nmin,nmax+1){
            if(val <= vec[i-1] - vec[i]){
                val = vec[i-1]-vec[i];
                ans = i;
            }
        }
        cout << ans << "\n";
    }
    return 0;
}



Measured memory_bytes: 3136
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
typedef long long ll;
using namespace std;

int main(){
  string s;
  cin >> s;
  ll ans = 0;

  for(int t=0; t<(1<<(s.size()-1)); t++){
    ll num = s[0] -'0';
    for(int i=0; i<s.size()-1; i++){
      if(t&(1<<i)){
          ans+=num;
          num=0;
      }
      num=num*10+s[i+1]-'0';
    }
    ans+=num;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(raw_input())
T, A = map(int, raw_input().split())
H = map(int ,raw_input().split())
nearT, nearI = 100000, 0
i = 0
while i < N:
  tempelature = T-0.006*H[i]
  if abs(tempelature-A) < nearT:
    nearT = abs(tempelature-A)
    nearI = i
  i+=1
print nearI+1



Measured memory_bytes: 2692
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define MOD 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//↑templete
signed main(){

	int H, A;
	cin>>H>>A;
	cout<<(H+A-1)/A<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

bool dfs(int v, int const s, vector<vector<int>> const& es, vector<bool>& visited) {
    visited[v] = true;
    bool res = false;
    for(auto& u : es[v]) {
        if(!visited[u]) {
            res |= dfs(u, s, es, visited);
        } else if(visited[v] && u == s) {
            res = true;
            break;
        }
    }
    return res;
}

int main() {
    int n;
    cin >> n;
    vector<vector<int>> es(210);
    for(int i=0; i<n; ++i) {
        int u, d;
        string s;
        cin >> u >> s >> d;
        d += 100;
        if(s == "lock") {
            es[d].push_back(u);
        } else {
            es[u].push_back(d);
        }
    }
    bool res = false;
    for(int i=0; i<101; ++i) {
        vector<bool> visited(210);
        res |= dfs(i, i, es, visited);
    }
    cout << res << endl;
}


Measured memory_bytes: 3160
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
using namespace std;
typedef long long int ll;

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  rep (i, 100000) {
    if (i % 2 == 0) {
      c -= b;
      if (c <= 0) {
        Yes;
        return 0;
      }
    } else {
      a -= d;
      if (a <= 0) {
        No;
        return 0;
      }
    }
  }

  return 0;
}

Measured memory_bytes: 3628
import sys
import math

n, m = map(int, input().split())
h = list(map(int, input().split()))
ma = [0] * n
for i in range(m):
    a, b = map(int, input().split())
    ma[a - 1] = max(ma[a-1],h[b - 1])
    ma[b - 1] = max(ma[b-1] ,h[a - 1])
cnt = 0
for i in range(n):
    if h[i] > ma[i]:
        cnt += 1
print(cnt)


Measured memory_bytes: 20120
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef int64_t Int;
typedef pair<Int, Int> p;



int main(){
    int N, M; cin >> N >> M;
    vector<p> ab(51), cd(51);
    rep(i,N) cin >> ab[i].first >> ab[i].second;
    rep(i,M) cin >> cd[i].first >> cd[i].second;

    rep(i,N){
        Int minD = 1e9, ans = -1;
        rep(j,M){
            Int D = abs(ab[i].first - cd[j].first) + abs(ab[i].second - cd[j].second);
            if(D < minD){
                minD = D; 
                ans = j+1;
            };
        }
        cout << ans << endl;
    }
    
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <cstdio>

using namespace std;

int main() {
    int n, k, h, m;
    vector<pair<int, int> > time;
    cin >> n;
    while (n--) {
        cin >> h >> m;
        time.push_back(make_pair(h, m));
    }
    cin >> k;
    while (k--) {
        cin >> h >> m;
        time.push_back(make_pair(h, m));
    }
    sort(time.begin(), time.end());
    time.erase(unique(time.begin(), time.end()), time.end());
    printf("%d:%02d", time[0].first, time[0].second);
    for (int i = 1; i < time.size(); ++i) {
        printf(" %d:%02d", time[i].first, time[i].second);
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 1236
n,q=map(int,input().split())
s=input()
ans=[0]*n+[0]
for i in range(n):
    if s[i:i+2]=='AC':
        ans[i+1]=ans[i]+1
    else:
        ans[i+1]=ans[i]
for i in range(q):
    l,r=map(int,input().split())
    print(ans[r-1]-ans[l-1])

Measured memory_bytes: 6172
/*
 
*/ 
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define LSOne(S) (S & (-S))
#define EPS 1e-9
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pd;
typedef tree<pi, null_type, less<pi>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int MOD = 1e9+7;

int main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(0); // FOR QUERY PROBLEM DON'T FORGET TO UNCOMMENT THIS
    int n;
    cin >> n;
    vector<ll> vec(n);
    for(auto& v : vec)
    {
        cin >> v;
    }
    vector<ll> suff = vec;
    for(int i = n-2; i >= 0; --i)
    {
        (suff[i] += suff[i+1]) %= MOD;
    }
    ll ans = 0;
    for(int i = 0; i < n-1; ++i)
    {
        ll temp = (vec[i] * suff[i+1]) % MOD;
        (ans += temp) %= MOD;
    }
    cout << ans << "\n";
    return 0;
}
 
/*
 
*/  

Measured memory_bytes: 6360
#include <stdio.h>
#include <math.h>
int main(void){
    double base = 100000;
    int cnt = 0;
    scanf( "%d" , &cnt );
    
    for( int i = 0 ; i < cnt; i++ ){
        base = (base * 1.05)/1000;
        base = ceil(base);
        base = base * 1000;
    }
    printf("%d\n", (int)base);
}



Measured memory_bytes: 2028
#include<bits/stdc++.h>
using namespace std;
const int N=200005;

inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-') f=-1;ch=getchar();}
	while(isdigit(ch)){x=(x<<3)+(x<<1)+(ch&15);ch=getchar();}
	return x*f;
}

int n,l,a[N];

int main()
{
	n=read(),l=read();
	for(int i=1;i<=n;i++) a[i]=read();
	int k=1;
	for(int i=1;i<n;i++)
	if(a[i]+a[i+1]>a[k]+a[k+1]) k=i;
	if(a[k]+a[k+1]<l) printf("Impossible\n");
	else
	{
		printf("Possible\n");
		for(int i=n-1;i>k;i--) printf("%d\n",i);
		for(int i=1;i<=k;i++) printf("%d\n",i);
	}
}

Measured memory_bytes: 1152
#include <iostream>
#include <sstream>
#include <map>
using namespace std;
int main(){
	string s,tmp,lw,histw;
	map<string,int> count;
	int maxh=0,maxl=0;
	getline(cin,s);
	stringstream ss;
	ss<<s;
	while(ss>>tmp){
		if(count.find(tmp)!=count.end())++count[tmp];
		else count[tmp]=1;
		if(count[tmp]>maxh){
			maxh=count[tmp];
			histw=tmp;
		}
		if(tmp.length()>lw.length())lw=tmp;
	}
	cout<<histw<<" "<<lw<<"\n";
	return 0;
}

Measured memory_bytes: 0
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
//#define ll long long
//#define int  unsigned long long
#define pb push_back
#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int N = 3000000;
int mod = 1e9 + 7;
int f[N], dp[N], s[N];
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int n;
    cin >> n;
    cout << 180 * n - 360;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;

int main(void)
{
	int n;
	cin >> n;
	int k;
	cin >> k;
	int h[n];
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	int d[n];
	for (int i = 0; i < n; i++) {
		d[i] = 0;
	}
	d[1] = abs(h[1]-h[0]);
	for (int i = 2; i < n; i++) {
		int m = d[i-1] + abs(h[i]-h[i-1]);
		for (int j = 1; j <= k; j++) {
			if (i-j < 0)
				break;
			m = min(m, d[i-j] + abs(h[i]-h[i-j]));
		}
		d[i] = m;
	}
	cout << d[n-1] << endl;

	return 0;
}


Measured memory_bytes: 1024
abcd = input()
a = int(abcd[0])
b = int(abcd[1])
c = int(abcd[2])
d = int(abcd[3])

op = ["+", "-"]
for op1 in op:
    for op2 in op:
        for op3 in op:
            val = a
            if op1 == "+":
                val += b
            else:
                val -= b
 
            if op2 == "+":
                val += c
            else:
                val -= c
 
            if op3 == "+":
                val += d
            else:
                val -= d
            
            if val==7:
                print("{}{}{}{}{}{}{}=7".format(a,op1,b,op2,c,op3,d))
                exit(0)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
template<class T, class... U> void assign(V<T>& v, int n, const U&... u) { v.resize(n); for (auto&& i : v) assign(i, u...); }

struct M {
  using T = int;
  using U = int;
  static void ap(T& a, const U& g) { a += g; }
  // static void ap(U& f, const U& g) { f += g; }
  static constexpr U id() { return 0; }
};

template<class M> struct ST {
  using T = typename M::T;
  using U = typename M::U;
  int n;
  V<T> t;
  V<U> u;

  ST(int n) : n(n) {
    t.assign(n, 0);
    u.assign(n, M::id());
  }

  void _ap(int i, const U& f) {
    if (i < n) M::ap(u[i], f);
    else M::ap(t[i - n], f);
  }

  T get(int i) {
    T res = t[i];
    for (i += n; i >>= 1;) M::ap(res, u[i]);
    return res;
  }

  void set(int l, int r, const U& f) {
    // stack<int> s;
    // for (int i = l + n; i >>= 1;) s.push(i);
    // for (int i = r + n - 1; i >>= 1;) s.push(i);
    // while (!s.empty()) {
    //   int i = s.top(); s.pop();
    //   _ap(2 * i, u[i]);
    //   _ap(2 * i + 1, u[i]);
    //   u[i] = M::id();
    // }
    for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
      if (l & 1) _ap(l++, f);
      if (r & 1) _ap(--r, f);
    }
  }
};

int main() {
  cin.tie(NULL); ios::sync_with_stdio(false);
  int n, m; cin >> n >> m;
  struct seg { int l, r; };
  V<seg> a(n); for (int i = 0; i < n; i++) cin >> a[i].l >> a[i].r;
  sort(a.begin(), a.end(), [](seg a, seg b) { return a.r - a.l < b.r - b.l; });
  ST<M> res(m + 1), st(m + 1);
  int i = 0;
  for (int d = 1; d < m + 1; d++) {
    while (i < n and a[i].r - a[i].l + 1 <= d) {
      st.set(a[i].l, a[i].r + 1, 1);
      res.set(1, d, 1);
      i++;
    }
    for (int x = 0; x < m + 1; x += d) res.set(d, d + 1, st.get(x));
  }
  for (int d = 1; d < m + 1; d++) cout << res.get(d) << '\n';
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
using lli = int_fast64_t;
using ulli = uint_fast64_t;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = x;cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl

const lli MOD = 1000000007;
const lli LIMIT = 1000000000000000000 * 5;
const int tenfive = 100000;

int main() {
	string s;
	cin >> s;
	int N = count(s.begin(), s.end(), 'N');
	int S = count(s.begin(), s.end(), 'S');

	int E = count(s.begin(), s.end(), 'E');
	int W = count(s.begin(), s.end(), 'W');

	bool ok = true;
	if (N > 0 || S > 0) {
		if (N == 0 || S == 0) {
			ok = false;
		}
	}

	if (E > 0 || W > 0) {
		if (W == 0 || E == 0) {
			ok = false;
		}
	}
	cout << (ok ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define range(i, l, r) for(long long int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (long long int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    if (v.size() == 0) return os << "]";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    lint N; cin >> N;
    lint ans = 0;
    range(i, 1, N + 1) {
        if (i % 3 == 0 or i % 5 == 0) continue;
        ans += i;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3656
#include "bits/stdc++.h"
#include "atcoder/all"
using namespace atcoder;
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int k;
	cin >> k;
	rep(i,k) cout << "ACL";
	cout << endl;
	return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <algorithm>
#include <bitset>
#include <cmath>
#define range(i, r) for(int i=0;i<r;i++)
#define ranges(i, l, r) for(int i=l;i<r;i++)
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
#define MODn 1000000009;
typedef long long int ll;
using namespace std;
bool judge(ll a, ll b){
  if(b==1) return false;
  if(a/(b-1)==a%(b-1)) return true;
  else return false;
}

int main(int argc, char const *argv[]) {
  ll N, ans = 0;
  std::cin >> N;
  for(ll i=1; i*i<=N;i++){
    //std::cout << i << '\n';
    if(N%i==0){
      if(i*i==N){
        if(judge(N, i)) ans += i-1;
      }else{
        if(judge(N, i)) ans += i-1;
        if(judge(N, N/i)) ans += N/i-1;
      }
    }
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 888
# 2019-11-16 21:01:15(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    n = int(sys.stdin.readline().rstrip())
    s = sys.stdin.readline().rstrip()
    if n % 2 == 1:
        ans = 'No'
    else:
        if s[:n//2] * 2 == s:
            ans = 'Yes'
        else:
            ans = 'No'
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>

using namespace std;

const int INF = 1 << 30;

struct Primal_Dual
{
  typedef pair< int, int > Pi;

  struct edge
  {
    int to, cap, cost, rev;
  };
  vector< vector< edge > > graph;
  vector< int > potential, min_cost, prevv, preve;

  Primal_Dual(int V) : graph(V) {}

  void add_edge(int from, int to, int cap, int cost)
  {
    graph[from].push_back((edge) {to, cap, cost, (int) graph[to].size()});
    graph[to].push_back((edge) {from, 0, -cost, (int) graph[from].size() - 1});
  }

  int min_cost_flow(int s, int t, int f)
  {
    int V = graph.size(), ret = 0;
    priority_queue< Pi, vector< Pi >, greater< Pi > > que;
    potential.assign(V, 0);
    preve.assign(V, -1);
    prevv.assign(V, -1);

    while(f > 0) {
      min_cost.assign(V, INF);
      que.push(Pi(0, s));
      min_cost[s] = 0;

      while(!que.empty()) {
        Pi p = que.top();
        que.pop();
        if(min_cost[p.second] < p.first) continue;
        for(int i = 0; i < graph[p.second].size(); i++) {
          edge &e = graph[p.second][i];
          int nextCost = min_cost[p.second] + e.cost + potential[p.second] - potential[e.to];
          if(e.cap > 0 && min_cost[e.to] > nextCost) {
            min_cost[e.to] = nextCost;
            prevv[e.to] = p.second, preve[e.to] = i;
            que.push(Pi(min_cost[e.to], e.to));
          }
        }
      }
      if(min_cost[t] == INF) return (INF);
      for(int v = 0; v < V; v++) potential[v] += min_cost[v];
      int addflow = f;
      for(int v = t; v != s; v = prevv[v]) {
        addflow = min(addflow, graph[prevv[v]][preve[v]].cap);
      }
      f -= addflow;
      ret += addflow * potential[t];
      for(int v = t; v != s; v = prevv[v]) {
        edge &e = graph[prevv[v]][preve[v]];
        e.cap -= addflow;
        graph[v][e.rev].cap += addflow;
      }
    }
    return ret;
  }
};

int N, M, B, AX[100], AY[100], BX[5], BY[5], C[5], F[5];

int check(int bit, int dist)
{
  int ret = 0, cnt = __builtin_popcount(bit);
  for(int i = 0; i < M; i++) if((bit >> i) & 1) ret += F[i];
  ret += dist * B * cnt;
  Primal_Dual flow(N + M + 2);
  int latte = N + M, malta = N + M + 1;
  for(int i = 0; i < N; i++) flow.add_edge(latte, i, 1, 0);
  for(int i = 0; i < M; i++) {
    if((bit >> i) & 1) {
      flow.add_edge(N + i, malta, C[i], 0);
      for(int j = 0; j < N; j++) {
        flow.add_edge(j, N + i, 1, max(0, abs(AX[j] - BX[i]) + abs(AY[j] - BY[i]) - dist));
      }
    }
  }
  return (flow.min_cost_flow(latte, malta, N) + ret);
}

int beet(int bit)
{
  int ng = -1, ok = 5050;
  while(ok - ng > 1) {
    int mid = (ok + ng) >> 1;
    int latte = check(bit, mid);
    int malta = check(bit, mid + 1);
    if(malta - latte >= 0) ok = mid;
    else ng = mid;
  }
  return (check(bit, ok));
}

int main()
{
  while(scanf("%d %d %d", &N, &M, &B), N) {
    for(int i = 0; i < N; i++) scanf("%d %d", AX + i, AY + i);
    for(int i = 0; i < M; i++) scanf("%d %d %d %d", BX + i, BY + i, C + i, F + i);
    int ret = INF;
    for(int i = 0; i < (1 << M); i++) ret = min(ret, beet(i));
    printf("%d\n", ret);
  }
}

Measured memory_bytes: 3264
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		if(a%2 == 0) {
			System.out.println(a);
		}else {
			System.out.println(a*2);
		}
	}

}

Measured memory_bytes: 21844
N, T = map(int, input().split())
A = list(map(int, input().split()))

lo = 10**18
hi = 0
d = 0
res = 0


for i in range(N):
    if lo > A[i]:
        lo = A[i]
        hi = 0
    if hi < A[i]:
        hi = A[i]
        if d == hi - lo:
            res += 1
        elif d < hi - lo:
            d = hi - lo
            res = 1

print(res)

Measured memory_bytes: 20464
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>
#define len length()
#define sz size()
#define rng(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) rng(i, 0, n)
#define srt(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define vi(a, n) vector<int> a(n)
#define vs(a, n) vector<string> a(n)
#define vc(a, n) vector<char> a(n)
#define psb(a) push_back(a)
#define ppb pop_back()
#define erc(S, i) S.erase(S.begin() + i)
#define ers(S, i, j) S.erase(S.begin() + i, S.begin() + j)
#define sp(n) cout << setprecision(n) << fixed
#define fst(s) s.at(0)
#define lst(s) s.at(s.len - 1)
using namespace std;

int main(){
    string N;
    cin >> N;
    int ans=0;
    rep(i,4) if(N.at(i) == '2') ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
int main(){
    int m,f,r;
    for(;;){
        scanf("%d %d %d",&m,&f,&r);
        if(m==-1&&f==-1&&r==-1)break;
       else if(m==-1||f==-1)printf("F\n");
        else if (m+f>=80) printf("A\n");
        else if (m+f>=65) printf("B\n");
        else if (m+f>=50) printf("C\n");
        else if (m+f>=30 && r>=50) printf("C\n");
        else if (m+f>=30) printf("D\n");
        else if (m+f<30)  printf("F\n");
    }
    return 0;   
}
         
       
      
     
   



Measured memory_bytes: 2036
#include <iostream>
using namespace std;

int main()
{
	bool cards[4][14];
	int n, rank;
	char suit;

	for (int s = 0; s < 4; s++) {
		for (int r = 1; r <= 13; r++) {
			cards[s][r]=0;
		}
	}
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> suit >> rank;
		if (suit == 'S')cards[0][rank] = 1;
		if (suit == 'H')cards[1][rank] = 1;
		if (suit == 'C')cards[2][rank] = 1;
		if (suit == 'D')cards[3][rank] = 1;
	}

	for (int s = 0; s < 4; s++) {
		for (int r = 1; r <= 13; r++) {
			if (cards[s][r])continue;
			if (s == 0)suit = 'S';
			if (s == 1)suit = 'H';
			if (s == 2)suit = 'C';
			if (s == 3)suit = 'D';
			cout << suit << " " << r << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3068
n, k, q = map(int, input().split())
points = [k]*n
win = [0]*n

for i in range(q):
    a = int(input())
    win[a-1] += 1

for i in range(n):
    point = points[i]-q+win[i]
    if point <= 0:
        print('No')
    else:
        print('Yes')

Measured memory_bytes: 10548
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for (int i=0;i<n;++i)

int main() {
  int n,ans,mn=100000000;

  cin >> n;
  vector<int> x(n);

  rep(i,n) {
    cin >> x[i];
  }

  rep(i,100){
    int t=0;
    rep(j,n){
      t += pow((x[j] - i),2);
    }
    mn = min(mn,t);
    if (mn==t) ans = i;
  }

  cout << mn << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n,k;
    cin >> n >> k;

    vector<int> inp(n + 1,0);
    for(int i = 1 ; i <= n ; i++){
        cin >> inp.at(i);
        //inp.at(i) = 0;
    }

    vector<int> data(n + 2,0);
    
    if(k >= 2000){
        k = 2000;
    }

    for(int j = 0 ; j < k ; j++){
        for(int i = 1 ; i <= n ; i++){
            int left = max(i - inp.at(i), 1);
            int right = min(i + inp.at(i) + 1, n + 1);
            data.at(left)++;
            data.at(right)--;
        }
        int temp = 0;
        for(int i = 1 ; i <= n ; i++){
            temp += data.at(i);
            data.at(i) = 0;
            inp.at(i) = temp;
        }

        
    }

    //確認用
    for(int i = 1 ; i <= n ; i++){
        cout << inp.at(i);
        if(i != n){
            cout << " ";
        }
    }
    //cout << " " << j+1 << endl;
    cout << endl;
}

Measured memory_bytes: 4804
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
using namespace std;

int main() {

	int k, x;

	cin >> k >> x;

	for (int i = k * (-1); i <= k - 2; i++) {
		cout << x + i + 1 << " ";
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

int FindStart(const vector<int64_t> &vec)
{
    auto res = 0;
    for (size_t i = 0; i < vec.size(); i += 1) {
        if (abs(vec[i]) > abs(vec[res])) {
            res = i;
        }
    }
    return res;
}

vector<pair<int, int>> Solve(vector<int64_t> &vec)
{
    auto start = FindStart(vec);
    vector<pair<int, int>> moves;

    if (vec[start] > 0) {
        vec[0] += 2 * vec[start];
        moves.push_back({start, 0});
        moves.push_back({start, 0});

        for (size_t i = 1; i < vec.size(); i += 1) {
            while (vec[i] < vec[i - 1]) {
                vec[i] += vec[i - 1];
                moves.push_back({i - 1, i});
            }
        }
    } else if (vec[start] < 0) {
        vec.back() += 2 * vec[start];
        moves.push_back({start, vec.size() - 1});
        moves.push_back({start, vec.size() - 1});

        for (int i = vec.size() - 2; i >= 0; i -= 1) {
            while (vec[i] > vec[i + 1]) {
                vec[i] += vec[i + 1];
                moves.push_back({i + 1, i});
            }
        }
    }
    return moves;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin >> n;

    vector<int64_t> vec(n);
    for (auto &num : vec) {
        cin >> num;
    }

    auto moves = Solve(vec);
    cout << moves.size() << "\n";

    for (const auto &p : moves) {
        cout << p.first + 1 << " " << p.second + 1 << "\n";
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define hell 1000000007
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std;
bool prime[200005];
void sieve(){
    memset(prime, true, sizeof(prime)); 
    for (int p=2; p*p<200005; p++) 
    {
        if (prime[p] == true) 
        {
            for (int i=p*p; i<200005; i += p) 
                prime[i] = false; 
        } 
    }
}
int powmod(int x,int y,int mod){
    int res = 1;
    x = x%mod;
    while(y>0){
        if(y&1){
            res = (res*x)%mod;
        }
        y = y>>1;
        x = (x*x)%mod;
    }
    return res;
}
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t=1;
    //cin>>t;
    while(t--){
        int n;
        cin>>n;
        map <string, int> m;
        for(int i = 0; i < n; i++)
        {
            string t;
            cin >> t;
            sort(all(t));
            m[t]++;
        }
        int ans = 0;
        for(auto x : m){
            ans += x.S * (x.S - 1) / 2;
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 11264
#include <iostream>

int main()
{
	int N;
	std::cin >> N;

	if ( N == 1 )
	{
		std::cout << "Hello World" << std::endl;
	}
	else
	{
		int A, B;
		std::cin >> A >> B;

		std::cout << A + B << std::endl;
	}

	return ( 0 );
}


Measured memory_bytes: 256
#include <bits/stdc++.h>

#define o(output) cout << output << endl

using namespace std;

string s,t,u;
int a,b,c,d;
int l[13]={0,1,3,1,2,1,2,1,1,2,1,2,1};
char A,B,C;
priority_queue<int,vector<int>,greater<int> >small;

int main(){
  cin >>a>>b>>c>>d;
  o(max(a*b,c*d));
}

Measured memory_bytes: 256
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r#"7 4"# => "6",
// r#"24"# => "No",
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        a: usize,
        b: usize,
        c: usize,
        d: usize,
    }

    let l = a + b;
    let r = c + d;
    if l > r { "Left" } else if l == r { "Balanced" } else { "Right" }.to_string()
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main() {
  int n,k;
  cin >> n >> k;
  n++;
  if(n/2 >= k) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

#define ll long long


int main(){

    int N;
    cin >> N;
    vector<int> B;
    for(int i=0;i<N-1;i++){
        int a; cin >> a; B.push_back(a);
    }
    B.insert(B.begin(), B.at(0));
    ll ans = 0;
    for(int i=0;i<N-1;i++){
        ans += min(B.at(i), B.at(i+1));
    }
    cout << ans+B.at(N-1) << endl;
    return 0;
}


Measured memory_bytes: 256
S=input()
b=0
for i in range(0,len(S)):
    if S[i]=='B':
        b+=1

ans=0
cnt=0
for i in range(0,len(S)):
    if S[i]=='B':
        cnt+=1
        ans+=len(S)-1-i-(b-cnt)

print(ans)


Measured memory_bytes: 40048
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define vl vector<ll>

int main(){
    int n;cin>>n;
    vl a(n);rep(i,n)cin>>a.at(i);

    vl b(n);
    rep(i,n){
        b.at(a.at(i)-1)=i+1;
    }

    rep(i,n)cout<<b.at(i)<<endl;
}

Measured memory_bytes: 2432
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <bitset>
typedef long long ll;
typedef unsigned long long ull;

# define INF 0x3f3f3f3f

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define DEBUG(vec) for (auto v : vec) { cout << v << " "; } cout << endl;

using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  string S;
  cin >> S;

  int a = 0;
  int b = 0;
  int c = 0;
  REP(i, S.size()) {
    if (S[i] == 'a') a++;
    if (S[i] == 'b') b++;
    if (S[i] == 'c') c++;
  }

  int ma = max(a, max(b, c));
  int mi = min(a, min(b, c));
  if (ma - mi <= 1) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long
using namespace std;
 
int main(){
    string s,t;
    int l;
    bool flag = false;
    cin >> s >> t;
    for(int i = 0; i < s.size(); i++){
        for(int j = 0; j < t.size() && (i + j) < s.size(); j++){
            if(s[i + j] != t[j] && s[i + j] != '?')break;
            if(j == (t.size() - 1)){
                flag = true;
                l = i;
            }
        }
    }
    if(flag){
        for(int i = 0; i < s.size(); i++){
            if(l == i){
                for(int j = 0; j < t.size(); j++){
                    cout << t[j];
                }
                i += (t.size()-1);
            }
            else if(s[i] == '?')cout << "a";
            else cout << s[i];
        }
        cout << endl;
    }else{
        cout << "UNRESTORABLE" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using edge = struct { int to; ll cost; };

#define mod 1000000007
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(a) (a).begin(), (a).end()
#define INF (1 << 29)

long long combination[10001][10001];

//initC(int n);
//long long gcd(long long a, long long b);
//long long lcm(long long a, long long b);

void solve()
{
    vector<int> in(3);
    REP(i, 3) cin >> in[i];
    sort(ALL(in));
    int isEven[3];
    REP(i, 3) isEven[i] = in[i] % 2;
    int ans = 0;
    if(isEven[0] != isEven[1] && isEven[0] != isEven[2]) {
        in[1]++;
        in[2]++;
        ans++;
    }
    if(isEven[1] != isEven[0] && isEven[1] != isEven[2]) {
        in[0]++;
        in[2]++;
        ans++;
    }
    if(isEven[2] != isEven[1] && isEven[2] != isEven[0]) {
        in[1]++;
        in[0]++;
        ans++;
    }
    ans += (in[2] - in[0]) / 2;
    ans += (in[2] - in[1]) / 2;
    cout << ans << "\n";
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define ll long long
#define maxn 100005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
    int n;
    cin >> n ;
    cout << n*n << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<V>;
using VVV = vector<VV>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VVVL = vector<VVL>;
template<class T> using VE = vector<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
int main() {
	int n, m;
	cin >> n >> m;
	V cnt(n, 0);
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		cnt[a] ^= 1;
		cnt[b] ^= 1;
	}
	bool valid = true;
	rep(i, n) {
		if (cnt[i] != 0) valid = false;
	}
	puts(valid ? "YES" : "NO");
	return 0;
}

Measured memory_bytes: 3772
#include <bits/stdc++.h>
#define INF 0x3f3f3f
#define PB push_back
#define F first
#define S second
#define FOR(i,k) for(int i=0; i<k; i++)
#define RFOR(i,k) for(int i=k; i>=0; i--)
#define ALL(x) x.begin(), x.end()
#define INS(x) inserter(x, x.begin())
#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
#define DEBUGV(x) cout<<#x<<": "; for(auto &d:x) cout<<d<<" "; cout<<endl
#define DEBUGM(x) for(auto &p:x) cout<<p.F<<":"<<p.S<<" "; cout<<endl;
#define OUT(x) cout<<(x)<<endl

using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VPII;
typedef vector<VI> VVI;
typedef map<char,int> MC;
typedef map<int,int> MI;
typedef map<string,int> MS;

template<typename T, typename U> void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> void amax(T &x, U y) { if(x < y) x = y; }
VPII neighbors = {{0,1}, {1,0}, {0,-1}, {-1,0}};
PII operator+(PII &l, PII &r) { return {l.F+r.F, l.S+r.S}; }
bool IsValid(PII p, int Y, int X) { 
  return p.F >=0 && p.F < Y && p.S >=0 && p.S < X; }
bool IsPrime(int n) {
  if (n <= 1)  return false;
  if (n <= 3)  return true;
  if (n%2 == 0 || n%3 == 0) return false;
  for (int i=5; i*i<=n; i=i+6)
    if (n%i == 0 || n%(i+2) == 0)
      return false;
  return true;
}

int main() {
  ll n, c;
  cin>>n>>c;
  vector<pair<ll, ll> > xv;
  for(ll i=0; i<n; i++) {
    ll x,v;
    cin>>x>>v;
    xv.PB({x,v});
  }

  vector<ll> CW, CCW, CWmax, CCWmax;
  ll cal=0;
  ll res=0;
  for(ll i=0; i<n; i++) {
    cal = cal - (xv[i].F-(i-1>=0 ? xv[i-1].F : 0)) + xv[i].S;
    CW.PB(cal);
    amax(res, cal);
    CWmax.PB(res);
  }

  cal=0;
  ll res2=0;
  for(ll i=xv.size()-1; i>=0; i--) {
    cal = cal-((i+1>=xv.size() ? c : xv[i+1].F) - xv[i].F) + xv[i].S;
    CCW.PB(cal);
    amax(res2, cal);
    CCWmax.PB(res2);
  }
  amax(res, res2);

  for(ll i=0; i<n; i++) {
    ll cwccw = CW[i] + (n-2-i>=0 ? CCWmax[n-2-i] - xv[i].F : 0);
    ll ccwcw = CCW[i] + (n-2-i>=0 ? CWmax[n-2-i] - (c-xv[n-1-i].F) : 0);
    amax(res, max(cwccw, ccwcw));
  }
  OUT(res);
}

Measured memory_bytes: 6256
#include<iostream>

typedef long long ll;

ll gcd(ll a, ll b){
  if(b == 0) return a;
  return gcd(b, a % b);
}

ll lcm(ll a, ll b){
  ll g = gcd(a, b);
  return a / g * b;
}

int main(){
  int N;
  std::cin >> N;
  ll T;
  ll ans = 1;
  for(int i = 0; i < N; i++){
    std::cin >> T;
    ans = lcm(ans, T);
  } 
  std::cout << ans << std::endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x; cin>>x;
  if(x==0) cout<<"1";
  else if(x==1) cout<<"0";
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
using namespace std;

int main(){
  long long a, b, c;
  cin >> a >> b >> c;

  long long diff = c - (a + b);
  if(diff >= 0 && 4 * a * b < diff * diff){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}



Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    int N;
    cin >> N;
    vector<int> A(N);
    for (int i=0; i<N; ++i) cin >> A[i];

    vector<long long> ac(N+1);
    ac[0] = 0;
    for (int i=0; i<N; ++i) {
        ac[i+1] = ac[i] + A[i];
    }

    map<long long, long long> m;
    for (int i=0; i<N+1; ++i) {
        m[ac[i]] ++;
    }

    long long ans = 0;
    for (auto it=m.begin(); it!=m.end(); ++it) {
        ans += it->second * (it->second - 1) / 2LL;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 15104
#include <iostream>
using namespace std;

int main(){
  int n,roads;
  int high[100001];
  int hantei[100001];
  int a,b;
  cin >> n >> roads;
  for(int i=1; i<=n; i++){
    cin >> high[i];
    hantei[i] = 1;
  }
  for(int i=1; i<=roads; i++){
    cin >> a >> b;
    if(high[a] > high[b]){
      hantei[b] = 0;
    }else if(high[a] == high[b]){
      hantei[a] = 0;
      hantei[b] = 0;
    }else{
      hantei[a] = 0;
    }
  }
  int ans = 0;
  for(int i=1; i<=n; i++){
    if(hantei[i] == 1){
      ans += 1;
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 4408
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, m, d[1003][1003] = {}, x1, y1, x2, y2;
    string s[1003] = {};
    cin >> n >> m >> x1 >> y1 >> x2 >> y2;
    for (int i = 0; i <= n + 1; i++) for (int j = 0; j <= m + 1; j++) d[i][j] = mod;
    for (int i = 1; i <= n; i++) cin >> s[i], s[i] = '#' + s[i] + '#';
    for (int i = 0; i <= m + 1; i++) s[0] += '#', s[n + 1] += '#';
    d[x1][y1] = 0;
    deque<pii> q;
    q.push_back({x1, y1});
    while (!q.empty()) {
        int x = q.back().first, y = q.back().second;
        //cout << x << ' ' << y << ' ' << d[x][y] << '\n';
        q.pop_back();
        if (s[x - 1][y] != '#' && d[x - 1][y] > d[x][y]) d[x - 1][y] = d[x][y], q.push_back({x - 1, y});
        if (s[x + 1][y] != '#' && d[x + 1][y] > d[x][y]) d[x + 1][y] = d[x][y], q.push_back({x + 1, y});
        if (s[x][y - 1] != '#' && d[x][y - 1] > d[x][y]) d[x][y - 1] = d[x][y], q.push_back({x, y - 1});
        if (s[x][y + 1] != '#' && d[x][y + 1] > d[x][y]) d[x][y + 1] = d[x][y], q.push_back({x, y + 1});
        for (int i = -2; i <= 2; i++) for (int j = -2; j <= 2; j++) if (x + i > 0 && x + i <= n && y + j > 0 && y + j <= m && s[x + i][y + j] != '#' && d[x + i][y + j] > d[x][y]) d[x + i][y + j] = d[x][y] + 1, q.push_front({x + i, y + j});
    }
    if (d[x2][y2] != mod) cout << d[x2][y2];
    else cout << -1;
}


Measured memory_bytes: 9784
#include<bits/stdc++.h>
using namespace std;

int main(){
    int r;
    cin >> r;
    
    if(r < 1200)
    cout << "ABC" <<endl;
    else if (r < 2800)
    cout << "ARC"<<endl;
    else 
    cout << "AGC" << endl;
        
    return 0;
}


Measured memory_bytes: 256