akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var ab = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();
            var a = ab[0];
            var b = ab[1];

            Console.WriteLine((int) Math.Ceiling((double) (b - a) / (a - 1)) + 1);
        }

    }
}

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


int main(void){
    int a,b,c;
    cin >> a >> b >> c;
    int num=0;
    num = c-(a-b);
    if(num>0){
        cout << num <<endl;
    }
    else{
        cout << 0 << endl;
    }
    
    return 0;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
    #include <math.h>
 
    using namespace std;
    typedef long long ll;
    typedef unsigned long long ull;
    # define M_PI  3.14159265358979323846
 
 
    const int M=1e9+7;
    long long mod(long long x){
        return ((x%M + M)%M);
    }
    long long add(long long a, long long b){
        return mod(mod(a)+mod(b));
    }
    long long mul(long long a, long long b){
        return mod(mod(a)*mod(b));
    }
 
    ll modPow(ll a, ll b){
        if(b==0)
            return 1LL;
        if(b==1)
            return a%M;
        ll res=1;
        while(b){
            if(b%2==1)
                res=mul(res,a);
            a=mul(a,a);
            b=b/2;
        }
        return res;
    }

    int isPrime(ll n){
        for(int i=2;i*i<=n;i++){
            if(n%i==0)
                return 0;
        }
        return 1;
    }
 
    void solve (){
        ll a,b;
        cin>>a>>b;
        ll com=__gcd(a,b);
        vector<ll>fac;
        for(ll i=2;i*i<=com;i++){
            if(com%i==0){
                fac.push_back(i);
                while(com%i==0){
                    com/=i;
                }
            }
        }
        // for(int i=0;i<(int)fac.size();i++)
        //     cout<<fac[i]<<" ";
        // cout<<"\n";
        int total=fac.size();
        if(com!=1)
            total++;
        cout<<total+1;
    }
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cout<<fixed;
        cout<<setprecision(10);
//        freopen("timber_input.txt", "r", stdin);
//        freopen("timber_output.txt", "w", stdout);
        int t=1;
        // cin>>t;
        for(int i=1;i<=t;i++){
//            cout<<"Case #"<<i<<": ";
            solve();
        }
        return 0;
    }

Measured memory_bytes: 3608
n,a,b=map(int,input().split())
if (b-a)%2==0:
    print((b-a)//2)
else:
    aa=a
    bb=b
    tot=0
    tot+=(a)
    b-=(a)
    a=1
   # print(a,b)
    tot+=((b-a)//2)
    a=aa
    b=bb
    tot2=0
    tot2+=(n-b+1)
    a+=(n-b+1)
    b=n

    tot2+=((b-a)//2)
    print(min(tot,tot2))


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

int main(void){
    int n,i;
    double *x,*y;
    double distance1=0.0,distance2=0.0,distance3=0.0,distance4=0.0;
    
    scanf("%d",&n);
    x = (double *)malloc(n*sizeof(double));
    y = (double *)malloc(n*sizeof(double));
    for(i=0;i<n;i++){
        scanf("%lf",&x[i]);
    }
    for(i=0;i<n;i++){
        scanf("%lf",&y[i]);
    }
    for(i=0;i<n;i++){
        double now=0.0;
        distance1+=fabs(x[i]-y[i]);
        distance2+=fabs(x[i]-y[i])*fabs(x[i]-y[i]);
        distance3+=fabs(x[i]-y[i])*fabs(x[i]-y[i])*fabs(x[i]-y[i]);
        now=fabs(x[i]-y[i]);
        if(now>distance4){
            distance4=now;
        }
    }
    distance2=sqrt(distance2);
    distance3=cbrt(distance3);
    printf("%.6lf\n%.6lf\n%.6lf\n%.6lf",distance1,distance2,distance3,distance4);

    return 0;

}



Measured memory_bytes: 2148
#include <algorithm>
#include <cmath>
#include <complex>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using std::cin;
using std::cout;
using std::endl;
using std::cerr;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::stack;
using std::priority_queue;
using std::pair;
using std::make_pair;

using std::min;
using std::max;
using std::sort;
using std::abs;

using std::fixed;
using std::setprecision;
using std::setw;

typedef long long int ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 314;

int main() {
    ll n, h;
    cin >> n >> h;

    vector<ll> a(n);
    vector<ll> b(n);
    for(ll i = 0; i < n; i++){
        cin >> a[i] >> b[i];
    }

    sort(a.begin(), a.end(), std::greater<ll>());
    sort(b.begin(), b.end(), std::greater<ll>());

    ll sum_b = 0;
    ll ans = (h + a[0] - 1) / a[0];
    for (ll i = 0; i < n; i++) {
        sum_b += b[i];

        ll j = h - sum_b;
        if(j <= 0){
            ans = min(ans, i + 1);
        }else{
            ans = min(ans, i + 1 + (j + a[0] - 1) / a[0]);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")

//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
// -------------------</optimizations>--------------------
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define d long double
#define pii pair<int,int>
#define pb push_back
#define pf push_front
#define cases int t;cin>>t;while(t--)
#define N 100003
#define M 103
#define inf LLONG_MAX
//int mod=1e9+7;
//int mod=998244353;

signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

    int n,x;
    cin>>n;
    cin>>x;
    int ans=1,ma=x,i;
    for(i=2;i<=n;++i)
    {
        cin>>x;
        if(x>=ma)
            ++ans;
        ma=max(ma,x);
    }
    cout<<ans;



    return 0;
}


Measured memory_bytes: 256
from math import ceil
from collections import defaultdict as dd
import sys
input=sys.stdin.readline
#t=int(input())
#while t:
l=['AC','WA','TLE','RE']
ans=[0]*4
n=int(input())
for i in range(n):
    s=input().split()[0]
    if(s==l[0]):
        ans[0]+=1
    if(s==l[1]):
        ans[1]+=1
    if(s==l[2]):
        ans[2]+=1
    if(s==l[3]):
        ans[3]+=1
for i in range(4):
    print(l[i],'x',ans[i])



Measured memory_bytes: 74240
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

vector<ll> fac(2020); //n!(mod M)
vector<ll> ifac(2020); //k!^{M-2} (mod M)
//a,bの範囲的にこれだけ配列を用意していけば十分

ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % mod;
        x = x*x % mod;
        n = n >> 1;
    }
    return ans;
}

ll comb(ll a, ll b){ //aCbをmod計算
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % mod;
    return tmp * fac[a] % mod;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    ll N, K; cin >> N >> K;

    fac[0] = 1;
    ifac[0] = 1;
    for(ll i = 0; i<2020; i++){
        fac[i+1] = fac[i]*(i+1) % mod; // n!(mod M)
        ifac[i+1] = ifac[i]*mpow(i+1, mod-2) % mod; // k!^{M-2} (mod M) ←累乗にmpowを採用
    }
    
    rep1(i, K) {
        ll res = comb(K - 1, K - i) * comb(N - K + 1, i) % mod;
        cout << res << endl;
    }
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>

using namespace std;
long long n,h,he;
int a[100000+10];
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	sort(a+1,a+1+n);
	for(int i=1;i<=n+1;i++)
	{
		if(a[i]!=a[i-1])
		{
			if(h<a[i-1])
			{
				he+=h;
			}
			else
			{
				he+=h-a[i-1];
			}
			h=1;
		}
		else
		h++;
	}
	cout<<he<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#define inf 99999999
using namespace std;
typedef long long ll;
const int MAXN=1e9+10;
const int MAX=100+10;
char mapp[MAX][MAX];
int book[MAX][MAX];
int n,m,ans=0;
int d[20][2]={-1,0,1,0,0,-1,0,1};
void dfs(int x,int y,char ch){
	for(int i=0;i<4;i++){
		int xt=x+d[i][0];
		int yt=y+d[i][1];
		if(xt>=0&&xt<n&&yt>=0&&yt<m&&book[xt][yt]==0&&mapp[xt][yt]==ch){
			book[xt][yt]=1;
			dfs(xt,yt,ch);
		}
	}
}
int main(){
   #ifdef SIYU
   freopen("in.txt","r",stdin);
   #endif // SIYU
   //ios::sync_with_stdio(false);
   while(cin>>n>>m){
   		if(n==0&&n==m)
   			break;
   		ans=0;
	   memset(book,0,sizeof(book));
	   for(int i=0;i<n;i++){
	   		cin>>mapp[i];
	   }
	   for(int i=0;i<n;i++){
	   		for(int j=0;j<m;j++){
	   			if(book[i][j]==0){
	   				ans++;
	   				dfs(i,j,mapp[i][j]);
	   			}
	   		}
	   }
	   cout<<ans<<endl;
	}
   return 0;
}

Measured memory_bytes: 3580
#include<stdio.h>
int main()
{
   int x,y;
   scanf("%d%d", &x, &y);

   if((x==4||x==6||x==9||x==11)&&(y==4||y==6||y==9||y==11)){
        printf("Yes");
   }
   else if((x==1 || x==3 || x==5 || x==7 || x==8 || x==10 || x==12)&&(y==1 || y==3 || y==5 || y==7 || y==8 || y==10 || y==12)){
        printf("Yes");
   }
   else
    printf("No");

    return 0;

}

Measured memory_bytes: 128
S = input()
T = input()

ans = len(T)
for i in range(len(S)):
    if i+len(T) > len(S):
        break
    ss = S[i:i+len(T)]
    cnt = 0
    for j in range(len(T)):
        if ss[j] != T[j]:
            cnt += 1
    ans = min(cnt, ans)
print(ans)

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

template<typename F>
constexpr decltype(auto) fix(F&& f) {
	return[f = std::forward<F>(f)](auto&&... args) {
		return f(f, std::forward<decltype(args)>(args)...);
	};
}

using i64 = std::int64_t;
using u64 = std::uint64_t;

int popcount(u64 bits) {
	bits = bits - (bits >> 1 & 0x55555555);
	bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
	bits = bits + (bits >> 4) & 0x0f0f0f0f;
	bits = bits * 0x01010101;
	return bits >> 24;
}

struct Node {
	int par = 0;
	int depth = -1;
};

int main() {
	int n, m;
	std::cin >> n;

	std::vector<std::vector<int>> edges(n);
	for (int i = 0; i < n - 1; ++i) {
		int a, b;
		std::cin >> a >> b;
		--a, --b;

		edges[a].push_back(b);
		edges[b].push_back(a);
	}

	std::vector<Node> tree(n);
	fix([&](auto dfs, int x, int depth) -> void {
		tree[x].depth = depth;

		for (auto&& dist : edges[x]) {
			if (tree[dist].depth != -1)
				continue;

			tree[dist].par = x;
			dfs(dfs, dist, depth + 1);
		}
	})(0, 0);

	// usedBits[i] の j ビット目 := 頂点 i から親への辺が制約 j に含まれているか
	std::vector<u64> usedBits(n);

	std::cin >> m;

	for (int i = 0; i < m; ++i) {
		int u, v;
		std::cin >> u >> v;
		--u, --v;

		int cu = u, cv = v;
		while (cu != cv) {
			usedBits[cu] |= (u64(1) << i);
			usedBits[cv] |= (u64(1) << i);

			if (tree[cu].depth < tree[cv].depth)
				cv = tree[cv].par;
			else
				cu = tree[cu].par;
		}

		usedBits[cu] &= ~(u64(1) << i);
	}

	i64 ans = 0;
	for (u64 i = 0; i < (u64(1) << m); ++i) {
		int cnt = 0;
		for (int j = 0; j < n; ++j)
			if ((i & usedBits[j]) != 0)
				++cnt;

		ans += (popcount(i) % 2 == 0 ? 1 : -1) * i64(u64(1) << (n - 1 - cnt));
	}

	std::cout << ans << std::endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char a[200005];
int sum;
int main(){
    scanf("%s",a);
    int k=strlen(a);
    for(int i=0;i<k;i++)sum+=a[i]-48;
    if(sum%9==0)cout<<"Yes";
	else cout<<"No"; 
    return 0;
}

Measured memory_bytes: 3836
#include <iostream>
#include<cmath>
#include<string>
#include<algorithm>
#include<ctime>
#include<functional>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<map>
#include<set>
#include<tuple>
#include<cassert>
#include<bitset>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<iomanip>
#include<climits>
#include<typeinfo>
#include<utility>
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(ll i=0;i<n;i++)
#define For(i,m,n) for(int i=m;i<n;i++)
#define FOR(i,m,n) for(ll i=m;i<n;i++)
double pi = 3.141592653589793238;
using ll = long long;
using namespace std;

ll LGCD(ll x, ll y) { if (x % y == 0) return y;else return LGCD(y, x % y); }
ll LLCM(ll x, ll y) { return x * y / LGCD(x, y); }

int GCD(int x, int y) { if (x % y == 0) return y;else return GCD(y, x % y); }
int LCM(int x, int y) { return x * y / GCD(x, y); }
ll dpcombination[10000][10000];

ll modi = 1000000007;
ll combination(ll n, ll r) {
	if (n == r) { return dpcombination[n][n] = 1; }
	else if (r == 0) { return dpcombination[n][0] = 1; }
	else if (r == 1) { return dpcombination[n][1] = n; }
	else if (dpcombination[n][r]) { return dpcombination[n][r]; }
	else { return dpcombination[n][r] = combination(n - 1, r - 1) % modi + combination(n - 1, r) % modi; }
}

void clockman(int time1) {

	cout << 1.0*(clock() - time1) / CLOCKS_PER_SEC << endl;
	return;
}
//cout << fixed << setprecision(10)

void printVec(std::vector<int> &vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}


int main() {
	ll n,k;
	cin >> n >> k;
	vector<ll>a(n);
	vector<ll>A(n);
	vector<ll>b(0);
	vector<ll>c(n);
	vector<ll>loop(0);
	b.push_back(0);
	
	for (int i = 0;i < n;i++) {
		cin >> A[i];
		a[i] = A[i] - 1;
	}
	ll f = 0;
	ll t = 0;
	ll tmp = 0;
	ll Loopbegin;
	for (int i = 0;i < k;i++) {
		
		c[tmp]++;
		
		if (c[tmp] == 2) {
			//Loopbegin = tmp;
			t++;
			loop.push_back(tmp);
		}
		if (c[tmp] == 3) {
			break;
		}
		f++;
		
		tmp = a[tmp];
		b.push_back(tmp);
	}
	
	

	if (k <= f) {
		cout << b[k] + 1 << endl;
	}
	else {

		cout << loop[(k - f) % t] + 1 << endl;
	}



	return 0;
}


Measured memory_bytes: 13824
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF          1e9
#define INFLL        1e18
#define EPS          1e-9
#define MOD          1000000007
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define VV(T,h,w)    move(vector<vector<T>>(h,move(vector<T>(w))))
#define VVI(T,h,w,i) move(vector<vector<T>>(h,move(vector<T>(w,i))))
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

int main()
{
	ll n = in(), d = in(), x = in();
	vector<ll>a(n); REP(i, n)a[i] = in();
	ll consum = 0;
	REP(i, n) {
		consum += (d - 1) / a[i] + 1;
	}
	cout << consum + x << endl;
}

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

int counter[100100];

int main() {
    int n;
    cin >> n;
    ll ans = 0;
    rep(i, n) {
        int a;
        cin >> a;
        counter[a]++;
        ans += a;
    }

    int q;
    cin >> q;
    while (q--) {
        int b, c;
        cin >> b >> c;
        ans += (c - b) * counter[b];
        counter[c] += counter[b];
        counter[b] = 0;
        cout << ans << endl;
    }
}

Measured memory_bytes: 4012
#ifdef Prateek
  #include "Prateek.h"
#else
  #include <bits/stdc++.h>
  using namespace std;
  #define debug(...) 42
#endif
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   string s;
   cin >> s;
   int sm = 0;
   for(char c : s) sm += c-'0';
   cout << ((sm%9)?"No":"Yes");
   return 0;
} 


Measured memory_bytes: 3660
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
using namespace std;
const int N=45;
int n;
char e[N][N];
ll f[N][N][N],g[N][N][N];
int main(){
	scanf("%d",&n); n*=2;
	For(i,1,n) scanf("%s",e[i]+1);
	For(i,1,n) For(j,1,n) e[i][j]-='0';
	For(i,1,n) f[i][i][i]=1;
	For(i,1,n) For(j,1,n) if (e[i][j]) g[i][i][j]=1;
	for (int l=3;l<=n;l+=2)
		for (int i=1,j=l;j<=n;i++,j++){
			For(k,i,j) For(p1,i,k-1) For(p2,k+1,j) For(p3,p2,j)
				f[i][j][k]+=f[p1+1][p2-1][k]*f[p2][j][p3]*g[i][p1][p3];
			For(k,i,j) For(l,1,n) if (e[k][l])
				g[i][j][l]+=f[i][j][k];
		}
	ll ans=0;
	For(i,2,n) if (e[1][i])
		ans+=f[2][n][i];
	printf("%lld\n",ans);
}

Measured memory_bytes: 1152
#include <iostream>

using namespace std;

int main(){
  int N, flag=0;
  cin >> N;
  char S[N];
  if(N%2 == 1) flag = 1;
  for(int i=0; i<N; i++){
    cin >> S[i];
  }
  for(int i=0; i<N/2; i++){
    if(S[i] != S[i+N/2]){
      flag = 1;
    }
  }
  if(flag == 1) cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
	    if(a<b&&b<c)System.out.println("Yes");
	    else System.out.println("No");
	    sc.close();
	}
}



Measured memory_bytes: 26180
def solve_lcs():
    x = raw_input()
    y = raw_input()
 
    a = len(x)
    b = len(y)
    c1 = [0 for i in range(b+1)]
    for i in range(a):
        e1 = x[i]
        c2 = c1+[]
        for j in range(b):
            if e1 == y[j]:
                c1[j+1] = c2[j] + 1
            elif c1[j+1] < c1[j]:
                c1[j+1] = c1[j]
    return c1[-1]
 
n = input()
for i2 in range(n):
    print solve_lcs()

Measured memory_bytes: 6460
#include<algorithm>
#include<iostream>
#include<vector>
using namespace std;
int main() {
	vector<int32_t> a(3);
	for (int i = 0; i < 3; i++) {
		cin >> a.at(i);
	}
	sort(a.begin(), a.end());
	if (a.at(0) == a.at(1)) {
		cout << a.at(2) << endl;
	}
	else {
		cout << a.at(0) << endl;
	}
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b && b != c && c != a)
    cout << "Yes" << endl;
  else if (a != b && b == c && c != a)
    cout << "Yes" << endl;
  else if (a != b && b != c && c == a)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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


using namespace std;


int main(){

 int n,m;
 cin>>n>>m;

 vector<pair<int, int> >mp(n);


 for(int i=0;i<n;i++){
     cin>>mp[i].first>>mp[i].second;
 }

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

  int64_t ans = 0, i = 0;

 while(m>0){

  ans += (int64_t)mp[i].first * min(mp[i].second,m);
  m -= mp[i].second;
  i++;
 }

 cout<<ans<<endl;

 return 0;
}






Measured memory_bytes: 1024
import sys
from collections import deque

input = sys.stdin.readline


def bfs(G, v, check):
    queue = deque([v])
    while queue:
        v = queue.popleft()
        for u in G[v]:
            if check[u] != -1:
                continue
            check[u] = v + 1
            queue.append(u)


def main():
    N, M = map(int, input().split())
    G = [[] for _ in range(N)]
    for _ in range(M):
        A, B = map(int, input().split())
        A -= 1
        B -= 1
        G[A].append(B)
        G[B].append(A)

    check = [-1] * N
    check[0] = 0
    bfs(G, 0, check)

    print("Yes")
    print(*check[1:], sep="\n")


if __name__ == "__main__":
    main()


Measured memory_bytes: 38392
#include <iostream>
#include <algorithm>
#include <time.h>
#include <stack>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cassert>

using namespace std;

const int N = 1005;
const int inf = 1000 * 1000 * 1000;
const int mod = 1000 * 1000 * 1000 + 7;

int n;
int p[N] , x[N];
vector <int> g[N];
int dp[N][3];
int D[5 * N] , mas[5 * N];

void dfs(int v){
    for(int i=0;i<(int)g[v].size();i++){
        int to = g[v][i];
        dfs(to);
    }
    for(int i=0;i<2;i++){
        for(int j=0;j<=x[v];j++){
            D[j] = inf;
            mas[j] = inf;
        }
        D[0] = 0;
        for(int j=0;j<(int)g[v].size();j++){
            int to = g[v][j];
            for(int h=0;h<=x[v];h++){
                if(D[h] != inf){
                    if(dp[to][i] != inf){
                        if(h + x[to] <= x[v]){
                            mas[h + x[to]] = min(mas[h + x[to]] , dp[to][i] + D[h]);
                        }
                        ////////////////// h + x[to] -> dp[to][i] + D[h]
                    }
                    if(dp[to][i ^ 1] != inf){
                        if(h + dp[to][i ^ 1] <= x[v]){
                            mas[h + dp[to][i ^ 1]] = min(mas[h + dp[to][i^ 1]] , D[h] + x[to]);
                        }
                        ////////////////// h + dp[to][i ^ 1] -> D[h] + x[to]
                    }
                }
            }
            for(int h=0;h<=x[v];h++){
                D[h] = mas[h];
                mas[h] = inf;
            }
        }
        for(int j=0;j<=x[v];j++){
            if(j == 0 || D[j] < dp[v][i])
                dp[v][i] = D[j];
        }
    }
}

int main(){
    cin>>n;
    for(int i=2;i<=n;i++){
        scanf("%d",&p[i]);
        g[p[i]].push_back(i);
    }
    for(int i=1;i<=n;i++) scanf("%d",&x[i]);
    dfs(1);
    if(dp[1][0] != inf || dp[1][1] != inf)
        cout<<"POSSIBLE"<<endl;
    else
        cout<<"IMPOSSIBLE"<<endl;
    return 0;
}


Measured memory_bytes: 384
import math

A, B, H, M = list(map(int, input().split()))
rad = ((H / 12) - (M * 11 / 720)) * 2 * math.pi

ans = ((A ** 2) + (B ** 2) - (2 * A * B * math.cos(rad))) ** (1 / 2)
print(ans)

Measured memory_bytes: 9460
#include<stdio.h>
int main(void){
  int a[100][100],b[100][100];
  int n,m,l;
  int i,j,k;
  long term,c[100][100];
  scanf("%d %d %d",&n,&m,&l);
  for(i=0;i<n;i++){
    for(j=0;j<m;j++) scanf("%d",&a[i][j]);
  }
  for(i=0;i<m;i++){
    for(j=0;j<l;j++) scanf("%d",&b[i][j]);
  }
  //    printf("\n");

  for(i=0;i<n;i++){
    for(j=0;j<l;j++){
      term=0;
      for(k=0;k<m;k++){
        term+=a[i][k]*b[k][j];
        c[i][j]=term;
      }
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<l;j++){
      printf("%ld",c[i][j]);
      if(j!=l-1) printf(" ");
    }
    printf("\n");
  }
return 0;
}

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

using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, m;
  cin >> n >> m;

  vector<int> cnt(n+5);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    cnt[a]++;
    cnt[b]++;
  }

  reps(i, 1, n) {
    cout << cnt[i] << "\n";
  }

  return 0;
}

Measured memory_bytes: 256
# vim: fileencoding=utf-8


def main():
    n = int(input())
    li = list(map(int, input().split()))
    li.sort(reverse=True)
    ans = 0
    for i in range(n):
        ans += li[i * 2 + 1]
    print(ans)


if __name__ == "__main__":
    main()


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

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

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main(int argc, char const *argv[]) {
  int x,y; cin >> x >> y;
  REP(i,x + 1) {
    if (i * 2 + (x - i) * 4 == y) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#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 srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

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

  int H, W;
  cin >> H >> W;
  vector<vector<char>> Board(H, vector<char>(W));
  rep(i, H) rep(j, W) cin >> Board[i][j];
  vector<int> del_row;
  rep(i, W) {
    bool is_check = true;
    rep(j, H) {
      if (Board[j][i] == '#') {
        is_check = false;
        break;
      }
    }
    if (is_check == true)del_row.push_back(i);
  }
  vector<int> del_line;
  rep(i, H) {
    bool is_check = true;
    rep(j, W) {
      if (Board[i][j] == '#') {
        is_check = false;
        break;
      }
    }
    if (is_check == true)del_line.push_back(i);
  }

  rep(i, H) {
    if (find(del_line.begin(), del_line.end(), i) != del_line.end()) continue;
    rep(j, W) {
      if (find(del_row.begin(), del_row.end(), j) != del_row.end()) continue;
      cout << Board[i][j];
    }
    cout << '\n';
  }
}


Measured memory_bytes: 256
N = int(input())
a_list = [int(i) for i in input().split()]
b_list = [0 for i in range(N)]
for i in range(N):
    b_list[i] = a_list[i] - (i + 1)
b_list.sort()
b1,b2 = b_list[N//2-1], b_list[N//2]
c1,c2 = 0,0
for i in range(N):
    c1 += abs(a_list[i] - (b1 + i + 1))
for i in range(N):
    c2 += abs(a_list[i] - (b2 + i + 1))
print(min(c1,c2))

Measured memory_bytes: 26180
#include<iostream>
#define N 100
using namespace std;

int main(){
    int n,a[N],b[N],c[N],x=0;
    cin>>n;
    for(int i=0;i<n-1;i++){
        cin>>a[i];
    }
    b[0]=a[0];
    x+=b[0];
    for(int i=1;i<n-1;i++){
        if(a[i-1]<=a[i]){
            b[i]=a[i-1];
            x+=b[i];
        }
        else{
            b[i]=a[i];
            x+=b[i];
        }
    }
    b[n-1]=a[n-2];
    x+=b[n-1];
    cout<<x<<endl;
}



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

namespace CompetitiveProgramming
{
    class Solve
    {
        public Solve()
        {
            int N = Scanner.nextInt();
            int[] L = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            Array.Sort(L);
            int ans = 0;
            for (int i = 0; i < 2 * N; i += 2)
            {
                ans += L[i];
            }
            Console.WriteLine(ans);
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            new Solve();
        }
    }

    public class Pair<T, U>
    {
        public Pair()
        {

        }
        public Pair(T first, U second)
        {
            this.first = first;
            this.second = second;
        }
        public T first { get; set; }
        public U second { get; set; }
    }

    class Scanner
    {
        private static List<string> buf = new List<string>();

        private static void next()
        {
            if (buf.Count == 0)
            {
                buf = Console.ReadLine().Split().ToList();
            }
        }

        private static string pop()
        {
            string ret = buf[0];
            buf.RemoveAt(0);
            return ret;
        }

        public static int nextInt()
        {
            next();
            return int.Parse(pop());
        }
        public static long nextLong()
        {
            next();
            return long.Parse(pop());
        }
        public static string nextString()
        {
            next();
            return pop();
        }
        public static double nextDouble()
        {
            next();
            return double.Parse(pop());
        }
    }
}


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

int ua, ta, tp;

int main() {
    scanf("%d%d%d", &ua, &ta, &tp);
    if(ua + ta >= tp || ua + ta == tp - 1) printf("%d\n", ta + tp);
    else printf("%d\n", ua + (2 * ta) + 1);
}

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


int main() {
	int x,y,z;
	cin>>x;
	y=x%500;
	cin>>z;
	if(y<=z){
		cout<<"Yes"<<endl;
	}
	else if(y>z){
		cout<<"No"<<endl;
	}
	else{
		cout<<"error"<<endl;
	}

}


Measured memory_bytes: 256
while True:
    h,w,n = map(int, input().split())
    if h==0: break
    
    mapp = []
    for i in range(h):
        hoge = list(map(int,input().split()))
        hoge.append(0)
        mapp.append(hoge)
    mapp.append([0]*(w+1))

    n -= 1
    nmap = [[0]*(w+1) for _ in range(h+1)]
    nmap[0][0] = n
    for i in range(h):
        for j in range(w):
            nmap[i+1][j] += (nmap[i][j]+1-mapp[i][j]) // 2
            nmap[i][j+1] += (nmap[i][j]+mapp[i][j]) // 2
            mapp[i][j] = (nmap[i][j]+mapp[i][j]) % 2

    i,j = 0,0
    while i < h and j < w:
        if mapp[i][j] == 0:
            i += 1
        else:
            j += 1
    print(i+1,j+1)

Measured memory_bytes: 30880
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,N) for(auto i=0; i<N; ++i)
#define ALL(x) x.begin(), x.end()

/* clang-format off */
template <class T> inline void chmin(T& a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T& a, const T& b) { if (b > a) a = b; }
/* clang-format on */

int main() {

  ll N; cin >> N;
  vector<ll> A(N); FOR(i, N) cin >> A[i];
  auto B(A); transform(ALL(A), B.begin(), [](auto a) { return abs(a); }); // 絶対値　
  sort(ALL(B)); // 絶対値でソート
  vector<pair<ll, ll>> memo; // 答えをメモっとく。

  ll plsCount = 0; for (auto a : A) if (a >= 0) plsCount += 1; // 正の数がN個、または0個のときだけ、pls, neg を調整する。

  //////////////////////////////////// pls, neg の更新　//////////////////////////////////
  vector<ll> pls, neg;

  //////////////////////////////////  コーナーケースの処理//////////////////////////////////  
  if (plsCount == 0) {
    ll idx = -1;
    for (int i = 0; i < N; ++i) {
      if (abs(A[i]) == B[0]) {
        idx = i; break;
      }
    }
    pls.push_back(A[idx]);

    A.erase(A.begin() + idx);
  }
  else if (plsCount == N) {
    ll idx = -1;
    for (int i = 0; i < N; ++i) {
      if (abs(A[i]) == B[0]) {
        idx = i; break;
      }
    }
    neg.push_back(A[idx]);


    A.erase(A.begin() + idx);
  } ////////////////////////////////////////////////////////////////////////////////////  

  for (auto a : A) {
    if (a >= 0) pls.push_back(a);
    else neg.push_back(a);
  } ////////////////////////////////////////////////////////////////////////////////////


  ll ans = neg.back(); neg.pop_back();
  // 
  // まず先に、正の数を足しこむ。そのために、 -1, 2, 3 だったら、 -1 -2 という形を作って、マイナスを増やす感じで膨らます。
  // -1 -2 -3  しかし最後の-3のときに正にするため、 3 - (-1 - 2 ) という形式にする。
  while (pls.size() != 1) {
    /*答えのメモ*/memo.emplace_back(ans, pls.back());
    ans = ans - pls.back();
    pls.pop_back();
  }
  /*答えのメモ*/memo.emplace_back(pls.back(), ans);
  ans = pls.back() - ans;
  pls.pop_back();

  while (!neg.empty()) {
    /*答えのメモ*/memo.emplace_back(ans, neg.back());
    ans += abs(neg.back());
    neg.pop_back();
  }
  
  cout << ans << endl;

  for (auto v : memo) {
    cout << v.first << " " << v.second << endl;
  }

  return 0;
}


Measured memory_bytes: 6768
#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;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef pair<int, int> p;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int k; cin >> k;

    int e, o;
    e = k / 2;
    o = k / 2;
    if(k % 2 == 1) o++;
    cout << e * o << endl;



}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);
#define ppp(a) (cout << (a) << endl);
#define cop(a) for(auto x:(a)){cout << x << endl;}


using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

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

constexpr char sp = ' ';
constexpr char cmm = ',';
constexpr int MOD = 1e9+7;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
inline void Yes(){cout << "Yes" << endl;}
inline void No(){cout << "No" << endl;}
inline void Judge(bool b){b?Yes():No();}
inline void YES(){cout << "YES" << endl;}
inline void NO(){cout << "NO" << endl;}
inline void JUDGE(bool b){b?YES():NO();}
ll powmod(ll b, ll e){ll r=1;while(e>0){if(e&1)r=(r%MOD)*(b%MOD)%MOD;b=(b%MOD)*(b%MOD)%MOD;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

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; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}
template<typename T> ostream& operator<<(ostream& s, const set<T>& st) {
    int len = st.size();
    s << '{';
    int i = 0;
    for (auto x : st) {
        s << x; if (i < len-1) s << ", ";
        ++i;
    }
    s << '}';
    return s;
}

struct aaa{
    aaa(){
        // comment this out when you use scanf or printf
        // cin.tie(0); ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(15);
    };
}fastio;

vector<vector<int>> dp;
int main(){

    string s, t;
    cin >> s >> t;
    int n = s.size(), m = t.size();
    dp.resize(n+1, vector<int>(m+1, 0));
    rep(i, n){
        rep(j, m){
            if(s[i] == t[j]) dp[i+1][j+1] = dp[i][j]+1;
            else dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1]);
        }
    }

    string ans = "";
    while(n > 0 and m > 0){
        if(dp[n][m] == dp[n-1][m]) --n;
        else if(dp[n][m] == dp[n][m-1]) --m;
        else --n, --m, ans = s[n]+ans;
    }
    ppp(ans);


    return 0;
}


Measured memory_bytes: 35584
from functools import lru_cache
import numpy as np

N,K=[int(i) for i in input().split(" ")]
V=[int(i) for i in input().split(" ")]

retval=0
for left in range(max(N+1,K+1)):
    for right in range(min(N-left+1,K-left+1)):
        modoseru=K-(left+right)
        temoto=np.asarray(sorted(V[:left:]+V[N-right::]))
        modosu=min(np.sum(temoto<0),modoseru)
        retval=max(sum(temoto[modosu::]),retval)

print(retval)


Measured memory_bytes: 14412
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const double pi = acos(-1.0);
const double EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

template<typename T>
T floor_sum(T n, T m, T a, T b){
    T ret = (a/m)*(n*(n-1)/2) + (b/m)*n;
    a %= m, b %= m;
    T y = (a*n+b)/m;
    if(y == 0) return ret;
    ret += floor_sum(y, a, m, a*n-(m*y-b));
    return ret;
}

int main(){
    int 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: 3624
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset

using namespace std;

int main() {

	long n,m[100001],count = 0,max=0,coutn=0;


	cin >> n;

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

	for (int i = 0; i < n; i++) {
		if (max < m[i]) {
			if (count > coutn)coutn = count;
			count = 0;
			max = m[i];
		}
		else {
			max = m[i];
			count++;
		}
	}

	if (count > coutn)coutn = count;

	cout << coutn << endl;

	return 0;
}


Measured memory_bytes: 1024
n = int(input())
dp = [{} for i in range(n + 1)]
s = "AGCT"
M = 10 ** 9 + 7
 
for j in range(n + 1):
  for c1 in s:
    for c2 in s:
      for c3 in s:
        dp[j][c1 + c2 + c3] = 0
 
dp[0]["TTT"] = 1
 
for l in range(n):
  for c1 in s:
    for c2 in s:
      for c3 in s:
        for p in s:
          if c2 == "A" and c3 == "G" and p == "C":
            continue
          if c1 == "A" and c3 == "G" and p == "C":
            continue
          if c1 == "A" and c2 == "G" and p == "C":
            continue
          if c2 == "G" and c3 == "A" and p == "C":
            continue
          if c2 == "A" and c3 == "C" and p == "G":
            continue
          dp[l + 1][c2 + c3 + p] += dp[l][c1 + c2 + c3]
          dp[l + 1][c2 + c3 + p] = dp[l + 1][c2 + c3 + p] % M
 
ans = 0
for c1 in s:
  for c2 in s:
    for c3 in s:
      ans += dp[n][c1 + c2 + c3]
      ans = ans % M
print(ans)

Measured memory_bytes: 3828
a = 0
b = 0
op = "+"
ans = 0
while op != "?":
    z = input()
    a,op,b = [str(x) for x in z.split()]
    a = int(a)
    b = int(b)
    if op == "+":
        ans = a + b
        print (str(ans))
    elif op == "-":
        ans = a - b
        print (str(ans))
    elif op == "*":
        ans = a * b
        print (str(ans))
    elif op == "/":
        ans = a // b
        print (str(ans))


Measured memory_bytes: 5600
import collections

n = int(input())
a=[int(i) for i in input().split()]
#a.sort()

c = collections.Counter(a)

#print(c)
ans=0
for i in set(a):
  tmp=c[i]
  if tmp-i<0:
    ans+=tmp
  else:
    ans+=tmp-i
  
print(ans)



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

#define sz(x) int(x.size())
#define pii pair<int, int>
#define All(x) (x).begin(), (x).end()
#define mp make_pair
#define Task "abc"

typedef long long ll;
const int maxn = 2e5 + 10;
const ll mod = 1e9 + 7;

ll f[maxn][3];

int main(){
  ios_base::sync_with_stdio(0); cin.tie(NULL);
//  freopen(Task".inp", "r", stdin); freopen(Task".out", "w", stdout);
  int n; cin >> n;
  vector<int> a(n+1);
  for (int i = 1; i <= n; ++i){
    cin >> a[i];
  }
  ll inf = ll(1e18);
  for (int i = 0; i <= n; ++i)
  for (int j = 0; j < 3; ++j) f[i][j] = -inf;
  f[1][0] = -inf; f[1][1] = 0; f[1][2] = a[1];
  f[2][0] = 0; f[2][1] = max(a[1], a[2]);
  for (int i = 3; i <= n; ++i){
    int l = i/2 - 1, r = (i+1) / 2;
    int opl = (i-2)/2 - 1, opr = (i-1) / 2;
    for (int j = opl; j <= opr; ++j){
      if (l <= j + 1 && j + 1 <= r) f[i][j - l + 1] = max(f[i][j - l + 1], f[i-2][j - opl] + a[i]);
    }
    opl = (i-1)/2 - 1, opr = i / 2;
    for (int j = opl; j <= opr; ++j){
      if (l <= j && j <= r) f[i][j - l] = max(f[i][j - l], f[i-1][j - opl]);
    }
  }
  cout << f[n][1];
return 0;
}




Measured memory_bytes: 8728
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ut i=(a);i<(ut)(b);i++)
#define REP(i,b) FOR(i,0,b)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define cat //cout << __LINE__ << endl;
using namespace std;
typedef long long LL;
typedef double ld;
typedef LL ut;
typedef vector<ut> VI;
typedef pair<ut,ut> pr;
const int SIZE=1001;
const int INF=10+1e9;
bool exist[10][10];

int N,M;
int DP[SIZE+10][SIZE+10];
int main(){
	int a,b,c,MA,MB;
	cin >> N;
	cin >> MA >> MB;
	REP(i,SIZE) REP(j,SIZE) DP[i][j]=INF;
	DP[0][0]=0;
	REP(i,N){
		cin >> a>> b >> c;
		REP(ii,SIZE) REP(jj,SIZE){
			int i=SIZE-1-ii,j=SIZE-1-jj;
			DP[i+a][j+b]=min(DP[i+a][j+b],DP[i][j]+c);
		}
	}
	int ans=INF;
	for(int i=1;max(MB,MA)*i<SIZE;i++){
		ans=min(ans,DP[MA*i][MB*i]);
	}
	if(ans>INF/2) cout << -1 << endl;
	else cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4224
#include<bits/stdc++.h>
int main()
{
	int n ,i;
	scanf("%d",&n);
	int a[n+1] ,b[n+1];
	for(i = 1; i <= n; i++)
	{
		scanf("%d",&a[i]);
		b[i] = a[i];
	}
	int pos = n/2;
	std::sort(b+1,b+n+1);
	for(i = 1; i <= n; i++)
	{
		if(b[pos] >= a[i])
			printf("%d\n",b[pos+1]);
		else printf("%d\n",b[pos]);
	}
	return 0;
}

Measured memory_bytes: 3712
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>

using namespace std;

//#include <ext/pb_ds/assoc_container.hpp>
//
//using namespace __gnu_pbds;
//typedef tree<int, null_type, less<>, rb_tree_tag,
//        tree_order_statistics_node_update>
//        indexed_set;

#define MP make_pair
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) (int((x.size())))
#define fi first
#define se second
#define REP(i, a, b) for (int (i)=(a);(i)<(b);(i)++)
#define PER(i, a, b) for (int (i)=(b)-1;(i)>=(a);(i)--)

typedef long double ld;
typedef long long ll;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<ll> VL;
typedef vector<PLL> VPL;
typedef vector<PII> VPI;

#ifdef qwerty
#define dbb(x)        { cerr << #x << " = " << x << "\t";      }
#define db(x)        { dbb(x); cerr << endl; }
#define db2(x, y)    { dbb(x); dbb(y); cerr << endl; }
#define db3(x, y, z)    { dbb(x); dbb(y); dbb(z); cerr << endl; }
#else
#define dbb(x)	404;
#define db(x)	404;
#define db2(x,y) 404;
#define db3(x,y,z)	404;
#endif


const ll MOD = 1000000007ll;

ll powmod(ll a, ll b) {
    ll res = 1;
    a %= MOD;
    assert(b >= 0);
    for (; b; b >>= 1) {
        if (b & 1) res = res * a % MOD;
        a = a * a % MOD;
    }
    return res;
}

template<typename t1, typename t2>
inline bool upmax(t1 &a, t2 b) {
    if (a < (t1) b) {
        a = (t1) b;
        return true;
    } else return false;
}

template<typename t1, typename t2>
inline bool upmin(t1 &a, t2 b) {
    if (a > (t1) b) {
        a = (t1) b;
        return true;
    } else return false;
}

template<typename T>
inline T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

template<typename T>
inline T lcm(T a, T b) { return a * (b / gcd(a, b)); }

template<typename T>
inline T sqr(T a) { return a * a; }

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

const int INF = 1000000404;
const ll LINF = 1e18 * (1ll);
const ld PI = 3.14159265358979323846;
const ld EPS = 1e-9;

const int SQ = 318;
int timer = 0;


const int a_lot_of_test = 0;
#define N 100100


void solve() {

    ll A, B, C, K;
    cin >> A >> B >> C >> K;
    ll s = 0;

    ll foo = min(K, A);
    s += foo;
    A -= foo;
    K -= foo;

    foo = min(K, B);
    B -= foo;
    K -= foo;

    foo = min(K, C);
    s -= foo;
    C -= foo;
    K -= foo;
    cout << s << endl;
}

int main() {

#ifdef qwerty
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    //freopen("input.in", "r", stdin);
    //freopen("output.out", "w", stdout);
#endif

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int t = 1;
    if (a_lot_of_test) cin >> t;
    for (int i = 1; i <= t; i++) {
        solve();
    }


    return 0;
}

Measured memory_bytes: 3656
#include<stdio.h>
int G[101][101],n,m=1,stump[101][2];
int DFS(int);
int main(void)
{
    int k,v,u,i,j;
    scanf("%d", &n);
    for(i=0;i<=n;i++){
        for(j=0;j<=n;j++) G[i][j]=0;
        stump[i][0]=0;
        stump[i][1]=0;
    }
    for(i=0;i<n;i++){
        scanf("%d", &u);
        scanf("%d", &k);
        for(j=0;j<k;j++){
            scanf("%d", &v);
            G[u][v] = 1;
        }
    }
    DFS(1);
    for(i=1;i<=n;i++){
        if(stump[i][0]==0) DFS(i);
    }
    for(i=1;i<=n;i++) printf("%d %d %d\n", i, stump[i][0], stump[i][1]);
    return 0;
}
int DFS(int num)
{
    int l;
    if(stump[num][0]==0){
        stump[num][0]=m;
        m++;
    }
    for(l=0;l<=n;l++){
        if(G[num][l]==1&&stump[l][0]==0) DFS(l);
    }
    if(stump[num][1]==0){
        stump[num][1]=m;
        m++;
    }
    return 0;
}

Measured memory_bytes: 636
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<char> s(n);
  for(int i=0;i<n;i++)cin >> s[i];
  if(n==1 || n%2==1){
    cout << "No" << endl;
    return 0;
  }
  int j=n/2;
  for(int i=j;i<n;i++){
    if(s[i-j]!=s[i]){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 3628
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
using namespace std;

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

    cout << max(0, a - 2 * b) << endl;
}

Measured memory_bytes: 384