akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define N 512
#define ll long long
#define misaka 250
#define rep(i, h) for (int i = misaka - h; i <= h + misaka; i++) if (i)
using namespace std;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(ch>'9'||ch<'0')ch=='-'&&(f=0)||(ch=getchar());
	while(ch<='9'&&ch>='0')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return f?x:-x;
}
int fa[N], sz[N], out[N], ini[N], vis[N];
int find(int x){return x==fa[x]?x:fa[x]=find(fa[x]);}
void merge(int x, int y) {
	int xx = find(x), yy = find(y);
	if (xx == yy) ++ sz[xx];
	else fa[xx] = yy, sz[yy] += sz[xx] + 1;
}
int main(int argc, char const *argv[]) {
	int n = read(), h = read();
	rep(i, h) fa[i] = i, sz[i] = 1;
	for (int i = 1; i <= n; i++) {
		int a = read(), b = read(), c = read(), d = read();
		int x = (c ? -c : a) + misaka;
		int y = (d ? d : -b) + misaka;
		out[x] ++; ini[y] ++;
		merge(x, y);
	}
	for (int i = 1 + misaka; i <= h + misaka; i++)
		if (out[i] < ini[i]) return puts("NO") & 0;
	for (int i = misaka - h; i <= misaka - 1; i++)
		if (ini[i] < out[i]) return puts("NO") & 0;
	rep(i, h) vis[find(i)] |= (out[i] != ini[i]);
	rep(i, h)
		if (sz[find(i)] > 1 && find(i) == i && !vis[i])
			return puts("NO") & 0;
	puts("YES");
	return 0;
}


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

int main(){

    int a, b, c;
    cin >> a >> b >> c;
    swap(a, b);
    swap(a, c);

    cout << a << " " << b << " " << c;
    
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int>> vvint;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<int, vector<int>, greater<int>> spqint; //小さい順に取り出し
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;     //小さい順に取り出し
typedef priority_queue<int, vector<int>, less<int>> bpqint;    //大きい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;        //大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define PF push_front
#define TS to_string
#define BS binary_search
#define LB lower_bound
#define UB upper_bound
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


int INF = 1e9;
int NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
double EPS = 1e-9;
double PI = M_PI;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}
//-----------------------------------------
vector<long long> factor_array(long long n){
    vector<long long> res ;
    for(long long i=1;i*i<=n;i++){
        if(n%i==0){
            res.push_back(i) ;
            if(i*i!=n){
                res.push_back(n/i) ;
            }
        }
    }
    sort(res.begin(),res.end()) ;
    return res ;
}
//-----------------------------------------
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::chrono::system_clock::time_point start,end;
    start = std::chrono::system_clock::now();
    int n ;
    cin >> n ;
    vint a(n+1) ;
    vint b(n+1,0) ;
    REP(i,n){
        cin >> a[i+1] ;
    }
    vint ans ;
    for(int i=n;i>0;i--){
        int cnt = 0 ;
        int j = 2*i ;
        while(j<=n){
            cnt += b[j] ;
            j += i ;
        }
        if(cnt%2!=a[i]){
            ans.PB(i) ;
            b[i] += 1 ;
        }
    }
    cout << SZ(ans) <<endl;
    REP(i,SZ(ans)){
        cout << ans[i] <<" ";
    }
    cout <<endl;




    end = std::chrono::system_clock::now();
    auto elapsed = std::chrono::duration_cast< std::chrono::milliseconds >(end - start).count();
    //std::cout << elapsed <<"ms"<< std::endl;

    

    return 0;
}



Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using i64 = int64_t;
using ll = long long;
int main() {
  int N;
  cin >> N;
  vector<int> h(N), g(N);
  rep(i,N){
    cin >> h.at(i);
    g.at(i) = h.at(i);
  }
  int ans = 0;
  rep(i,100){
    rep(j,N){
      if(j == 0 && h.at(j) > 0){
        ans ++;
        g.at(j) --;
      }
      else if(h.at(j) > 0){
        if(h.at(j-1) == 0){
          ans ++;
        }
        g.at(j) --;
      }
    }
    h = g;
  }
  cout << ans << endl;
}

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

namespace ABC178
{
    using static Ex;
    public class Solve
    {
        public static void Main(string[] args)
        {
            new ABC_A();
        }
    }
    public class ABC_A
    {
        public ABC_A()
        {
            var x = ReadInt;
            if (x == 0) 1.Cw();
            else 0.Cw();
        }
    }
    public class ABC_B
    {
        public ABC_B()
        {
        }
    }
    public class ABC_C
    {
        public ABC_C()
        {
        }
    }

    public static class Ex
    {
        public static void Cw(this object s) { Console.WriteLine(s); }



        public static bool Mins<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }
        public static bool Maxs<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
        public static void Swap<T>(ref T a, ref T b) { var t = b; b = a; a = t; }
        public static void Swap<T>(List<T> list, int i, int j) { T tmp = list[j]; list[j] = list[i]; list[i] = tmp; }

        public static long Lcm(int x, int y) { return x / Gcd(x, y) * y; }
        public static long Gcd(long m, long n) { if (n == 0) return m; return Gcd(n, m % n); }
        public static List<string> FastSort(this List<string> s) { s.Sort(StringComparer.Ordinal); return s.ToList(); }
        public static void yesno(this bool b) { (b ? "yes" : "no").Cw(); }
        public static void YesNo(this bool b) { (b ? "Yes" : "No").Cw(); }
        public static void YESNO(this bool b) { (b ? "YES" : "NO").Cw(); }

        public static string Read { get { return Console.ReadLine().Trim(); } }
        public static int ReadInt { get { return int.Parse(Read); } }
        public static long ReadLong { get { return long.Parse(Read); } }
        public static double ReadDouble { get { return double.Parse(Read); } }
        public static string[] ReadArray() { return Read.Split(' '); }
        public static int[] ReadIntArray() { return Read.Split(' ').Select(int.Parse).ToArray(); }
        public static long[] ReadLongArray() { return Read.Split(' ').Select(long.Parse).ToArray(); }
        public static string[] ReadArray(long N) { var v = new string[N]; for (long i = 0; i < N; ++i) v[i] = Read; return v; }
        public static int[] ReadIntArray(long N) { var v = new int[N]; for (long i = 0; i < N; ++i) v[i] = ReadInt; return v; }
        public static long[] ReadLongArray(long N) { var v = new long[N]; for (long i = 0; i < N; ++i) v[i] = ReadLong; return v; }

        public static (T, T) ToTpl2<T>(this T[] v) { return (v[0], v[1]); }
        public static (T, T, T) ToTpl3<T>(this T[] v) { return (v[0], v[1], v[2]); }
        public static (T, T, T, T) ToTpl4<T>(this T[] v) { return (v[0], v[1], v[2], v[3]); }
        public static (T, T, T, T, T) ToTpl5<T>(this T[] v) { return (v[0], v[1], v[2], v[3], v[4]); }
    }
}


Measured memory_bytes: 27532
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define MAX_N 200
int par[MAX_N];
int rank[MAX_N];

typedef struct{int p1; int p2; int leng;}map;

void init(int n){
	int i;
	for(i=0;i<n;i++){
		par[i] = i;
		rank[i] = 0;
	}
}

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

void unite(int x,int y){
	x =find(x);
	y =find(y);
	if(x==y){
		return ;
	}
	if(rank[x] < rank[y]){
		par[x] = y;
	}else {
		par[y] = x;
		if(rank[x] == rank[y])rank[x]++;
	}
}

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

int comp(const void* c1,const void* c2);

int main(){
	int n,m,i,count,num;
	map* road;

	while(1){
		scanf("%d",&n);
		if(n==0)break;
		init(n);

		scanf("%d",&m);
		road=(map*)malloc(m*sizeof(map));
		for(i=0;i<m;i++){
			scanf("%d,%d,%d",&road[i].p1,&road[i].p2,&road[i].leng);
		}

		qsort(road,m,sizeof(map),comp);
		i=0; count=0; num=0;
		while(count<n-1){
			if(!same(road[i].p1,road[i].p2)){
				unite(road[i].p1,road[i].p2);
				count++;
				num+=(road[i].leng/100)-1;
			}
			i++;
		}
		printf("%d\n",num);
		free(road);
	}
	return 0;
}

int comp(const void *c1,const void *c2){
	map data1=*(map*)c1;
	map data2=*(map*)c2;

	int temp1=data1.leng;
	int temp2=data2.leng;

	return temp1-temp2;
}

Measured memory_bytes: 768
#include<stdio.h>
#include<string.h>

//こっち
char t1[1510];
char t2[1510];
char t3[1510];

int main() {
    int n, a, b, i, j;
    char t;
    
    //文字列入力
    scanf("%s", &t1);
    //命令の数の入力
    scanf("%d", &n);
    
    for (i=0; i<n; i++) {//命令の数の分だけ
        scanf("%s", &t3); //具体的に入力
        if (strcmp(t3, "replace") == 0) { //replaceと一致
            scanf("%d %d %s", &a, &b, &t2); //条件
            for (j=0; j<b-a+1; j++) {
                t1[a+j] = t2[j]; //場所を指定して入れ替え
            }
        }else if (strcmp(t3, "reverse") == 0) { //reverseと一致
            scanf("%d %d", &a, &b); //条件
            while (a<b) { //aがbより小さい間
                t = t1[a]; //tmp的な扱い
                t1[a] = t1[b];
                t1[b] = t;
                a++;//進める
                b--;
            }
        }else if (strcmp(t3, "print") == 0) { //printと一致
            scanf("%d %d", &a, &b);//条件
            for (j=a; j<b+1; j++) {
                printf("%c", t1[j]);//そのまま印字
            }
            puts("");
        }
    }
    
    return 0;
}




Measured memory_bytes: 2104
#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 A, B, C;
  cin >> A >> B >> C;
  if (B / A < C) {
    cout << B / A << endl;
  } else {
    cout << C << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
using namespace std;
#define pi pair<int32,int32>
#define pl pair<int64,int64>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
// cout << fixed << setprecision(10);
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}
int main(){
    int N; cin >> N;
    long long a[100010];
    for (int i = 1; i <= N; i++){
        cin >> a[i];
    }
    long long L[100010],R[100010];
    L[0] = 0, L[N+1] = 0;
    R[0] = 0, R[N+1] = 0;
    for (int i = 1; i <= N; i++){
        L[i] = GCD(a[i],L[i-1]);
    } 
    for (int i = N; i >= 1; i--){
        R[i] = GCD(a[i],R[i+1]);
    }
    long long mx = 0;
    for (int i = 1; i <= N; i++){
        mx = max(mx, GCD(L[i-1],R[i+1]));
    }
    cout << mx << endl;
} 


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

int main()
{
    int a,b,c;
    cin>>a>>b;
    if(a<b)
    {
        a=a;
        b=b;
}
        else
        {
        int i=a;
        a=b;
        b=i;
        }
    if(a==1&&b==2)
        c=3;
    else if(a==2&&b==3)
        c=1;
    else if(a==1&&b==3)
    c=2;
    cout<<c;
}


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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)        //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++)   //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)      //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e
#define RANGE(i,v) for(auto &(i):v)                  //repeat range
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))          //array size

using LL = long long;

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vll = V<LL>;
using Vs = V<string>;

template<typename T>
T SUM(V<T> v, T init_val=0){return accumulate(ALL(v),T(init_val));}

template<typename T>
T MAX(V<T> v){return *max_element(ALL(v));}

int main(){
    int n;
    cin>>n;
    Vi l(n);
    REP(i,n) cin>>l[i];

    int l_max = MAX(l);
    if(l_max<SUM(l)-l_max){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    string s;
    cin >> s;
    int n = s.length();
    string sr = s;
    reverse(ALL(sr));
    if (s == sr){
        cout << 0 << endl;
        return 0;
    }

    string t;
    VI p;
    p.push_back(-1);
    REP(i,n){
        char c = s[i];
        if (c != 'x'){
            t += c;
            p.push_back(i);
        }
    }
    p.push_back(n);
    string tr = t;
    reverse(ALL(tr));
    if (t != tr){
        cout << -1 << endl;
        return 0;
    }


    ll ans = 0;
    int m = p.size();
    REP(i,(m+1)/2-1){
        int x = p[i+1] - p[i];
        int y = p[m-1-i] - p[m-2-i];
        ans += abs(x-y);
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 1148
/**
*    created: 10.07.2020 16:50:06
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
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;}
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1LL << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

signed main() {

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

    int n; cin >> n;
    if (n < 1200) cout << "ABC" << endl;
    else cout << "ARC" << endl;
    return 0;
}

Measured memory_bytes: 3524
#include<iostream>
#include<cmath>
#include<map>
#include<vector>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

void fzation(li n,map<li,li>& mp){
  li b=2;
  while(n%b==0){
    mp[b]++;
    n/=b;
  }
  b=3;
  while(n>=b*b){
    while(n%b==0){
      mp[b]++;
      n/=b;
    }
    b+=2;
  }
  if(n!=1) mp[n]++;
}

li take(li x){
  return ((-1+(li)sqrt(1+8*x+0.01))/2);
}

int main(){
  li n; cin >>n;
  map<li,li> mp;
  fzation(n,mp);

  li s=0;
  for(pair<li,li> x:mp){
    s+=take(x.second);
  }
  print(s);
}


Measured memory_bytes: 3720
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<cstdio>
#include<string>
#include<vector>
//#include<string>
//#include<sstream>
using namespace std; 
const int MAX_V=10000+5;
const int INF=1<<30;
int pre[MAX_V];
int cost[MAX_V][MAX_V];//cost[u][v]表示边e=(u,v)的权值（不存在这条边时设为INF）
bool visited[MAX_V][MAX_V];
int d[MAX_V];//顶点s出发的最短距离
bool used[MAX_V];//已经使用过的图
int V,E;//顶点数，边数
//求从起点s出发到各个顶点的最短距离
void dijkstra(int s)
{
    fill(d+1,d+V+1,INF);
    fill(used+1,used+V+1,false);
    fill(pre+1,pre+V+1,-1);
    d[s]=0;
    while(true)
    {
        int v=-1;
        //从尚未使用过的顶点中选择一个距离最小的顶点
        for(int u=1; u<=V; u++)
        {
            if(!used[u]&&(v==-1||d[u]<d[v]))
                v=u;
        }
        if(v==-1)
            break;
        used[v]=true;
        for(int u=1; u<=V; u++)
        {
            if(d[u]>d[v]+cost[v][u])
            {
                d[u]=d[v]+cost[v][u];
                pre[u]=v;
            }
        }
    }
}
vector<int> get_path(int t)
{
    vector<int>path;
    for(; t!=-1; t=pre[t])
        path.push_back(t);
    reverse(path.begin(),path.end());
    return path;
}
int main()
{
    scanf("%d%d",&V,&E);
    int a,b,c;
    for(int i=1;i<=V;i++)
    {
        for(int j=1;j<=V;j++)
            cost[i][j]=INF;
    }
    for(int i=0;i<E;i++)
    {
        scanf("%d%d%d",&a,&b,&c);
        cost[a][b]=cost[b][a]=c;
    }
    memset(visited,false,sizeof(visited));
    int ans=E;
    for(int i=1;i<=V;i++)
    {
        dijkstra(i);
        for(int j=1;j<=V;j++)
        {
            if(i==j)
                continue;
            vector<int>v=get_path(j);
            for(int i=0;i<v.size()-1;i++)
            {
                int a=v[i];
                int b=v[i+1];
                if(!visited[v[i]][v[i+1]]&&!visited[v[i+1]][v[i]])
                {
                    visited[v[i]][v[i+1]]=visited[v[i+1]][v[i]]=true;
                    ans--;
                }
            }
        }
    }
    printf("%d\n",ans);
    return 0;
}


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

using namespace std;

#define int long long
#define endl '\n'
#define maxn 1000010
const int MOD = 1000000007;

int pw[maxn + 10];

void solve() {
    int k;
    cin >> k;

    pw[0] = 1;
    pw[0] %= k;
    for (int i = 1; i <= maxn; i++)pw[i] = (pw[i - 1] * 10) % k;
    int cur = 0;
    for (int d = 1; d <= maxn; d++) {
        cur = (cur + pw[d - 1] * 7 % k);
        cur %= k;
        if (cur == 0) {
            cout << d << endl;
            return;
        }
    }
    cout << -1 << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 11456
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const ll INF=mod*mod;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 ll gcd(ll m,ll n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
ll lcm(ll a,ll b){
  ll g=gcd(a,b);
  return a/gcd(a,b)*b;
		

}
int main(){
  
  ll N,x;
  cin>>N>>x;
  
  vector<ll>a(N);
  vector<ll>A(N-1);

  
  for(ll i=0;i<N;i++){
cin>>a[i];
  }
  ll ans=0;
 rep(i,N-1){
   A[i]=a[i]+a[i+1];
   if(A[i]>x){
     ll sub=A[i]-x;
       if(a[i+1]<sub){
         ans+=sub;
         a[i+1]=0;
       }
       else{
         ans+=sub;
         a[i+1]-=sub;
       
     }

   }
   
 }
  
  cout<<ans<<endl;
}


Measured memory_bytes: 1792
def chmax(a, b):
    return a if a >= b else b


N = int(input())
abc_list = []
for _ in range(N):
    abc_list.append([int(x) for x in input().split()])

dp = [[0, 0, 0] for _ in range(N+1)]

for i in range(N):
    for j in range(3):
        for k in range(3):
            if j == k:
                continue
            dp[i+1][k] = chmax(dp[i+1][k], dp[i][j] + abc_list[i][k])

print(max(dp[-1]))


Measured memory_bytes: 44100
/*E869120 は 1円硬貨を A枚と
500円硬貨を無限枚持っています.
これらの硬貨だけを使うことによって, ちょうど
N円を支払うことができるかを判定しなさい.

*/
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N , A;
  cin >> N >> A;
  bool p = false;
  int sum =0;
  for(int i = 0; 500 * i< N+1; i++){

  sum = 500 * i;
}
for(int j = 0 ; j < A+1; j++){
  if(sum + j == N){
    p = true;
  break;}
}
if(p){
  cout << "Yes" ;
}
else{
  cout << "No" ;
}
}
//なぜか失敗したのでコードのミス等あれば教えて欲しい


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


int main() {
    int x, y;
    cin >> x >> y;

    int ans = abs(abs(x) - abs(y));
    if (x > y && y > 0) ans += 2;
    else if (x < 0 && 0 < y) ans++;
    else if (y <= 0 && 0 <= x) ans++;
    else if (y < x && x < 0) ans += 2;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; (i) < (n); (i)++)
using namespace std;
using Graph = vector<vector<int>>;
using P = pair<long, long>;

long modpow(long a, long n, long mod) {
    long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod を計算する
long modinv(long a, long mod) {
    return modpow(a, mod - 2, mod);
}

struct compare1 { 
    bool operator()(const pair<long, long>& value,  
                                const long& key) 
    { 
        return (value.first < key); 
    } 
    bool operator()(const long& key,  
                    const pair<long, long>& value) 
    { 
        return (key < value.first); 
    } 
}; 

int main()
{
    string S; cin >> S;
    int len = S.length();
    bool flag = true;
    REP(i, len){
        if(S[i] != S[len - 1 - i]){
            flag = false;
            break;
        }
    }
    REP(i, (len-1)/2)
        if(S[i] != S[(len-1)/2 - 1 - i]){
            flag = false;
            break;
        }

    for(int i = (len+3)/2-1; i < len; i++)
        if(S[i] != S[len - 1 - i]){
            flag = false;
            break;
        }
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for(ll i=(ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
constexpr ll INF = 1LL<<60;

int main() {
    string s;
    cin >> s;

    auto f = [&](string t) {
        bool flag = true;
        ll m = t.size();
        REP(i, m/2) if(t[i] != t[m-1-i]) flag = false;
        return flag;
    };

    ll n = s.size();
    if(f(s) && f(s.substr(0, (n-1)/2)) && f(s.substr((n+3)/2-1))) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <set>
#include <unordered_set>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <numeric>

using namespace std;

typedef long long ll;

#define forn(i, n) for(int i = 0; i < (int)(n);++i)
#define fore(i, a, b) for(int i = (int)(a); i <= (int)(b); ++i)
#define fi first
#define se second
#define pb push_back
#define pll pair<ll,ll>
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vb vector<bool>
#define vvi vector<vi>
#define vpll vector<pll>
#define vll vector<ll>
#define vvll vector<vll>
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()


void fastik() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
	cout.tie(nullptr);
}

//ifstream &cin
void solve(){

}

int main() {
    fastik();
    //ifstream cin("input.txt");
    /*ll t=1;cin>>t;
    while(t--){
       solve();
    }*/
    vll a(5);
    ll ind = 0;
    ll mx = 10;
    forn(i,5){
        cin >> a[i];
        if(a[i] % 10 < mx && (a[i]%10 != 0)){
            mx = a[i] % 10;
            ind =  i;
        }
    }
    ll ans = 0;
    forn(i,5){
        if(i == ind){
            ans += a[i];
        }else{
            ans += ((a[i] + 9)/10)  * 10;
        }
    }
    cout << ans;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main ()
{
	int k=0,n,c=0,i;
	vector<int> v;
	cin>>n;
	for(i=0;i<n;i++)
	{
		int j;
		cin>>j;
		v.push_back(j);
	}
	for(i=0;i<n;i++)
	{
		if(v[i]%2==0 && (v[i]%3==0 || v[i]%5==0))
		{
			c++;
		}
		if(v[i]%2==0)
		{
			k++;
		}
	}
	c==k ? cout<<"APPROVED" : cout<<"DENIED";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<string,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[100000],dp[100][100];

int main(){
  bool day[101][11];
  cin >> n;
  rep(i,0,n){
    rep(j,0,10){
      cin >> day[i][j];
    }
  }
  rep(i,0,n){
    lep(j,0,10){
      cin >> dp[i][j];
    }
  }
  ll ans = - (1 << 30);
  rep(i,1,1 << 10){
    ll w = 0;
    rep(j,0,n){
      ll p = 0;
      rep(k,0,10)if(i >> k & 1 && day[j][k])p++;
      w += dp[j][p];
    }
    if(ans < w)ans = w;
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 384
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;
 
vector<int> mul(vector<int> &a,vector<int> &b){
	int i=0,n=a.size();
	vector<int> r(n);
	for(i=0;i<n;i++)r[i]=a[b[i]];
	return r;
}
 
int main(){
	int n,m,i,x,s;
	long long k;
	scanf("%d",&n);
	vector<int> t(n),e(n),a(n);
	for(i=0;i<n;i++)scanf("%d",&a[i]),t[i]=i,e[i]=i;
	for(i=n-1;i;i--)a[i]-=a[i-1];
	scanf("%d%lld",&m,&k);
	for(i=0;i<m;i++)scanf("%d",&x),swap(t[x-2],t[x-1]);
	for(;k;k>>=1){
		if(k&1)e=mul(e,t);
		t=mul(t,t);
	}
	for(k=a[i=0];i<n;i++)printf("%lld\n",k),k+=a[e[i]+1];
}

Measured memory_bytes: 2792
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
 
int main()
{
	string a, b;
	cin >> a >> b;
 
	int n = stoi( a + b );
	int sq = sqrt( n );
 
	cout << ( sq * sq == n ? "Yes" : "No" ) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
int main(){
  int n;cin >> n;
  ll dp[n+1][5][5][5]={};
  // A1 C2 G3 T4
  dp[0][0][0][0]=1;
  for(int i=0;i<n;i++){
    for(int j=0;j<5;j++){
      for(int k=0;k<5;k++){
        for(int l=0;l<5;l++){
          for(int m=1;m<5;m++){
            if((j==1&&k==3&&m==2)||(j==1&&l==3&&m==2)||(k==1&&l==3&&m==2)||(k==3&&l==1&&m==2)||(k==1&&l==2&&m==3)){
              continue;
            }
            dp[i+1][k][l][m]+=dp[i][j][k][l];
            dp[i+1][k][l][m]%=mod;
          }
        }
      }
    }
  }
  ll ans=0;
  for(int i=1;i<5;i++){
    for(int j=1;j<5;j++){
      for(int k=1;k<5;k++){
        ans+=dp[n][i][j][k];
        ans%=mod;
      }
    }
  }
  cout << ans << endl;
}

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

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

    string s, t;
    cin >> s >> t;

    int n = s.size();
    map<char, vector<int>> mp1, mp2;
    REP(i, n){
        mp1[s[i]].push_back(i);
        mp2[t[i]].push_back(i);
    }

    if(mp1.size() != mp2.size()){
        cout << "No" << endl;
        return 0;
    }

    vector<vector<int>> A, B;
    vector<int> T;
    for(auto x : mp1){
        T.clear();
        for(auto y : x.second){
            T.push_back(y);
        }
        A.push_back(T);
    }
    for(auto x : mp2){
        T.clear();
        for(auto y : x.second){
            T.push_back(y);
        }
        B.push_back(T);
    }

    sort(A.begin(), A.end());
    sort(B.begin(), B.end());

    int m = A.size();
    REP(i, m){
        if(A[i].size() == B[i].size()){
            REP(j, int(A[i].size())){
                if(A[i][j] == B[i][j]);
                else{
                    cout << "No" << endl;
                    return 0;
                }
            }
        }else{
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 4992
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
#include<bitset>
#include<random>
#include<cstdint>
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
#define shosu setprecision(17)
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<char,P> Q;
ll longinf=(1ll<<60);
ll inf=1ll<<29;

vector<pair<ll,ll>> primeFactorDecomp(ll n){
      vector<pair<ll,ll>> ret;
      ll m=n;
      for(ll i=2;i*i<=m;i++){
            if(n%i!=0) continue;
            int cnt=0;
            while(n%i==0){
                  cnt++;
                  n/=i;
            }
            ret.push_back({i,cnt});
      }
      if(n>1){
            ret.push_back({n,1});
      }
      return ret;
}

int main(){
    ll n,p;
    cin>>n>>p;
    vector<P> a=primeFactorDecomp((ll)p);
    ll ans=1;
    for(auto q: a){
        while(q.second>=n){
            ans*=q.first;
            q.second-=n;
        }
    }
    cout<<ans<<endl;

      return 0;
}

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

using ll=__int128;

using ll2=long long;

const ll INF=1e15;

ll powi(ll x,ll k){
    ll res=1;
    while(k){
        if(k&1) res*=x;
        if(res>INF) return INF;
        x*=x;
        k>>=1;
    }
    return res;
}
int main(){
    ll2 nn,mm,aa,bb,pp,qq;
    cin>>nn>>mm>>aa>>bb>>pp>>qq;
    ll n=nn,m=mm,a=aa,b=bb,p=pp,q=qq;
    if(a>=2 || b>=2){
        int tn=min(n,ll(41));
        int half=min(tn/2,20);
        vector<ll> vec(1<<half);
        for(int i=0;i<(1<<half);i++){
            ll val=0;
            for(int j=0;j<half;j++){
                if((i>>j)&1){
                    val+=p*powi(a,j)+q*powi(b,j);
                }
                if(val>=INF){
                    break;
                }
            }
            vec[i]=val;

        }
        int rest=tn-half;
        vector<ll> s(1<<rest);
        for(int i=0;i<(1<<rest);i++){
            ll val=0;
            for(int j=0;j<rest;j++){
                if((i>>j)&1){
                    val+=p*powi(a,half+j)+q*powi(b,half+j);
                }
                if(val>=INF){
                    break;
                }
            }
            s[i]=val;
        }
        sort(s.begin(),s.end());
        ll2 res=m;
        for(int i=0;i<vec.size();i++){
            auto it=lower_bound(s.begin(),s.end(),m-vec[i]);
            if(it!=s.end()){
                res=min(res,abs(ll2(m-vec[i]-*it)));
            }
            if(it!=s.begin()){
                it--;
                res=min(res,abs(ll2(m-vec[i]-*it)));
            }
        }
        cout<<res<<endl;
    }
    else{
        if((p+q)*n>=m){
            cout<<ll2(min(m%(p+q),(p+q)-m%(p+q)))<<endl;
        }
        else{
            cout<<ll2(m-(p+q)*n)<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 51872
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <iomanip>

using namespace std;



int main(){

    int a, b, c;
    cin >> a >> b >> c;

    if(a == b and a != c){
        cout << "Yes" << endl;
    }
    else if(a == c and a != b){
        cout << "Yes" << endl;
    }
    else if(c == b and a != c){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

//    cout << fixed << dp_table.at(n-1) << endl;

}

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

int main() {
	int N, M;
	cin >> N >> M;
	vector<int> road(N);
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		road.at(a - 1)++;
		road.at(b - 1)++;
	}

	for (int i = 0; i < N; i++) {
		cout << road.at(i) << endl;
	}
}

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

int w, h;
vector<vector<int>> g, d;

void dfs(int y, int x) {
	d[y][x] = 1;
	for (int i = -1; i <= 1; i++) {
		for (int j = -1; j <= 1; j++) {
			int dy = y + i;
			int dx = x + j;
			if (dy < 0 || dy >= h || dx < 0 || dx >= w) continue;
			if (g[dy][dx] == 0 || d[dy][dx] != 0) continue;
			dfs(dy, dx);
		}
	}
}

int main() {
	while (cin >> w >> h) {
		if (w == 0 && h == 0) break;
		g.assign(h, vector<int>(w));
		rep(i, h) rep(j, w) cin >> g[i][j];
		d.assign(h, vector<int>(w));
		int ans = 0;
		rep(i, h) rep(j, w) {
			if (g[i][j] == 0 || d[i][j] != 0) continue;
			dfs(i, j);
			ans++;
		}
		cout << ans << endl;
	}
	return 0;
}


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

vector<int> graph[200000];

int main() {
	int n, m; cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b; a--; b--;
		graph[a].push_back(b); graph[b].push_back(a);
	}

	for (int i = 0; i < graph[0].size(); i++) {
		int u = graph[0][i];
		for (int j = 0; j < graph[u].size(); j++) {
			int v = graph[u][j];
			if (v == n - 1) {
				cout << "POSSIBLE" << endl;
				return 0;
			}
		}
	}
	cout << "IMPOSSIBLE" << endl;

	return 0;
}

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

int main() {
    int N;
    cin >> N;
    long long list[N*3];
    for(int i = 0; i<N*3;i++) {
        cin >> list[i];
    }

    sort(list, list + N*3, greater<long long>());
    long long summ = 0;
    int cnt = 0;
    for(int i = 0; i<N*3; i++) {
        if(i != 0 && i % 2 == 1 && cnt < N) {
            summ += list[i];
            cnt++;
        }
    }

    cout << summ << endl;
}

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

int main(){
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	if(a != c){
		cout << 1 << endl;
	} else{
		cout << 0 << endl;
	}
	
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <set>

using namespace std;

typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

template<typename T> T gcd(T a, T b) {
  if(a < b) swap(a, b);
  if(b == 0) return a;
  return gcd(b, a % b);
}

int main(int argc, char *argv[]) {
  i64 A, B;
  cin >> A >> B;
  i64 g0 = gcd(A, B);
  i64 g = g0;

  i64 ans = 1;
  i64 p = 2;
  while(g > 1) {
    if(p * p > g0) {
      ans += 1;
      break;
    }
    
    i64 d = 0;
    while(g % p == 0) {
      d = 1;
      g /= p;
    }
    ans += d;
    ++p;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = [0]*n
x = [[] for i in range(n)]
y = [[] for i in range(n)]
for i in range(n):
    a[i] = int(input())
    for j in range(a[i]):
        tmp1,tmp2 = list(map(int,input().split()))
        x[i].append(tmp1-1)
        y[i].append(tmp2)

ans = 0
honest = [0]*n
cnt=0
for i in range(2**n): #bit全探索
    for j in range(n):
        if((i>>j)&1):
            honest[j] = 1
            cnt+=1
        else:
            honest[j] = 0
            
    f = True
    for k in range(n):
        if honest[k]!=1:
            continue
        for l in range(a[k]):
            if y[k][l]!=honest[x[k][l]]:
                f = False
                break
    if f:
        ans = max(ans,cnt)
    cnt=0

print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> T;

void output(vector<int> &v){
    for(auto e: v){
        char c = 'a' + e;
        cout << c;
    }
    cout << endl;
}

void dfs(vector<int>& v, int x, int N){
    if(v.size() == N){
        output(v);
    }
    else{
        for(int i = 0; i <= x+1; i++){
            v.push_back(i);
            if(i <= x){
                dfs(v, x, N);
            }
            else{
                dfs(v, x+1, N);
            }
            v.pop_back();
        }
    }
    return;
}

int main(){
    int n;  cin >> n;
    vector<int> v(1, 0);
    dfs(v, 0, n);

    return 0;

}


Measured memory_bytes: 1536
<?php
  while (true) {
    list($m, $f, $r) = explode(" ", trim(fgets(STDIN)));
    if (($m == "-1") && ($f == "-1") && ($r == "-1")) {
      return;
    } else if (($m == "-1") || ($f == "-1")) {
      print "F";
    } else if (($m + $f) >= 80) {
      print "A";
    } else if (($m + $f) >= 65) {
      print "B";
    } else if ((($m + $f) >= 50) || ($r >= 50)) {
      print "C";
    } else if (($m + $f) >= 30) {
      print "D";
    } else {
      print "F";
    }
    print "\n";
  }
?>

Measured memory_bytes: 6576
#include<iostream>
using namespace std;
typedef long long ll;
int main() {
	int n;
  	cin>>n;
  	ll arr[n];
  	for(int i=0;i<n;++i)	cin>>arr[i];
  
  	ll ans = 0;
  	for(int i = 1;i<n;++i) {
    	ll d = arr[i-1] - arr[i];
      	if(d>0)	{
        	ans += d;
          	arr[i] += d;
        }
    
    }
  	cout<<ans;
  
	return 0;
}

Measured memory_bytes: 5148
n,k = (int(num) for num in input().split())
p = [int(num) for num in input().split()]
cum = [0] * (n+1)
for i in range(n):
    cum[i+1] = cum[i] + p[i]
ans = 0
#print(cum)
for j in range(n-k+1):
    t = cum[j+k] - cum[j]
    if t > ans:
        ans = t
print((ans+k)/2)

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

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

    int a[n * 3];

    for (int i = 0; i < n * 3; i++) cin >> a[i];

    sort(a, a + n * 3, greater<int>());

    long ans = 0;
    for (int i = 0; i < n * 2; i++) {
        if (i % 2 == 1) ans += a[i];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1408
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int k, s;
  cin >> k >> s;
  int ans = 0;
  for (int x = 0; x <= k; ++x) {
    for (int y = 0; y <= k; ++y) {
      int z = s - x - y;
      if (0 <= z && z <= k) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
typedef long long int ll;
#define mod 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define m0(x) memset(x,0,sizeof(x))

int main(void){
	ll a,b;
	int k;
	scanf("%lld %lld %d",&a,&b,&k);
	rep(i,k){
		//高橋の操作
		if (i%2==0) {
			if (a%2!=0) a--;
			b+=(a/2);
			a/=2;
		}
		//青木君の操作
		else{
			if (b%2!=0) b--;
			a+=(b/2);
			b/=2;
		}
	}
	printf("%lld %lld",a,b);
	return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <atcoder/all>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace atcoder;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 300;
const int K = 100000;
const int mod = 1e9 + 7;
using mint = modint998244353;
pair <mint, int> op(pair <mint, int> x, pair <mint, int> y){
    return {x.F + y.F, x.S + y.S};
}
pair <mint, int> e(){
    return {0, 0};
}
pair <mint, int> mapping (pair <mint, mint> f, pair <mint, int> x){
    return {f.F * x.F + x.S * f.S, x.S};
}
pair <mint, mint> composition (pair <mint, mint> f, pair <mint, mint> g){
    return {f.F * g.F, g.S * f.F + f.S};
}
pair <mint, mint> id (){
    return {1, 0};
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n, q;
    cin >> n >> q;
    vector <pair<mint,int>> v(n);
    for (int i = 0; i < n; i++){
        int x;
        cin >> x;
        v[i] = {x, 1};
    }
    lazy_segtree<pair <mint, int>, op, e, pair<mint, mint>, mapping, composition, id> lst(v);
    while(q--){
        int t;
        cin >> t;
        if (t == 0){
            int l, r, b, c;
            cin >> l >> r >> b >> c;
            lst.apply(l, r, {b, c});
        } else{
            int l, r;
            cin >> l >> r;
            cout << lst.prod(l, r).F.val() << endl;
        }
    }
}


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

using namespace std;

typedef long long ll;

int main()
{

	int n;
	while(cin >> n)
	{
		map<string, int> MP;
		string a;
		for(int i=0; i<n; i++)
		{
			cin >> a;
			MP[a]++;
		}

		cout << MP.size() << "\n";

	}

	return 0;

}


Measured memory_bytes: 19188
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
#include <stack>
#include <cctype>
#include <cmath>
#include <bitset>

using namespace std;

/* typedef */
typedef long long ll;

/* constant */
const int INF = 1 << 30;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;

/* global variables */

/* function */

/* main */
int main(){

    int n, k;
    cin >> n >> k;
    // Print bit if binary(i) includes k bits

    /*
    // 1 ============================
    for (int i = 0; i < (1 << n); i++) {
        bitset<18> bs(i);
        if (bs.count() == k) {
            printf("%d:", i);
            for (int j = 0; j < n; j++) {
                if ((bs >> j)[0]) printf(" %d", j);
            } 
            printf("\n");
        }
    }
    */

    // 2 ===========================
    for (int b = 0; b < (1 << n); b++) {
        if (__builtin_popcount(b) == k) {
            printf("%d:", b);
            for (int i = 0; i < n;i++)
                if( (b >> i) & 1)
                    printf(" %d", i);
            printf("\n");
        }
    }
}



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

int main() {
    int64_t N, W, a = 0;
    cin >> N >> W;
    vector<vector<int64_t>> S(N, vector<int64_t>(2));
    vector<vector<int64_t>> ans(N,vector<int64_t>(100001,1000000001));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 2; j++) {
            cin >> S.at(i).at(j);
        }
    }
    ans.at(0).at(0) = 0;
    ans.at(0).at(S.at(0).at(1)) = S.at(0).at(0);
    for (int i = 0; i < N - 1; i++) {
        for (int j = 0; j < 100001; j++) {
            if (j - S.at(i + 1).at(1) >= 0) {
                ans.at(i + 1).at(j) = 
                min(ans.at(i).at(j), ans.at(i).at(j - S.at(i + 1).at(1)) + S.at(i + 1).at(0));
            }
            else {
                ans.at(i + 1).at(j) = ans.at(i).at(j);
            }
        }
    }
    for (int i = 0; i < 100001; i++) {
        if (ans.at(N - 1).at(100000 - i) <= W) {
            cout << 100000 - i << endl;
            return 0;
        }
    }
}



Measured memory_bytes: 79488
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<int,int>;
using LP=pair<ll,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353;

ll modpower(ll n,ll p){
    if(p==0){return 1;}
    if(p%2==1){return n*modpower(n,(p-1)/2)%MOD*modpower(n,(p-1)/2)%MOD;}
    else{return modpower(n,p/2)*modpower(n,p/2)%MOD;}
}

//二項係数
const int MAX = 2010000;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 前処理 COMinit();
// 計算例 cout << COM(100000, 50000) << endl;


int main() {
    int K;
    string S;
    cin>>K>>S;
    int N=sz(S);
    ll ans=0;
    COMinit();
    for(int i=N;i<=N+K;i++){
        ll now=modpower(25,N+K-i);
        ll a=COM(N+K,i);
        now*=a;
        now%=MOD;
        ans+=now;
        ans%=MOD;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 51432