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

namespace Daydream
{
    class Program
    {
        public static void Main(string[] args)
        {
            using (var sc = new SetConsole())
            {
                var array = new string[] { "dream", "dreamer", "erase", "eraser" };
                var str = GetString();
                while (str.Length != 0)
                {
                    int strLength = str.Length;
                    foreach (var item in array)
                    {
                        if (str.EndsWith(item))
                        {
                            str = str.Remove(str.Length - item.Length);
                            break;
                        }
                    }
                    if (strLength == str.Length) { CWrite("NO");return; }
                }
                CWrite("YES");
            }
        }

        static void CWrite<T>(T str) => Console.WriteLine(str);
        static string GetString() => Console.ReadLine();
        static T[] GetArray<T>()
        {
            var t = typeof(T);
            var str = Console.ReadLine();
            if (t == typeof(string))
            {
                return (T[])(object)str.Split();
            }
            if (t == typeof(int))
            {
                return (T[])(object)str.ToNumArray<T>();
            }
            if (t == typeof(long))
            {
                return (T[])(object)str.ToNumArray<T>();
            }
            if (t == typeof(double))
            {
                return (T[])(object)str.ToNumArray<T>();
            }
            throw new NotSupportedException($"{t} is not supported.");
        }
    }



    class SetConsole : IDisposable
    {
        readonly StreamWriter sw = new StreamWriter(Console.OpenStandardOutput());
        public SetConsole()
        {
            sw.AutoFlush = false;
            Console.SetOut(sw);
        }
        public void Dispose()
        {
            Console.Out.Flush();
            sw.AutoFlush = true;
            Console.SetOut(sw);
        }
    }

    static class ExtentionsLibrary
    {
        public static T[] ToNumArray<T>(this string str)
        {
            var t = typeof(T);
            if (t == typeof(int))
            {
                return (T[])(object)str.Split().Select(int.Parse).ToArray();
            }
            if (t == typeof(long))
            {
                return (T[])(object)str.Split().Select(long.Parse).ToArray();
            }
            if (t == typeof(double))
            {
                return (T[])(object)str.Split().Select(double.Parse).ToArray();
            }
            throw new NotSupportedException();
        }
        public static int ToInt(this string str) => int.Parse(str);
    }
}


Measured memory_bytes: 31228
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    int n,h,w;
    cin >> n >> h >> w;
    cout << (n - h + 1) * (n - w + 1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int k;
  cin>>k;
  int a,b;
  cin>>a>>b;
  int c=0;
  for(int i=a;i<=b;i++)
  {
    if(i%k==0)
    {
      c=1;
      cout<<"OK\n";
      break;
    }
  }
  if(c==0)
  {
    cout<<"NG\n";
  }
}

Measured memory_bytes: 3648
#include<iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
    int a,b,C;
    double S,L,h,rad;
    double PI=acos(-1);
    cin>>a>>b>>C;
    rad=C*PI/180;
    S=sin(rad)*a*b/2;
    L=a+b+sqrt(a*a+b*b-2*a*b*cos(rad));
    h=2*S/a;
    cout<<fixed<<setprecision(20)<<S<<endl<<L<<endl<<h<<endl;
}


Measured memory_bytes: 3560
import java.util.*;

class Main {
	  static int mod=1_000_000_007;
  public static void main(String[] args) {
	  Scanner sc = new Scanner(System.in);
	  double Sum=0;
	  long S1=0,S2=0;
      long N = sc.nextLong();
      long[] a = new long[(int)N];
      for (int i=0 ; i<N; i++) {
          a[i] = sc.nextLong();
          Sum=Sum+a[i];
      }
 
      for (int i=0 ; i<N; i++) {
    	  S1 = S1 + a[i];
    	  if(S1>=Sum/2) {
    		  S2=S1-a[i];
    		  break;
    	  }
      }
      
      
	  System.out.println((long)Math.min(2*S1-Sum, Sum-2*S2));
  }
  
 
}

Measured memory_bytes: 21844
#pragma GCC optimize ("Ofast")
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(int)(b); i++)
#define FORD(i, a, b) for (int i=a; i>(int)(b); i--)
#define PPC(x) __builtin_popcount(x)
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define ft first
#define sd second
#ifdef DEBUG
#include "debug.h"
#else
#define dbg(...) 0
#endif
using namespace std;

const int maxN = 1 << 19;

char T[maxN];

void solve()
{
	int n, a, b, c;
	scanf ("%d", &n);
	scanf ("%s", T);
	int res = 0;
	FOR(i, 0, n-2)
		if (T[i] == 'A' and T[i+1] == 'B' and T[i+2] == 'C')
			res++;
	printf("%d\n", res);
}

int main()
{
	int t;
	t = 1;//scanf ("%d", &t);
	while (t--)
		solve();
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
string S, T[1000], U; int sum, maxn; int k, p[1000];
int main() {
	getline(cin, S);
	S += ' ';
	for (int i = 0; i <= S.size(); i++) {
		if (S[i] == ' ') {
			if (maxn < T[sum].size()) {
				maxn = T[sum].size(); U = T[sum]; 
			}
			sum++;
		}
		else {
			T[sum] += S[i];
		}
	}
	for (int i = 0; i < sum; i++) {
		p[i] = i;
		for (int j = 0; j < i; j++) {
			if (T[i] == T[j]) {
				p[j] += 10000; break;
			}
		}
	}
	sort(p, p + sum);
	cout << T[p[sum - 1] % 10000] << ' ' << U << endl;
	return 0;
}

Measured memory_bytes: 1200
#include<iostream>
#include<string>
#include<map>
#include<string.h>
#include<vector>
#include<set>
#include<stdio.h>
#include<math.h>
//#include<algothm>
#include<queue>
typedef long long ll;
typedef long double ld;
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int h=0;
	if(a<=b) 
 		h+=a;
 		else h+=b;
	if(c<=d) 
  	h+=c;
  	else h+=d;
   cout<<h<<endl;	
	system("pause");
  return 0;
}

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

int main() {
	string s,t;cin>>s>>t;
	int q;cin>>q;
	vector<int> a(q),b(q),c(q),d(q);
	for(int i=0;i<q;i++){
		cin>>a[i]>>b[i]>>c[i]>>d[i];
	}
	vector<int> sa(s.size()+1,0),sb(s.size()+1,0),ta(t.size()+1,0),tb(t.size()+1,0);
	int count=0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='A'){
			count++;
		}
		sa[i+1]=count;
	}
	count=0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='B'){
			count++;
		}
		sb[i+1]=count;
	}
	count=0;
	for(int i=0;i<t.size();i++){
		if(t[i]=='A'){
			count++;
		}
		ta[i+1]=count;
	}
	count=0;
	for(int i=0;i<t.size();i++){
		if(t[i]=='B'){
			count++;
		}
		tb[i+1]=count;
	}
	for(int i=0;i<q;i++){
		int csa=sa[b[i]]-sa[a[i]-1];
		int csb=sb[b[i]]-sb[a[i]-1];
		int cta=ta[d[i]]-ta[c[i]-1];
		int ctb=tb[d[i]]-tb[c[i]-1];
		if(((csa-csb)%3-(cta-ctb)%3)%3==0){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
//		cout<<csa<<' '<<csb<<' '<<cta<<' '<<ctb<<endl;
	}

	return 0;
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
#define ll long long
#define loop(n) for(ll i = 0; i<n; i++)
using namespace std;

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

    int n; cin>>n;
    if(n&1) cout<<1+(n/2)<<"\n";
    else cout<<n/2<<"\n";
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int Taka,Ao,K;
    scanf("%d %d %d",&Taka,&Ao,&K);
    int i,tmp;

    for(i=0;i<K;i++){
        if(Taka%2 == 1){
            Taka = Taka - 1;
        }
        Ao += (Taka/2);
        tmp = Taka / 2;
        Taka = Ao;
        Ao = tmp;
    }

    if(K%2==1){
        tmp = Taka;
        Taka = Ao;
        Ao = tmp;
    }

    printf("%d %d",Taka,Ao);

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll a,b,c;
  cin >> a >> b >> c;
  ll ans=0;
  rep(i,c+1) {
    if(i*a<=b) ans=i;
  }
  pr(ans);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;
#define ll int64_t
const long MOD = 1e9 + 7;
const long LINF = 1e13;
const long LLINF = 1e18;
const long ALPHABET = 26;

template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}



int main() {

  long n;

  cin >> n;
  vector<long> a(n);
  vector<long> b(n);
  vector<long> amb(n);

  vector<pair<long, long>> abpair(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < n; i++) {
    abpair[i] = make_pair(a[i], b[i]);
    amb[i] = a[i] - b[i];
  }


  long ans = 0;

  sort(amb.begin(), amb.end(), greater<long>());

  vector<long> nenough;
  long sum_ = 0;


  for (auto v : amb) {
    if (v < 0)nenough.push_back(v);
    if (v < 0)sum_ += v;
  }

  ans = nenough.size();
  cerr << "nenough.size()  " << nenough.size() <<endl;
  cerr << "sum_  " << sum_ <<endl;


  if (nenough.size() > 0) {
    bool isfeasible = false;
    for (int i = 0; i < amb.size(); i++) {
      cerr << "amb[i])  " << amb[i] <<endl;

      if (amb[i] < 0)break;
      if (amb[i] + sum_ >= 0&& amb[i] >0) {
        ans++;
        isfeasible = true;
        break;
      } else {
        if (amb[i] > 0)sum_ += amb[i];
        if (amb[i] > 0)ans++;
      }
    }

    if (isfeasible == false)ans = -1;
  }




  cout << ans << endl;


}




















Measured memory_bytes: 4732
#include <stdio.h>
int main(void)
{
    long N,l[87],i;
    scanf("%ld",&N);
    l[0]=2;
    l[1]=1;
    for(i=2;i<=87;i++)
        l[i]=l[i-2]+l[i-1];
    printf("%ld\n",l[N]);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define shosu(X) fixed << setprecision(X)
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;}
 
int main(){
  int a, b;
  string s;
  cin >> s;
  if(s[0] == 'S') cout << "Cloudy" << endl;
  else if(s[0] == 'C') cout << "Rainy" << endl;
  else cout << "Sunny" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int uli;
const int mx=1e5+10;
int a[mx];
vector<int>g[mx];
int height(int u){
  vector<int>h;
  for(int v:g[u]){
    h.push_back(height(v));
  }
  sort(h.begin(),h.end());
  int sz=h.size();
  int ans=0;
  for(int i=0;i<sz;i++){
    ans=max(ans,h[i]+sz-i);
  }
  return ans;

}
int main(){
  int n;
  scanf("%d",&n);
  for(int i=1;i<n;i++){
    scanf("%d",a+i);
    --a[i];
    g[a[i]].push_back(i);
  }
  int ans=height(0);
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 13952
#include<iostream>
#include<algorithm>
#include<cmath>
#define int long long
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define c(n) cout<<n<<endl;
signed main(){
	string s,t;
	cin>>s>>t;
	if(s==t){
		c("No")
		return 0;
	}	
	int ss=s.size();
	int ts=t.size();
	int a[ss],b[ts];
	rep(i,ss){
		a[i]=s[i];
	}
	rep(i,ts){
		b[i]=t[i];
	}
	sort(a,a+ss);
	sort(b,b+ts);
	reverse(b,b+ts);
	rep(i,min(ss,ts)){
		if(a[i]>b[i]){
			c("No")
			return 0;
		}	
		else if(a[i]<b[i]){
			c("Yes")
			return 0;
		}	
		else{
		}	
		if(i==ss-1&&ss<ts){
			c("Yes")
			return 0;
		}	
	}
	c("No")		
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
int f[2010][2010],n,a[2010],mi[2010][2010],mx[2010][2010];
int main()
{
	scanf("%d",&n);n+=2;
	memset(f,-1,sizeof(f));
	memset(mi,0x3f,sizeof(mi));
	memset(mx,0,sizeof(mx));
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
//	for(int i=1;i<=n;i++)
//		cout<<a[i]<<' ';
//	cout<<endl;	
	for(int i=n;i>=1;i--)
		for(int j=n;j>=2;j--)
		{
			if(i!=j)
			{
				if(i==n||j==n) f[i][j]=abs(a[i]-a[j]);
				else if(i<j) f[i][j]=mx[j+1][j];
				else f[i][j]=mi[i][i+1];
				mx[i][j]=max(f[i][j],mx[i+1][j]);
				mi[i][j]=min(f[i][j],mi[i][j+1]);
			}
		}
	printf("%d",f[1][2]);		
	return 0;
}

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

int main()
{
    int a, b;
    cin >> a >> b;
    string s1 = "", s2 = "";
    for(int i = 0; i < b; i++) s1 += (char)(a + '0');
    for(int i = 0; i < a; i++) s2 += (char)(b + '0');
    cout << (s1 < s2 ? s1 : s2) << endl;
    
    return 0;
}


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

int main()
{
    string s;
    cin >> s;
    rep(i, s.size() - 1)
    {
        if (s[i] == s[i + 1])
        {
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
    return 0;
}

Measured memory_bytes: 3576
#include <iostream>

using namespace std;
using ll = long long;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

int main() {
  string s, t, u;
  cin >> s >> t;
  int a, b;
  cin >> a >> b >> u;

  if (u == s)
    --a;
  else
    --b;

  cout << a << ' ' << b;

  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

class Main {
    public static void main(String[] args) throws IOException {
       Scanner in = new Scanner(System.in);
       while (in.hasNextInt()) {
           double  a = in.nextInt();
           double  b = in.nextInt();
           double  c = in.nextInt();
           double  d = in.nextInt();
           double  e = in.nextInt();
           double  f = in.nextInt();

           double y = (d*c-a*f) / (b*d-a*e);
           double x = 0;
           if(a != 0) x = (c-b*y) / a;
           else x = (f-e*y) / d;
           if (x == -0.000) x += 0;
           if (y == -0.000) y += 0;
           System.out.printf("%.3f %.3f\n", x, y);
       }
    }
}

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


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long int x, k, d;
    cin >> x >> k >> d;
    if(x < 0) {
        x = -x;
    }
    long long int req = x / d;
    if(req >= k) {
        cout << x - d * k << "\n";
    }
    else {
        k -= req;
        if(k & 1) {
            cout << d - x % d << "\n";
        }
        else {
            cout << x % d << "\n";
        }
    }
    return 0;
}

Measured memory_bytes: 3636
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
#include <numeric>
#include <random>
using namespace std;

typedef long long LL;
typedef pair<LL, LL> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;				// VVL v(100,VL(100,0));
typedef vector<pair<LL, LL> > VP;
typedef vector<string> VS;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<LL, pair<P, P> > PP;

#define INF 999999999999999997		// 少し加算したらオーバーフローする
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
#define O(s) cout<<s<<endl;

#define DUMP_VVI(b) if(dbgF){FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}

template<class T>T IN() { T d; cin >> d; return d; }

LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; } // 最大公約数（Greatest Common Divisor）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; } // 最小公倍数（Least Common Multiple）
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); } // うるう年判定
string Replace(string S, string from, string to) { auto p = S.find(from); while (p != string::npos) { S.replace(p, from.size(), to); p = S.find(from, p + to.size()); }return S; }

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

// -------------------------------------------------------------------------------

int main() {
	FAST_IO;
	bool dbgF = true; // for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;

	LL n;
	cin >> n;
	LL ans = n / 3;
	if (n < 3)ans = 0;
	O(ans);

	return 0;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
A = set([int(input()) for _ in range(M)])
mod = 10**9+7
dp=[0]*(N+1)
dp[0] = 1
for i in range(1,N+1):
    dp[i] = (dp[i-1] + dp[i-2])%mod
    if i in A:dp[i] = 0
print(dp[-1])

Measured memory_bytes: 13192
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<iomanip>
#include<map>
#include<cmath>
#include<cstdio>

#define rep(i,n) for(int i=0; i<(n); ++i)
#define pai 3.1415926535897932384

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

#define MAX_NUM 100000

int main(int argc, const char * argv[]) {
    int n;
    cin >> n;
    
    P p[MAX_NUM];
    rep(i, n){
        int x, l;
        cin >> x >> l;
        p[i].first = x+l;
        p[i].second = x-l;
    }
    sort(p, p+n);
    
    int res=0;
    int x=p[0].first;
    for(int i=1; i<n; i++){
        if(x>p[i].second){
            res++;
        }else{
            x=p[i].first;
        }
    }
    
    cout << n - res << endl;
    
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define each(a,x) for(auto a : (x))
#define all(a) (a).begin(),(a).end()
#define chmin(a,b) ((a) = min((a),(b)))
#define chmax(a,b) ((a) = max((a),(b)))
#define in_range(x,l,r) ((l)<=(x) && (x)<(r))
#define printvec(a) rep(i,a) cout << a[i] << " \n"[i+1==(a).size()];
#define fs first
#define sc second
#define em emplace
#define eb emplace_back
#define sz size()
#define MP make_pair
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;

const ll INF = 1e8;
const D EPS = 1e-8;
const ll MOD = 1e9+7;

int main(){
  string s,t;
  cin >> s >> t;
  vi sa(s.size()+1, 0);
  rep(i,s.size()){
    if(s[i] == 'A') sa[i+1] = 1;
    else sa[i+1] = 2;
    sa[i+1] += sa[i];
  }
  vi ta(t.size()+1, 0);
  rep(i,t.size()){
    if(t[i] == 'A') ta[i+1] = 1;
    else ta[i+1] = 2;
    ta[i+1] += ta[i];
  }
  
  int q;
  cin >> q;
  rep(i,q){
    int a,b,c,d;
    cin >> a >> b >> c >> d; a--; c--;
    int T = (ta[d]-ta[c]), S = (sa[b]-sa[a]);

    if( abs(T-S)%3==0 ){
      cout << "YES" << endl;
    }else{
      cout << "NO" << endl;
    }
  }
}


Measured memory_bytes: 1664
# -*- coding: utf-8 -*-

# Nの入力
N = int(input())

# a1,a2 ~ aNまでの入力
a = list(map(int,input().split()))

# aの配列を降順にソートする
a.sort(reverse = True)

# aclie合計　と　bob合計
alice = sum(a[::2])
bob = sum(a[1::2])

# 出力
print(alice-bob)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define ll long long
#define pb emplace_back
#define mp make_pair
#define nt _int128
#define ld long double
long double PI =3.14159265358979323846;


const ll modo=1e9+7;
const ll inf=1e16;
const ll ms=(2e5) +5;



int main()
{
    idfc;

    int ar[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int n;
    cin>>n;
    n--;
    cout<<ar[n];
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

int main()
{
    int n, x;
    cin >> n >> x;
    int l[n];
    rep(i, n)
    {
        cin >> l[i];
    }
    int d = 0;
    int ans = 1;
    rep(i, n)
    {
        d += l[i];
        if (d <= x)
        {
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int N;
  cin >> N;
  cout << N*N << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
typedef long long ll;
char mp[1005][1005];
ll dp[1005][1005];
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=0;i<n;i++)
    {
        scanf("%s",mp[i+1]+1);
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(i==1&&j==1) dp[i][j] = 1;
            if(mp[i][j]=='#') continue;
            if(i>1&&mp[i-1][j]=='.') dp[i][j] = (dp[i][j]+dp[i-1][j])%mod;
            if(j>1&&mp[i][j-1]=='.') dp[i][j] = (dp[i][j]+dp[i][j-1])%mod;
        }
    }
    printf("%lld\n",dp[n][m]);
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
ll n;
ll a[100005];
ll ans;
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]%2==0&&a[i]>0){
            ans+=(a[i]/2-1);
            a[i]=2;
            if(i==0||a[i-1]==0){
                a[i]=0;
                ans++;
            }
        }else if(a[i]>0){
            ans+=a[i]/2;
            a[i]=1;
        }
    }
    for(int i=0;i<n-1;i++){
        if(a[i]==0&&a[i+1]==2){
            ans++;
            a[i]=0;
            a[i+1]=0;
        }else if(a[i]+a[i+1]>=2){
            ans++;
            a[i]--;
            a[i+1]--;
        }
    }
    cout<<ans<<endl;
    

}



Measured memory_bytes: 4416
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
 
using vd=vector<double>;
using vvd=vector<vd>;
 
 
int main(){
    int h,w;
    cin>>h>>w;
    vvi f(h+2,vi(w+2,1));
    vvi walk(h+2,vi(w+2,0));
    int gy,gx,y=0,x=0,v=0;
    range(i,1,h+1)range(j,1,w+1){
        char c;
        cin>>c;
        switch(c){
            case 'G': gy=i,gx=j,f[i][j]=0; break;
            case '.': f[i][j]=0;break;
            case '#': break;
            case '^': y=i,x=j,v=0,f[i][j]=0; break;
            case '>': y=i,x=j,v=1,f[i][j]=0; break;
            case 'v': y=i,x=j,v=2,f[i][j]=0; break;
            case '<': y=i,x=j,v=3,f[i][j]=0; break;
        }
    }
    walk[y][x]=1;
    rep(loop,4000){
        vvi vec={{-1,0},{0,1},{1,0},{0,-1}};
        if(f[y+vec[(v+1)%4][0]][x+vec[(v+1)%4][1]]==0){ //右手が道なら右に曲がって前に進む
            //cout<<"hoge";
            v=(v+1)%4;
            y+=vec[v][0], x+=vec[v][1];
            walk[y][x]=1;
        }else if(f[y+vec[v][0]][x+vec[v][1]]==1){ //（右が壁で、）正面が壁なら左に回る
            //cout<<"fuga";
            v=(v+3)%4;
        }else{ //そうでないならまえに進む
            //cout<<"zako";
            y+=vec[v][0],x+=vec[v][1];
            walk[y][x]=1;
        }
        if(y==gy&&x==gx){
            break;
        }
        // cout<<y<<","<<x<<","<<v<<endl;
        // rep(i,h+2){
        //     rep(j,w+2){
        //         if(i==y&&j==x){
        //             cout<<"^>v<"[v];
        //         }else{
        //             cout<<".#"[f[i][j]];
        //         }
        //     }
        //     cout<<endl;
        // }
    }
    if(y==gy&&x==gx){
        int ans=0;
        rep(i,h+2)rep(j,w+2)ans+=walk[i][j];
        cout<<ans<<endl;
    }else cout<<-1<<endl;
    return 0;
}


Measured memory_bytes: 3192
#include <stdio.h>
 
int main()
{
	char n,a;
	scanf("%c",&n);
	if(n == 'A') a = 'T';
	if(n == 'T') a = 'A';
	if(n == 'G') a = 'C';
	if(n == 'C') a = 'G';
	printf("%c",a);
	return 0;
}

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

int main(){
    long A,B,K;
    cin >> A >> B >> K;
    
    long ansA, ansB;

    ansA=A-K;
    ansB=B+min(ansA,0l);

    cout << max(ansA,0l) << " " << max(ansB,0l) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define ll long long
#define mod 1000000007
using namespace std;
int a[3005];
ll power(ll n,ll x){
    ll sp=1ll;
    while(x){
        if(x&1) sp=sp*n%mod;
        n=n*n%mod;x>>=1;
    }return sp;
}
ll inv=(mod+1)>>1,base,ans;
ll dp[3005][3005];
int n,m;
int main(){
    scanf("%d%d",&n,&m);base=power(2,m);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    for(int i=1;i<=n;i++)
    for(int j=1;j<=n;j++)
    dp[i][j]=(a[i]<a[j]);
    while(m--){
        ll l,r;scanf("%d%d",&l,&r);
        dp[l][r]=dp[r][l]=(dp[l][r]+dp[r][l])*inv%mod;
        for(int i=1;i<=n;i++)
        if(i!=l&&i!=r){
            dp[i][l]=dp[i][r]=(dp[i][l]+dp[i][r])*inv%mod;
            dp[l][i]=dp[r][i]=(dp[l][i]+dp[r][i])*inv%mod;
        }
    }
    ans=0;
    for(int i=1;i<=n;i++)
    for(int j=1;j<i;j++)
    (ans+=dp[i][j])%=mod;
    printf("%lld",ans*base%mod);
    return 0;
}


Measured memory_bytes: 70656
#include<iostream>
#include<vector>
using namespace std;
const int INF = 1e9+7;

int main(){
	int n;
	cin >> n;
	vector<int> h(n);
	for(int i = 0; i<n; i++){
		cin >> h[i];
	}
	
	vector<int> dp(n, INF);
	
	dp[0] = 0;
	dp[1] = abs(h[0]- h[1]);
	for(int i = 2; i < n; i++){
		dp[i] = min(dp[i-1]+abs(h[i] - h[i-1]),
			 dp[i-2]+abs(h[i] - h[i-2]));
	}
	
	cout << dp[n-1];
	return 0;
} 

Measured memory_bytes: 4004
//file_name:ABC48_B.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#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)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


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

    if(a%x!=0){
        a += x - a%x;
    }
    if(b%x!=0){
        b -= b%x;
    }




    ll ans = 0;

    if(a<=b){
        ans = (b-a)/x +1;
    }

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



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define int long long

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

    int x;
    cin >> x;

    int ans = 1;
    for (int i = 2; i <= x; i++)
    {
        int y = i * i;
        while (y <= x)
        {
            ans = max(y, ans);
            y *= i;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
h, w, k = map(int, input().split())
c = [''] * h
for i in range(h):
    c[i] = list(input())

ans = 0

for i in range(2 ** (h + w)):
    white = 0
    wi = []
    he = []

    for j in range(h + w):
        if ((i >> j) & 1):
            if j < w:
                wi.append(j)
            else:
                he.append(j - w)

    for hei in range(h):
        for wid in range(w):
            if (not hei in he) and (not wid in wi) and c[hei][wid] == '#':
                white += 1

    if white == k:
        ans += 1

print(ans)


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

int main()
{
    int N;
    cin >> N;
    std::vector<long long> A(N);
    for(int i=0; i<N; i++) {
        cin >> A[i];
    }
    long long stepSum = 0;
    for (int i=1; i<N; i++) {
        if (A[i] >= A[i-1]) continue;
        long long diff = A[i-1] - A[i];
        stepSum += diff;
        A[i] += diff;
    }
    cout << stepSum << endl;
    return 0;
}

Measured memory_bytes: 4364
#include <stdio.h>
 
int main()
{
    int k;
    int a,b;
    scanf("%d", &k);
    scanf("%d %d", &a, &b);
 
if(a%k==0){
    printf("OK");
}
else if(((a/k)+1)*k<=b){
    printf("OK");
}
else{
    printf("NG");
}
    return 0;
}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
const double EPS=1e-7;
 
int main()
{
  int n,d1,d2;
  scanf("%d%d%d",&n,&d1,&d2);
  int n1=0,n2=0;
  while(d1%(1<<(n1+1))==0)n1++;
  while(d2%(1<<(n2+1))==0)n2++;
  int c=0;
  for(int i=0;i<2*n&&c<n*n;i++){
    for(int j=0;j<2*n&&c<n*n;j++){
      if((n1%2==0?(i>>(n1/2))%2==(j>>(n1/2))%2:(i>>(n1/2))%2==0)
	 &&(n2%2==0?(i>>(n2/2))%2==(j>>(n2/2))%2:(i>>(n2/2))%2==0)){
	printf("%d %d\n",i,j);
	c++;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 896
#include<cstdio>
#include<cmath>
using namespace std;

int main() {
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);

  double PI = acos(-1);
  double rad = c * PI / 180;

  double s = 0.5 * a * b * sin(rad);
  double l = a + b + sqrt(a * a + b * b - 2 * a * b * cos(rad));
  double h = b * sin(rad);

  printf("%.8f\n", s);
  printf("%.8f\n", l);
  printf("%.8f\n", h);

  return 0;
}



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

#define scd second
#define fst first
#define pb push_back
#define mkp make_pair
#define all(x) x.begin(), x.end()

using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
typedef vector<ll> vlong;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vint> vvint;
typedef vector<vlong> vvlong;
typedef list<int> lint;
typedef list<ll> llong;
typedef list<pii> lpii;
typedef list<pll> lpll;
typedef list<lint> llint;
typedef list<llong> lllong;

int const N=1e6+100;
ll const LINF=numeric_limits<long long int>::max();
int const INF=numeric_limits<int>::max();
int const BN = 31;

ll gcd(ll a, ll b){
	return b ? gcd(b,a%b) : a;
}

ll pow_mod(ll a, ll e, ll m){
	ll res=1;
	while(e){
		if(e&1) res=res*a%m;
		a=a*a%m;
		e>>=1;
	}
	return res;
}

ll inv_mod(ll b, ll m){
	b%=m;
	ll x=0, y=1, r, q, a=m;
	while(b){
		q=a/b;
		r=a%b;
		a=b;
		b=r;
		r=x;
		x=y;
		y=r-q*y;
	}
	x+=m;
	return x%m;
}

void dfs(int r, vint gr[], vlong &xsum, vlong &ans, ll psum, vint &vst){
	psum+=xsum[r];
	ans[r]=psum;
	vst[r]=0;
	for(auto x : gr[r]){
		if(vst[x]==1){
			dfs(x,gr,xsum,ans,psum,vst);
		}
	}
}

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

	int n, q;
	cin>>n>>q;

	vint gr[n+1];
	for(int i=1; i<n; i++){
		int a, b;
		cin>>a>>b;
		gr[a].pb(b);
		gr[b].pb(a);
	}

	vlong xsum(n+1);
	while(q--){
		int p,  x;
		cin>>p>>x;
		xsum[p]+=x;
	}
	vlong ans(n+1);
	vint vst(n+1,1);
	dfs(1,gr,xsum,ans,0,vst);
	for(int i=1; i<=n; i++) cout<<ans[i]<<" ";
	cout<<endl;
}

Measured memory_bytes: 32896
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int digits(ll N){ 
    int digits=0;
    while(N>0){
        N/=10;
        digits++;
    }
    return digits;
}
int main(){
  ll n,ans;
  cin>>n;
  ans=digits(n);
  for(int i=2;i<=sqrt(n);i++){
      if(n%i!=0) continue;
      ll b=n/i;
      int cur=max(digits(i),digits(b));
      if(ans>cur) ans=cur;
  }
    
  cout<<ans<<endl;
}

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;

#define print(a) {for(auto xxxxx : (a)) cout << xxxxx << ' '; cout << '\n';}
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin() , (a).end()
#define rall(a) (a).rbegin() , (a).rend()

ll next(){ll x; cin >> x;return x;}
const int maxn = 2e5 + 2 , intf = 2e9;
const ll inf = 2e18 , mod = 1e9 + 7;
const ld eps = 1e-9;


void solve(){
    int k , n; cin >> k >> n;
    vector <int> a(n);
    for (auto &x : a) 
        cin >> x;
    a.pb(a[0]);
    int ans = k;
    for (int i = 0; i < n; i ++){
        if (i + 1 < n) ans = min(ans , k - abs(a[i] - a[i + 1]));
        else ans = min(ans , abs(a[i] - a[i + 1]));
    }
    cout << ans;
}


signed main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.precision(20);
    
    for (int t = 1; t--;) solve();

	return 0;
}
/*


*/



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

int main(){
	int a, b;
	cin >> a >> b;
    int memo = 0;
    int ans = -1;
    for(int i=10000; i>0; i--){
      memo = i;
      if(memo*8/100 == a && memo/10 == b) ans = i;
    }
	cout << ans << endl;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
# coding: utf-8
from fractions import gcd 
from functools import reduce
import sys
sys.setrecursionlimit(200000000)
from inspect import currentframe


# my functions here!
#標準エラー出力
def printargs2err(*args):
    names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' : '+repr(arg) for arg in args),file=sys.stderr)






def printglobals():
    for (symbol, value) in globals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)
def printlocals():
    for (symbol, value) in locals().items():
        print('symbol="%s"、value=%s' % (symbol, value),file=sys.stderr)
#入力（後でいじる）
def pin(type=int):
    return map(type,input().split())
     
#input
from collections import Counter 
def resolve():
    print(["win","bust"][ sum(pin())>21])
            
    #print([["NA","YYMM"],["MMYY","AMBIGUOUS"]][cMMYY][cYYMM])
#if __name__=="__main__":resolve()

"""
#printデバッグ消した？
#前の問題の結果見てないのに次の問題に行くの？
"""
"""
お前カッコ閉じるの忘れてるだろ
"""
import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """5 7 9"""
        output = """win"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """13 7 2"""
        output = """bust"""
        self.assertIO(input, output)


if __name__=="__main__":resolve()

Measured memory_bytes: 83032
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <set>
#include <numeric>
#include <vector>
#include <math.h>
#include <string>
#include <queue>

using namespace std;



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

	int V[20];
	int C[20];

	for (int i = 0; i < N; i++)
	{
		cin >> V[i];
	}
	for (int i = 0; i < N; i++)
	{
		cin >> C[i];
	}
	
	int sum = 0;
	for (int i = 0; i < N; i++)
	{
		int d = V[i] - C[i];

		if (d > 0)
		{
			sum += d;
		}
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <set>
#include <sstream>
#include <string>
using namespace std;

int main(){
	while(1){
		int n, k;
		int p[10];
		set<long> s;
		
		scanf(" %d", &n);
		if(n==0) break;
		scanf(" %d", &k);	
		for(int i=0; i<n; ++i) scanf(" %d", &p[i]);
		
		if(k==2){
			for(int a=0; a<n; ++a){
				for(int b=0; b<n; ++b){
					if(b==a) continue;
					stringstream ss;
					ss<<p[a];
					ss<<p[b];
					
					istringstream iss(ss.str());
					long t;
					iss>>t;
					s.insert(t);
					iss.clear();
				}
			}	
		}
		else if(k==3){
			for(int a=0; a<n; ++a){
				for(int b=0; b<n; ++b){
					if(b==a) continue;
					for(int c=0; c<n; ++c){
						if(c==a || c==b) continue;
						stringstream ss;
						ss<<p[a];
						ss<<p[b];
						ss<<p[c];
						
						istringstream iss(ss.str());
						long t;
						iss>>t;
						s.insert(t);
						iss.clear();	
					}
				}
			}
		}
		else if(k==4){
			for(int a=0; a<n; ++a){
				for(int b=0; b<n; ++b){
					if(b==a) continue;
					for(int c=0; c<n; ++c){
						if(c==a || c==b) continue;
						for(int d=0; d<n; ++d){
							if(d==a || d==b || d==c) continue;
							stringstream ss;
							ss<<p[a];
							ss<<p[b];
							ss<<p[c];
							ss<<p[d];
							
							istringstream iss(ss.str());
							long t;
							iss>>t;
							s.insert(t);
							iss.clear();	
						}
					}
				}
			}
		}
		
		printf("%ld\n", s.size());
	}
}

Measured memory_bytes: 1412
N, M, C = list(map(lambda x: int(x), input().split(" ")))
B = list(map(lambda b: int(b), input().split(" ")))
cnt = 0
for i in range(N):
  A = list(map(lambda a: int(a), input().split(" ")))
  if sum([a * b for (a, b) in zip(A, B)]) + C > 0:
    cnt += 1
    
print(cnt)

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

void generate(int map[][15],int n){
	int i,j,num;

	i = (n+1)/2;
	j = n/2;

	map[i][j] = 1;
	num = 2;

	while(num <= n*n){
		i++;
		j++;
		if(i >= n){
			i -= n;
		}
		if(j >= n){
			j -= n;
		}else if(j <= -1){
			j += n;
		}
		if(map[i][j] != 0){
			i++;
			j--;
		}
		if(i >= n){
			i -= n;
		}
		if(j >= n){
			j -= n;
		}else if(j <= -1){
			j += n;
		}
		map[i][j] = num;
		num++;
	}
}

int main(){
	int i,j,n;
	int map[15][15];

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

		memset(map,0,sizeof(map));
		generate(map,n);

		for(i = 0;i < n;i++){
			for(j = 0;j < n;j++){
				printf("%4d",map[i][j]);
			}
			printf("\n");
		}
	}

	return 0;
}

Measured memory_bytes: 616
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T, class S> std::ostream& operator <<(std::ostream& os, std::pair<T, S> p)
{
  return os << "(" << p.first << " " << p.second << ")";
}

template<class T> std::ostream& operator <<(std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  //os << v[0]; for (ll i = 1; i < (ll)v.size(); i++){ os << " " << v[i]; }
  return os;
}

template<class T, class S> std::ostream& operator <<(std::ostream& os, std::map< T, S > m)
{
  ll i = 0; for (auto p : m){ os << " [" << i << "]" << p.first << "->" << p.second; i++;}
  return os;
}

template<class T> std::ostream& operator <<(std::ostream& os, std::vector< std::vector<T> > vv)
{
  for (auto& vec : vv){ os << vec << std::endl; }
  os << "--------" << std::endl;
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H&& head){ std::cout << head << std::endl; }
template<typename H, typename... T> void print(H&& head, T&&... tail){
  std::cout << head << " ", print(std::forward<T>(tail)...);
}

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

  ll X;
  std::cin >> X;

  ll max_a = 0LL;
  for (ll a = 0LL; a < 100000; a++) {
    ll d = std::pow(a, 5) - std::pow(a-1, 5);
    if (d > (ll)1e9) {
      max_a = a;
      break;
    }
  }

  for (ll a = -max_a; a <= max_a; a++) {
    for (ll b = -max_a; b <= max_a; b++) {
      ll a5 = std::pow(a, 5);
      ll b5 = std::pow(b, 5);
      if (a5 - b5 == X) {
        print(a, b);
        std::exit(0);
      }
    }
  }

  return 0;
}


Measured memory_bytes: 3952
////////////////////////////////////////////
///                                      ///
///        Template ver. 1.2. rapel      ///
/// Fear is Temporary, Regret is Forever ///
///          Must Try and Get AC         ///
///                                      ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>
#include <chrono>
#include <random>

#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>

#define F first
#define S second
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
//#define endl '\n'
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

ll n, arr[3], d;
const ll MAXN = 1e18;

unordered_map<ll, bool> vis;
ll ans = 0;

int mo[] = {2, 3, 5};

priority_queue<pair<ll, ll> > pq;

void print(__int128 x) {
	if(x == 0) return ;
	print(x / 10);
	int c = x % 10;
	cout<<c;
}

void hora(int tc) {
	cin>>n>>arr[0]>>arr[1]>>arr[2]>>d;
	vis.clear();
	pq.push({0, n});
	ans = MAXN;
	while(!pq.empty()) {
		ll ct = -pq.top().F;
		ll cur = pq.top().S;
		pq.pop();
		if(ct > ans) continue;
		if(vis.find(cur) != vis.end()) continue;
		vis[cur] = 1;
		if(cur > MAXN / d) ;
		else ans = min(ans, ct + cur * d);
		for(ll i = -5;i <= 5;i++) {
			ll nv = cur + i;
			if(nv < 0) continue;
			for(int j = 0;j < 3;j++) {
				if(nv % mo[j]) continue;
				ll nct = ct + abs(i) * d + arr[j];
				pq.push({-nct, nv / mo[j]});
			}
		}
	}
	cout<<ans<<endl;
}

int main(){
	desperate_optimization(10);
	int ntc = 1;
	cin>>ntc;
	for(int tc = 1;tc <= ntc;tc++) hora(tc);
	return 0;
}


Measured memory_bytes: 9116
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
char s[3];
int main(){
    bool qaq=0;
    scanf("%s",s);
    if(s[1]=='S') qaq=1;
    int r=0;
    rep(i,0,2) {
        if(s[i]=='R') ++r;
    }
    if(r==2&&qaq) puts("1");
    else if(r==3) puts("3");
    else if(r==2) puts("2");
    else if(r==1) puts("1");
    else puts("0");
    return 0;
}

Measured memory_bytes: 3684
#include <iostream>

using namespace std;

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

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
from itertools import permutations, combinations
from fractions import gcd
from collections import Counter
from math import sqrt
import sys
input = sys.stdin.readline
def lcm(x, y):
    return (x*y//gcd(x, y))
def small_letters():
    return [chr(i) for i in range(97, 97+26)]
def capital_letters():
    return [chr(i) for i in range(65, 65+26)]
def continual_letters(list_x):
    """example"""
    """[2,2,2,2,4,4,5,5,5,8,8,8,8,8] => [4,2,3,5]"""
    i,j = 0,0
    result = []
    k = len(list_x) - 1
    while(True):
        A = list_x[i]
        while(True):
            print(j)
            if list_x[j] != A:
                break
            if j >= k:
                break
            j += 1
        result.append(j-i)
        if i >= k:
            break
        i = j
    result[-1] += 1
    return result


def main():
    """ここに書いてね"""
    H = int(input())
    n = 0
    while(True):
        if H == 0:
            break
        H = H // 2
        n += 1
    print(2**n-1)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5076