akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl;
#define INF 1ll<<60;
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; }

using namespace std;
using ll = long long;
typedef pair<int, int> P;


int main(){
    int n; cin >> n;
    ll l=0, l0=2,l1=1;
    ll ans=0;
    rep(i, n-1){
        ans = l0 + l1;
        l0 = l1;
        l1 = ans;
    }
    
    out(l1);
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int n;
  cin>>n;
  n--;
  string res;
  while(n>=0)
  {
    long long int r=n%26;
    res+='a'+r;
    n/=26;
    n--;
  }
  reverse(res.begin(),res.end());
  cout<<res;
}
  


Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
using namespace std;
int n,m;
string poi;
int c[500];
int para[3][500]={0};
int maxnum=0;
int now=1;
int dp[301]={0};
int by,i,j,k,e;
main(){
  while(cin>>n>>m){
    for(i=0;i<n;i++){
      cin.ignore();
      getline(cin,poi);
      cin>>c[i]>>para[0][i]>>para[1][i]>>para[2][i];
    }
    for(by=0;by<3;by++){
      for(i=0;i<301;i++){
	dp[i]=0;
      }
      for(i=0;i<n;i++){
	for(j=0;j<=m-c[i];j++){
	  now=1;
	  if(dp[j]!=0||j==0){
	    for(k=j+c[i];k<=m;k+=c[i]){
	      dp[k]=max(dp[k],dp[j]+para[by][i]*now);
	      now++;
	    }
	  }
	}
      }
      for(e=0;e<=m;e++){
	maxnum=max(dp[e],maxnum);
      }
    }
    cout<<maxnum<<endl;
    maxnum=0;
  }
  return 0;
}
     

Measured memory_bytes: 1208
n = int(input())
k = int(input())
x = int(input())
y = int(input())
cost = 0
if n > k:
    for i in range(k):
        cost += x

    for j in range(k, n):
        cost += y
    print(cost)

elif n <= k:
    for i in range(n):
        cost += x
    print(cost)




Measured memory_bytes: 8936
#include <bits/stdc++.h>
#define pr printf
#define sc scanf
#define pb push_back

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef long double ld;
int a,b ;
int main () {
    sc("%d %d", &a, &b);
    pr("%d\n", max(a+b, max(a-b, a*b)));
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
int c,lim,sho;
string res[65],str;
bool check(string s)
{
    if(!s.size())return 1;
    cout<<"? "<<s<<endl;
    int t;
    cin>>t;
    if(t==sho)return 1;
    return 0;
}
string merge(int l,int r)
{
    if(l==r)return res[l];
    int mid=(l+r)>>1;
    string t1=merge(l,mid),t2=merge(mid+1,r),ans="";
    int j=0;sho=c-t1.size()-1;
    for(int i=0;i<t1.size();i++)
    {
        while(j<t2.size())
        {
            if(!check(ans+t2[j]+t1.substr(i)))break;
            ans.pb(t2[j]);
            j++;
            sho--;
        }
        ans.pb(t1[i]);
    }
    while(j<t2.size())ans.pb(t2[j]),j++;
    return ans;
}
int main()
{
    ios::sync_with_stdio(0);
    int cnt=0,t;
    for(int i='A';i<='Z';i++)
    {
        str.clear();
        for(int j=1;j<=128;j++)str.pb(i);
        cout<<"? "<<str<<endl;
        cin>>t;
        t=128-t;
        if(t)
        {
            c+=t;
            cnt++;
            for(int j=1;j<=t;j++)res[cnt].pb(i);
        }
    }
    for(int i='a';i<='z';i++)
    {
        str.clear();
        for(int j=1;j<=128;j++)str.pb(i);
        cout<<"? "<<str<<endl;
        cin>>t;
        t=128-t;
        if(t)
        {
            c+=t;
            cnt++;
            for(int j=1;j<=t;j++)res[cnt].pb(i);
        }
    }
    for(int i='0';i<='9';i++)
    {
        str.clear();
        for(int j=1;j<=128;j++)str.pb(i);
        cout<<"? "<<str<<endl;
        cin>>t;
        t=128-t;
        if(t)
        {
            c+=t;
            cnt++;
            for(int j=1;j<=t;j++)res[cnt].pb(i);
        }
    }
    string s=merge(1,cnt);
    cout<<"! "<<s<<endl;
    return 0;
}

Measured memory_bytes: 3768
n = int(input())
p = list(map(int, input().split()))

ans = 0
for i in range(n - 2):
    if p[i] < p[i + 1] < p[i + 2]:
        ans += 1
    elif p[i] > p[i + 1] > p[i + 2]:
        ans += 1

print(ans)


Measured memory_bytes: 2940
H, W = map(int, input().split())
L = [list(input()) for _ in range(H)]

L1 = list(filter(lambda x: ''.join(x) != '.' * W, L))
L2 = list(filter(lambda x: x.count('.') != len(L1), list(zip(*L1))))
for t in list(zip(*L2)):
    print(''.join(t))


Measured memory_bytes: 3316
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
	char str[1001];
	scanf("%s",str);
	int i = 0;
	while(str[i])
	{
		char ch = str[i]-'A';
		ch += 23;
		ch %= 26;
		putchar(ch+'A');
		i++;
	}
	putchar('\n');
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
    int N, M;
    cin >> N >> M;
    vector<string> A(N), B(M);
    for(int i=0; i<N; i++) cin >> A[i];
    for(int i=0; i<M; i++) cin >> B[i];
    
    int flag=1, ans=0;
    for(int i=0; i<=N-M; i++){
        for(int j=0; j<=N-M; j++){
            flag=1;
            for(int k=0; k<M; k++){
                if(A[i+k].substr(j,M) != B[k])
                    flag = 0;
            }
            if(flag) ans=1;
        }
    }
    
    if(ans) cout << "Yes";
    else cout << "No";
}

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


def main():
    S = input().strip()
    T = input().strip()

    ls = len(S)
    lt = len(T)
    dp = [[0]*(lt+1) for _ in range(ls+1)]
    for i, s in enumerate(S):
        for j, t in enumerate(T):
            if s == t:
                dp[i+1][j+1] = dp[i][j] + 1
            else:
                dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1])

    ans = ""
    x = dp[-1][-1]
    for i in range(ls, -1, -1):
        for j in range(lt, -1, -1):
            if dp[i][j] == x:
                if dp[i-1][j] == x-1 and dp[i][j-1] == x-1:
                    ans = S[i-1] + ans
                    x -= 1
                    break
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 112732
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cstdio>
using namespace std;

int top, S[1000];

void push(int x) {
    // top を加算してから、その位置へ挿入
    top++;
    S[top] = x;
}

int pop() {
    top--;
    // top が指していた要素を返す
    return S[top+1];
}

int main() {
    int a, b;
    top = 0;
    char s[100];

    while (scanf("%s", s) != EOF) {
        if (s[0] == '+') {
            a = pop();
            b = pop();
            push(a + b);
        } else if (s[0] == '-') {
            b = pop();
            a = pop();
            push(a - b);
        } else if (s[0] == '*') {
            a = pop();
            b = pop();
            push(a * b);
        } else {
            push(atoi(s));
        }
    }

    printf("%d\n", pop());

    return 0;
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ld long double
#define ull unsigned ll
#define pb push_back
#define popb pop_back
#define mt make_tuple
#define eb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define pii pair <int,int>
#define piii pair <pii,int>
#define piiii pair <pii,pii>
#define pll pair <ll,ll>
#define plll pair <pair <ll, ll>, ll>
#define rep0(i,n) for(ll i=0;i<(ll)n;i++)
#define rep1(i,n) for(ll i=1;i<=(ll)n;i++)
#define rep(i,x,y) for(ll i=(ll)x;i<=(ll)y;i++)
#define reprev(i,n) for(ll i=(ll)n;i>=0;i--)
#define all(c) c.begin(),c.end()
#define print(a) rep0(i,a.size()) cout << a[i] << " "
#define hi() cout << "\nHello, I am error. Can you find me? :):):)\n"
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_eppoch().count())
 
using namespace __gnu_pbds;
using namespace std;
using ordered_set =  tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>;

// FOR DEBUGGING
vector<string> vec_splitter(string s) {
	s += ',';
	vector<string> res;
	while(!s.empty()) {
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}

void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
	if(idx > 0) cerr << ", ";
	else cerr << "Line(" << LINE_NUM << ") ";
	stringstream ss; ss << H;
	cerr << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}

#ifndef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif

const int mod = 1e9+7;
const long double PI = acos(-1);

ll power(ll x, ll y){
	x %= mod;
	ll ans = 1;
	while(y){
		if(y&1) ans = (ans*x)%mod;
		y /= 2;
		x = (x*x)%mod;
	}
	return ans;
}

void solve(){

	int n;
	cin >> n;
	if(n%1000==0){
		cout << 0;
		return;
	}
	cout << 1000 - n%1000;

	return;
}
	
int main(){

	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	int TC = 1,t = 0;
	// cin >> TC;
	while(t++ < TC){
		// cout << "Case #" << t << ": ";
		solve();
		// cout << "\;
	}

	cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";

	return 0; 
}

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

int main() {

	ll n, T; cin >> n >> T;
	vector<ll> t(n);
	for (ll i = 0; i < n; i++) {
		cin >> t[i];
	}
	ll ans = 0;
	for (ll i = 1; i <= n - 1; i++) {
		ans += min(T, t[i] - t[i - 1]);
	}
	ans += T;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4808
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
const int M=2e5+5;
ll a[M],cs[M];
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		cs[i]=cs[i-1]+a[i];
	}
	int l=1,r=1;
	ll ans=1e16;
	for(int i=2;i<=n-2;i++)
	{
		while(1)
		{
			if(l==i-1)
				break;
			if(abs((ll)2*cs[l]-cs[i])>abs((ll)2*cs[l+1]-cs[i]))
				l++;
			else
				break;
		}
		r=max(r,i+1);
		while(1)
		{
			if(r==n-1)
				break;
			if(abs((ll)2*cs[r]-cs[i]-cs[n])>abs((ll)2*cs[r+1]-cs[i]-cs[n]))
				r++;
			else
				break;
		}
		std::vector<ll> vt;
		vt.pb(cs[l]);vt.pb(cs[i]-cs[l]);vt.pb(cs[r]-cs[i]);vt.pb(cs[n]-cs[r]);
		sort(all(vt));
		ans=min(ans,vt[3]-vt[0]);
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 3328
/** Seek God..Trust God..Praise God..**/

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


#define fRead(x)        freopen("x.txt","r",stdin)
#define fWrite(x)       freopen ("x.txt","w",stdout)

#define mt              make_tuple
#define ld              long double
#define ll              long long
#define ull             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>
#define endl            "\n";

#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


#define FASTIO        ios_base::sync_with_stdio(0);cin.tie(nullptr);




///..................Sort by second element in a pair in decending order............. ///
bool SortbySecDesc(const pair<long long,long long > &a, const pair<long long,long long > &b)
{
    return a.second>b.second;
}

///.........................first element of pair in descending order..........................//////
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}



///.............................................................TEMPLATE................................................./////



/*
long long  Prime[3000000],nPrime;
long long  mark[10000002];

void seive(long long int n)
{
	long long int i,j,limit=sqrt(n*1.0)+2;
	mark[1]=1;
	for(i=4; i<=n ;i+=2)
	mark[i]=1;
	Prime[nPrime++]=2;
	for(i=3; i<=n; i+=2)
	{
		if(!mark[i])
		{
			Prime[nPrime++]=i;
			if(i<=limit)
			{
				for(j=i*i; j<=n ;j+=i*2)
				{
					mark[j]=1;
				}
			}
		}
	}
}
*/
int isSubstring(string s1, string s2)
{
    int M = s1.length();
    int N = s2.length();

    for (int i = 0; i <= N - M; i++) {
        int j;


        for (j = 0; j < M; j++)
            if (s2[i + j] != s1[j])
                break;

        if (j == M)
            return i;
    }

    return -1;
}

int main()
{
    FASTIO;

    string s , t;

    cin >> s >> t;


        int sz = t.size();

        int ans = sz;


        for(int i=0; i<s.size(); i++)
        {
            if(i+sz<=s.size())
            {
                int cnt = 0;

                for(int j=i,k=0; k<t.size() && j<(i+sz); k++,j++)
                {
                    if(s[j]==t[k])
                    {
                        cnt++;
                    }
                }

                //cout << cnt << endl;


                ans = min(ans,sz-cnt);
            }

        }

        cout << ans << endl;










    return 0;
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
const int maxn = 1e6+5;
const int mod = 1e9+7;
const double eps = 1e-8;
using namespace std;

void tlfclwx(){ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
string s[maxn];
string k[maxn];
int main()
{
    int n; cin >> n;
    map<string, int> mp;
    int maxx = 0;
    for(int i = 1; i <= n; i++) {
        cin >> s[i];
        mp[s[i]]++;
        maxx = max(maxx, mp[s[i]]);
    }
    int a = 0;
    for(int i = 1; i <= n; i++) {
        if(mp[s[i]]==maxx) {
            k[a++] = s[i];
            mp[s[i]] = 0;
        }
    }
    sort(k,k+a);
    for(int i = 0; i < a; i++) {
        cout << k[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 40832
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b;
	cin>>a>>b;
	if(a<=5)b=0;
	else if(a<=12)b/=2;
	cout<<b<<endl;
}


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

int main(){
  int N;
  cin >> N;
  vector<int> ans(N);
  for(int i = 1;i<=N;i++){
    for(int a = 1;a<=sqrt(i);a++){
      for(int b = 1;b<=sqrt(i);b++){
        long double c1 = (-a-b)+sqrt(4*i-3*a*a-3*b*b-2*a*b);
        if(floor(c1) == c1 && c1 >= 1){
          int c = c1;
          ans.at(i-1)++;
        }
      }
    }
  }
  for(int i:ans){
    cout << i << endl;
  }
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a)      (a).begin(),(a).end()
#define debug_array(a,n) for (ll bccc=(0); bccc<(n); bccc++) cout<<a[bccc]<<" "<<"\n"
#define debug_vector(a) for(ll bccc=(0); bccc<(a.size());bccc++) cout<<a[bccc]<<" "<<"\n"
#define F           first
#define S           second
#define debug_set(s) for(auto p:s) cout<<p<<" "
#define debug_map(m) for(auto p:m) cout<<p.F<<" "<<p.S<<"\n"
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
/* ll t = 0;
ordered_multiset me;
...
me.insert({x, t++});
me.erase(me.lower_bound({x, 0}));
cout << me.order_of_key({x, 0}) << "\n";

///////////   t is insertion time
*/
//#pragma GCC optimize("Ofast")  // works very well
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
typedef long double lld;
lld pi=3.14159265358;
ll powr(ll a,ll b)
{
    ll c=1;
    ll kjk;
    for(kjk=0;kjk<b;kjk++)
        c*=a;
    return c;
}
ll hell=1000000007;
//ll hell=998244353   ;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
// to generate random number , use rng() ... eg cout<<rng();
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    ll n,i;
    cin>>n;
    ll a[n];
    for(i=0;i<n;i++)
        cin>>a[i];
    ll c=0;
    ll mini=hell;
    for(i=0;i<n;i++)
    {
        mini=min(mini,a[i]);
        if(a[i]==mini)
            c++;
    }
    cout<<c;
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>

int main(){
    int a, b, c;
    std::cin >> a >> b >> c;
    if(a < b){
        if(b < c){
            std::cout << a << " " << b << " " << c;
        }else if(a < c){
            std::cout << a << " " << c << " " << b;
        }else{
            std::cout << c << " " << a << " " << b;
        }
    }else{
        if(a < c){
            std::cout << b << " " << a << " " << c;
        }else if(b < c){
            std::cout << b << " " << c << " " << a;
        }else{
            std::cout << c << " " << b << " " << a;
        }
    }
    std::cout << std::endl;
    return 0;
}


Measured memory_bytes: 3092
using System;

namespace atcoder
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            //Console.WriteLine("Hello World!");
            int howmany500 = Int32.Parse(Console.ReadLine());
            int howmany100 = Int32.Parse(Console.ReadLine());
            int howmany50 = Int32.Parse(Console.ReadLine());
            int sum = Int32.Parse(Console.ReadLine());
            int count = 0;

            for (int i = 0; i <= howmany500; i++)
            {
                for (int j = 0; j <= howmany100; j++)
                {
                    for (int k = 0; k <= howmany50; k++)
                    {
                        if (sum == (i * 500) + (j * 100) + (k * 50))
                        {
                            count++;
                        }
                    }
                }
            }

            Console.WriteLine(count);

        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL)
#define INF 1e18
#define x first
#define y second
int n, k;
vector<int> arr, dp;
ll search(int level)
{
    if(level == n-1)
        return 0;
    if(dp[level] != -1)
        return dp[level];
    else{
        ll ans = INF;
        for (int i = 1; i <= k; ++i) {
            if(level+i < n)
                ans = min(ans, abs(arr[level] - arr[level+i]) + search(level+i));
        }
        return dp[level] = ans;
    }
}
int main() {
    fast;
    cin>>n>>k;
    arr.resize(n);
    dp.resize(n);
    for (int i = 0; i < n; ++i) {
        dp[i] = -1;
        cin>>arr[i];
    }
    cout<<search(0);
}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
using namespace std;
string a,b;
int main()
{
    cin>>a;
    b=a;
    int l=a.size();
    for(int i=0;i<l;i++)
    {
        a[l-i-1]=b[i];
    }
    for(int i=0;i<l;i++)
    {
        if(a[i]=='b') a[i]='d';
        else if(a[i]=='d') a[i]='b';
        else if(a[i]=='p') a[i]='q';
        else if(a[i]=='q') a[i]='p';
    }
    if(a==b) printf("Yes");
    else printf("No");
    return 0;
}

Measured memory_bytes: 512
#include <cmath>
#include <iostream>
#include <functional>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <list>
#include <numeric>
using namespace std;

int main(){    
  int A,B,C;
 
  cin >> A >> B >>C;

  if(A==B && A==C && B==C){
  cout << "No" << endl;
  return 0;
  }
  if(A!=B && A!=C && B!=C){ 
  cout << "No" << endl;
  return 0;
  }
  else{ 
  cout << "Yes" << endl;
  }
}


Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#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>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl

#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
int n,m,v,i;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  ll ans =0;
  rep(i,4) {
    if(s[i]=='-') ans--;
    else ans++;
  }
  cout<<ans<<endl;

}

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


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

int main() {
  int A,B,C,D,L,R;
  cin >> A >> B >> C >> D;
  
  L = A + B;
  R = C + D;
  
  if (L > R) {
    cout << "Left" << endl;
  }
  else if (L < R) {
    cout << "Right" << endl;
  }
  else if (L == R) {
    cout << "Balanced" << endl;
  }
}

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

string S;
int main(){
	cin >> S;
	long long zero = 0;
	long long one = 0;
	for(long long i = 0; i < S.size(); i++){
		if(S[i] == '0'){
			zero++;
		}else {
			one++;
		}
	}
	cout << 2*min(zero, one) << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main () {
	int N,Y;
	cin >> N >> Y;
	int sen = -1;
	int gosen = -1;
	int man = -1;
	for (int x = 0; x <= N; ++x)
	{
		for (int y = 0; y <= N-x; ++y)
		{
			int z = N - x - y;
			if(1000 * x + 5000 * y + 10000 * z == Y){
				sen = z;
				gosen = y;
				man = x;
			}
		}
	}
	cout << sen << " " << gosen << " " << man << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int L; cin >> L;
  double v = L/3.0, l = L/3.0, h = L/3.0;
  double ans;
  ans = v * l * h;
  printf("%.12f\n",ans);
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};
  

int main()
{
  int a, b, c;
  cin >> a >> b >> c;
  int k; cin >> k;
  int count = 0;
  while(a >= b) {
    ++count;
    b *= 2;
  }
  while(b >= c) {
    ++count;
    c *= 2;
  }
  if(count <= k) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define rep(i,a,b) for(register int i=a;i<=b;++i)
#define rpd(i,a,b) for(register int i=a;i>=b;--i)
#define rep1(i,x) for(register int i=head[x];i;i=nxt[i])
typedef long long ll;
const int N=1e5+5;
using namespace std;
inline int read(){
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
    while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int gcd(int a,int b){return a==0?b:gcd(b%a,a);}
int n,x,ans;
int main(){
	n=read();x=read();
	ans=abs(x-read());
	rep(i,2,n)ans=gcd(ans,abs(x-read()));
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
// E.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

#ifdef __GNUC__
#define popcount __builtin_popcount
#elif _MSC_VER >= 1400
#include <intrin.h>
#define popcount __popcnt
#else
static inline int popcount(unsigned int b) {
	b = (b & 0x55555555) + (b >> 1 & 0x55555555);
	b = (b & 0x33333333) + (b >> 2 & 0x33333333);
	b = (b & 0x0F0F0F0F) + (b >> 4 & 0x0F0F0F0F);
	b += b >> 8;
	return (b + (b >> 16)) & 0x3F;
}
#endif

int main(int argc, char* argv[]) {
#ifdef _MSC_VER
	while (true)
#endif
	{
		int h = -1, w, k;
		cin >> h >> w >> k;
		if (h < 0) return 0;
		vector<string> s(h);
		for (int i = 0; i < h; ++i) {
			cin >> s[i];
		}
		int ans = 1 << 30;
		int bm = 1 << (h - 1);
		for (int b = 0; b < bm; ++b) {
			vector<int> cnt(10);
			int divs = popcount(b);
			int columns = 0;
			for (int col = 0; col < w; ++col) {
				bool ok = true;
				int gi = 0;
				for (int row = 0; row < h; ++row) {
					cnt[gi] += s[row][col] != '0';
					if (cnt[gi] > k) {
						ok = false;
					}
					if (b & 1 << row) {
						++gi;
					}
				}
				if (ok) {
					++columns;
				} else {
					if (!columns) {
						goto next;
					} else {
						--col;
						++divs;
						cnt = vector<int>(10);
						columns = 0;
					}
				}
			}
			ans = min(ans, divs);
		next: {}
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s)
{
    int v;
    istringstream sin(s);
    sin >> v;
    return v;
}
template <class T>
inline string toString(T x)
{
    ostringstream sout;
    sout << x;
    return sout.str();
}

//math
//-------------------------------------------
template <class T>
inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

//repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const long long INFL = __LONG_LONG_MAX__ / 10;
const int INFI = __INT_MAX__ / 10;

//clear memory
#define CLR(a) memset((a), 0, sizeof(a))

//debug
// #define dump(x) cerr << #x << " = " << (x) << endl;
// #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
//                       << " " << __FILE__ << endl;

int N;
LL dp1[3000][3000];
LL dp2[3000][3000];
int A[3000];

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

    cin >> N;
    REP(i, N)
    {
        int a;
        cin >> a;
        A[i] = a;
        dp1[i][i] = a;
        dp2[i][i] = a;
    }

    REP(i, N - 1)
    {
        dp1[i][i + 1] = max(A[i] - A[i + 1], A[i + 1] - A[i]);
        dp2[i][i + 1] = min(A[i] - A[i + 1], A[i + 1] - A[i]);
    }

    FOR(len, 3, N + 1)
    {
        for (int l = 0; l <= N - len; l = l + 1)
        {
            int r = l + len - 1;
            // cout << l << ", " << r << endl;
            dp1[l][r] = max(
                A[l] + dp2[l + 1][r], A[r] + dp2[l][r - 1]);
            dp2[l][r] = min(
                dp1[l + 1][r] - A[l], dp1[l][r - 1] - A[r]);
        }
    }

    cout << (max(A[0] + dp2[1][N - 1], A[N - 1] + dp2[0][N - 2])) << endl;
}

Measured memory_bytes: 139776
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using Map = map<ll,ll>;
using T = tuple<ll,ll,ll>;
using vvl = vector<vector<ll>>;
const ll INF=1LL<<60;
const ll MOD=1000000007;

vector<bool> check(100005,0);
vector<vector<ll>> graph(100005, vector<ll>(0));
vector<ll> parent(100005,0);
vector<vector<ll>> children(100005, vector<ll>(0));
ll ans=1;
bool ng=0;
ll K;

void dfs(ll x){
    check[x]=1;
    for(auto p: graph[x]){
        if(check[p])continue;
        dfs(p);
        parent[p]=x;
        children[x].emplace_back(p);
    }
}

//xを根とする部分木はまだ塗ってない
ll dfs2(ll x){
    //残りは色の候補数
    ll nokori=K-1;
    if(x!=1)nokori--;
    for(auto p: children[x]){
        if(nokori<0)ng=1;
        ans*=nokori;ans%=MOD;
        dfs2(p);
        nokori--;
    ;}
}


int main(){
    ll N;
    cin >> N;
    cin >> K;
    vector<ll> a(N-1,0);
    vector<ll> b(N-1,0);
    for(ll i=0;i<N-1;i++){
        cin>>a[i]>>b[i];
        graph[a[i]].emplace_back(b[i]);
        graph[b[i]].emplace_back(a[i]);
    ;}
    //1を根として考える
    dfs(1);
    //1を塗る
    ans*=K;ans%MOD;

    dfs2(1);


    if(ng){
        cout<<0<<endl;return 0;
    }

    cout<<ans<<endl;


    



    return 0;
}


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

int main() {
	int n,d,x,b,sum=0;
	cin>>n>>d>>x;
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		b=(d-1)/a+1;
		sum+=b;
		
	}
	cout<<x+sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
#include <map>
using namespace std;
using ll = long long;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[10000001];
//char str[1010][1010];
//vector<pair<int,int> > pc[100001];
//int ABS(int a){return max(a,-a);}
ll keta(ll n){
	ll x=n,sum=0;
	while(x!=0){
		sum+=x%10;
		x/=10;
	}
	return sum;
}
int main(){
	ll n,a,b,sum=0,p;
	cin>>n>>a>>b;
	for(int i=1;i<=n;i++){
		p=keta(i);
		if(p>=a&&p<=b) sum+=i;
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
set <int> condition[4];
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    int n,m,a,b;
    vector <pair<int,int>> v;
 
    cin >> n >> m;
 
    for(int i=0;i<m;i++)
    {
    	cin >> a >> b;
    	condition[a-1].insert(b);
    	if(condition[a-1].size()>1)
    	{
    		cout << -1 << '\n';
    		return 0;
    	}	
    }
 
    for(int num=0;num<1000;num++)
    {
    	bool ok = true;
    	string s;
    	int t = num;
    	int cnt = 0;
    	while(t>0)
    	{
    		s = (char)(t%10 + '0') + s;
    		t/=10;
    		cnt++;
    	}
    	if(num==0)
    	{
    		s = "0";
    		cnt = 1;
    	}
    	if(cnt!=n)
    	{
    		continue;
    	}
    	for(int j=0;j<n;j++)
    	{
    		if(condition[j].empty())
    		{
    			continue;
    		}
    		if(*condition[j].begin()!=s[j]-'0')
    		{
    			ok = false;
    			break;
    		}
    	}
    	if(ok)
    	{
    		cout << num << '\n';
    		return 0;
    	}
    }
 
    cout << -1 << '\n';
 
    return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")
#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define f first
#define s second
typedef long long ll;
typedef unsigned long long ull;

void IO(){
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    #ifndef ONLINE_JUDGE
        freopen("test.txt","r",stdin);
    #endif
}

const int N=1e6+3,M=1e3+5,mod=1e9+7,dx[]={1,-1,0,0},
                                    dy[]={0,0,1,-1};
const double eps=1e-9;

int n,a,b,c;

int& get(char cc){
    if (cc == 'A')
        return a;
    else if (cc == 'B')
        return b;
    else
        return c;
}

vector<int> nxt[3];

int main(){
    //IO();
    cin >> n >> a >> b >> c;
    int zeros = (a == 0) + (b == 0) + (c == 0);
    vector<char> v;
    vector<string> ss(n);
    for(int i = 0 ; i < n ; i++){
        cin >> ss[i];
        nxt[ss[i][0] - 'A'].push_back(i);
        nxt[ss[i][1] - 'A'].push_back(i);
    }
    for(int i = 0 ; i < n ; i++){
        string& s = ss[i];
        int& x = get(s[0]);
        int& y = get(s[1]);
        if (x == 1 && y == 1){
            int p = s[0] - 'A';
            int nxt_x = upper_bound(nxt[p].begin(),nxt[p].end(),i) - nxt[p].begin();
            if (nxt_x == sz(nxt[p]))
                nxt_x = 1e9;
            else
                nxt_x = nxt[p][nxt_x];
            p = s[1] - 'A';
            int nxt_y = upper_bound(nxt[p].begin(),nxt[p].end(),i) - nxt[p].begin();
            if (nxt_y == sz(nxt[p]))
                nxt_y = 1e9;
            else
                nxt_y = nxt[p][nxt_y];
            if (nxt_x < nxt_y){
                x++;
                y--;
                v.push_back(s[0]);
            }
            else{
                x--;
                y++;
                v.push_back(s[1]);
            }
        }
        else if (x < y){
            x++;
            y--;
            v.push_back(s[0]);
        }
        else{
            x--;
            y++;
            v.push_back(s[1]);
        }
        
        if (a < 0 || b < 0 || c < 0){
            assert(zeros >= 2);
            return !printf("No\n");
        }
    }
    printf("Yes\n");
    for(auto c : v)
        printf("%c\n",c);
}


Measured memory_bytes: 7736
#include <bits/stdc++.h>
#define ms(x, a) memset(x, a, sizeof(x))
#define oo 100000000
#define ll long long int
#define MOD 1000000007
using namespace std;
ll getinverse(ll x)
{
    ll ans = 0;
    int j = 0;
    while (x) {
        ans = ans * 10 + (x % 10);
        x /= 10;
        j++;
    }
    return ans;
}
bool deja[1000004];
int y[10][10];
int u[10];
int main()
{
    ll n;
    cin >> n;
    for(ll i=1;i<=n;i++){
        int p=getinverse(i);
            y[i%10][p%10]++;
    }
    ll ans=0;
    for(int i=1;i<=9;i++){
        for(int j=1;j<=9;j++){
            ans+=(y[i][j])*(y[j][i]);
        }
    }
    cout<<ans;

    return 0;
}


Measured memory_bytes: 764
#include<iostream>

using namespace std;

int main(){
    int m[50],f[50],r[50];
    int i=0,cnt=0;
    for(;;){ 
        cin>>m[i]>>f[i]>>r[i];
        if(m[i]==-1 && f[i]==-1 && r[i]==-1){
            cnt=i;
            break;
        }
        i++;
    }
    for(i=0; i<cnt; i++){
        if(m[i]!=-1 && f[i]!=-1){
            if(m[i]+f[i]>=80){
                cout<<"A"<<endl;
            }
            else if(m[i]+f[i]>=65 && m[i]+f[i]<80){
                cout<<"B"<<endl;
                
            }
            else if(m[i]+f[i]>=50 && m[i]+f[i]<65){
                cout<<"C"<<endl;
                
            }
            else if(m[i]+f[i]>=30 && m[i]+f[i]<50){
                if(r[i]>=50){
                    cout<<"C"<<endl;
                }
                else{
                    cout<<"D"<<endl;
                }
            }
            else{
                cout<<"F"<<endl;
            }
        }
        else{
            cout<<"F"<<endl;    
        }
    }
}


Measured memory_bytes: 3096
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;

bool finish(double q, double x) {
  return abs(x*x*x - q) < 0.00001 * q;
}

int main() {
  double q, x;
  while(cin >> q && q != -1) {
    x = q/2.0;
    while(!finish(q, x)) {
      x = x - (x*x*x - q)/(3*x*x);
    }
    printf("%.6f\n", x);
  }
  return 0;
}

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

typedef long long LL;

template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar.size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}


int main(int argc, char const* argv[])
{

    int n,k;
    cin >> n >> k;

    map<int, int> a;
    for (int i = 0; i < n; i++) {
        int t;
        cin >> t;
        if (a.count(t) == 1) {
            a[t]++;
        }else{
            a[t] = 1;
        }
    }

    vector<int> v;
    for (auto itr =a.begin(); itr != a.end(); itr++) {
        v.push_back(itr->second);
    }
    sort(v.begin(), v.end());

    int total=0;
    for (int i = 0; i < (int)v.size() - k; i++) {
        total += v[i];
    }

    cout << total << endl;
    return 0;
}

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

int main()
{
	int n,i,j;
	cin>>n;
	int a[3][n+1],b[3][n+1];
	memset(b,0,sizeof(b));
	for (i=1;i<=2;i++) 
		for (j=1;j<=n;j++) 
		{
			cin>>a[i][j];
			if (i==1 && j==1) b[i][j]=a[i][j];
			else if (i==1) b[i][j]=a[i][j]+b[i][j-1];
			else if (j==1 && i==2) b[i][j]=a[i][j]+a[1][1];
		}
	for (i=2;i<=n;i++) b[2][i]=max(b[2][i-1],b[1][i])+a[2][i];
	cout<<b[2][n];
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <math.h>
#define rep(i,s,n) for(int i = s; n > i; i++)
#define REP(i,n) rep(i,0,n)
#define ll long long int
#define ALL(a) a.begin(), a.end()
using namespace std;

template<class T>
class segtree {
	vector<T> tree;
public:
	segtree(const int n) :tree(n * 2) {}
	int base() const { return tree.size() / 2; }
	void update(int i, const T&v) {
		i += base();
		tree[i] = v;
		while (i /= 2)
			tree[i] = tree[i * 2] + tree[i * 2 + 1];
	}
	T fold(int f, int l)const {
		f += base();
		l += base();
		T accl, accr;
		while (f < l) {
			if (f & 1)
				accl = accl + tree[f++];
			f /= 2;
			if (l & 1)
				accr = tree[--l] + accr;
			l /= 2;
		}
		return accl + accr;
	}
};


ll k;

struct hoge {
	bool flip;
	ll sum;
	hoge(bool x = 0, ll y = 0) :flip(x), sum(y) {}
	hoge operator+(const hoge &r)const {
		if (flip)
			return hoge(!r.flip, (sum - r.sum + k) % k);
		else
			return hoge(r.flip, (sum + r.sum) % k);
	}
};

ll getmod(const ll a) {
	return (a%k + k) % k;
}

hoge make(const ll a) {
	if (a != 0)
		return hoge(0, a);
	else
		return hoge(1, 0);
}


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

typedef pair<int, int> pii;
int main() {
	int n;
	cin >> n;

	vector<int> a(n);
	double sum = 0;
	REP(i, n) cin >> a[i], sum += a[i];

	sum /= n;
	pair<double, int> Min = {999999, 0};
	REP(i, n) Min = min(Min,make_pair(fabs(sum - a[i]), i ));

	cout << Min.second << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    // 減少した回数と変わらなかった回数を求める
    int K, Q;
    cin >> K >> Q;
    vector<int> D(K);
    rep(i, K) cin >> D[i];
    rep(i, Q) {
        int n, x, m;
        cin >> n >> x >> m;
        // 長さnの数列、初項はx、mod m
        int ans = n - 1;
        int time = (n-1) / K;
        int remain = (n-1) % K;
        vector<int> Dcur = D;
        rep(i, K) Dcur[i] %= m;
        ll total = accumulate(Dcur.begin(), Dcur.end(), 0ll);
        total *= time;
        rep(j, remain) total += Dcur[j];
        total += x;
        ll sub = 0;
        rep(j, K) if (Dcur[j] == 0) sub++;
        sub *= time;
        rep(j, remain) if (Dcur[j] == 0) sub++;
        ans -= sub + (total / m - x / m);
        cout << ans << '\n';
    }
    return 0;
    // ll, 0, -, 1i, for s&g, debug
}

Measured memory_bytes: 3668
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>
#include <unordered_map>

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;

int MOD = 998244353;

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

    int n; string s;
    cin >> n >> s;

    if(n%2==0 && s.substr(0,n/2)==s.substr(n/2, n/2)){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

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


int main(){
    ll x,n;cin>>x>>n;
    if(n==0){
        cout<<x<<endl;
        return 0;
    }
    ll an=1e5,ans;
    ll a[111];
    rep(i,0,n)cin>>a[i];
    rep(i,0,102){
        ll ok=1;
        rep(j,0,n){
            if(i==a[j])ok=0;
        }
        if(ok){
            if(an>abs(x-i)){
                an=abs(x-i);
                ans=i;
            }
        }
    }
    cout<<ans<<endl;
}

    









Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  ll h,w;
  cin>>h>>w;
  if(h<w) swap(h,w);
  ll ans=BIG;
  if(h%3==0 || w%3==0) ans=0;
  else{
    rep(i,h){
      ll na=w*(i+1);
      ll nb=(w/2)*(h-i-1);
      ll nc=((w+1)/2)*(h-i-1);
      ll nd=max(abs(na-nb),abs(na-nc));
      ans=min(ans,nd);
    }
    swap(h,w);
    rep(i,h){
      ll na=w*(i+1);
      ll nb=(w/2)*(h-i-1);
      ll nc=((w+1)/2)*(h-i-1);
      ll nd=max(abs(na-nb),abs(na-nc));
      ans=min(ans,nd);
    }
    
  }
  cout<<min(h,ans)<<endl;
  return 0;
}


Measured memory_bytes: 384