akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int cnt[105];
signed main() {
    int N;
    cin >> N;
    for(int i = 1; i <= N; i++) {
        int X = i;
        for(int j = 2; j*j <= i; j++) {
            if(X%j == 0) {
                while(X%j == 0) {
                    X/=j;
                    cnt[j]++;
                }
            }
        }
        if(X != 1) {
            cnt[X]++;
        }
    }
    int cnt3 = 0,cnt5 = 0,cnt15 = 0,cnt25 = 0,cnt75 = 0;
    for(int i = 2; i <= 100; i++) {
        if(cnt[i] >= 2) {
            cnt3++;
        }
        if(cnt[i] >= 4) {
            cnt5++;
        }
        if(cnt[i] >= 14) {
            cnt15++;
        }
        if(cnt[i] >= 24) {
            cnt25++;
        }
        if(cnt[i] >= 74) {
            cnt75++;
        }
    }
    cout << cnt75+cnt25*(cnt3-1)+cnt15*(cnt5-1)+cnt5*(cnt5-1)/2*(cnt3-2) << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <ctype.h>
#include <stdlib.h>
using namespace std;

int main(){
    int N;
    cin >> N;
    bool flag = false;
    for (int i = 1; i <= 9; i++)
    {
        /* code */
        for (int j = 1; j <= 9; j++)
        {
        /* code */
            if(i * j == N){
                flag = true;
                break;
            }
        }

    }
    if(flag){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i));
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a); i>n; --i)
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
inline bool isprime(int x) {
	if (x == 2 || x == 3) return true;
	if (x < 2 || x % 2 == 0 || x % 3 == 0) return false;
	int s = sqrt(x) + 1;
    for(int i = 5; i <= s; i += 2)
    	if(x % i == 0)
    		return false;
    return true;
}
int main() {
	int n; cin >> n;
	int tmp, cnt = 0;
	rep(i, 0, n) {
		cin >> tmp;
		if(isprime(tmp)) ++cnt;
	}
	P(cnt);
	return 0;
}

Measured memory_bytes: 3096
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
using namespace std;
using llong = long long;
#define rep(i,N) for (llong i = 0; i < N; i++)

template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}

string s, t;
int sizeS, sizeT;
int dp[3010][3010];

int main() {
    cin >> s >> t;
    for(int i = 0; i < s.size(); i++) {
        for (int j = 0; j < t.size(); j++) {
            if (s[i] == t[j]) chmax(dp[i+1][j+1] , dp[i][j] + 1);
            chmax(dp[i+1][j+1], dp[i+1][j]);
            chmax(dp[i+1][j+1], dp[i][j+1]);
        }
    }

    string ans = "";
    int i = s.size(); int j = t.size();
    while(i > 0 && j > 0) {
        if (dp[i-1][j] == dp[i][j]) i--;
        else if (dp[i][j-1] == dp[i][j]) j--;
        else {
            ans = s[i-1] + ans;
            i--; j--;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  int N=7;
  vector<long int> A(N);
  for(int i=0;i<N;i++){
    cin >> A.at(i);
  }
  
  int c=0;
  if(A.at(0)%2==1){
    c += 1;
  }
  if(A.at(3)%2==1){
    c += 1;
  }
  if(A.at(4)%2==1){
    c += 1;
  }
  
  long int ans =0;
  ans = A.at(1)+A.at(0)+A.at(3)+A.at(4);
if(c != 3){
  long int res =0;
  ans = ans - c;
  if((A.at(0)>0)&&(A.at(3)>0)&&(A.at(4)>0)){
  res = A.at(1)+2*((A.at(0)-1)/2+(A.at(3)-1)/2+(A.at(4)-1)/2)+3;
  if(res > ans){
  ans = res;
  }
  }
}
  cout << ans << endl;
}


Measured memory_bytes: 256
N,K = map(int,input().split())
P = list(map(int,input().split()))
Q = list()
R = [0]
result = 0

for i in P:
  Q.append((i+1)/2)

for i in range(N):
  R.append(R[i] + Q[i])

for i in range(N - K + 1):
  result = max(result,R[i+K]-R[i])

print(result)

Measured memory_bytes: 25060
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i) sort((i).begin(),(i).end(), greater<int>());
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 62;
constexpr auto mod = 1000000007;
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() {
    string s, t;
    cin >> s;
    t = s;
    bool S = 1, T = 1;
    while (!s.empty()) {
        if (s.length() >= 7 && s.substr(0, 7) == "dreamer") {
            if (s.length() == 7)break;
            s = s.substr(7, s.length() - 7);
        }
        else if (s.length() >= 6 && s.substr(0, 6) == "eraser") {
            if (s.length() == 6)break;
            s = s.substr(6, s.length() - 6);
        }
        else if (s.length() >= 5 && s.substr(0, 5) == "dream") {
            if (s.length() == 5)break;
            s = s.substr(5, s.length() - 5);
        }
        else if (s.length() >= 5 && s.substr(0, 5) == "erase") {
            if (s.length() == 5)break;
            s = s.substr(5, s.length() - 5);
        }
        else {
            S = 0;
            break;
        }
    }
    while (!t.empty()) {
        if (t.length() >= 7 && t.substr(t.length() - 7, 7) == "dreamer") {
            if (t.length() == 7)break;
            t = t.substr(0, t.length() - 7);
        }
        else if (t.length() >= 6 && t.substr(t.length() - 6, 6) == "eraser") {
            if (t.length() == 6)break;
            t = t.substr(0, t.length() - 6);
        }
        else if (t.length() >= 5 && t.substr(t.length() - 5, 5) == "dream") {
            if (t.length() == 5)break;
            t = t.substr(0, t.length() - 5);
        }
        else if (t.length() >= 5 && t.substr(t.length() - 5, 5) == "erase") {
            if (t.length() == 5)break;
            t = t.substr(0, t.length() - 5);
        }
        else {
            T = 0;
            break;
        }
    }
    cout << (S || T ? "YES" : "NO") << endl;
}


Measured memory_bytes: 616
#include<bits/stdc++.h>
#define pb emplace_back
using namespace std;
using ll = long long;
const int maxn = 300010;
const ll big = 1e9;
ll up(ll v, ll t) {
	ll res = 1;
	while (t--)
		res = min(big, res * v), res = max(res, -big);
	return res;
}
//ll cal(ll a, ll b) {
//	ll res = (a-b) * min(big, 
signed main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	ll x;
	cin >> x;
	for (ll a = 0, b = -100;;++a) {
		while (a * a * a * a * a - b * b * b * b * b > x)
			++b;
		if (a * a * a * a * a - b * b * b * b * b == x)
			return cout << a << ' ' << b << '\n', 0;
	}
}



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

int main(){
  int n;
  cin >> n;
  vector<int> a,b;
  for(int i=1;i<=n;i++){
    int x,y;
    cin >> x >> y;
    a.push_back(x);
    b.push_back(y);
  }
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  if(n%2){
    cout << b[n/2]-a[n/2]+1 << endl;
  }
  else {
    int r = b[n/2]+b[(n-1)/2];
    int l = a[(n-1)/2]+a[n/2];
    cout << (r-l+1) << endl;
  }
}


Measured memory_bytes: 5096
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <limits.h>
#include <math.h>
#include <queue>
#include <set>

using namespace std;



int main() {
	ios::sync_with_stdio(false);

	string filename = "date";

	//ifstream cin(filename + ".in");
	//ofstream cout(filename + ".out");
	
	int n;
	cin >> n;

	vector<int> vec(n);

	for (int i = 0; i < n; ++i) {
		cin >> vec[i];
	}

	sort(vec.begin(), vec.end());

	int b_ans = vec[1], a_ans = vec[0];

	for (int i = 2; i < n; ++i) {
		int b = vec[i];
		auto a_itr = lower_bound(vec.begin(), vec.begin() + i, vec[i] / 2);

		if (*a_itr == b) --a_itr;
		int a = *a_itr;

		if ((b - a + 1) * 1LL * a >= (b_ans - a_ans + 1) * 1LL * a_ans) {
			b_ans = b;
			a_ans = a;
		}

		/*if ((b - a) * 1.0 * a / b >= (b_ans - a_ans) * 1.0 * a_ans / b_ans) {
			b_ans = b;
			a_ans = a;
		}*/

		if (a_itr == vec.begin()) continue;
		a = *(--a_itr);

		if ((b - a + 1) * 1LL * a >= (b_ans - a_ans + 1) * 1LL * a_ans) {
			b_ans = b;
			a_ans = a;
		}

		/*if ((b - a) * 1.0 * a / b >= (b_ans - a_ans) * 1.0 * a_ans / b_ans) {
			b_ans = b;
			a_ans = a;
		}*/

		// DEBUG
		// cout << b << " " << a << "\n";
	}
	
	cout << b_ans << " " << a_ans;

	//system("pause");
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) GET_MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
void _dbg(string){cout<<endl;}
template<class H,class... T> void _dbg(string s,H h,T... t){int l=s.find(',');cout<<s.substr(0,l)<<" = "<<h<<", ";_dbg(s.substr(l+1),t...);}
template<class T,class U> ostream& operator<<(ostream &o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream &o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 1000000009
#define X 5005

vector<int> tree[1005];
int val[1005];

int dfs(int d){
  vector<int> v(X, INF);
  v[0] = 0;
  for(auto to : tree[d]){
    int u = dfs(to);
    vector<int> vv(X, INF);
    // val[to] or u
    rep(i,X-val[to]){
      if(v[i]>=0) vv[i+val[to]] = min(vv[i+val[to]], v[i] + u);
    }
    rep(i,X-u){
      if(v[i]>=0) vv[i+u] = min(vv[i+u], v[i] + val[to]);
    }
    swap(v, vv);
  }
  int ret = INF;
  rep(i,val[d]+1) ret = min(ret, v[i]);
  return ret;
}

int main(){
  int n;
  cin>>n;
  rep(i,n-1){
    int d;
    cin>>d; d--;
    tree[d].pb(i+1);
  }
  rep(i,n) cin>>val[i];

  if(dfs(0)<INF) cout << "POSSIBLE" << endl;
  else cout << "IMPOSSIBLE" << endl;

  return 0;
}


Measured memory_bytes: 8748
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
	if((a+b)%3==0||a%3==0||b%3==0)
		puts("Possible\n");
	else
		puts("Impossible\n");

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
//const int MAX=2e5+2;
int main(){
    long long sum=0,n,pre,cur;
    cin>>n;
    cin>>pre;
    for(int i=2;i<=n;i++)
    {
        cin>>cur;
        if(cur<pre)
        {
            sum+=pre-cur;
        }
        else
        {
            pre=cur;
        }
    }  
    cout<<sum;
    //system("pause");
}

Measured memory_bytes: 3632
import math

MOD = 10 ** 9 + 7
n, m = list(map(int, input().split()))
ptn = 1
if abs(n - m) >= 2:
    ptn = 0
else:
    ptn = math.factorial(n) * math.factorial(m)
    if abs(n - m) == 0:
        ptn *= 2

print(ptn % MOD)



Measured memory_bytes: 11056
#include<iostream>
using namespace std;
#define ll long long



int main()
{
	ll i,j;
	string a;
	string b;
	cin>>a>>b;
	ll n=a.length();
	ll m=b.length();
	ll dp[n+1][m+1];
	for(i=1;i<=n;i++)
	{
		dp[i][0]=0;
	}
	for(i=1;i<=m;i++)
	{
		dp[0][i]=0;
	}
	dp[0][0]=0;
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
		{
			if(a[i-1]==b[j-1])
			{
				dp[i][j]=1+dp[i-1][j-1];
			}
			else
			{
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
			}
		}
	}
	ll len=dp[n][m];
	i=n;
	j=m;
	string lcs="";
	while(len>0 && i>=0 && j>=0)
	{
		if(a[i-1]==b[j-1])
		{
			lcs+=a[i-1];
			len--;
			i--;
			j--;
		}
		else
		{
			if(dp[i][j-1]>dp[i-1][j])
			{
				j--;
			}
			else 
			{
				i--;
			}
		}
	}
	for(i=lcs.length()-1;i>=0;i--)
	{
		cout<<lcs[i];
	}
}

Measured memory_bytes: 73940
#include <stdio.h>
#include <set>
using namespace std;

int N;
set <int> s;

int main() {
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		int X; scanf("%d", &X);
		if (s.count(X)) s.erase(X);
		else s.insert(X);
	}
	printf("%d\n", s.size());
}

Measured memory_bytes: 4864
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
#include <iostream>
using namespace std;
int main() {
	long long N, C;
	cin >> N >> C;
	vector<long long> xl;
	vector<long long> vl;
	for (size_t i = 0; i < N; i++)
	{
		long long x, v;
		cin >> x >> v;
		xl.push_back(x);
		vl.push_back(v);
	}
	long long  fp = 0;
	long long  bp = C;
	long long maxv = 0;
	long long fs = 0;
	long long bs = 0;
	long long maxfs = 0;
	long long maxbs = 0;
	long long maxfsi = 0;
	long long maxbsi = 0;
	map<int, pair<long long,long long>> fm;
	map<int, pair<long long, long long>> bm;
	for (size_t i = 0; i < N; i++)
	{
		fs += vl[i] - (xl[i] - fp);
		if (fs > maxfs) {
			maxfs = fs;
			maxfsi = xl[i];
		}
		else if(i > 0){
			maxfs = fm[i - 1].first;
			maxfsi = fm[i - 1].second;
		}
		fm[i] = pair<long long,long long>(maxfs,maxfsi);
		fp = xl[i];
	}
	for (int i = N - 1; i >= 0; i--)
	{
		bs += vl[i] - (bp - xl[i]);
		if (bs > maxbs) {
			maxbs = bs;
			maxbsi = xl[i];
		}
		else if(i < (N - 1)){
			maxbs = bm[i + 1].first;
			maxbsi = bm[i + 1].second;
		}
		bm[i] = pair<long long, long long>(maxbs, maxbsi);
		bp = xl[i];
	}


	for (size_t i = 0; i < N; i++)
	{
		if (i < N - 1) {
			long long p1 = fm[i].first - min(fm[i].second, (C - bm[i + 1].second)) + bm[i + 1].first;
			maxv = max(maxv, max(p1, max(fm[i].first, bm[i + 1].first)));
		}
		else {
			maxv = max(maxv, max(fm[i].first,bm[0].first));
		}
	}
	cout << maxv;
	return 0;
}

Measured memory_bytes: 14316
n=int(input())
xy=[list(map(int,input().split())) for _ in range(n)]
xy.sort(key=lambda x:(x[0],x[1]))
# print(xy)
if n<=2:
    print(1)
else:
    diff=[]
    for i in range(n):
        for j in range(i):
            diff.append((xy[i][0]-xy[j][0],xy[i][1]-xy[j][1]))

    ans=[]
    # print(set(diff))
    for p,q in set(diff):
        cnt=n
        for i in range(n):
            for j in range(i):
                if xy[i][0]-xy[j][0]==p and xy[i][1]-xy[j][1]==q:
                    cnt-=1
        ans.append(cnt)
    print(min(ans))

Measured memory_bytes: 3188
a = int(input())
b = int(input())
c = int(input())
x = int(input())

cnt = 0

for a_idx in range(a + 1):
  for b_idx in range(b + 1):
    for c_idx in range(c + 1):
      total = 500 * a_idx + 100 * b_idx + 50 * c_idx
      if (total == x): cnt += 1

print(cnt)

Measured memory_bytes: 9000
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define dd double
#define pb push_back
#define ff first
#define ss second
#define Mp make_pair
const ll Mod=1000000007;
const ll INF=999999999999999999;
const ll NN=(ll)(1e6+5);
ll min(ll x,ll y){if(x<y) return x;return y;}
ll max(ll x,ll y){if(x>y) return x;return y;}
ll power(ll x,unsigned ll y) 
{ 
    if (y==0) 
        return 1; 
    else if (y%2==0) 
        return power(x,y/2)*power(x,y/2); 
    else
        return x*power(x,y/2)*power(x,y/2); 
}
ll hcf(ll a,ll b) 
{ 
    if(b==0) 
        return a; 
    return hcf(b,a%b);  
}
int main()
{
   fio;
   /*#ifndef ONLINE_JUDGE 
    	freopen("input.txt", "r", stdin); 
    	freopen("output.txt", "w", stdout); 
    	freopen("error.txt", "w", stderr); 
   #endif*/
   ll TT=1;
   //cin>>TT;
   while(TT--)
   {
       ll x,k,d;
       cin>>x>>k>>d;
       if(x==0)
       {
           if(k%2)
            cout<<d;
           else
            cout<<0;
            return 0; 
       }
       if(x<0)
        x*=-1;
       ll y=min(k,x/d);
       ll z=x-(y)*d;
       k-=y;
       if(k==0)
       {
           cout<<z;
           return 0;
       } 
       if(abs(z-d)<=abs(z))
       {
           k--;
           z-=d;
       }
       if(k%2==0)
        cout<<abs(z);
       else
        cout<<min(abs(z+d),abs(z-d)); 
   }
}


Measured memory_bytes: 3632
import java.util.*;

class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int A1 = sc.nextInt();
        int A2 = sc.nextInt();
        int A3 = sc.nextInt();

        if(A1+A2+A3 >= 22) System.out.println("bust");
        else System.out.println("win");
    }
}

Measured memory_bytes: 23892
#include "bits/stdc++.h"
#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);
    ll l, r;
    cin >> l >> r;
    chmin(r, l+2019);
    ll ans = 2018;
    for(ll i = l; i <= r; i++){
        for(ll j = i+1; j <= r; j++){
            chmin(ans, (i*j)%2019);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
lists = [input() for _ in range(n)]

for i in range(n):
    lists[i] = ''.join(sorted(lists[i]))

d = {}
for i in range(n):
    if lists[i] in d:
        d[lists[i]] += 1
    else:
        d[lists[i]] = 1

answer = 0
for i in d:
    answer += d[i] * (d[i]-1) // 2

print(answer)

Measured memory_bytes: 19472
#include <stdio.h>

int main(void) {
	int a1,a2,a3,a4,b1,b2,b3,b4,h,b;
	while (scanf("%d%d%d%d",&a1,&a2,&a3,&a4) != EOF){
		scanf("%d%d%d%d",&b1,&b2,&b3,&b4);
		h = 0;
		b = 0;
		if (a1 == b1){
			h = h + 1;
		}
		else if (a1 == b2 || a1 == b3 || a1 == b4){
			b = b + 1;
		}
		if (a2 == b2){
			h = h + 1;
		}
		else if (a2 == b1 || a2 == b3 || a2 == b4){
			b = b + 1;
		}
		if (a3 == b3){
			h = h + 1;
		}
		else if (a3 == b2 || a3 == b1 || a3 == b4){
			b = b + 1;
		}
		if (a4 == b4){
			h = h + 1;
		}
		else if (a4 == b2 || a4 == b3 || a4 == b1){
			b = b + 1;
		}
		printf("%d %d\n",h,b);
		
	}
	return 0;
}

Measured memory_bytes: 596
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long x = sc.nextLong();
        long count = 0;


        count =(b / x) - (a / x);
        if(a % x == 0)
            {
                count++;
            }
        System.out.println(count);
    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#include <string> 
#include <iomanip>
#include <cmath> 
#include <bitset>
#include <string.h> 
#include <algorithm>  
using namespace std;
#define mod 1000000007
#define int long long int
#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL)
#define PI 3.14159265358979323846
int32_t main()
{
    fast;
    int n;
    cin>>n;
    if(n>=30)
    {
        cout<<"Yes"<<"\n";
    }
    else
    {
        cout<<"No"<<"\n";
    }
}

Measured memory_bytes: 3648
#include <iostream>

int main(int argc, const char * argv[]) {
    using namespace std;
    int n,count = 1;
    bool k = true;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        if (a[i] % 2 != 0) {
            cout << "0" << endl;
            return 0;
        }
    }
    while (true) {
        for (int i = 0; i < n; ++i) {
            a[i] = a[i] / 2;
            if (a[i] % 2 != 0) {
                k = false;
            }
        }
        if (k == false) {
            cout << count << endl;
            break;
        }
        count++;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int main() {
    int n, x;
    cin >> n >> x;
    vector<ll> a(n);
    ll kids_sum = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        kids_sum += a[i];
    }
    sort(a.begin(),a.end());
    if(x>kids_sum){
        cout << n-1 << endl;
    }else if(x == kids_sum){
        cout << n << endl;
    }else{
        int ans;
        for(int i = 0; i < n; i++){
            x -= a[i];
            if(x < 0){
                ans = i;
                break;
            }
        }
        cout << ans << endl;
    }
    return 0;
}

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


using ll = long long;
int X, Y, A, B, C;
vector<pair<int, int>> v;


void solve()
{
    sort(v.begin(), v.end());
    int c0 = 0, c1 = 0, c2 = 0;
    int idx, t0, t1, t2;
    for (int i = v.size() - 1; i >= 0; i--) {
        if (v[i].second == 0)
            c0++;
        else if (v[i].second == 1)
            c1++;
        else
            c2++;
        t0 = max(X - c1, 0) + max(Y - c2, 0);
        if (t0 <= c0) {
            idx = i;
            t1 = min(X, c1);
            t2 = min(Y, c2);
            break;
        }
    }

    ll ans = 0;
    for (int i = v.size() - 1; i >= idx; i--) {
        if (v[i].second == 0) {
            if (t0 > 0) {
                ans += v[i].first;
                t0--;
            }
        } else if (v[i].second == 1) {
            if (t1 > 0) {
                ans += v[i].first;
                t1--;
            }
        } else {
            if (t2 > 0) {
                ans += v[i].first;
                t2--;
            }
        }
    }
    cout << ans << endl;
}


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

    cin >> X >> Y >> A >> B >> C;
    int p, q, r;
    for (int i = 1; i <= A; i++) {
        cin >> p;
        v.emplace_back(p, 1);
    }
    for (int i = 1; i <= B; i++) {
        cin >> q;
        v.emplace_back(q, 2);
    }
    for (int i = 1; i <= C; i++) {
        cin >> r;
        v.emplace_back(r, 0);
    }
    solve();
    return 0;
}


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

int main()
{
	char s[5];
	scanf("%s", s);
	int a = 0, c = 0;
	for (int i = 0; i < 3; ++i) {
		if (s[i] == 'R') {
			a = max(a, ++c);
		}
		else {
			c = 0;
		}
	}
	printf("%d\n", a);
}

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

inline int F ( int x )  {
	int sum ( 0 ) ;
	while ( x )  sum += x % 10, x /= 10 ;
	return sum ;
}

int main ( )  {

	int n, a, b ;
	std :: cin >> n >> a >> b ;
	
	int ans ( 0 ) ;

	for ( int i = 1 ; i <= n ; ++ i )  {
		if ( F ( i ) >= a && F ( i ) <= b )  {
			ans += i ;
		}
	}

	return ! printf ( "%d\n", ans ) ;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;

using namespace std;
int main() {
	int n, k;
	cin >> n >> k;
	if (k != 1) cout << n - k << endl;
	else cout << 0 << endl;
	return 0;
}


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

int main() {
    string s;cin>>s;
    int n = s.size();
    if(s[n-1]=='s')cout<<s<<"es"<<endl;
    else cout<<s<<'s'<<endl;
	return 0;
}

Measured memory_bytes: 3624
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

fn main() {
  let n: usize = read();
  let s: String = read();
  let mut cntr: i64 = 0;
  let mut cntg: i64 = 0;
  let mut cntb: i64 = 0;
  for c in s.chars() {
    if c == 'R' {
      cntr += 1;
    } else if c == 'G' {
      cntg += 1;
    } else {
      cntb += 1;
    }
  }
  let t = s.as_bytes();
  let mut ans = cntr * cntg * cntb;
  for i in 1..n {
    for j in 0..n {
      if j + 2 * i < n {
        if (t[j] != t[i + j]) && (t[j + i] != t[j + 2 * i]) && (t[j + 2 * i] != t[j]) {
          ans = ans - 1;
        }
      }
    }
  }
  println!("{}", ans);
}

Measured memory_bytes: 2180
#include<iostream>
#include<bits/stdc++.h>
#define int long long
using namespace std;


int32_t main()
{
    int a, b;
    cin>>a>>b;

    int p1 = a+b;
    int p2 = a-b;
    int p3 = a*b;

    int ans = max(p1, p2);
    ans = max(ans, p3);

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

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

count = 0

for i in range(1,len(a)):
    if a[i] == a[i-1]:
        count += 1
        if i < len(a)-1 :
            a[i] = a[i-1] + a[i+1]
        
print(count)


Measured memory_bytes: 3060
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <math.h>
using namespace std;

int main() {
	double r;
	cin >> r;
	cout << fixed << setprecision(6) << r * r * M_PI << " " << fixed << setprecision(6) << 2 * r * M_PI << endl;
}


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

int main()
{
   int n,k=0;
   cin>>n;
   int d1[n],d2[n];
   for(int i=0;i<n;i++)
   cin>>d1[i]>>d2[i];
   for(int i=0;i<n-2;i++){
     
           if(d1[i]==d2[i] && d1[i+1]==d2[i+1] && d1[i+2]==d2[i+2]){
           k=1;
           break;
           }
           else
           k=0;
       
   }
   if(k==1)
   cout<<"Yes";
   else
   cout<<"No";
    return 0;
}


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

int main () {
	
	string s="", s1="", s2="";
	int n1=0, n2=0;

	cin >> s;

	s1 = s[0]; s1 += s[1];
	s2 = s[2]; s2 += s[3];

	n1 = stoi(s1);
	n2 = stoi(s2);

	//cout << n1 << " , " << n2 << endl;
	if (n1>=1 && n1<=12) {

		if (n2>=1 && n2<=12) {
			cout << "AMBIGUOUS" << endl;
		}
		else {
			cout << "MMYY" << endl;
		}

	}
	else {

		if (n2>=1 && n2<=12) {
			cout << "YYMM" << endl;
		}
		else {
			cout << "NA" << endl;
		}

	}

	return 0;
}

Measured memory_bytes: 256
N, A, B, C = map(int, input().split())
l = [int(input()) for _ in range(N)]
INF = 10 ** 9

def dfs(cur, a, b, c):
    if cur == N:
        return abs(a - A) + abs(b - B) + abs(c - C) -30 if min(a, b, c) > 0 else INF
    ret0 = dfs(cur + 1, a, b, c)
    ret1 = dfs(cur + 1, a + l[cur], b, c) + 10
    ret2 = dfs(cur + 1, a, b + l[cur], c) + 10
    ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10
    return(min(ret0, ret1, ret2, ret3))
    
print(dfs(0, 0, 0, 0))

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

int main()
{
    int n;
	cin >> n;
	int a[n];
	
	for(int i=0; i<n; i++) cin >> a[i];
	
	int cnt=0, i;
	
	do{
		for(i=0; i<n; i++)
		   if(a[i]%2==1)
		   {
		       cout << cnt;
		       return 0;
		   }
		   else
		     a[i]=a[i]/2;
		cnt++;
	}while(1);
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    s = input().strip()

    next_o = {"SS": "S", "SW": "W","WS": "W", "WW": "S"}
    next_x = {"SS": "W", "SW": "S","WS": "S", "WW": "W"}

    for ans in ["SS", "SW", "WS", "WW"]:
        for i in range(1, N):
            if s[i] == "o":
                ans += next_o[ans[-2:]]
            else:
                ans += next_x[ans[-2:]]
        
        if ans[0] == ans[-1]:
            if s[0] == "o":
                if ans[1] == next_o[ans[-2:]]:
                    print(ans[:-1])
                    return
            else:
                if ans[1] == next_x[ans[-2:]]:
                    print(ans[:-1])
                    return
    
    print(-1)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3572
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

    int n, k; cin>>n>>k;
    vector<int> a(n);
    for(int i=0; i<n; i++) cin>>a[i];
    int asum = accumulate(a.begin(), a.end(), 0);

    vector<int> div;
    for(int i=1; i*i<=asum; i++){
        if(asum % i == 0){
            div.emplace_back(i);
            div.emplace_back(asum / i);
        }
    }

    sort(div.begin(), div.end(), greater<int>());

    for(auto i:div){
        vector<P> divmod;
        for(int j=0; j<n; j++){
            divmod.emplace_back(a[j] % i, j);
        }
        sort(divmod.begin(), divmod.end());

        ll summod = 0;
        vector<bool> checked(n, false);
        for(int j=0; j<n; j++){
            int num, id;
            tie(num, id) = divmod[j];
            summod += num;
            if(k < summod){
                summod -= num;
                break;
            }
            checked[id] = true;
        }

        for(int j=0; j<n; j++){
            if(!checked[j]){
                int rest = i - a[j] % i;
                summod -= rest;
            }
        }

        if(0 <= summod && summod % i == 0){
            cout << i << endl;
            return 0;
        }
    }
}

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


using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

const int  INF = 1 << 29;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }



int main() {

	ll w, h;
	cin >> w >> h;
	vector<pair<ll, bool>> v;

	REP(i, w) {
		int x;
		cin >> x;
		v.push_back({ x,true });
	}

	REP(i, h) {
		int x;
		cin >> x;
		v.push_back({ x,false });
	}

	sort(ALL(v));

	ll ans = 0;

	int ww = w + 1;
	int hh = h + 1;

	REP(i, w + h) {


		if (v[i].second) {
			ans += v[i].first*hh;
			ww--;

		}
		else {
			ans += v[i].first*ww;
			hh--;
		}
	}
	cout << ans << endl;



}

Measured memory_bytes: 6384
/*  -*- coding: utf-8 -*-
 *
 * c.cc: C: Grand Garden
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int n;
  scanf("%d", &n);

  int sum = 0, ph = 0;
  for (int i = 0; i < n; i++) {
    int hi;
    scanf("%d", &hi);
    if (ph < hi) sum += hi - ph;
    ph = hi;
  }

  printf("%d\n", sum);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

typedef long long ll;

int N;
int c[8][8];

struct P {
  int v[8]; 
  int dist;
  P(int a[], int dist) : dist(dist) {
    REP(i,N)v[i]=a[i];
  }
  P() {}
};

struct P2 {
  int v[8];
  P2(int a[]) {
    REP(i, N) v[i] = a[i];
  }
  P2() {}
};

bool operator<(const P &a, const P &b) {
  return a.dist > b.dist;
}

bool operator<(const P2 &a, const P2 &b) {
  REP(i, N) if (a.v[i]!=b.v[i]) return a.v[i]<b.v[i];
  return 0;
}
				 

int main() {
  cin >> N;
  REP(i, N) {
    REP(j, N) {
      cin >> c[i][j];
    }
  }
  priority_queue<P> Q;
  int ini[8];
  REP(i,N) ini[i] = i;
  Q.push(P(ini, 0));
  map<P2, int> dist;
  dist[P2(ini)] = 0;
  int ans = 0;
  while(!Q.empty()) {
    P p = Q.top(); Q.pop();
    if (p.dist > dist[P2(p.v)]) continue; 
    ans = max(ans, p.dist);
//     REP(i, N) cout << p.v[i] << " ";cout <<endl;
//     cout << p.dist << " " << dist[P2(p.v)] << endl;
    REP(i, N) {
      REP(j, i) {
	int tmp[N];
	REP(k, N) tmp[k] = p.v[k];
	swap(tmp[i], tmp[j]);
	int d = p.dist + c[p.v[i]][p.v[j]];
	if (dist.count(P2(tmp)) == 0 || dist[P2(tmp)] > d) {
	  dist[P2(tmp)] = d;
	  Q.push(P(tmp, d));
	}
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 5172
N = int(input())
dp = [[0 for _ in range(3)] for _ in range(N + 1)]
a, b, c = map(int, input().split())
dp[1][0] = a
dp[1][1] = b
dp[1][2] = c
for i in range(2, N + 1):
    a, b, c = map(int, input().split())
    dp[i][0] = max(dp[i - 1][1] + a, dp[i - 1][2] + a)
    dp[i][1] = max(dp[i - 1][0] + b, dp[i - 1][2] + b)
    dp[i][2] = max(dp[i - 1][0] + c, dp[i - 1][1] + c)

print(max(dp[N]))

Measured memory_bytes: 28768
bingo = [list(map(int, input().split())) for i in range(3)]
n = int(input())
for i in range(n):
    num = int(input())
    for j in range(3):
        for k in range(3):
            if bingo[j][k] == num:
                bingo[j][k] = 0
                break;
res = 'No'
for i in range(3):
    if bingo[i][0] == bingo[i][1] == bingo[i][2] == 0:
        res = 'Yes'
        break
    elif bingo[0][i] == bingo[1][i] == bingo[2][i] == 0:
        res = 'Yes'
        break
if bingo[0][2] == bingo[1][1] == bingo[2][0] == 0:
    res = 'Yes'
elif bingo[0][0] == bingo[1][1] == bingo[2][2] == 0:
    res = 'Yes'
print(res)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using ll = long long;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define ALL(x) x.begin(),x.end()

#define INF (ll)1e9 //10^9:∞
#define LLINF (ll)1e12
#define MOD (ll)(1e9+7) //10^9+7:合同式の法
#define PI 3.141592653589
#define PB push_back
#define F first
#define S second
#define __MAGIC__ ios::sync_with_stdio(false);cin.tie(nullptr);

#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

#define Graph vector<vector<int>>
#define PII pair<int,int>
#define VI vector<int>
#define VVI vector<vector<int>>
#define VPII vector<pair<int,int>>

#define DDD fixed<<setprecision(10)
#define endl "\n"

using namespace std;
/*..................DEFINE GLOBAL VARIABLES...................*/


/*.....................DEFINE FUNCTIONS ......................*/



/*.........................kemkemG0...........................*/
signed main() {
	__MAGIC__


	ll N, K;
	cin >> N >> K;
	vector<ll> h(N);
	REP(i, N)cin >> h[i];


	vector<ll> dp(N , INF);

	dp[0] = 0;

	FOR(i, 1, N - 1) FOR(j, 1, K) {if (i - j >= 0) dp.at(i) = min( dp[i] , dp.at(i - j) + abs(h.at(i) - h.at(i - j) ) );}

	cout << dp.at(N - 1) << endl;



	return 0;
}


Measured memory_bytes: 4724
#include <iostream>
using namespace std;
using llong = long long;

int main() {
    llong x, n;
    llong p[128];
    llong s = 1ll << 60ll;
    llong ans = 1ll << 60ll;
    
    cin >> x >> n;
    for (int i = 0; i < n; i++) cin >> p[i];

    for (int i = 0; i <= 101; i++) {
        if (llabs(x - i) < s && [&](){
            for (int j = 0; j < n; j++) if (p[j] == i) return false;
            return true;
        }()) {
            s = llabs(x - i);
            ans = i;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define len(v) (int)(v).size()

using namespace std;

vector<int> G[25];
int mp[(1 << 24)];
vector<int> x,y,r,c;
int p[25];
int n;

int dfs(int par)
{
    if(mp[par] >= 0){
        return mp[par];
    }
    vector<vector<int> > cl(4);
    rep(i,n){
        if((par >> i)&1){
            cl[c[i]].pb(i);
        }
    }
    int mx = 0;
    rep(i,4){
        if(len(cl[i])>=2){
            rep(j,len(cl[i])-1){
                int npar = par - (1 << cl[i][j]);
                for(auto& v : G[cl[i][j]]){
                    p[v] -= (1 << cl[i][j]);
                    if(p[v]==0) npar += (1 << v);
                }
                for(int k=j+1;k<len(cl[i]);k++){
                    npar -= (1 << cl[i][k]);
                    for(auto& v : G[cl[i][k]]){
                        p[v] -= (1 << cl[i][k]);
                        if(p[v]==0) npar += (1 << v);
                    }
                    mx = max(mx,dfs(npar)+2);
                    for(auto& v : G[cl[i][k]]){
                        if(p[v]==0) npar -= (1 << v);
                        p[v] += (1 << cl[i][k]);
                    }
                    npar += (1 << cl[i][k]);
                }
                for(auto& v : G[cl[i][j]]){
                    p[v] += (1 << cl[i][j]);
                }
            }
        }
    }
    mp[par] = mx;
    return mx;
}

inline bool intersect(int i, int j)
{
    return (x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]) < (r[i]+r[j])*(r[i]+r[j]);
}

int main()
{
    while(1){
        cin >> n;
        if(n == 0){
            break;
        }
        rep(i,n){
            G[i].clear();
        }
        memset(mp,-1,sizeof(mp));
        x.resize(n),y.resize(n),r.resize(n),c.resize(n);
        rep(i,n){
            cin >> x[i] >> y[i] >> r[i] >> c[i];
            p[i] = 0;
            c[i]--;
            rep(j,i){
                if(intersect(i,j)){
                    G[j].pb(i);
                    p[i] += (1 << j);
                }
            }
        }
        int par = 0;
        rep(i,n){
            if(p[i] == 0){
                par += (1 << i);
            }
        }
        cout << dfs(par) << "\n";
    }
}



Measured memory_bytes: 68640
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int N=3e5+9;


int main()
{

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    string s;
    map<string,int>cnt;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s;
        cnt[s]++;
    }
    cout<<"AC x "<<cnt["AC"]<<'\n';
    cout<<"WA x "<<cnt["WA"]<<'\n';
    cout<<"TLE x "<<cnt["TLE"]<<'\n';
    cout<<"RE x "<<cnt["RE"]<<'\n';



    return 0;
}


Measured memory_bytes: 3660
x, k, d = map(int, input().split(" "))
mini = x - k * d
maxi = x + k * d
t = maxi - (maxi // (2 * d)) * (2 * d)
if mini >= 0:
    print(mini)
elif maxi <= 0:
    print(- maxi)
else:
    print(min(t, abs(t - 2 * d)))


Measured memory_bytes: 9172
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("3");
            WillReturn.Add("5 2 4");
            //3
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("4");
            WillReturn.Add("631 577 243 199");
            //0
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("10");
            WillReturn.Add("2184 2126 1721 1800 1024 2528 3360 1945 1280 1776");
            //39
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int[] AArr = InputList[1].Split(' ').Select(X => int.Parse(X)).ToArray();

        long Answer = 0;
        for (int I = 0; I <= AArr.GetUpperBound(0); I++) {
            while (AArr[I] % 2 == 0) {
                Answer++;
                AArr[I] /= 2;
            }
        }
        Console.WriteLine(Answer);
    }
}


Measured memory_bytes: 14176
//be naame khodaa

#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <cstdio>
#include <algorithm>
#include <set>
#include <cassert>
#include <iomanip>
#include <cstring>
#include <sstream>
#define fi first
#define se second
#define rep(i, x, n) for (int i = x; i < n; i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef vector <int> VI;

const int maxd = 4*1000 + 5;
const int maxp = 10;
const int P = 998244353;

struct Poly {
	int c[maxd];
	int deg;

	friend istream &operator >> (istream &inp, Poly &p){
		string s;
		inp >> s;
		p.deg = s.length() - 1;
		for (int i = 0; i < s.length(); i++)
			p.c[p.deg-i] = (s[i] - '0');
		return inp;
	}

	friend ostream &operator << (ostream &out, Poly &p){
		for (int i = p.deg; i >= 0; i--)
			out << p.c[i];
		return out;
	}

	Poly () {
		deg = -1;
	}

} poly[maxp];

Poly gcd (Poly a, Poly b){
	if (a.deg < b.deg) swap (a, b);
	if (b.deg == -1) return a;
	for (int i = 0; i <= b.deg; i++)
		a.c[a.deg-i] ^= b.c[b.deg-i];
	while (a.deg >= 0 && a.c[a.deg] == 0)
		a.deg--;
	return gcd (a, b);
}

int main()
{
	ios::sync_with_stdio(false);
	Poly X;
	int n;
	cin >> n >> X;
	Poly g;
	for (int i = 0; i < n; i++){
		cin >> poly[i];
		g = gcd (g, poly[i]);
	}
	if (X.deg < g.deg)
		return (cout << 1 << endl), 0;
	ll res = 0;
	for (int i = X.deg; i >= g.deg; i--)
		res = (res*2 + X.c[i])%P;

	Poly Y = X;
	while (Y.deg >= g.deg){
		for (int i = 0; i <= g.deg; i++)
			Y.c[Y.deg-i] ^= g.c[g.deg-i];
		while (Y.deg >= g.deg && Y.c[Y.deg] == 0)
			Y.deg--;
	}

	res++;
	for (int i = g.deg-1; i >= 0; i--){
		if (X.c[i] != (X.c[i] ^ Y.c[i])) {
			if (X.c[i] < (X.c[i] ^ Y.c[i]))
				res--;
			break;
		}
	}
	res %= P;
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 127744
# include <bits/stdc++.h>
using namespace std;
namespace fastio{
	template<typename tn> void read(tn &a){
	    tn x=0,f=1;char c=' ';
	    for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	    for(;isdigit(c);c=getchar() ) x=x*10+c-'0';
	    a=x*f;
	}
	template<typename tn> void print(tn a){
	    if(a<0) putchar('-'),a=-a;
	    if(a>9) print(a/10);
	    putchar(a%10+'0');
	}
};
using namespace fastio;
int n,k,d,ans;
bool b[105];
int main(){
	read(n);
	read(k);
	for(int i=1;i<=k;i++){
		read(d);
		while(d--){
			int a;
			read(a);
			if(!b[a]) ans++;
			b[a]=1;
		}
	}
	printf("%d\n",n-ans);
	return 0;
}

Measured memory_bytes: 3696
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
const long long MOD = 1000000007;
using namespace std;
typedef long long ll;
map<ll, int> mp;
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int r;
	cin >> r;
	cout << 3 * (r * r) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using llpair=pair<ll,ll>;
using llvec=vector<ll>;
using llmat=vector<vector<ll>>;
#define llmattp(name,a,b,num) name(a,vector<ll>(b,num))
#define INTINF 1<<30
#define LLINF 1LL<<60
#define ABS(x) ( (x)>0 ? (x) : -(x) )

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

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

ll factorial(ll x) {
	ll f=1;
	for(ll i=2; i<x; i++) {
		f*=i;
	}
	return f;
}

ll nPr(ll n, ll r) {
	ll result=1;
	for(ll i=r+1; i<=n; i++) result*=i;
	return result;
}

ll nCr(ll n, ll r) {

	if (n == 0) { return 0; }
	if (r == 0) { return 1; }
	if (r == 1) { return n; }
	if (n == r) { return 1; }

	if (r > n / 2) { r = n / 2; }

	double result = 1;
	for (double i = 1; i <= r; i++) {
		result *= (n - i + 1) / i;
	}

	return (ll)result;
}

bool IsPrime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

	double sqrtNum = sqrt(num);
	for (ll i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}

ll GreaterBinarySearch(ll *array, ll key, ll max, ll min) {
	if(array[max]<array[min]) {
		return NULL;
	} else {
		ll mid = max + (min-max)/2;
		if(array[mid]<key) {
			return GreaterBinarySearch(array,key,max,mid-1);
		} if(array[mid]>key) {
			return GreaterBinarySearch(array,key,mid+1,min);
		} else {
			return mid;
		}
	}
}

int H,W;

int dx[2]={0,1};
int dy[2]={1,0};

char maps[100][100];
int turn[100][100];

int main() {
	cin>>H>>W;

	for(int i=0; i<H; i++)
		for(int j=0; j<W; j++) {
			cin>>maps[i][j];
			turn[i][j]=INTINF;
		}

	if(maps[0][0]=='#')
		turn[0][0]=1;
	else
		turn[0][0]=0;

	for(int i=0; i<H; i++) {
		for(int j=0; j<W; j++) {
			for(int k=0; k<2; k++) {
				if(i+dy[k]>=H||j+dx[k]>=W) continue;
				int turning=turn[i][j];
				if(maps[i][j]=='#') {
					chmin(turn[i+dy[k]][j+dx[k]],turn[i][j]);
				}
				else {
					if(maps[i+dy[k]][j+dx[k]]=='.') {
						chmin(turn[i+dy[k]][j+dx[k]],turn[i][j]);
					}
					else {
						chmin(turn[i+dy[k]][j+dx[k]],turn[i][j]+1);
					}
				}
			}
		}
	}
	/*for(int i=0; i<H; i++) {
		for(int j=0; j<W; j++) {
			cout<<turn[i][j]<<" ";
		}
		cout<<endl;
	}*/
	cout<<turn[H-1][W-1]<<endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CoinProblem {
	class Program {
		private const int MMAX = 20;
		private const int NMAX = 50000;
		private const int INFTY = (1 << 29);

		static void Main(string[] args) {
			int n, m;
			int[] C = new int[21];
			int[] T = new int[NMAX + 1];

			var line = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
			n = line[0]; m = line[1];

			foreach (var item in Console.ReadLine().Split(' ').Select((v, ix) => new { v, ix }))
				C[item.ix + 1] = int.Parse(item.v);

			for (int i = 0; i <= NMAX; i++) T[i] = INFTY;
			T[0] = 0;
			for( int i = 1; i <= m; i++) {
				for( int j = 0; j + C[i] <= n; j++) {
					T[j + C[i]] = Math.Min(T[j + C[i]], T[j] + 1);
				}
			}

			Console.WriteLine(T[n]);
		}
	}
}



Measured memory_bytes: 18460
N = int(input())

activities = []

for i in range(N):
  activities.append([int(x) for x in input().split()])
  
memo = [[0] * N for _ in range(3)]

for day in range(N):
  for no in range(3):
    # 1日目を初期化
    if day == 0:
      memo[no][0] = activities[0][no]
      continue
    # 同じアクティビティが連続しないように
    memo[no][day] = max(
      memo[(no + 1) % 3][day - 1], 
      memo[no - 1][day - 1]
    ) + activities[day][no]
    
print(max(memo[x][N -1] for x in range(3)))

Measured memory_bytes: 36152