akhauriyash/Code-Regression huggingface dataset:
s = input()
if s[0] == 'A':
    a = 1
else:
    a = 10

if s[2:len(s)-1].count('C') == 1:
    b = 1
else:
    b = 10
count = 0
ss = 'qwertyuioplkjhgfdsazxcvbnm'
for i in s:
    if i in ss:
        count += 1
if count == len(s)-2:
    c = 1
else:
    c = 10

if a+b+c == 3:
    print('AC')
else:
    print('WA')

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>

	int A[3][3];
	static int b[3][3];
int		main(void)
{
	int N;
	int i,j;
	int BB[12];
	for(i=0;i<3;i++){
		for(j=0;j<3;j++){
			scanf("%d",&A[i][j]);
		}
	}
	scanf("%d",&N);
	int k;
	for(k=0;k<N;k++){
		scanf("%d",BB+k);
		for(i=0;i<3;i++){
		for(j=0;j<3;j++){
			if(A[i][j]==BB[k]){
				b[i][j]=1;
				break;
			}
		
		}
		}
	}
	
	int ans=1;
	for(i=0;i<3;i++){
		for(j=0;j<3;j++){
			ans *=b[i][j];
		}
		if(ans==0){ans=1;}
		else {
			printf("Yes\n");
			return 0;
		}
	}
	for(i=0;i<3;i++){
		for(j=0;j<3;j++){
			ans *=b[j][i];
		}
		if(ans==0){ans=1;}
		else {
			printf("Yes\n");
			return 0;
		}
	}
	if(b[0][0]*b[1][1]*b[2][2] || b[0][2]*b[1][1]*b[2][0]){
		printf("Yes\n");return 0;
	}
	printf("No\n");
	
	return (0);
}


Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>


int main(void) {
	int n;
	int built[4][3][10] = { 0 };
	int b, f, r, v;
	int i;

	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		scanf("%d %d %d %d", &b, &f, &r, &v);

		built[b - 1][f - 1][r - 1] += v;
	}

	for (i = 0; i < 4; i++) {
		for (int j = 0; j < 3; j++) {
			for (int l = 0; l < 10; l++) {
				printf(" %d", built[i][j][l]);
			}
			printf("\n");
		}
		if (i != 3)
			printf("####################\n");
	}	



	return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
typedef long long ll;
typedef pair<ll,ll> prl;
typedef vector<ll> vcl;
typedef map<ll,ll> mapl;
typedef unordered_map<ll,ll> umap;
#define pb push_back
#define all(v) v.begin(), v.end()
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repi(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define reps(i,v) for(ll i=0;i<v.size();i++)
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
const ll mod = 1e9+7;
const double pi = 3.1415926535897932385;

int main() {
    // your code goes here
    double a,b,h,m,k,an;
    cin >> a >> b >> h >> m;
    k=abs(h*30.0+m/2.0-m*6.0)*pi/180.0;
    if(k>pi) k=2*pi-k;
    an = a*a+b*b-2.0*a*b*cos(k);
    cout << setprecision(17) << sqrt(an) << endl;
    return 0;
}

Measured memory_bytes: 4228
#include <bits/stdc++.h>
using namespace std;
 
#define speed ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define ub(a,x) upper_bound(a.begin(),a.end(),x)-a.begin()
#define lb(a,x) lower_bound(a.begin(),a.end(),x)-a.begin()
#define ll long long int
#define endl "\n"
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define pb push_back
#define PI 3.1415926535897932384626
#define keep_unique(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end());

 
// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
// using namespace __gnu_pbds;
// typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;


void solveFunction()
{
    string s;
    cin>>s;
    for(auto i:s) 
    {
    	if(i=='7')
    	{
    		cout<<"Yes";
    		return;
    	}
    }
    cout<<"No";
}

main()  
{
    speed;
    int t = 1;
    //cin>>t;
    while(t--)
    {
        solveFunction();
    }
}



Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define print(x) cout<<(x)<<'\n'
#define print_vec(v) rep(i,v.size()){if(i!=0)cout<<" ";cout<<v[i];}cout<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<'\n'
#define pb push_back
#define mp make_pair
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pi=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
using vstr=vector<string>;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
void Yes(bool c) { if (c)print("Yes"); else print("No"); };
void YES(bool c) { if (c)print("YES"); else print("NO"); };

void solve() {
    int A,B,C,D;
    cin >> A>>B>>C>>D;
    bool win = true;
    bool turn = true;
    while(1){
        if(turn){
            C -= B;
            if(C<=0){
                win = true;
                break;
            }
        }else{
            A -= D;
            if(A<=0){
                win = false;
                break;
            }
        }
        turn = !turn;
    }
    Yes(win);
}
 
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
    //int q; cin >> q;
	//while (q--)
		solve();
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[9]={1,0,-1,0,1,1,-1,-1,0};
const ll dx[9]={0,-1,0,1,1,-1,1,-1,0};
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;
}
long long floor_sum(long long n, long long m, long long a, long long b) {
    long long ans = 0;
    if (a >= m) {
        ans += (n - 1) * n * (a / m) / 2;
        a %= m;
    }
    if (b >= m) {
        ans += n * (b / m);
        b %= m;
    }

    long long y_max = (a * n + b) / m, x_max = (y_max * m - b);
    if (y_max == 0) return ans;
    ans += (n - (x_max + a - 1) / a) * y_max;
    ans += floor_sum(y_max, a, m, (a - x_max % a) % a);
    return ans;
}
int main(){
    ll t;cin >> t;
    while(t--){
        ll n,m,a,b;cin >> n >> m >> a >> b;
        cout << floor_sum(n,m,a,b) <<endl;
    }
}

Measured memory_bytes: 3548
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
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(){ 
    int n; cin >> n;
    vector<int> A(n); rep(i, n) cin >> A[i];

    int res = 0;
    rep(i, n-1){
      if(A[i]==A[i+1]){
        res++;
        i++;
      }
    }
    cout << res << ln;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#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(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    int A1, A2, A3;
    cin >> A1 >> A2 >> A3;
    if(A1 + A2 + A3 >= 22) {
        cout << "bust" << endl;
    } else {
        cout << "win" << endl;
    }
    return 0;
}

Measured memory_bytes: 764
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define lli long long int
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define true 1
#define false 0

char solve(char *a,char *b,char *c,char s){
	//printf("a = %c b = %c c = %c s = %c\n",*a,*b,*c, s);
	if(s == 'a'){
		if(*a == '\0'){
			return 'A';
		}
		return solve(a+1,b,c,*a);
	}else if(s == 'b'){
		if(*b == '\0'){
			return 'B';
		}
		return solve(a,b+1,c,*b);
	}else if(s == 'c'){
		if(*c == '\0'){
			return 'C';
		}
		return solve(a,b,c+1,*c);
	}
	return '\0';
}



int main(void){
	char sa[101],sb[101],sc[101];
	scanf("%s",sa);
	scanf("%s",sb);
	scanf("%s",sc);
	printf("%c\n", solve(sa,sb,sc,'a'));

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include<iomanip>

using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const int inf = 1000000;

int main(int argc, const char * argv[]) {
  string w;
  cin >> w;
  
  map<char, int> m;
  for(int i = 0; i < w.size(); i++) {
    m[w[i]]++;
  }
  
  for(int i = 0; i < w.size(); i++) {
    if (m[w[i]] % 2 == 1) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
    int n,i;
    int a[1000]={0};
    
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&a[n-i]);
    }
    printf("%d",a[0]);
    for(i=1;i<n;i++){
        printf(" %d",a[i]);
    }
    printf("\n");
    return(0);
}

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


def readstr():
    return input().strip()


def readint():
    return int(input())


def readnums():
    return map(int, input().split())


def readstrs():
    return input().split()


def main():
    _ = readint()
    a = list(readnums())
    ans = 0
    for i, v in enumerate(a):
        if (i + 1) % 2 and v % 2:
            ans += 1

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9120
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define INF 1e9+7
#define rep(i,n) for(ll i=0;i<n;i++)
const int maxn = 1000000;
ll mod = INF;

ll n;

int main(){
    cin >> n;

    if(n%2==1){
        cout << 0<<endl;
    }else{
        while(n%10!=0)n-=2;
        ll ans=0;
        ll t=10;
        while(t<=n){
            ans+=n/t;
            t=t*5;
        }
        cout << ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <cmath>
#include <complex>
#include <vector>
#include <queue>
#include <cstring>
using namespace std;
const double EPS = 1e-8;
const double INF = 1e12;

typedef complex<double> P;
namespace std {
	bool operator < (const P& a, const P& b) {
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
	return real(conj(a)*b);
}

struct L : public vector<P> {
	L(const P &a, const P &b) {
		push_back(a); push_back(b);
	}
};

typedef vector<P> G;

struct C {
	P p; double r;
	C(){ }
	C(const P &p, double r) : p(p), r(r) { }
};

int ccw(P a, P b, P c) {
	b-=a;c-=a;
	if(cross(b, c) > 0)  return +1;// counter clockwise
	if(cross(b, c) < 0)  return -1;// clockwise
	if(dot(b, c) < 0)    return +2;// c--a--b on line
	if(norm(b) < norm(c))return -2;// a--b--c on line
	return 0;
}

bool intersectSS(const L &s, const L &t) {
	return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0 && ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0;
}


class State{
public:
	double sum;
	int t,s;
	P cur;
	State(){}
	State(double c, int a, int b, P p):sum(c),t(a),s(b),cur(p){}
	bool operator < (const State &opp)const{
		return sum > opp.sum;
	}
};
P rotate(P t , P p , double r){
	double ta=cos(r)*real(t-p)-sin(r)*imag(t-p)+real(p);
	double tb=sin(r)*real(t-p)+cos(r)*imag(t-p)+imag(p);
	return P(ta , tb);
}


P unit_vector(P t){
	return t/fabs(abs(t));
}

L interpointCC(C a , C b){
	double di=fabs(abs(a.p-b.p));
	if(di > a.r+b.r || di < fabs(a.r-b.r)) return L(P(0, 0), P(0, 0));
	double t=(a.r*a.r-b.r*b.r+di*di)/(di+di);
	double rd=acos(t/a.r);

	P dv=unit_vector(b.p-a.p);
	P g1=rotate(dv , P(0,0) , rd);
	P g2=rotate(dv , P(0,0) , -rd);
	return L(a.p+g1*a.r, a.p+g2*a.r);
}

double dp[101][2];
int v[101][2];
vector <L> Lines;

bool check(L l, int s, int t){
	for(;s<t;s++) if(!intersectSS(l, Lines[s]))return 0;
	return 1;
}

main(){
	int i,j,n;

	while(cin>>n, n){
		priority_queue<State> S;
		memset(v, 0, sizeof(v));
		for(i=0;i<=100;i++) dp[i][0] = dp[i][1] = INF;
		Lines.clear();
		C Prev, Now;
		double x, y, r;
		cin >> x >> y >> r;
		Now = C(P(x, y), r);
		P Start = Now.p;
		Lines.push_back(L(Start, Start));
		for(i=1;i<n;i++){
			Prev = Now;
			cin >> x >> y >> r;
			Now = C(P(x, y), r);
			Lines.push_back(interpointCC(Now, Prev));
		}
		Lines.push_back(L(Now.p, Now.p));
		S.push(State(0, 0, 0, Start));
		while(!S.empty()){
			State t = S.top();S.pop();
			if(v[t.t][t.s]) continue;
			v[t.t][t.s] = 1;
			if(t.t == n) break;
			for(i=t.t+1;i<=n;i++){
				for(j=0;j<2;j++){
					if(v[i][j]) continue;
					L l = L(t.cur, Lines[i][j]);
					if(!check(l, t.t+1, i)) continue;
					if(dp[i][j] < abs(l[1]-l[0]) + t.sum) continue;
					dp[i][j] = abs(l[1]-l[0]) + t.sum;
					S.push(State(dp[i][j], i, j, l[1]));
				}
			}
		}
		printf("%.4lf\n", dp[n][0]);
	}
}

Measured memory_bytes: 1020
using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            bool judge = (input[0].Length == 1) && (input[1].Length == 1);
            if (judge)
            {
                int ans = int.Parse(input[0]) * int.Parse(input[1]);
                Console.WriteLine(ans);
            } else
            {
                Console.WriteLine(-1);
            }
        }
    }
}


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

 int solve(int x,int y)
 {

     if(y%2)
     {
         //cout<<"test 1"<<endl;
         return 0;
     }
     if((x*2)==y)
     {
         //cout<<"test 2"<<endl;
         return 1;
     }

     if((x*4)==y)
     {
         //cout<<"test 3"<<endl;
         return 1;
     }
     if((x*2)>y)
     {
         //cout<<"test 4"<<endl;
         return 0;
     }
     if((x*2)<y)
     {
         //cout<<"test 5"<<endl;
         int temp=x*2;
         int i=0;
         while(i<x)
         {
             //cout<<"test 6"<<endl;
             temp=temp+2;
             if(temp==y)
             {
                 //cout<<"test 7"<<endl;
                 return 1;


             }
             i++;
         }
     }

  return 0;

 }

int main()
{

    int x,y;
    cin>>x>>y;

   // cout<<solve(3,8)<<endl;
   // cout<<solve(2,100)<<endl;
   // cout<<solve(1,2)<<endl;


    if(solve(x,y)==1)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }


    return 0;
}


Measured memory_bytes: 3636
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix

# strlist = "abcdefghijklmnopqrstuvwxyz"
A,B,C = map(int,input().split())
lis = [A,B,C]
lis.sort()

check = [lis]
ans = 0

while not(check[-1][0]%2==1 or check[-1][1]%2==1 or check[-1][2]%2==1):
    A,B,C = B//2 + C//2 , A//2 + C//2,B//2 + A//2
    temp = [A,B,C]
    temp.sort()
    if temp in check:
        print(-1)
        exit()
    check.append(temp)
    ans += 1

print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))


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

int main() {
  int a;
  cin >> a;
  
  string s = "Good";
  if ( a % 10 == a / 10 % 10 ) {
    s = "Bad";
  } else if ( a / 10 % 10 == a / 100 % 10 ) {
    s = "Bad";
  } else if ( a / 100 % 10 == a / 1000 ) {
    s = "Bad";
  }
  cout << s << endl;
}

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

int main(){
  int a,b,c; cin>>a>>b>>c;
  bool flag = false;
  if(a==b && b!=c) flag=true;
  if(b==c && c!=a) flag=true;
  if(c==a && a!=b) flag=true;
  
  flag?cout<<"Yes":cout<<"No";
}

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

int main()
{
  int n, a[200000];
  cin >> n;

  int l, pc = 0, mc = 0, zc = 0;
  for (int i = 0; i < n; i++)
  {
    cin >> l;
    a[i] = l - (i + 1);
    if (l - (i + 1) > 0) pc++;
    if (l - (i + 1) < 0) mc++;
    if (l - (i + 1) == 0) zc++;
  }
  sort(a, a+n);

  int b;
  int h = n / 2;
  if (pc > mc + zc)
  {
    int o = pc - h;
    b = a[mc + zc + o - 1];
  }
  else if (mc > pc + zc)
  {
    int o = mc - h;
    b = a[mc - o];
  }
  else
  {
    b = 0;
  }

  long total = 0, val;
  for (int i = 0; i < n; i++)
  {
    val = a[i] - b;
    total += val > 0 ? val : -val;
  }

  cout << total << "\n";

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
/* ------------------------------------------------ */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ------------------------------------------------ */

int main() {
    int n,k,s;
    cin>>n>>k>>s;
    if(s==1e09){
        rep(i,k)cout<<s<<' ';
        rep(i,n-k)cout<<s-1<<' ';
    }
    else{
        rep(i,k)cout<<s<<' ';
        rep(i,n-k)cout<<s+1<<' ';
    }
    return 0;

        

}

Measured memory_bytes: 3588
import collections

def nCk(n, k):
    k = min(k, n-k)
    numer = 1
    for i in range(n, n-k, -1):
        numer *= i
    denom = 1
    for i in range(k, 1, -1):
        denom *= i
    return numer // denom

def main():
    N, P = map(int, input().split())
    A = list(map(int, input().split()))
    B = [x%2 for x in A]
    Bcount = collections.Counter(B)
    if Bcount[1] == 0 and P == 1:
        print(0)
        return
    ans = 0
    if P == 0:
        tmp = pow(2, Bcount[0])
        for i in range(0, Bcount[1]+1, 2):
            ans += tmp * nCk(Bcount[1], i)
        print(ans)
        return
    else:
        tmp = pow(2, Bcount[0])
        for i in range(1, Bcount[1]+1, 2):
            ans += tmp * nCk(Bcount[1], i)
        print(ans)
    

if __name__ == "__main__":
    main()


Measured memory_bytes: 9464
a,b,k=map(int,input().split())
p=[a,b]
i=0
while True:
  for g in range(2):
    t=g^1
    if p[g]%2==1:
      p[g]-=1
    p[t]+=p[g]//2
    p[g]//=2
    i+=1
    if i==k:
      print(*p)
      exit(0)


Measured memory_bytes: 3060
#include <iostream> 
#include <vector>
#include <math.h>

using namespace std;

const double EPS = 1e-8;
typedef pair<double, double> pt;
#define x first
#define y second

pt operator+(pt p, pt q) {
  return (pt){p.x + q.x, p.y + q.y};
}
pt operator-(pt p, pt q) {
  return (pt){p.x - q.x, p.y - q.y};
}
pt operator*(pt p, double c) {
  return (pt){p.x * c, p.y * c};
}
double sq(double a) { return a * a; }
double dist(pt p, pt q) {
  return sqrt(sq(p.x - q.x) + sq(p.y - q.y));
}

pt normal(pt a, pt b) {
	pt AB = b - a;
	double d = dist(a, b);
	pt n = pt(AB.y/d, -AB.x/d);
	return n;
}

void solve(int N) {
	vector<pt> point;
	for(int i=0; i < N; i++) {
		double a, b;
		cin >> a >> b;
		point.push_back(pt(a, b));
	}

	int ans = 1;
	for(int i=0; i < N; i++) {
		for(int j=i+1; j < N; j++) {
			pt A = point[i];
			pt B = point[j];
			pt M = pt((A.x + B.x)/2, (A.y + B.y)/2);

			if(dist(A, B) > 2.0 + EPS) continue;

			double l = sqrt(1 - sq(dist(A, M)));
			pt V = normal(A, B);

			pt C[2];
			C[0] = M + V*l;
			C[1] = M - V*l;

			for(int t=0; t < 2; t++) {
				int count = 0;
				for(int k=0; k < N; k++) {
					if(dist(C[t], point[k]) < 1.0 + EPS) count++;
				}
				ans = max(ans, count);
			}
		}
	}
	cout << ans << endl;
}

int main() {

	int N;
	while(cin >> N) {
		if(N == 0) break;
		solve(N);
	}

	return 0;
}


Measured memory_bytes: 3032
x = int(input())

import math
primes=[2]
def isPrime(n):
  if n == 2:
    return True
  if n % 2 == 0:
    return False
  
  m = math.floor(math.sqrt(n))
  for p in primes:
      if n % p == 0:
        return False
      if p > m:
        break
  primes.append(n)
  return True

for i in range(2,x):
  isPrime(i)

n = x
while(True):
  if isPrime(n):
    print(n)
    exit(0)
  elif n > 10**6:
    exit(0)
  n += 1


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

int main(){
    string S;
    cin >> S ;
    vector<int> cnt(2, 0);
    
    for (int i = 0; i < S.size() ; i++) {
        cnt[S[i]-'0']++;
    }
    int ans = min(cnt[0],cnt[1])*2;
    cout << ans << endl;
    return 0;
    
}


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

using namespace std;
typedef long long ll;
const ll mod = 998244353;
ll qpow(ll a, ll b){
	ll ret = 1;
	for(; b; b >>= 1, a = a * a % mod){
		if(b & 1) ret = ret * a % mod;
	}
	return ret;
}
const int MAXN = 1000000;
ll fac[1000005], ifac[1000005], inv[1000005];
void pre(){
	fac[0] = 1;
	for(int i = 1; i <= MAXN; i ++) fac[i] = fac[i - 1] * i % mod;
	ifac[MAXN] = qpow(fac[MAXN], mod - 2);
	for(int i = MAXN; i >= 1; i --) ifac[i - 1] = ifac[i] * i % mod;
	for(int i = 1; i <= MAXN; i ++){
		inv[i] = fac[i - 1] * ifac[i] % mod;
	}
}
ll a[200005];
ll c[1000005];
ll d[1000005];
void pre1(int x){
	for(int i = 1; i * i <= x; i ++){
		if(x % i == 0){
			c[i] += x;
			if(i * i != x) c[x / i] += x;
		}
	}
}
int n;
int main(){
	pre();
	scanf("%d", &n);
	for(int i = 1; i <= n; i ++){
		scanf("%lld", &a[i]);
		pre1(a[i]);
	}
	for(int i = 1; i <= MAXN; i ++) c[i] %= mod;
	d[1] = 1;
	for(int i = 2; i <= MAXN; i ++){
		if(c[i] == 0) continue;
		for(int j = 2; j * j <= i; j ++){
			if(i % j == 0){
				d[i] += d[j];
				if(j * j != i) d[i] += d[i / j];
			}
		}
		d[i] += d[1];
		d[i] %= mod;
		d[i] = (inv[i] - d[i] + mod) % mod;
	}
	ll ans = 0;
	for(int i = 1; i <= MAXN; i ++){
		(ans += d[i] * c[i] % mod * c[i]) %= mod;
	}
	for(int i = 1; i <= n; i ++){
		ans = (ans - a[i] % mod + mod) % mod;
	}
	ans = ans * inv[2] % mod;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 40832
#include<cstdio>

using namespace std;

int main(){
  long long int a,b,x;
  scanf("%lld %lld %lld",&a,&b,&x);
  if(a!=0)
    printf("%lld\n",(b/x)-((a-1)/x));
  else
    printf("%lld\n",(b/x)+1);
}

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

int r, D;
int x;

int main() {
  cin >> r >> D;
  cin >> x;
  rep(i, 10) {
    cout << (x=r*x-D) << endl;
  }
  return 0;
}



Measured memory_bytes: 256
import heapq
N, M = map(int, input().split())
A = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(A)

for _ in range(M):
    tmp_min = heapq.heappop(A)
    heapq.heappush(A, (-1)*(-tmp_min//2))
print(-sum(A))

Measured memory_bytes: 72216
import math
import sys
import functools

sys.setrecursionlimit(10 ** 9)

@functools.lru_cache(None)
def f(b, n):
    if n < b:
        return n
    else:
        return f(b, n // b) + (n % b)

def main(n, s):
    if s == n:
        return n + 1

    if s > n:
        return -1

    for b in range(2, math.ceil(math.sqrt(n)) + 1):
        if f(b, n) == s:
            return b

    ans = float('inf')
    for p in range(1, math.ceil(math.sqrt(n)) + 1):
        if (n - s) % p == 0:
            b = (n - s) // p + 1
            if f(b, n) == s:
                ans = min(ans, b)

    return -1 if ans == float('inf') else ans

if __name__ == '__main__':
    n = int(input())
    s = int(input())
    print(main(n, s))


Measured memory_bytes: 157556
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<vector>
using namespace std;

#define lld long long

int main(){
    int X,Y,Z;
    cin >> X >> Y >> Z;
    swap(X,Y);
    swap(X,Z);
    cout << X << " " << Y << " " <<  Z << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
typedef pair<ll,ll> P;
typedef pair<double,double> point;
const ll MAX = 200000;
constexpr ll nx[8] = {1,0,-1,0,1,-1,1,-1};
constexpr ll ny[8] = {0,1,0,-1,1,1,-1,-1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<ll> a(7);
    ll ans = 0;
    cins(all(a));
    if (a[0]*a[3]*a[4] == 0){
        ans += a[0]/2*2+a[3]/2*2+a[4]/2*2;
    }
    else if (a[3]%2 == 0 && a[4]%2 == 0){
        ans += a[3]+a[4]+a[0]/2*2;
    }
    else if (a[3]%2 == 1 && a[4]%2 == 1){
        if (a[0]%2){
            ans += a[3]+a[4]+a[0];
        }
        else{
            ans += a[3]+a[4]+a[0]-1;
        }
    }
    else{
        ans += a[3]+a[4]+a[0]-1;
    }
    PRINT(ans+a[1]);
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace A
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var XAB = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var X = XAB[0];
            var A = XAB[1];
            var B = XAB[2];
            var delicious = B - A <= 0;
            var safe = B - A <= X;
            Console.WriteLine(delicious ? "delicious" : (safe ? "safe" : "dangerous"));
        }
    }
}


Measured memory_bytes: 28208
fun main(args:Array<String>) {
    val (n,k) = readLine()!!.split(" ").map { it.toLong() }
    goal = k
    val resultList = (1..n).map { getAns(it) }
    val mul = resultList.maxBy { it.total() }!!.total()
    val winTotal = resultList.map { it.win * (mul/it.total()) }
    val total = mul*resultList.size
    println(winTotal.sum().toDouble()/total.toDouble())
}

val dic = mutableMapOf<Long, Result>()

fun getAns(current:Long):Result {
    if(current >= goal) {
        return Result(1, 0)
    }
    dic[current]?.let { return it}
    val ret = getAns(current * 2)
    val ans = Result(ret.win, ret.lose + ret.total())
    dic[current] = ans
    return ans
}
var goal = 0L
class Result(val win:Long, val lose:Long) {
    fun total():Long {
        return win + lose
    }
}

Measured memory_bytes: 42060
#include <stdio.h>
  
int  main(void){
         int h,w,i,j;
          while(1){
          scanf("%d %d",&h,&w);
           if( h==0 && w==0)
              break;
           for(i=1; i<=h; i++){
            for(j=1; j<=w; j++){
              if(i==1 || i==h || j==1 || j==w)
              printf("#");
             else
              printf(".");
             }printf("\n");
            }printf("\n");
           }
            return 0;
}



Measured memory_bytes: 2084
#include <stdio.h>

int main(void) {
  long i,j,num=0;

  long n;
  scanf("%ld",&n);

  int a[n+1];
  for(i=1;i<=n;i++){
    scanf("%d",&a[i]);
  }

  int ans[n+1];

  for(i=0;i<=n;i++){
    ans[i]=0;
  }

  for(i=n;i>=1;i--){
    for(j=2;i*j<=n;j++){
      if(ans[i*j]==1){
        ans[i]=(ans[i]+1)%2;
      }
    }
    if(ans[i]==a[i]){
      ans[i]=0;
    }else{
      ans[i]=1;
      num++;
    }
  }


  printf("%ld\n",num);
  for(i=1;i<=n;i++){
    if(ans[i]==1){
      printf("%ld ",i);
    }
  }
  printf("\n");

  return 0;
}


Measured memory_bytes: 2432
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
using namespace std;

#define REP(i,p,n) for(ll i=p;i<ll(n);++i)
#define rep(i,n) REP(i,0,n)

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

const ll mod = static_cast<ll>(1e9) + 7;

int main()
{
    ll K, N;
    cin >> K >> N;

    vector<ll> A(N * 2);
    rep (i, N) { cin >> A[i]; A[i + N] = K + A[i]; }

    ll ans = K;

    rep (i, N)
    {
        ans = min(ans, A[i + N - 1] - A[i]);
    }

    cout << ans  << endl;

    return 0;
}


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

int main(){
  int N,count=0,p[10001]={};

 for(int i=2;i<=10000;i++){
    p[i]=1;
 }
 for(int i=2;i*i<=10000;i++){
   if(p[i]==1){
     for(int j=2;j<=10000/i;j++){
       p[i*j]=0;
     }
   }
 }


  while( cin>>N){
    count=0;
    for(int i=2;i<=N;i++){
      if(p[i]==1 && p[N-i+1]==1) count++;
    }


  cout<<count<<endl;
  }
  return 0;
}

Measured memory_bytes: 1204
using System;
class Program
{
    static void Main(string[] args)
    {
        string[] s = Console.ReadLine().Split(' ');
        long a = long.Parse(s[0]);
        long b = long.Parse(s[1]);
        long x = long.Parse(s[2]);
        Console.WriteLine(b / x + 1 - (a == 0 ? 0 : (a - 1) / x + 1));
    }
}


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

using namespace std;

int main() {

	int n,m;
	cin >> n;

	vector<string> s(n, "");
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	
	cin >> m;
	vector<string> t(m, "");
	for (int i = 0; i < m; i++) {
		cin >> t[i];
	}

	int maxcount = 0;

	for (int k = 0; k < n; k++) {
		int counter = 0;
		for (int i = 0; i < n; i++) {
			if (s[i] == s[k]) {
				counter++;
			}
		}
		for (int j = 0; j < m; j++) {
			if (s[k] == t[j]) {
				counter--;
			}
		}
		maxcount = max(counter, maxcount);
	}
	cout << maxcount << endl;

}

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

typedef pair<int, int> P;
typedef pair<P, int> PP;

int N;
int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy[] = {1, 0, -1,  1, -1, 1, 0, -1};
bool check(int bit, int x, int y){
	return 0 <= x && x < N && 0 <= y && y < N && (bit & (1 << (y * N + x)));
}

int trans(int bit, int x, int y){
	int ans = 0;
	bit |= 1 << (y * N + x);
	for(int i = 0; i < N; i++){
		for(int j = 0; j < N; j++){
			if(i == y && j == x) continue;
			int cnt = 0;
			for(int k = 0; k < 8; k++){
				if(check(bit, j + dx[k], i + dy[k])) cnt++;
			}
			if(cnt == 3 || (cnt == 2 && check(bit, j, i))) ans |= 1 << (i * N + j);
		}
	}
	return ans;
}

int pbit(int bit, int x, int y){
	cout << "===" << x << " " << y << endl;
	int idx = 0;
	for(int i = 0; i < N; i++){
		for(int j = 0; j < N; j++){
			if(i == y && j == x) cout << '@';
			else if(bit & (1 << idx)) cout << '#';
			else cout << '.';
			idx++;
		}
		cout << endl;
	}
	cout << endl;
}

int main(){
	string str;
	while(cin >> N, N){
		int idx = 0;
		int bit = 0;
		int carx = 0, cary = 0;
		for(int i = 0; i < N; i++){
			cin >> str;
			for(int j = 0; j < N; j++){
				char c = str[j];
				if(c == '#') bit |= (1 << idx);
				if(c == '@') {
					carx = j;
					cary = i;
				}
				idx++;
			}
		}

		set<P> reach;
		queue<PP> que;
		que.push(PP(P(cary * N + carx, bit), 0));
		int ans = 10000000;
		while(que.size()){
			PP p = que.front(); que.pop();
			if(p.first.second == 0){
				ans = min(ans, p.second);
				break;
			}else if(!reach.count(p.first)){
				reach.insert(p.first);
				int y = p.first.first / N;
				int x = p.first.first % N;
				//cout << x << " " << y << endl;
				for(int i = 0; i < 8; i++){
					if(check(~p.first.second, x + dx[i], y + dy[i])){
						int nb = trans(p.first.second, x + dx[i], y + dy[i]);
						que.push(PP(P((x + dx[i]) + (y + dy[i]) * N, nb), p.second + 1));

						//pbit(p.first.second, x, y);
						//cout << "|||" << endl;
						//pbit(nb, x + dx[i], y + dy[i]);
					}
				}
			}
		}
		if(ans == 10000000){
			cout << -1 << endl;
		}else{
			cout << ans << endl;
		}
	}
}

Measured memory_bytes: 3552
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);};};
const int MOD = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<62;



int main(void) {
    int n,m;
    cin>>n>>m;
    vi co(n,0);
    rep(i,m){
        int a,b;
        cin>>a>>b;
        co[a-1]++;
        co[b-1]++;
    }
    bool ch=true;
    for(int i = 0;i<n;i++){
        if(co[i]%2!=0)ch=false;
    }
    if(ch)fin("YES");
    else fin("NO");

}



Measured memory_bytes: 640
from collections import deque
import sys

def main():
    n=int(input())
    sum_d=0
    aa=deque()
    for _ in range(n):
        qq=list(map(int, input().split()))
        if qq[0]==0:
            aa.appendleft(qq[1])
        elif qq[0]==1:
            aa.rotate(-qq[1])
            sum_d+=qq[1]
        else:
            aa.popleft()
    aa.rotate(sum_d)
    for a in aa:
        print(a)

main()


Measured memory_bytes: 21672
//#pragma warning disable
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System;
using System.Numerics;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;
class Z { static void Main() => new K(); }
struct P : IEquatable<P>, IComparable<P>
{
	public readonly int Player, Left, Card;
	public P(int p, int q, int r)
	{
		Player = p;
		Left = q;
		Card = r;
	}
	public bool Equals(P p) => Player == p.Player && Left == p.Left && Card == p.Card;
	public override bool Equals(object obj) => obj is P && Equals((P)obj);
	public override int GetHashCode() => Player.GetHashCode() ^ Left.GetHashCode() ^ Card.GetHashCode();
	public override string ToString() => string.Format("({0}, {1}, {2})", Player == 0 ? "X" : "Y", Left, Card);
	public int CompareTo(P p) => Left == p.Left ? Player == p.Player ? Card.CompareTo(p.Card) : Player.CompareTo(p.Player) : Left.CompareTo(p.Left);
}
class K
{
	int F() => int.Parse(ReadLine());
	long FL() => long.Parse(ReadLine());
	int[] G() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
	long[] GL() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
	public const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	readonly Dictionary<P, int> memo = new Dictionary<P, int>();
	int N, Y;
	int[] a;
	void Solve()
	{
		a = G();
		N = a[0];
		Y = a[2];
		a = G();
		Console.WriteLine(Calc(0, 0, Y));
		//Console.WriteLine(Calc2(1, 0, Y));
		//var t = memo.Keys.ToList();
		//t.Sort();
		// foreach (var k in t) Console.WriteLine($"{k} -> {memo[k]}");
	}
	// 次に p さんがカードを引き, a[q], ..., a[N-1] のカードが残っていて,
	// p さんでないプレイヤーは r のカードを持っているときの, p さんにとっての最適なスコア
	// p = 0 -> X, p = 1 -> Y
	int Calc(int p, int q, int r)
	{
		var k = new P(p, q, r);
		Set(k);
		return memo[k];
	}
	readonly Func<int,int,bool>[] c = { Comp, Comp2 };
	static bool Comp(int a, int b) => a > b;
	static bool Comp2(int a, int b) => a < b;
	void Set(P k)
	{
		if (memo.ContainsKey(k)) return;
		//memo[k] = a[N - 1];
		memo[k] = Abs(a[N - 1] - k.Card);
		for (var i = k.Left; i < N - 1; i++)
		{
			var t = Calc(1 - k.Player, i + 1, a[i]);
			if (c[k.Player](t, memo[k]))
			{
				//memo[k] = a[i];
				memo[k] = t;
			}
		}
	}
}


Measured memory_bytes: 14304
#include "bits/stdc++.h"
using namespace std;

int main(){
	int a,b,c,x;
	cin>>a>>b>>c>>x;
	int ans=0;
	
	for(int i=0;i<=a;i++){
		for(int j=0;j<=b;j++){
			for(int k=0;k<=c;k++){
				if(i*500+j*100+k*50==x)ans++;
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	public static void main(String args[]) {
		FastScanner cin = new FastScanner();
		PrintWriter cout = new PrintWriter(System.out);
		solve(cin, cout);
		cout.flush();
	}

	private static void solve(FastScanner cin, PrintWriter cout) {
		int x = cin.nextInt();
		int a = cin.nextInt();
		int b = cin.nextInt();

		if (b - a <= 0)
			cout.println("delicious");
		else if (b - a <= x)
			cout.println("safe");
		else
			cout.println("dangerous");
	}

	/**
	 * How to read input in Java — tutorial <br />
	 * By Flatfoot<br />
	 * http://codeforces.com/blog/entry/7018
	 */
	static class FastScanner {
		private BufferedReader br;
		private StringTokenizer st;

		FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new IllegalStateException(e);
				}
			return st.nextToken();
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				throw new IllegalStateException(e);
			}
			return str;
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}

}


Measured memory_bytes: 21204
using System;
using System.Text;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
    static void Main(string[] args)
    {
        string []input = Console.ReadLine().Split(' ');
        int ab = int.Parse(input[0]);
        int bc = int.Parse(input[1]);

        Console.WriteLine("{0}", (ab * bc)/2);
    }

}



Measured memory_bytes: 13140
# WIP (WA)
import sys

sys_input = sys.stdin.readline

D, G = map(int, sys_input().split())
pc_list = [tuple(map(int, sys_input().split())) for _ in range(D)]

n_solved = 10000000000
for i in range(1 << D):
    score_per_combi = 0
    combi = []
    tmp_n_solved = 0

    for j in range(D):
        if (i >> j) & 1:
            p = pc_list[j][0]
            c = pc_list[j][1]
            score_per_combi += (j + 1) * 100 * p + c
            combi.append(j)
            tmp_n_solved += p

    if tmp_n_solved == 0:
        continue
    if score_per_combi < G:
        continue

    # problems are already sorted
    # -> check if these were oversolved
    for problem_idx in combi:
        for solved_num in range(pc_list[problem_idx][0]):
            diff = None
            if solved_num == 0:
                c = pc_list[problem_idx][1]
                diff = (problem_idx + 1) * 100 + c
            else:
                diff = (problem_idx + 1) * 100
            score_per_combi -= diff
            tmp_n_solved -= 1

            if score_per_combi < G:
                tmp_n_solved += 1
                score_per_combi += diff
                break
            # Not finish innner loop -> continue outer loop
            else:
                continue
            # Finish innner loop -> break outer loop
            break

    # Check if mininum n_solved are updated
    if tmp_n_solved < n_solved:
        n_solved = tmp_n_solved

print(n_solved)


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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	long long int n;
	cin>>n;
	vector<long long int> v;
	while(n--){
		long long int x;
		cin>>x;
		v.push_back(x);
	}
	if(v.size()<=2){
		cout<<"0";
	}
	else{
		long long int ans=0;
	for(long long int i=0;i<v.size()-2;i++){
		for(long long int j=i+1;j<v.size()-1;j++){
			for(long long int k=j+1;k<v.size();k++){
				if(v[i]!=v[j]&&v[j]!=v[k]&&v[k]!=v[i]){
					if((v[i]+v[j])>v[k]&&(v[k]+v[j])>v[i]&&(v[i]+v[k])>v[j]){
						ans++;
					}
				}
			}
		}
	}
	cout<<ans;	
	}
   	return 0;
}

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

int main(){
    string a; cin >> a;
    int n = 0;
    for(int i = 0;i < 4;i++){
        if(a[i] == '+'){
            n++;
        }
        else{
            n--;
        }
    }
    cout << n << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);
#define l  long
#define ll  long long

int main()
{
     fast
     string s;cin>>s;
     if((s.at(2)==s.at(3))&&(s.at(4)==s.at(5)))cout<<"Yes";else cout<<"No";
    return 0;
}


Measured memory_bytes: 256
import fractions

N, M = map(int, input().split())
S = input()
T = input()

g = fractions.gcd(N, M)
h = N * M // g

si = 0
ti = 0

for _ in range(g):
    if S[si] != T[ti]:
        print(-1)
        break
    si += N // g
    ti += M // g
else:
    print(h)


Measured memory_bytes: 5564
#include <stdio.h>

int main(){
	int i,j,a[4],b[4],hit,blow;
	while(scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3]) != EOF){
		hit = 0;
		blow = 0;
		scanf("%d %d %d %d",&b[0],&b[1],&b[2],&b[3]);
		for(i = 0;i < 4;i++){
			for(j = 0;j < 4;j++){
				if(a[i] == b[j]){
					if(i == j) hit++;
					else blow++;
				}
			}
		}
		printf("%d %d\n",hit,blow);
	}
}

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

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

	vector<long long> a(n);	for (long long i = 0; i < n; i++) cin >> a[i];

	sort(a.begin(), a.end(), greater<int>());
	
	long long d_f = 0;
	long long index;

	for (long long i = 1; i < n; i++) {
		if (a[i - 1] == a[i]) {
			d_f = a[i];
			index = i;
			break;
		}
	}

	long long d_s = 0;
	
	for (long long i = index + 2; i < n; i++) {
		if (a[i - 1] == a[i]) {
			d_s = a[i];
			break;
		}	
	}

	cout << d_f * d_s << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void)

{
	int a, i= 1;
	while (scanf("%d", &a) && a != 0)
	{
		if (a == 0)
		{
			break;	
		}
		printf("Case %d: %d\n", i++, a);		
	}
    
	return 0;
 } 


Measured memory_bytes: 2688
#include<iostream>
#include<vector>

using namespace std;

int main(){
    int n;
    cin>>n;
    int ans[4]={0};
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        if(s=="AC"){
            ans[0]++;
        }else if(s=="WA"){
            ans[1]++;
        }else if(s=="TLE"){
            ans[2]++;
        }else if(s=="RE"){
            ans[3]++;
        }
    }
    cout<<"AC x "<<ans[0]<<endl;
    cout<<"WA x "<<ans[1]<<endl;
    cout<<"TLE x "<<ans[2]<<endl;
    cout<<"RE x "<<ans[3]<<endl;
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define repr(i,n) for(int i=0, i##_len=(n); i<i##_len; --i)
#define REP(i,m,n) for(int i=int(m), i##_len=(n); i<i##_len; ++i)
#define VV(T) vector<vector<T>>
#define co(P) cout << P << endl
#define pb push_back
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;;
typedef long long ll;
typedef double D;

int main() {
  int A,B,C,D,E,F;
  cin >> A >> B >> C >> D;
  if(A>=C) E = A;
  else E = C;
  if(B>=D) F = D;
  else F = B;
  if(F-E>=0)co(F-E);
  else co(0);
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

//typedef pair<int,int> P;

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

	int ans = 1; 
	for(int i=2*d+1;i<n;i+=(2*d+1)){
		ans++ ;
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
#include<numeric>
using namespace std;
using ll = long long;
int main(){
  ll x;
  cin >> x;
  ll sum = 0;
  ll cnt = 0;
  for(int i = 1; sum <= x; i++) {
    sum += i;
    cnt++;
    if(sum >= x) {
      cout << cnt << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 256