akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
 
int scanint() { 
	char c = getchar_unlocked();
	int x = 0;
	for(; (c<48)||(c>57);c = getchar_unlocked());
	for(; (c>47)&&(c<58);c = getchar_unlocked())
		x = 10 * x + c - 48;
    return x;
} 
 
int main() {
 
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    constexpr int A_MAX = 1000000;
 
    vector<int> min_factor(A_MAX);
    // q[n] = i where n = i * p^e, p = min_factor[n], p does not divide i. + 1);
    vector<int> q(A_MAX + 1, 1);
    vector<int> primes;
    for (int i = 2; i <= A_MAX; ++i) {
        if (!min_factor[i]) {
            min_factor[i] = i;
            primes.push_back(i);
        }
        for (int p : primes) {
            int n = i * p;
            if (n > A_MAX) {
                break;
            }
            min_factor[n] = p;
            if (p == min_factor[i]) {
                q[n] = q[i];
                break;
            } else {
                q[n] = i;
            }
        }
    }
 
    int N = scanint();
    vector<int> a(A_MAX + 1);
    for (int i = 0; i < N; ++i) {
        ++a[scanint()];
    }
 
    bool is_pairwise_coprime = true;
    for (int n = A_MAX; n > 1; --n) {
        if (a[n] > 1) {
            if (a[n] == N) {
                cout << "not coprime" << endl;
                return 0;
            }
            is_pairwise_coprime = false;
        }
        a[min_factor[n]] += a[n];
        a[q[n]] += a[n];
    }
    if (is_pairwise_coprime) {
        cout << "pairwise coprime" << endl;
    } else {
        cout << "setwise coprime" << endl;
    }
 
    return 0;
}

Measured memory_bytes: 15520
#include <iostream>
#include <algorithm>
#include <string>
#include <regex>
using namespace std;

int main()
{
	string S;
	cin >> S;
	int a = 0, b = 0;
	for (int i = 0; i<S.size(); i++) {
		if (S[i] == 'A') {
			a = i;
			break;
		}
	}
	for (int i = S.size(); i>=0;i--){
		if (S[i] == 'Z') {
			b = i;
			break;
		}
	}
	cout << b - a + 1 << endl;
}

Measured memory_bytes: 640
// Aizu Vol0 0055: Sequence
// 2017.7.29

#include <stdio.h>
#include <stdlib.h>

#define Magic 7.81481481481481

int main()
{
	double a;

	while (scanf("%lf", &a) == 1) {
		printf("%.8lf\n", a * Magic);
	}
	return 0;
}

Measured memory_bytes: 652
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

int main(int argc, const char * argv[]) {
    int N = 0;
    cin >> N;

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

    sort(ds.begin(), ds.end());
    
    const int half_N = N/2;
    const int abc_last_i = half_N - 1;
    const int count = ds[abc_last_i+1] - ds[abc_last_i];
    cout << count << endl;

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(void){
    int N;
    cin >> N;
    vector<int> pon = {0, 1, 6, 8};
    if (N % 10 == 3)
        cout << "bon";
    else if (find(pon.begin(), pon.end(), N%10) != pon.end())
        cout << "pon";
    else
        cout << "hon";
}


Measured memory_bytes: 3620
#include <iomanip>
#include <limits>
#include <thread>
#include <utility>
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
#include <numeric>
#include <cassert>
#include <random>
#include <chrono>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <list>
#include <functional>
#include <bitset>
#include <complex>
#include <tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double D;
typedef complex<D> P;
const ll E = 1e18 + 7;
const ll MOD = 1000000007;
#define REP(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define fill(x, y) memset(x, y, sizeof(x))
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
template <class... A>
void prints() { cout << endl; }
template <class... A>
void prints_rest() { cout << endl; }
template <class T, class... A>
void prints_rest(const T &first, const A &... rest) { cout << " " << first; prints_rest(rest...); }
template <class T, class... A>
void prints(const T &first, const A &... rest) { cout << first; prints_rest(rest...); }

template <class T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

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

    int N,D;
    cin >> N >> D;
    prints(int(ceil((double)N / (1+2*D))));

    return 0;
}



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

int main() {
  int n,k;
  cin >> n >> k;
  int ans = 1;

  for(int i = 0; i < n; i++){
    int a = ans * 2;
    int b = ans + k;
    if(a >  b){
      ans = b;
    }else{
      ans = a;
    }
    
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int m,n,a[100],b[101],ten[101],i,j;
	scanf("%d",&n);
	scanf("%d",&m);
	for(i=0;i<m;i++)	scanf("%d",&a[i]);
	for(i=1;i<=n;i++)	ten[i]=0;
	for(i=0;i<m;i++)	{
		for(j=1;j<=n;j++)	{
			scanf("%d",&b[j]);
			if(b[j]==a[i])	ten[j]++;
			else ten[a[i]]++;
		}
	}
	for(i=1;i<=n;i++)	printf("%d\n",ten[i]);
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<ll, ll> PL;
using graph = vector<vector<int>>;

const double pi = 3.14159265358979323846;
const ll mod = 1000000007;

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
    int n, k; cin >> n >> k;
    ll dp[3000][3000];
    dp[0][0] = 1; dp[1][0] = 1; dp[1][1] = 1;
    for(int i = 2; i <= 2500; i++){
        dp[i][0] = 1; dp[i][i] = 1;
        for(int j = 1; j < i; j++){
            dp[i][j] = dp[i-1][j-1] + dp[i-1][j];
            dp[i][j] %= mod;
        }
    }
    ll ans;
    for(int i = 1; i <= k; i++){
        ans = dp[n-k+1][i] * dp[k-1][i-1] % mod;
        cout << ans << endl;
    }
} 

Measured memory_bytes: 59904
#include <bits/stdc++.h>
using namespace std; 
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define LINY "YES\n"
#define Liny "Yes\n"
#define LINN "NO\n"
#define Linn "No\n"

int main(){
  int H,W; cin>>H>>W;
  string s[H]; CINA(s,H);
  bool r = true;
  REP(i,H){
    REP(j,W){
      bool check = false;
      if(s[i][j]=='#'){
        if(i>0) check += (s[i-1][j]=='#');
        if(j>0) check += (s[i][j-1]=='#');
        if(i<H-1) check += (s[i+1][j]=='#');
        if(j<W-1) check += (s[i][j+1]=='#');
        if(!check){r = false;break;}
      }
    }
    if(!r){break;}
  }
  cout <<(r?Liny:Linn);
}


Measured memory_bytes: 256
/*ITS FUCKING O(N) now
GET ACCEPTED FOR FUCK'S SAKE*/
#define _USE_MATH_DEFINES
 
#include <cmath>

#include <iostream>
# include <bits/stdc++.h>
using namespace std;

long long powerexp(long long base, long long exp, int mod) {
   long long res = 1;
   while (exp > 0) {
      if (exp % 2 == 1)
         res= (res * base) % mod;
      exp = exp >> 1;
      base = (base * base) % mod;
   }
   return res;
}
int gcd(int a, int b)
{
    int c = a % b;
    while(c != 0)
    {
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}
void PrintVector(vector<long long int> v,long long int n)
{
 
    for(int i=v.size()-1;i>=0;i--)
    {
        cout<<v[i]<<" ";
    }
    cout<<endl;
}
void Takevector(vector<long long int> &v,long long int n)
{
  for(long long int i=0;i <n;i++)
  { long long int number;
    cin>>number;
    v.push_back(number);
  }
}
typedef long long int ll;
typedef vector<long long int> vi;

#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define scl(x)         ll x;       scanf("%lld", &x);
#define scll(x, y)     ll x, y;    scanf("%lld %lld", &x, &y);
#define sclll(x, y, z) ll x, y, z; scanf("%lld %lld %lld", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define rep(i, x, y)   for (__typeof(x) i = x; i <= y; i ++)
#define repi(i, x, y)  for (__typeof(x) i = x; i >= y; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
#define nl cout<<"\n";
int min(int x, int y)  
{  
    return (x < y)? x: y;  
      
}  
  
int main()
{
  int flag=0;
  ll sum=0;
  int flag1=1;
  ll tot=0;
  int ans=0;
  map<int,int>m;
  vi v;
  set<int,int>st;
  string s;
  cin>>s;
  if(s=="ABC")
  {
    cout<<"ARC";
  }
  else
  {
    cout<<"ABC";
  }
   
    return 0;
}

Measured memory_bytes: 3600
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)



int main(){
	int n,x;
	cin >> n >> x;
	int d=0;
	vector<int> l(n);
	REP(i,n) cin >>l[i];
	
	for(int i=2; i<=n+1; i++){
		d+=l[i-2];
		if(x < d){
			cout << i-1 << endl;
			return 0;
		} 
	}
	
	cout << n+1 << endl;
	
	
	return 0;
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    char c;
    cin >> c;
    if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o')    cout << "vowel\n";
    else{
        cout << "consonant\n";
    }

    return 0;
}

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

using namespace std;

int map[160][160][160];

int main(){
	
	int N, K;
	
	cin >> N >> K;
	
	int x1[100], x2[100], y1[100], y2[100], d1[100], d2[100];
	vector<long long int> x_v, y_v, d_v;
	
	for(int i = 0; i < N; i++){
		cin >> x1[i] >> y1[i] >> d1[i] >> x2[i] >> y2[i] >> d2[i];
		x_v.push_back(x1[i]);
		x_v.push_back(x2[i]);
		y_v.push_back(y1[i]);
		y_v.push_back(y2[i]);
		d_v.push_back(d1[i]);
		d_v.push_back(d2[i]);
	}
	
	for(int i = 0; i < 160; i++){
		for(int j = 0; j < 160; j++){
			for(int k = 0; k < 160; k++){
				map[i][j][k] = 0;
			}
		}
	}
	
	sort(x_v.begin(), x_v.end());
	sort(y_v.begin(), y_v.end());
	sort(d_v.begin(), d_v.end());
	
	for(int q = 0; q < N; q++){
		for(int i = 0; i < N * 2; i++){
			if(x1[q] > x_v[i]){
				continue;
			}
			if(x2[q] <= x_v[i]){
				break;
			}
			for(int j = 0; j < N * 2; j++){
				if(y1[q] > y_v[j]){
					continue;
				}
				if(y2[q] <= y_v[j]){
					break;
				}
				for(int k = 0; k < N * 2; k++){
					if(d1[q] > d_v[k]){
						continue;
					}
					if(d2[q] <= d_v[k]){
						break;
					}
					map[i][j][k]++;
				}
			}
		}
	}
	
	long long int ans = 0;
	
	for(int i = 0; i < N * 2; i++){
		for(int j = 0; j < N * 2; j++){
			for(int k = 0; k < N * 2; k++){
				if(map[i][j][k] >= K){
					ans += (x_v[i + 1] - x_v[i]) * (y_v[j + 1] - y_v[j]) * (d_v[k + 1] - d_v[k]);
				}
			}
		}
	}
	
	printf("%lld\n", ans);
	
	return 0;
}

Measured memory_bytes: 19312
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 100005
#define MOD 1000000007
using namespace std;
using LL = long long;
int n;
LL pw2[M],pw3[M];
char in[M];
int main()
{
    pw2[0] = 1;
    REP(i,1,M-1) pw2[i] = pw2[i-1] * 2 % MOD;

    pw3[0] = 1;
    REP(i,1,M-1) pw3[i] = pw3[i-1] * 3 % MOD;

    while (~scanf("%s", in+1)) {
        n = strlen(in+1);

        LL ans = 0;
        int pre = 0;
        REP(i,1,n) if(in[i]=='1') {
            int noko = n-i;
            ans += pw2[pre] * pw3[noko];
            ans %= MOD;
            pre++;
        }
        ans += pw2[pre];
        ans %= MOD;
        printf("%lld\n", ans);
    }
    return 0;
}


Measured memory_bytes: 1920
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
#define int long long
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279; //円周率
/*---------------------便利な関数--------------------------------------*/
int fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}

int gcd(int a, int b) {        //最大公約数
    if (b == 0) return a;
    return gcd(b, a % b);
}

int lcm(int a, int b) {      //最小公倍数
    return a * b / gcd(a, b);
}

int keta(int n) {        //桁数を求める
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}

int ketasum(int n) {    //各桁の和
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/*-------------ここまで---------------------------------------------*/

//C++(GCC9.2.1)

signed main() {
    //宣言
    int n, k;
    cin >> n >> k;
    vector<int> d(k);
    vector<int> s(n, 0);
    for (int i = 0; i < k; i++) {
        cin >> d.at(i);
        for (int j = 0; j < d.at(i); j++) {
            vector<int> a(d.at(i));
            cin >> a.at(j);
            s.at(a.at(j) - 1) = 1;
        }
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        ans += s.at(i);
    }
    cout << n - ans << endl;
}

Measured memory_bytes: 3596
//#pragma warning(disable:4996)
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>
//#include <stdio.h>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
typedef long long LL;
typedef long double LD;
//typedef boost::multiprecision::cpp_int bigint;
typedef pair<LL, LL> PLL;
typedef pair<int, int> PI;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
template<class T>
using V = vector<T>;
template<class T>
using VV = vector<vector<T>>;
typedef unsigned long long ULL;

int main() {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int N;
	cin >> N;
	VI L(N);
	for (int  n = 0; n < N; n++) {
		cin >> L[n];
	}
	LL ans = 0;
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			for (int k = j+1; k < N; k++) {
				if (L[i] == L[j] || L[j] == L[k] || L[k] == L[i])continue;
				if (
					L[i] < L[j] + L[k] &&
					L[j] < L[k] + L[i] &&
					L[k] < L[i] + L[j]
					)ans++;
			}
		}
	}
	cout << ans << "\n";
	return 0;
}

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

using namespace std;

using ll = long long;

int main(){
  int n;
  cin >> n;
  vector <int> a(n);
  for(int &i : a)cin >> i;
  ll ans = 0;
  for(int i = 1, last = a[0]; i < n; i++){
    if(a[i] < last){
      ans += (last - a[i]);
    }
    last = max(last, a[i]);
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3988
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int h = 126257;
const int mod = 1e9+7;
int a[400001], b[200001];
LL p[400001];
int A[30][400001];
int B[2][30][200001];
int main(){
    int n;
    scanf("%d", &n);
    for(int i=1;i<=n;i++) scanf("%d", &a[i]);
    for(int i=1;i<=n;i++) scanf("%d", &b[i]);
    for(int i=n+1;i<=n+n;i++) a[i] = a[i-n];

    p[0] = 1;
    for(int i=1;i<=n+n;i++) p[i] = p[i-1]*h%mod;
    for(int i=1;i<=n+n;i++){
        for(int j=0;j<30;j++){
            A[j][i] = (A[j][i-1] + ((a[i]>>j)&1)*p[i])%mod;
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=0;j<30;j++){
            B[0][j][i] = (B[0][j][i-1] + ((b[i]>>j)&1)*p[i])%mod;
            B[1][j][i] = (B[1][j][i-1] + ((1-((b[i]>>j)&1))*p[i]))%mod;
        }
    }

    for(int i=1;i<=n;i++){
        int x = a[i]^b[1];

        bool ok = 1;
        for(int j=0;j<30;j++){
            if((x>>j)&1){
                int Pa = (A[j][i+n-1] - A[j][i-1] + mod)%mod*p[n+n-(i+n-1)]%mod;
                int Pb = B[1][j][n]*p[n+n-n]%mod;
                if(Pa != Pb){
                    ok = 0;
                    break;
                }
            }
            else{
                int Pa = (A[j][i+n-1] - A[j][i-1] + mod)%mod*p[n+n-(i+n-1)]%mod;
                int Pb = B[0][j][n]*p[n+n-n]%mod;
                if(Pa != Pb){
                    ok = 0;
                    break;
                }
            }
        }
        if(ok) printf("%d %d\n", i-1, x);
    }
}

Measured memory_bytes: 102656
#include <stdio.h>
#include <algorithm>
using namespace std;
int dp[10001];
int par[10001];
int cost[]={0,2,5,5,4,5,6,3,7,6};
int arr[10];
int cnt[10];
int N,M;
void bt(int x){
	if(x==0) return;
	cnt[x-par[x]]++;
	return bt(par[x]);
}
int main(){
	scanf("%d %d",&N,&M);
	for(int i=0;i<M;i++){
		int tmp;
		scanf("%d",&tmp);
		arr[tmp]=1;
	}
	for(int i=1;i<=N;i++) dp[i]=-987654321;
	
	for(int j=0;j<=N;j++){
	for(int i=9;i>0;i--){
		if(!arr[i]) continue;
		if(j-cost[i]<0) continue;
		if(dp[j]<1+dp[j-cost[i]]){
			dp[j]=dp[j-cost[i]]+1;
			par[j]=j-cost[i];
		}
		}
	}
	bt(N);
	for(int i=9;i>0;i--){
		if(!arr[i]) continue;
		if(cnt[cost[i]]<=0) continue;
		while(cnt[cost[i]]--) printf("%d",i);
	}
}

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

#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).begin(),(x).end(),greater<int>())
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) " (L" << __LINE__ << ") " << __FILE__ << endl;

typedef long long ll;
const int mod = 1e9+7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;

void solve()
{
  int n,q;cin>>n>>q;
  string s; cin>>s;
  vector<int> l(q, 0);
  vector<int> r(q, 0);
  for (int i=0; i<q; i++) {
    cin >> l[i] >> r[i];
  }

  vector<int> cl(n+2, 0);
  vector<int> cr(n+2, 0);
  for (int i=0; i<n; i++) {
    cl[i+1] = cl[i];
    if (i>0) {
      cl[i+1] += !!(s.substr(i-1, 2)=="AC");
    }
  }
  for (int i=0; i<q; i++) {
    cout << cl[r[i]]-cl[l[i]] << endl;
  }
}

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


Measured memory_bytes: 2688
#include<stdio.h>
int main(){
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if(a==(a+b+c)/2.0 || b==(a+b+c)/2.0 ||c==(a+b+c)/2.0)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
using namespace std;

int main(){
	int n;
	cin >> n;
	int floor[n][4];
	for(int i = 0; i < n; i++){
		for(int j = 0; j < 4; j++){
			cin >> floor[i][j];
		}
	}

	int base[4][3][10] = {0};
	for(int i = 0; i < n; i++){
		base[floor[i][0]-1][floor[i][1]-1][floor[i][2]-1] += floor[i][3];
	}

	for(int i = 0; i < 4; i++){
		for(int j = 0; j < 3; j++){
			for(int k = 0; k < 10; k++){
				cout << " " << base[i][j][k];
			}
			cout << endl;
		}
		if(i < 3) cout << "####################" << endl;
	}
	return 0;
}


Measured memory_bytes: 3080
import java.util.*;
import java.lang.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long ans = Long.MAX_VALUE;
        long n, k;
        long[] x = new long[100005];

        n = sc.nextLong();
        k = sc.nextLong();
        for (int i = 0; i < n; i++) {
            x[i] = sc.nextLong();
        }

        for (int i = 0; i < n - k + 1; i++) {
            int l = i;
            int r = i + (int)k - 1;
            long tmp = x[r] - x[l];

            if (x[l] < 0 && x[r] > 0) {
                tmp += Math.min(x[r], Math.abs(x[l]));
            }
            else if (x[l] > 0) {
                tmp += x[l];
            }
            else if (x[r] < 0) {
                tmp += Math.abs(x[r]);
            }

            ans = Math.min(ans, tmp);
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 62360
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <cmath>
#include <algorithm>
#include <vector>
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; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>func(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p;
}

int main(){
  int N,X;
  cin>>N>>X;
  vector<int>L(N);
  for(int i=0;i<N;i++){
    cin>>L[i];
  }
  vector<int>D(N+1);
  int cnt=1;
  for(int i=1;i<N+1;i++){
    D[i]=D[i-1]+L[i-1];
    if(D[i]<=X){cnt++;}
  }
  cout<<cnt<<endl;
  return 0;
}

Measured memory_bytes: 3608
#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() {
  string S;
  cin >> S;
  reverse(S.begin(), S.end());
  while(true){ 
   int N = S.size();
   if(N < 5){
     if(N == 0){
       cout << "YES" << endl;
       return 0;
     }else{
       cout << "NO" << endl;
       return 0;
     }
   }else if(N == 5){
     if(S == "maerd" || S == "esare"){
       cout << "YES" << endl;
       return 0;
     }else{
      cout << "NO" << endl;
      return 0;
     }
   }else if(N == 6){
     if(S == "resare"){
       cout << "YES" << endl;
       return 0;
     }else{
       cout << "NO" << endl;
       return 0;
     }
   }else{
      string S1 = S.substr(0, 5);
      string S2 = S.substr(0, 6);
      string S3 = S.substr(0, 7);
    if(S1 == "maerd" || S1 == "esare"){
      S = S.erase(0, 5);
    }else if(S2 == "resare"){
      S = S.erase(0, 6);
    }else if(S3 == "remaerd"){
      S = S.erase(0, 7);
    }else{
      cout << "NO" << endl;
      return 0;
    }
  }
 }
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
void solve() {
	int a,b; cin >> a >>  b;
	cout << (b % a == 0 ? a + b : b - a) << endl;
	return;
}
int main() {
	solve();
	return 0;
}

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

constexpr int MAX = 200010;

// 関数にしておくと便利
ll subcalc(ll x) { return x * (x + 1) / 2; }

int n;
int c[MAX];
vector<int> G[MAX];

int sz[MAX];
stack<int> last[MAX];
ll ans[MAX];

// 部分木のサイズを求める
void dfs1(int v, int p) {
    sz[v] = 1;
    for(int u : G[v]) {
        if(u != p) {
            dfs1(u, v);
            sz[v] += sz[u];
        }
    }
}

// 答えの計算
void dfs2(int v, int p) {
    if(v == 0) { // 根の上の頂点 (?) で切断しておく
        for(int i = 1; i <= n; i++)
            last[i].push(n);
        dfs2(1, 0);
        for(int i = 1; i <= n; i++)
            ans[i] += subcalc(last[i].top());
    } else {
        last[c[v]].top() -= sz[v];

        for(int u : G[v]) {
            if(u != p) {
                last[c[v]].push(sz[u]);
                dfs2(u, v);
                ans[c[v]] += subcalc(last[c[v]].top());
                last[c[v]].pop();
            }
        }
    }
}

int main() {
    cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> c[i];
        last[i].push(n);
    }
    for(int i = 0; i < n - 1; i++) {
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    dfs1(1, 0);
    dfs2(0, 0);

    for(int i = 1; i <= n; i++)
        cout << subcalc(n) - ans[i] << endl;

    return 0;
}

Measured memory_bytes: 168508
k,n=map(int, input().split())
a=list(map(int,input().split()))
maxi=0
for i in range(n):
    if i==0:
        if max(a[1]-a[0],k-a[n-1]+a[0])>maxi:
            maxi=max(a[1]-a[0],k-a[n-1]+a[0])
    elif i!=n-1:
        if max(a[i+1]-a[i],a[i]-a[i-1])>maxi:
            maxi=max(a[i+1]-a[i],a[i]-a[i-1])
    else:
        if a[n-1]-a[n-2]>maxi:
            maxi=a[n-1]-a[n-2]
print(k-maxi)

Measured memory_bytes: 26444
#include	<bits/stdc++.h>
using	namespace	std;
typedef	long long ll;

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)
// while (getline(cin, S)) {}

// cout <<fixed <<setprecision(10)

// priority_queue<int> q;
// priority_queue<int, vector<int>, less<int>> q; // Default: vector, less
// priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> q;

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

//
// Notes
//
// When specified less than N, try full scan.
// RE: empty vector
// Check Qs
// long/int
// xor -> count each bit
// Check values
// 	1,000,000 -> Loop
// 	100,000	-> vector(int:400KB, long:800KB) 

#define	INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define	MOD 1000000007

#define	Rep0(i, n)	for (ll i=0; i<n; i++)
#define	Rep1(i, n)	for (ll i=1; i<=n; i++)
#define Sort(P)	sort(P.begin(), P.end())
#define Rev(P)	reverse(P.begin(), P.end())

ll	FP(const vector<ll> &P, const vector<ll> &M, const ll K) {
	ll r=0;
	if (0!=M.size()) // No positive number
		r=max(r, M.back()*M.back()+1);
	if (0!=P.size()) // No negative number
		r=max(r, P.back()*P.back()+1);
	ll l=0;// Less than minimum value
	while(r-l>1) { // Loop
		ll m=(l+r)/2;
		ll s=0;// Count pairs equal or more then m
		if (0<P.size())
			Rep0(i, P.size()-1) {
				ll d=(m+P.at(i)-1)/P.at(i);
					// minimum value for the other for m
				ll c=lower_bound(P.begin(), P.end(), d)-P.begin();
					// index for the minimum P
				c=max(c, i+1); // count only the ones more than P[i]
				s +=P.size()-c;
			}
		if (0<M.size())
			Rep0(i, M.size()-1) {
				ll d=(m+M.at(i)-1)/M.at(i);
					// minimum value for the other for m
				ll c=lower_bound(M.begin(), M.end(), d)-M.begin();
					// index for the minimum M
				c=max(c, i+1); // count only the ones more than M[i]
				s +=M.size()-c;
			}
		if (s>=K)
			l=m;
		else
			r=m;
	}
	return l;
}

ll	FM(const vector<ll> &P, const vector<ll> &M, const ll K) {
	ll r=P.back()*M.back()+1;// More then maximum value
	ll l=0;// Less than minimum value
	while(r-l>1) { // Loop
		ll m=(l+r)/2;
		ll s=0;// Count pairs equal or more then m
		Rep0(i, P.size()) {
			ll d=(m+P.at(i)-1)/P.at(i);
				// minimum value for the other for m
			ll c=lower_bound(M.begin(), M.end(), d)-M.begin();
				// index for the minimum M
			s +=M.size()-c;
		}
		if (s>=K)
			l=m;
		else
			r=m;
	}
	return l;
}

int	main() {
	ll N, K;
	cin >>N >>K;
	vector<ll> P, M, Z;
	Rep0(i, N) {
		ll A;
		cin >>A;
		if (A<0)
			M.push_back(-A);
		else if (A==0)
			Z.push_back(A);
		else
			P.push_back(A);
	}
	Sort(P);
	Sort(M);
	ll NM=P.size()*M.size();
	ll NZ=Z.size()*(P.size()+M.size())+Z.size()*(Z.size()-1)/2;
	if (K<=NM){ // Minus
		cout <<-FM(P, M, K) <<endl;
	} else if (K<=NM+NZ) { // Zero
		cout <<0 <<endl;
	} else { // Plus
		cout <<FP(P, M, N*(N-1)/2-K+1) <<endl;
	}
	return 0;
}



Measured memory_bytes: 2548
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

ll a[15];

int main(void){
	for(int i=0;i<7;i++){
		scanf("%lld",&a[i]);
	}
	ll res=a[1];
	ll va=min(a[0],min(a[3],a[4]));
	res+=va*3LL;
	res+=((a[0]-va)/2LL)*2LL;
	res+=((a[3]-va)/2LL)*2LL;
	res+=((a[4]-va)/2LL)*2LL;
	ll res2=a[1];
	va--;
	res2+=va*3LL;
	res2+=((a[0]-va)/2LL)*2LL;
	res2+=((a[3]-va)/2LL)*2LL;
	res2+=((a[4]-va)/2LL)*2LL;
	if(va==-1)res2=0;
	printf("%lld\n",max(res,res2));
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#define pb push_back
#define ob pop_back
#define xx first
#define yy second
#define dob double
#define rin(i,n,k) for(int i=0;i<n;i+=k)
//#define int long long int
#define ss size()
using namespace std;
const int M=1e16,maxn=100010;
std::vector<int> adj[maxn];
std::vector<int> v1;
int ans,n,k,m,x,y,q,par[maxn],h[maxn],mach[maxn],sk[maxn],dp[maxn];
bool mark[maxn],bpart[maxn];
string s,s1,s2;
map <string ,int> mp;
bool markchaild[maxn];
bool dfsmach(int v){
    if(v==-1) return true;
    if(mark[v]==1) return false;
    mark[v]=1;
    for(int i=0;i<adj[v].ss;i++){
        int u=adj[v][i];
        if(dfsmach(mach[u])){
            bpart[u]=((bpart[v]+1)%2);
            mach[u]=v;
            mach[v]=u;
            return true;
        }
    }
    return false;
}


int32_t main() {
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    dp[0]=0;
    for(int i=1;i<n;i++){
        dp[i]=dp[i-1]+fabs(a[i]-a[i-1]);
        for(int j=i-1;j>=max(0,i-k);j--)
            if(dp[i]>(dp[j]+fabs(a[i]-a[j])))
                dp[i]=dp[j]+fabs(a[i]-a[j]);
    }
    cout<<dp[n-1];
    return 0;
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

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

vector<ll> get_prime(ll n){
    bool is_prime[n+1];
    is_prime[0]=false;
    is_prime[1]=false;
    for(ll i=2; i<=n; i++) is_prime[i]=true;
    for(ll i=2; i*i<=n; i++){
		if(!is_prime[i]) continue;
		for(ll j=i*i; j<=n; j+=i){
			is_prime[j]=false;
        }
    }
    vector<ll> p;
    for(ll i=2; i<=n; i++){
        if(is_prime[i]) p.push_back(i);
    }
    return p;
}

int main(){
	ll a, b;
	cin >> a >> b;
	ll g=gcd(a, b);
	vector<ll> p=get_prime(sqrt(g));
	ll ans=1;
	for(int i=0; i<p.size(); i++){
		if(g%p[i]!=0) continue;
		ans++;
		while(g%p[i]==0) g/=p[i];
	}
	if(g!=1) ans++;
	cout << ans << endl;
	return 0;
}

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

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

using Graph = vector<vector<int>>;

ll calc(ll a, ll b, ll p){//aのb乗をpで割った余り
  if(b == 0) return 1;

  else if(b%2 == 0){
    ll d = calc(a,b/2,p);
    return (d*d)%p;
  }
  else if(b%2 == 1){
    return (a * calc(a,b-1,p))%p;
  }
}

typedef pair<int,int> P;

bool is_prime(int n){//nが素数であるかどうか判定 iで割り切れると素数でない
    if(n == 1) return false;//1は例外
    for(int i = 2;i*i <= n;i++){
        if(n%i == 0) return false;
    }
    
    return true;
}
int factorial(int a){
  int res = 1;
  while(a){
    res *= a;
    a--;
  }
  return res;
}

int main(){
  string s1,s2,s3;
  cin >> s1 >> s2 >> s3;
  s1[0] = (char)toupper(s1[0]);
  
  s2[0] = (char)toupper(s2[0]);
  s3[0] = (char)toupper(s3[0]);
  string ans;
  ans.push_back(s1[0]);
  ans.push_back(s2[0]);
  ans.push_back(s3[0]);
  cout << ans << endl;
}

Measured memory_bytes: 256
n, a, b = map(int, input().split())
x = list(map(int, input().split()))

ans = 0
for i in range(len(x)-1):
  walk_cost = a * (x[i+1]-x[i])
  if b < walk_cost:
    ans += b
  else:
    ans += walk_cost
print(ans)



Measured memory_bytes: 85332
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
#define MPlus(x,y) {x=(x+y)%M;}
#define MSub(x,y) {x=(x-y+M)%M;}
#define MMul(x,y) {x=(x*y)%M;}



template< typename T >
struct edge {
  int src, to;
  T cost;

  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WG = vector< Edges< T > >;
using UG = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;



struct UnionFind
{

  vector<int> par;
  vector<int> sizes;

  UnionFind(int n) : par(n), sizes(n, 1) {
    rep(i,n) par[i] = i;
  }

  int root(int x) {
    if (x == par[x]) return x;
    return par[x] = root(par[x]); 
  }

  bool unite(int x, int y) {

    x = root(x);
    y = root(y);

    if (x == y) return false;

    if (sizes[x] < sizes[y]) swap(x, y);

    par[y] = x;
    sizes[x] += sizes[y];

    return true;
  }

  bool find(int x,int y){
    return root(x)==root(y);
  }

  int size(int x) {
    return sizes[root(x)];
  }
};

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  int n,m;
  cin>>n>>m;
  Edges<int> es;
  UnionFind uf(n);
  rep(i,m){
    int a,b;
    cin>>a>>b;
    a--;b--;
    es.PB(edge<int>(a,b,0));
    uf.unite(a,b);
  }

  int a=uf.size(0),b=uf.size(1);

  int ans=a*(a-1)/2+(n-a)*(n-a-1)/2-m;
  ans=max(ans,b*(b-1)/2+(n-b)*(n-b-1)/2-m);

  cout<<ans<<endl;


}

Measured memory_bytes: 6132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

string mp[25];
int h,w;
int dist[25][25];

void solve(int sy, int sx){
  int dx[4] = {-1, 1, 0, 0};
  int dy[4] = {0, 0, -1, 1};
  
  queue<pair<int, int> > q;
  q.push({sy, sx});
  while(!q.empty()){
    auto v = q.front();q.pop();
    int y = v.first;
    int x = v.second;
    for(int i=0;i<4;i++){
      int ny = y + dy[i];
      int nx = x + dx[i];
      if(0<=ny&&ny<h&&0<=nx&&nx<w){
        if(mp[ny][nx]=='.'){
          if(dist[ny][nx]==-1){
            dist[ny][nx] = dist[y][x]+1;
            q.push({ny, nx});
          }
        }
      }
    }
  }
}

int chk(int sy, int sx) {
  if(mp[sy][sx]=='#')return 0;
  for(int i=0;i<25;i++)
    for(int j=0;j<25;j++)
      dist[i][j]=-1;
  dist[sy][sx]=0;
  solve(sy, sx);
  int mx=0;
  for(int i=0;i<25;i++)
    for(int j=0;j<25;j++)
      mx=max(mx, dist[i][j]);
  return mx;
}

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

  cin>>h>>w;

  for(int y=0;y<h;y++){
    cin>>mp[y];
  }

  int ans=0;
  for(int y=0;y<h;y++){
    for(int x=0;x<w;x++){
      ans=max(ans, chk(y, x));
    }
  }

  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 256
n = int(input())
arr = []

z=False
for x in input().split(' '):
    if x == '0':
        z = True
    arr.append(int(x))
if z == True:
    print(0)

else:
    ans = 1
    for x in arr:
        ans *= x
        if ans > int(1e18):
            print(-1)
            exit(0)
    
    print(ans)

Measured memory_bytes: 21640
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const static int MOD = 1000000007;
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
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; // Be careful not to overflow
}
//素数判定
bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
int getdigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll N, K;
    cin >> N >> K;
    ll a=0;
    ll b=0;
    rept(i,1,N+1){
        if(i%K==0){
            b++;
        }
        if(i%K==K/2){
            a++;
        }
    }
    if(K%2==0){
        cout << b*b*b+a*a*a << endl;
    }
    else{
        cout << b*b*b << endl;
    }
}


Measured memory_bytes: 256
#include<stdio.h>

void run(void){
  int n;
  scanf("%d",&n);
  while(n--){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    a*=a;
    b*=b;
    c*=c;
    printf("%s\n",(a==b+c || b==c+a || c==a+b)?"YES":"NO");
  }
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 2036
#include <iostream>
#include <vector>
#define REP(i, a, n) for(int i = (a); i <= (n); i++)
using namespace std;
typedef pair<int, int> PII;

int N, M, A, B;
long cnt[100001];

int main(void) {
  cin >> N >> M;
  REP(i, 1, M) cnt[i] = 0;
  REP(i, 1, M) {
    cin >> A >> B;
    cnt[A]++;
    cnt[B]++;
  }

  bool ans = true;
  REP(i, 1, M) if(cnt[i] % 2 == 1) ans = false;

  cout << (ans ? "YES" : "NO") << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
typedef long long ll;
int dp[100][100];

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

  //find prime num
  vector<bool> prime(n+1,true);
  prime[0] = false;
  prime[1] = false;
  FOR(i,2,n+1){
    if(prime[i] == true){
      int x = 2;
      while(x*i <= n){
    	prime[x*i] = false;
    	x++;
      }
    }
  }

  //make prime num array
  vector<int> primeNum;
  FOR(i,2,n+1){
    if(prime[i]){
      primeNum.push_back(i);
    }
  }

  map<int,int> primeCnt;
  FOR(i,2,n+1){
    int tmp = i;
    rep(j,primeNum.size()){
        while(tmp%primeNum[j]==0){
            primeCnt[primeNum[j]] ++;
            tmp /= primeNum[j];
        }
    }

  }
  vector<int> a;

  for(auto itr: primeCnt){
    a.push_back(itr.second);
  }

  dp[0][1] = 1;
  for (int i = 0; i < a.size(); i++) {
    for (int j = 1; j <= 75 ; j++) {
      for (int e = 0; e <= a[i]; e++) {
        if (j * (e + 1) < 100) {
          dp[i + 1][j * (e + 1)] += dp[i][j];
        }
      }
    }
  }

  cout << dp[a.size()][75] << endl;

  return 0;
}


Measured memory_bytes: 256
from collections import defaultdict

ans=defaultdict(int)
d=defaultdict(int)
p_list=[2]

p=2
n=10**5

while p<=n:
    m=2*p
    while m<=n:
        d[m]=1
        m+=p
    p+=1
    while d[p]!=0:
        p+=1
        if p>n:
            break
    p_list.append(p)

pp=defaultdict(int)

for i in p_list:
    if d[(i+1)//2]==0:
        pp[i]=1

cnt=0
for i in range(1,10**5+1,2):
    if pp[i]==1:
        cnt+=1
    ans[i]=cnt

Q=int(input())
for i in range(Q):
    l,r=map(int,input().split())
    print(ans[r]-ans[l-2])


Measured memory_bytes: 22860
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#define inf 2e30+1
typedef long long ll;

int compare(const void *a, const void *b) {
  return *(int*)a - *(int*)b;
}

int main(void) {
  int i, j, k, n, m;
  scanf("%d%d", &n, &m);
  int x, y, uni[n], a[n], r[n];
  for(i = 0; i < n; ++i) scanf("%d", &a[i]);
  for(i = 0; i < n; ++i) uni[i] = i, r[i] = 0;
  for(i = 0; i < m; ++i) {
    scanf("%d%d", &x, &y);
    int t;
    if(r[x] > r[y]) {
      r[y] = r[x] + r[y] + 1;
      for(j = y; uni[j] != j; ) {
        j = uni[j];
      }
      uni[j] = x;
      /*for(j = 0; j < n; ++j) {
        if(j == y) continue;
        if(uni[j] == t) uni[j] = uni[y];
      }*/
    } else {
      t = uni[x];
      r[x] = r[y] + r[x] + 1;
      for(j = x; uni[j] != j; ) {
        j = uni[j];
      }
      uni[j] = y;
      /*for(j = 0; j < n; ++j) {
        if(j == x) continue;
        if(uni[j] == t) uni[j] = uni[x];
      }*/
    }
  /*for(j = 0; j < n; ++j) printf("%d ", uni[j]);
  printf("\n");*/
  }
  for(i = 0; i < n; ++i) {
     for(j = i; uni[j] != j; ) {
        j = uni[j];
      }
      uni[i] = j;
  }
  int num = 0;
  for(i = 0; i < n; ++i) {
    if(uni[i] == i) ++num;
  }
  if(num == 1) {
    printf("0");
    return 0;
  }
  if(num * 2 - 2 > n) {
    printf("Impossible");
    return 0;
  }
  if(num * 2 - 2 == n) {
    ll t = 0;
    for(i = 0; i < n; ++i) t += (ll)a[i];
    printf("%lld", t);
    return 0;
  }
  int min[n], minn[n];
  for(i = 0; i < n; ++i) min[i] = inf;
  for(i = 0; i < n; ++i) if(min[uni[i]] > a[i]) min[uni[i]] = a[i], minn[uni[i]] = i;
  ll ssum = 0;
  int tnum = num - 2;
  //return 0;
  //for(i = 0; i < n; ++i) printf("%d ", min[i]);
  //printf("%d", inf);
  for(i = 0; i < n; ++i) {
    int y = inf;
    if(min[i] != y) {
      ssum += (ll)min[i];
      a[minn[i]] = inf;
    }
  }
  qsort(a, n, sizeof(int), compare);
  //std::sort(a, a + n);
  //return 0;
  for(i = 0; i < tnum; ++i) {
    ssum += a[i];
  }
  printf("%lld", ssum);
  return 0;
}


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


int main(void) {
    double Y = 0;
    int N;
    double x;
    string u;
    cin >> N;
    for (int i = 0; i < N; i++ ) {
        cin >> x >> u;
        if ( u == "JPY" ) {
            Y += x;
        } else {
            Y += x*380000;
        }
    }
    printf("%lf\n", Y);
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define N 22
#define low(x) ((x)&(-(x)))
int go[N][N];
int dp[2][2][(1<<20)+3];
int n,m,k;
const int mod=1e9+7;
int main(){
    memset(go,-1,sizeof(go));
    scanf("%d%d%d",&n,&m,&k);
    for(int i=1,a,b,c;i<=k;i++){
        scanf("%d%d%d",&a,&b,&c);
        go[a][b-1]=c;
    }
    int now=0;
    dp[0][0][0]=1;
    for(int i=1;i<=m;i++){
        memset(dp[now^1],0,sizeof(dp[0]));
        int pos=0;
        for(int j=0;j<n-1;j++){
            memset(dp[now][pos^1],0,sizeof(dp[0][0]));
            for(int k=0,v;k<(1<<(n-1));k++){
                if((v=dp[now][pos][k])==0) continue;
                if(go[i][j]!=1&&((k>>j)&1)==0) (dp[now][pos^1][k]+=v)%=mod;
                if(go[i][j]!=0) (dp[now][pos^1][k^(low(k>>j)<<j)|(1<<j) ]+=v)%=mod;
            }
            pos^=1;
        }
        for(int k=0;k<(1<<(n-1));k++)
            dp[now^1][0][k]=dp[now][pos][k];
        now^=1;
    }
    long long ans=0;
    for(int k=0;k<(1<<(n-1));k++)
        ans+=dp[now][0][k];
    cout<<ans%mod<<endl;
    return 0;
}

Measured memory_bytes: 16768
#include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
//#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;


signed main() {
	vi d;
	while(1){
		int a;
		char c;
		scanf("%d%c",&a,&c);
		if(a == 0) break;
		d.push_back(a);
		if(c == '\n'){
			int sum = 0;
			int f = 0;
			rep(i, 0, d.size()){
				//cout <<d[i]<<" ";
				if(d[i] == 1) f ++;
				else sum += min(10, d[i]);
			}
			if(f){
				if(21 - sum - f + 1 >= 11) sum += 11 + f - 1;
				else sum += f;
			}
			cout<< (sum > 21 ? 0 : sum) << endl;
			d.clear();
		}
	}
}

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

map<string,int> price;
map<string,int> id;
map<int,string> di;
bool table[100][100];

int calcPrice(string t, int n) {

    bool flag = false;
    int tmp = 0;
    for(int i = 0; i < n; i++) {
       if(table[id[t]][i]) {
           flag = true;
           tmp += calcPrice(di[i], n);
       }
    }
    if(!flag) return price[t];

    if(tmp > price[t]) return price[t];

    return tmp;
}


int main(void){
    // Your code here!
    int n;
    while(true) {
        cin >> n;
        if(n==0) break;

        price.clear();
        id.clear();
        di.clear();
        
        string s;
        int p;
        for(int i = 0; i < n; i++) {
            cin >> s >> p;
            price[s] = p;
            id[s] = i;
            di[i] = s;
        }

        for(int i = 0; i < 100; i++) {
            for(int j = 0; j < 100; j++) {
                table[i][j] = false;
            }
        }
        
        int m;
        cin >> m;
        for(int i = 0; i < m; i++) {
            int k;
            string o;
            cin >> o >> k;
            string q;
            for(int j = 0; j < k; j++) {
                cin >> q;
                table[id[o]][id[q]] = true;
            }
        }
        string t;
        cin >> t;
        cout << calcPrice(t, n) << endl;
    }
}



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

using namespace std;

int main (void) {
    string S;
    cin >> S;

    if ( S.at(0) != 'A' ) {
        cout << "WA" << endl;
        return 0;
    }

    int C_cnt = 0;
    for ( int i=2; i<S.size()-1; i++ ) {
        if ( S.at(i) == 'C' )
            C_cnt++;
    }
    if ( C_cnt != 1 ) {
        cout << "WA" << endl;
        return 0;
    }

    for ( int i=1; i<S.size(); i++ ) {
        if ( S.at(i) != 'C' && isupper(S.at(i)) ) {
            cout << "WA" << endl;
            return 0;
        }
    }

    cout << "AC" << endl;
    return 0;
}


Measured memory_bytes: 256