akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
	int n,m,x,y;
  	scanf("%d%d%d%d",&n,&m,&x,&y);
  	int max=x,min=y;
  	int elementx;
  	for(int i=1;i<=n;i++)
    {
      scanf("%d",&elementx);
      if(elementx>max)
        max=elementx;
    }
  int elementy;
  	for(int i=1;i<=m;i++)
    {
      scanf("%d",&elementy);
      if(elementy<min)
        min=elementy;
    }
    if(max<min)
      printf("No War");
  else
    printf("War");
}


Measured memory_bytes: 256
#coding:utf-8



def main():
    
    def dbg(*something):
        if DEBUG:
            print(*something)


    #正の宝石を戻すことはない
    #負の宝石を戻すのは後半
    from sys import stdin
    from math import ceil,floor
    DEBUG = False
    N,K = list(map(int,stdin.readline().split()))
    V = list(map(int,stdin.readline().split()))
    
    max_value = 0
    dbg([i for i in range(3,-1,-1)])
    for getnum in range(1,min(N+1,K+1)):  #取る宝石の総数
        for a in range(getnum + 1):  #左から石を取る回数
            J = [0] * getnum #石
            b = getnum - a #右から石を取る回数
            for i in range(a):
                J[i] = V[i]
            for i in range(b):
                J[a+i] = V[-i-1]
            J.sort()
            #dbg(J,a,b)
            t = min(K-getnum,getnum) #捨てる石
           
            for i in range(t): 
                if J[i] >= 0:
                    t = i
                    break
            #dbg(J,i,t,a,b,J[t:])
            tmp_max = sum(J[t:])

            max_value = max(max_value,tmp_max)
    print(max_value)



if __name__ == '__main__':
    main()


Measured memory_bytes: 41836
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    ll a,b;
    cin >> a >> b;
    if(a < 9 && b < 9) cout << "Yay!"<<endl;
    else cout << ":(" << endl;

    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


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

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


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 8)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, K = map(int, input().split())
coords = []
for i in range(N):
    x, y = map(int, input().split())
    coords.append((x, y))
coords.sort()


def solve():
    minarea = 1 << 62
    for t in range(N):
        _, yt = coords[t]
        for b in range(N):
            _, yb = coords[b]
            if yb < yt:
                continue
            h = yb - yt
            xs = []
            for i in range(N):
                xi, yi = coords[i]
                if yi < yt or yi > yb:
                    continue
                xs.append(xi)
            for i in range(K - 1, len(xs)):
                w = xs[i] - xs[i - K + 1]
                a = w * h
                minarea = min(minarea, a)
    return minarea


if __name__ == "__main__":
    print(solve())


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<map>
#include<set>
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
    int n;
    cin >> n;
    map<int,int>s;
    rep(i,n-1){
        int shainnum;
        cin >> shainnum;
        s[shainnum] +=1;
    }
    for(int i=1;i<n+1;i++){
        cout << s[i] << " ";
    }
    return 0;
}

Measured memory_bytes: 12976
n = int(input())
A = [0]+[int(i) for i in input().split()]+[0]
S = 0
for i in range(n+2):
    S += abs(A[i]-A[i-1])
for i in range(1,n+1):
    print(S-abs(A[i]-A[i+1])-abs(A[i]-A[i-1])+abs(A[i-1]-A[i+1]))

Measured memory_bytes: 14048
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define Stdio
#ifdef Stdio
#define Open_file(F)
#ifdef ONLINE_JUDGE
char _B[1<<15],*_S=_B,*_T=_B,_U[1<<15|1],*_O=_U,*_W=_U+(1<<15);
bool END=0;
#define getc() (_S==_T&&(_T=(_S=_B)+fread(_B,1,1<<15,stdin),_S==_T)?END=1:*_S++)
#define putc(c) (_O==_W?fwrite(_U,1,1<<15,stdout),_O=_U,1:1,*_O++=c)
#define EXIT fwrite(_U,1,_O-_U,stdout);\
	return 0
#else
#define getc() getchar()
#define putc(x) putchar(x)
#define EXIT return 0
#endif
#else
#define Open_file(F) freopen(F".in","r",stdin);\
	freopen(F".out","w",stdout)
char _B[1<<15],*_S=_B,*_T=_B,_U[1<<15|1],*_O=_U,*_W=_U+(1<<15);
bool END=0;
#define getc() (_S==_T&&(_T=(_S=_B)+fread(_B,1,1<<15,stdin),_S==_T)?END=1:*_S++)
#define putc(c) (_O==_W?fwrite(_U,1,1<<15,stdout),_O=_U,1:1,*_O++=c)
#define EXIT fwrite(_U,1,_O-_U,stdout);\
	return 0
#endif
#define I_inF 2*(233333333LL+666666666LL)
#define UI_inF 4*(233333333LL+666666666LL)
#define LL_inF (2333333333333333333LL+6666666666666666666LL)
#define ULL_inF 2*(2333333333333333333ULL+6666666666666666666ULL)
#define R register
#define D long long
#define RD R D
#define For(a,b,c) for(RD a=b;a<=c;++a)
#define foR(a,b,c) for(RD a=b;a>=c;--a)
#define Mset(a,b) memset(a,b,sizeof(a))
inline D read() {
#define isd(c) (c>='0'&&c<='9')
	RD aa,bb;
	R char ch;
	while(ch=getc(),!isd(ch)&&ch!='-');
	ch=='-'?aa=bb=0:(aa=ch-'0',bb=1);
	while(ch=getc(),isd(ch)) aa=(aa*10+ch-'0');
	return bb?aa:-aa;
}
inline void out(RD x,RD k=0) {
	if(x<0) putc('-'),x=-x;
	if(!x) putc('0');
	else {
		R char stk[20];
		RD ts;
		for(ts=0; x; x/=10) stk[++ts]=x%10+'0';
		for(; ts; putc(stk[ts--]));
	}
	if(k==1) putc(' ');
	if(k==2) putc('\n');
}
int main() {
	RD n=read();
	if(n==1) puts("Hello World");
	else out(read()+read());
	EXIT;
}


Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int main()
{
	string s;
	cin >> s;
	if (s == "AAA" || s == "BBB")
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>                                               //scanf,printf
#include <algorithm>                                            //max,min
#include <string>                                               //string
#include <cstring>                                              //strlen,strcat
#include <cctype>                                               //isalpha,tolower
#include <cmath>                                                //sqrt,sin
#include <stack>                                                //top,push
#include <queue>                                                //front,push
#include <vector>                                               //push_back,sort
#include <set>                                                  //insert,begin
#include <map>                                                  //insert,find
#include <list>                                                 //push_front,begin
#include <stdio.h>
#include <string.h>
#include <cstdlib>
using namespace std;
#define MAX 60
#define INFTY (1<<21)

int h,w,game[MAX][MAX],bla=0;
int times[MAX][MAX];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

void bfs(){
  queue<pair<int, int>> S;
  for(int i=0; i<51; i++){
    for(int j=0; j<=51; j++) times[i][j]=-1;
  }
  times[1][1]=1;
  S.push(make_pair(1, 1));
  bool fin=false;
  
  while (!S.empty()) {
    pair<int, int> p=S.front(); S.pop();
    for(int i=0; i<4; i++){
      if(game[p.first+dy[i]][p.second+dx[i]]==0&&p.first+dy[i]>=1&&p.second+dx[i]>=1&&times[p.first+dy[i]][p.second+dx[i]]==-1){
        S.push(make_pair(p.first+dy[i], p.second+dx[i]));
        times[p.first+dy[i]][p.second+dx[i]]=times[p.first][p.second]+1;
        game[p.first+dy[i]][p.second+dx[i]]=1;
        if(p.first+dy[i]==h&&p.second+dx[i]==w) {
          fin=true;
          break;
        }
      }
    }
  }
  if(fin) cout<<(h*w-times[h][w])-bla<<endl;
  else cout<<-1<<endl;
}

int main(){
  char ch;
  cin>>h>>w;
  for(int i=0; i<=55; i++){
    for(int j=0; j<=55; j++) game[i][j]=INFTY;
  }
  for(int i=1; i<=h; i++){
    for(int j=1; j<=w; j++){
      cin>>ch;
      if(ch=='.') game[i][j]=0;
      else {
        game[i][j]=1;
        bla++;
      }
    }
  }
  
  bfs();
}















Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))


def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)
def lcm(a,b):
    return a*b//gcd(a,b)

L = 1

D = 1000000007
for i in range(N):
    L = lcm(L,A[i]) 
L = L % D

res = 0
for i in range(N):
    res = (res + L * pow(A[i],D-2,D)) % D  
print(int(res))





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

//#define int long long
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
const int MOD = 1e9 + 7;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(ba))

signed main() {
    string s; cin >> s;
    map<char, int> m;
    for(char c : s){
        m[c]++;
    }
    for(auto p : m){
        if(p.second % 2 == 1){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
N,M,K,*AB = map(int, open(0).read().split())
A = AB[:N]
B = AB[N:]
a = [0]
b = [0]
for i in range(N): a.append(a[i] + A[i])
for i in range(M): b.append(b[i] + B[i])
ans = 0
j = M
for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)

Measured memory_bytes: 55224
#include <bits/stdc++.h>
using namespace std;
#define mem(a, b) memset(a, (b), sizeof(a))
#define fore(i,a) for(int i=0;i<a;i++)
#define fore1(i,j,a) for(int i=j;i<a;i++)
#define print(ar) for(int i=0;i<ar.size();i++)cout<<ar[i]<<" ";
#define END cout<<'\n'
const double pi=acos(-1.0);
 
typedef pair<int, int> PII;
 
typedef vector<long long int> VI;
 
typedef vector<string> VS;
 
typedef vector<PII> VII;
 
typedef vector<VI> VVI;
 
typedef map<int,int> MPII;
 
typedef set<int> SETI;
 
typedef multiset<int> MSETI;
 
typedef long int li;
 
typedef unsigned long int uli;
 
typedef long long int ll;
 
typedef unsigned long long int  ull;
const ll N = 1e9+7;



ll fastexp (ll a, ll b, ll n) {
  ll res = 1;
  while (b) {
      if (b & 1) res = res*a%n;
      a = a*a%n;
      b >>= 1;
  }
  return res;
}
void fast(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
int diff(string a,string b){
    int dc=0;
    fore(i,a.length()){
        if(a[i]!=b[i])dc++;
    }
    return dc;
}
int main()
 {  fast();
     ll t,n,m;
    t=1;
    while(t--){
        cin>>n>>m;
        char arr[n][m];
        ull dp[n][m];
        fore(i,n){
            fore(j,m){
                cin>>arr[i][j];
            }
        }
        
        fore(i,n){
            fore(j,m){
               dp[i][j]=0;
            }
        }
       fore(i,n)
       {if(arr[i][0]!='#')
           dp[i][0]=1;
           else break;
       }
       fore(j,m)
       {if(arr[0][j]!='#')
           dp[0][j]=1;
           else break;}
           
        fore1(i,1,n){
            fore1(j,1,m){
                if(arr[i][j]!='#')
               { dp[i][j]=(dp[i-1][j]%N+dp[i][j-1]%N)%N;
                   
               }
               else dp[i][j]=0;
                 }
        }
         
        cout<<dp[n-1][m-1]%N<<endl;
        
    }
	}


Measured memory_bytes: 9088
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <string>
#include <bitset>
#include <fstream>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef vector<pii> vii;

#define INF 1000000007ll
#define PB push_back
#define MP make_pair
#define X first
#define Y second
#define cil(a,b) ( ((a)%(b) == 0)?((a)/(b)):((a)/(b)+1) )
#define err(x) cerr << #x << " = " << x << endl;
#define SIZE 200010

vi adj[SIZE];
int d[SIZE], vis[SIZE] = {0};

int main() {
   int n, m;
   cin >> n >> m;
   for (int i = 0 ; i < m ; ++i) {
      int u, v;
      cin >> u >> v;
      adj[u].PB(v); adj[v].PB(u);
   }
   queue<pii > q;
   q.push(MP(1, 0));
   while (!q.empty()) {
      pii c = q.front();
      d[c.X] = c.Y;
      q.pop();
      vis[c.X] = 1;
      for (int i = 0 ; i < adj[c.X].size() ; ++i) {
         int t = adj[c.X][i];
         if (!vis[t]) q.push(MP(t, c.Y + 1));
      }
   }
   if (d[n] == 2) cout << "POSSIBLE" << endl;
   else cout << "IMPOSSIBLE" << endl;

   return 0;
}

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




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

    vector<tuple<string,int,int>>gin(n);
    for(int i=0;i<n;i++){
        string name;
        int value;
        cin>>name>>value;
        gin.at(i)=make_tuple(name,-value,i+1);
    }
    sort(gin.begin(),gin.end());

    for(auto GIN:gin){
        cout<<get<2>(GIN)<<endl;

    }

}

  


Measured memory_bytes: 256
#!/usr/bin/env python3
n, x = map(int, input().split())
a = sorted(list(map(int, input().split())))

ans = 0

for i in a:
    
    if x - i >= 0:
        x -= i
        ans += 1
    else:
        break
else:
    if x != 0:
        ans -= 1

print(ans)


Measured memory_bytes: 9188
#include<bits/stdc++.h>
using namespace std;
#define INF 100000000000;
using ll =long long;

int main()
{
	int N;cin >> N;
	vector<pair<int,int>> point(N);
	double x,y;
	vector<int> factrial(N+1);factrial[0]=1;
	for (int i=1;i<N+1;i++) factrial[i]=i*factrial[i-1];
	for (int i=0;i<N;i++)
	{
		cin >> x >>y;
		point[i]=make_pair(x,y);
	}
	double sum=0;
	double xx,yy;
	for (int i=0;i<N;i++)
	{
		for (int j=0;j<N;j++)
		{
			x=point[i].first;
			y=point[i].second;
			xx=point[j].first;
			yy=point[j].second;
			sum+=sqrt((x-xx)*(x-xx)+(y-yy)*(y-yy))*factrial[N-1];
		}
	}
	cout<< fixed << setprecision(15)<<sum/factrial[N] <<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
const int maxn = 10005;
const int mod = 1e9 + 7;


int main() {
    ios_base::sync_with_stdio(false); 
    cin.tie(0);
    int n;
    while (cin >> n) {
        set<int>v1,v2;
        vector<int>tar;
        f1(n) {
            int x;
            cin >> x;
            if (i & 1) {
                v1.insert(x);
            }
            else {
                v2.insert(x);
            }
            tar.pb(x);
        }
        sort(all(tar));
        int ans = 0;
        for (int i = 0 ; i < n ; i++) {
            if ((i & 1) && !v2.count(tar[i])) {
                ans++;
            }
            if (!(i & 1) && v2.count(tar[i])) {
                ans++;
            }
        }
        cout << ans/2 << '\n';
    }
}

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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

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

#define XX              first
#define YY              second
#define PB              push_back
#define MP              make_pair

#define NEWLINE         cerr << "\n";
#define HOISE           cerr << "hoise " << __LINE__ << "\n"
#define PAUSE           system("pause")
#define DEBUG(x)        cerr << #x << " = " << x << "\n"
#define FASTIO          ios_base::sync_with_stdio(false);cin.tie(NULL)

typedef long long ll;
typedef pair<int, int > pii;
typedef pair<ll, ll> pll;

const int INF = 1e9 + 23;
const ll INFL = 2e18 + 23;

int32_t main()
{
    int a, b;
    cin >> a >> b;
    cout << a*b;

    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define ff first
#define pb push_back
#define ss second
#define maxn 1000005
using namespace std;

ll dp[maxn][10], n;
ll price[10];

ll rec(ll taken, ll pos){
    if(dp[taken][pos] != -1) return  dp[taken][pos];
    if(taken >= n){
        if(taken == n) return 1LL;
        return 0LL;
    }
    ll res = 0LL;

    for(ll i=pos;i<=6;i++){
        res |= rec(taken + price[i], i);
    }
    return dp[taken][pos] = res;
}

int main(){
    price[1] = 100;
    price[2] = 101;
    price[3] = 102;
    price[4] = 103;
    price[5] = 104;
    price[6] = 105;
    memset(dp, -1, sizeof dp);
    cin >> n;
    cout << rec(0, 1) << endl;


    return 0;
}


Measured memory_bytes: 78464
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<long double, long double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int MOD = 1000000007;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

int main(){
    int n; cin >> n;
    map<string, int> m;
    map<string, int>::iterator ite;;
    int t = 0;
    rep(i,n){
        string s; cin >> s;
        ite = m.find(s);
        if (ite == m.end()) m[s] = 1;
        else m[s]++;
        t = max(t,m[s]);
    }
    vector<string> ar;
    for (ite = m.begin(); ite != m.end(); ite++){
        if (ite->second == t) ar.emplace_back(ite->first);
    }
    sort(ar.begin(), ar.end());
    rep(i,ar.size()) cout << ar[i] << endl;
}

Measured memory_bytes: 26868
#include<cstdio>
#include<iostream>
#include <string>
#include<algorithm>
using namespace std;

int main()
{
    int a;
    cin >> a;
    
    int b = a/1000;
    int c = (a/100)%10;
    int d = (a/10)%10;
    int e = a%10;
    
    if((b==c and c==d) or (c==d and d==e) or (b==c and c==d and d==e))
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    
    
    
}




Measured memory_bytes: 3080
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl;
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define RE return 0;
#define HERE cout<<"    "<<"HERE"<<en

string c("XYZABCDEFGHIJKLMNOPQRSTUVWXYZ");

int main(){
  string ch;
  cin>>ch;
  for(int i=0; i<ch.size(); i++){
    for(int j=3; j<c.size(); j++){
      if(ch[i]==c[j]){
        cout<<c[j-3];
      }
    }
  }
  cout<<en
}



Measured memory_bytes: 3208
#include "bits/stdc++.h"

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL << (n))
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define en '\n'
#define pb push_back
#define mp make_pair

typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;

struct aaa {
	aaa() {
		cin.tie(0);
		ios::sync_with_stdio(0);
		cout << fixed << setprecision(20);
	};
}aaaaa;



int main() {
	int n;
	cin >> n;
	if (n == 7 || n == 5 || n == 3) {
		cout << "YES" << en;
	}
	else {
		cout << "NO" << en;
	}
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int k;
	int a,b;
	scanf("%d",&k);
	scanf("%d %d",&a,&b);
	for(int i=a;i<=b;i++){
		if(i%k==0){
		printf("OK\n");
		return 0;
		}
		else{
			continue;
			
		}
	}
	printf("NG\n");
	return 0;
}

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

#define all(x) begin(x), end(x)

using i64 = int_fast64_t;
using f64 = double;
using p64 = pair<i64, i64>;

constexpr i64 INF = INT_FAST64_MAX / 2;
constexpr f64 EPS = DBL_EPSILON;

i64 n, k;
vector<vector<i64>> graph;

i64 dfs(i64 current, i64 from, i64 depth) {
    if (depth == k / 2) return 1;
    i64 res = 1;
    for (auto& e : graph[current]) {
        if (e == from) continue;
        res += dfs(e, current, depth + 1);
    }
    return res;
}

void solve() {
    cin >> n >> k;
    graph.assign(n, {});

    vector<p64> edges(n - 1);
    for (i64 i = 0; i < n - 1; i++) {
        i64 a, b;
        cin >> a >> b, a--, b--;
        graph[a].emplace_back(b);
        graph[b].emplace_back(a);
        edges[i] = { a, b };
    }

    i64 ans = INF;
    if (k % 2) {
        for (auto& e : edges) {
            ans = min(ans, n - (dfs(e.first, e.second, 0) + dfs(e.second, e.first, 0)));
        }
    } else {
        for (i64 i = 0; i < n; i++) {
            ans = min(ans, n - dfs(i, -1, 0));
        }
    }
    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 512
N,M=map(int,input().split())
ans=[[0]*N for _ in range(N)]

for i in range(M):
    a,b=map(int,input().split())
    ans[a-1][b-1]+=1
    ans[b-1][a-1]+=1

for i in range(N):
    print(sum(ans[i]))

Measured memory_bytes: 3060
#include <stdio.h>

int main(){
	int n,count=0;
	scanf("%d",&n);
	int p[n];
	for(int i=0;i<n;i++){
		scanf("%d",&p[i]);
	}

	for(int i=1;i<n-1;i++){
		if((p[i-1] < p[i] && p[i]<p[i+1]) || (p[i-1]>p[i] && p[i+1]<p[i])){
			count++;
		}
	}

	printf("%d\n",count);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;
// ceil() 切り上げ, floor() 切り捨て
// next_permutation(all(x))

int		main(void)
{
	int N, K;
	cin >> N >> K;
	vector<int> H(N);
	for (int i = 0; i < N; i++)
		cin >> H[i];
	sort(all(H));
	int ans = 1e9;
	for (int i = 0; i <= N-K; i++)
	{
		ans = min(ans, H[i+K-1] - H[i]);
	}
	cout << ans << endl;
}



Measured memory_bytes: 640
N = int(input())
A = list(map(int, input().split()))
Q = int(input())

ans = sum(A)
dic = {a+1:0 for a in range(10**5)}
for a in A:
  dic[a] += 1

for i in range(Q):
  B, C = list(map(int, input().split()))
  ans += dic[B]*(C-B)
  dic[C] += dic[B]
  dic[B] = 0
    
  print(ans)


Measured memory_bytes: 24344
#include<iostream>
using namespace std;
int main(void) {
	int w, h, x, y, r;
	cin >> w >> h >> x >> y >> r;
	if (x + r > w || x - r <0 || y + r >h || y - r < 0) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
	return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for (ll i=0; i<n; ++i)
#define all(c) begin(c),end(c)
/*
10 10
2 5 6 5 2 1 7 9 7 2
6 6 6 5 4 4 3 3 2 1
1 2 3 3 3 4 5 6 6 6
5 5
2 4
6 7
2 2
7 8
7 9
1 8
6 9
8 10
6 8

クエリを整理して、右から見ていく？
ああ、区間和
なんかいけるかも

2 5 6 5 2 1 7 9 7 2
1 2 3 3 3 4 5 6 6 6

  for(ll i=3;i<100;i+=i&-i)
    printf("i: %lld\n",i);
i: 3
i: 4
i: 8
i: 16
i: 32
i: 64


*/
//BIT
#define M 500010
ll dat[M];
void init(){
  rep(i,M) dat[i] = 0;
}
void add(ll i, ll x){
  for(; i<M; i += i&-i) dat[i] += x;
}
ll sum(ll i){
  ll res = 0;
  for(; i>0; i -= i&-i) res += dat[i];
  return res;
}
ll rangesum(ll L, ll R){
  return sum(R) - sum(L-1);
}

ll A[M] = {};
vector<ll> QL[M], QID[M];
ll ans[M];

ll N, Q, C[M];

int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  cin>>N>>Q;
  for(ll i=1; i<=N; i++) cin>>C[i];
  rep(i,Q){
    ll L,R; cin>>L>>R;
    QL[R].push_back(L);
    QID[R].push_back(i);//後続、sortしないで順番に出せる
  }
  init();
  for(ll i=1; i<=N; i++){
    if (A[C[i]]>0) add(A[C[i]], -1);
    add(i, +1);
//rep(i, Q+10) cout<<dat[i]; cout<<endl;
    A[C[i]] = i;
    rep(j, QL[i].size())
      ans[QID[i][j]] = rangesum(QL[i][j], i);
  }

  rep(i, Q) cout<<ans[i]<<endl;
}


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

int main()
{
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; i++)
  {
    cin >> p[i];
  }
  
  int minp = 1e7, cnt = 0;
  for (int i = 0; i < n; i++)
  {
    if (minp > p[i])
    {
      minp = p[i];
      cnt++;
    }
  }
  cout << cnt << endl;
}
  

Measured memory_bytes: 1024
a,b,c,x,s;
main(){
  scanf("%d%d%d%d",&a,&b,&c,&x);
  for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)for(int k=0;k<=c;k++)s+=i*500+j*100+k*50==x;
  printf("%d",s);
}

Measured memory_bytes: 128
import java.util.*;
 
public class Main {
	
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int N = sc.nextInt();
    	int A = sc.nextInt();
    	int B = sc.nextInt();
    	char[] S = sc.next().toCharArray();
    	List<String> judge = new ArrayList<>();
    	int clear = 0;
    	int bnum = 1;
    	for (int i = 0; i < S.length; i++) {
    		if (S[i] == 'c') {
    			judge.add("No");
    		} else if (S[i] == 'a') {
    			if (clear < A + B) {
    				judge.add("Yes");
    				clear++;
    			} else {
    				judge.add("No");
    			}
    		} else {
    			if (clear < A + B && bnum <= B) {
    				judge.add("Yes");
    				clear++;
    				bnum++;
    			} else {
    				judge.add("No");
    			}
    		}
    	}
    	for (String res : judge) {
    		System.out.println(res);
    	}
    }
}

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

int main() {
	int loop;
	int flag = 0;
	int ans = 0;
	char s[200001];
	int len;

	scanf("%s", s);
	len = strlen(s);

	for (loop = 0; loop < len; loop++) {
		if (flag == 0 && s[loop] == 'T')ans++;
		else if (s[loop] == 'S')flag++;
		else flag--;
	}
	printf("%d\n", 2 * ans);
	return 0;
}

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

int main() {
	int N;
	cin >> N;
	string ans = "";
	while (N != 0) {
		if (N % 2 != 0) {
			N--;
			ans = "1" + ans;
		}
		else ans = "0" + ans;
		N /= -2;
	}
	
	if (ans == "") ans = "0";

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

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

int main() {
  int n,k;
  cin >> n >> k;
  vector<double> p(n);
  for(int i=0;i<n;i++){
    int x;
    cin >> x;
    p.at(i) = (x+1)/2.0;
  }

  vector<double> sum(n+1,0);
  sum.at(0) = 0;
  for(int i=0;i<n;i++){
    sum.at(i+1) = sum.at(i) + p.at(i);
  }
  
  /*
  for(int i=0;i<n;i++){
    cout << sum.at(i) << endl;
  }
  */
  
  double ans=0;
  for(int i=0;i<n-k+1;i++){
    //cout << i << " " << i+k << endl;
    if(ans < sum.at(i+k)-sum.at(i)){
      ans = sum.at(i+k)-sum.at(i);
    }
  }
  cout << fixed << setprecision(10) << ans << endl;
  return(0);
}

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

typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, int> pli;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

ll A, B, C, K;

int main() {
	cin >> A >> B >> C >> K;
	ll ans;
	if (K & 1) {
		ans = B - A;
	} else {
		ans = A - B;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define mod 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=5050;
//↑templete
int main() {
	int N;
	cin>>N;
	vpint V;
	for(int i=0;i<N;i++){
		int a;
		cin>>a;
		V.eb(a,i);
	}
	sort(V.begin(),V.end());
	for(int i=0;i<N;i++)
		cout<<V[i].second+1<<(i==N-1?'\n':' ');
	return 0;
}

Measured memory_bytes: 1780
#include <iostream>
#include <string>
#include <vector>
#include <queue>

using namespace std;

#define INF 100000

vector<string> F;
vector< vector<int> > D;

int H, W, N;

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

struct P {
    int x, y;
    P(int x, int y) : x(x), y(y) {};
};

P findpos(int c) {
    char t;
    if (c == 0) t = 'S';
    else t = c + '0';
    for (int i = 0; i < H; i++) 
        for (int j = 0; j < W; j++) 
            if (F[i][j] == t)
                return P(j, i);
}

int bfs(int cur) {
    for (int i = 0; i < H; i++) 
        for (int j = 0; j < W; j++) 
            D[i][j] = INF;
    P s = findpos(cur);
    D[s.y][s.x] = 0;
    P g = findpos(cur+1);
    queue<P> q;
    q.push(s);
    while (!q.empty()) {
        P p = q.front(); q.pop();
        if (p.x == g.x && p.y == g.y) break;
        for (int i = 0; i < 4; i++) {
            int nx = p.x + dx[i], ny = p.y + dy[i];
            if (0 <= nx && nx < W && 0 <= ny && ny < H && F[ny][nx] != 'X' && D[ny][nx] == INF) {
                q.push(P(nx, ny));
                D[ny][nx] = D[p.y][p.x] + 1;
            }
        }
    }
//    for (int i = 0; i < H; i++) {
//        for (int j = 0; j < W; j++) {
//            if (D[i][j] == INF) cout << "x ";
//            else cout << D[i][j] << ' ';
//        }
//        cout << endl;
//    }
//    cout << endl;
    return D[g.y][g.x];
}


void solve() {
    int time = 0;
    for (int cur = 0; cur != N; cur++) {
        time += bfs(cur);
    }
    cout << time << endl;
}

int main() {
    cin >> H >> W >> N;
    F.resize(H); for(int i = 0; i < H; i++) F[i].resize(W);
    D.resize(H); for(int i = 0; i < H; i++) D[i].resize(W);
    for (int i = 0; i < H; i++) {
        cin >> F[i];        
    }
    solve();
    return 0;
}

Measured memory_bytes: 5824
//↓見なくていいよ！ここから--------------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  myerr("-----start-----");
  var start = new Date();
  Main();
  var end = new Date() - start;
  myerr("----- end -----");
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//↑見なくていいよ！ここまで--------------------------------------------------
function Main(){
	var one = nextIntArray();
	var X = one[0];
	var Y = one[1];
	for(var i = 0; i <= X; i++){
		var kame = i * 4;
		var turu = (X - i) * 2;
		if(kame + turu == Y){
			myout("Yes");
			return;
		}
	}
	myout("No");
}

Measured memory_bytes: 30108
def check(y,x):
    if 0<=y<=h-1 and 0<=x<=w-1:
        return True
    return False

h,w=map(int,raw_input().split())
g=[map(int,raw_input().split()) for _ in xrange(h)]
pos=[-1]*(h*w)
for i in xrange(h):
    for j in xrange(w):
        pos[g[i][j]-1]=[i,j]

dy=(1,0,-1,0)
dx=(0,1,0,-1)
stop=[set() for _ in xrange(h*w)]
ans=0
for i in xrange(h*w):
    y,x=pos[i]
    for j in xrange(4):
        ny=y+dy[j];nx=x+dx[j]
        if check(ny,nx):
            if g[ny][nx]<g[y][x]:
                stop[i]=stop[i]|stop[g[ny][nx]-1]
    cnt=len(stop[i])
    if cnt>=2:
        ans+=1
    elif cnt==0:
        stop[i].add(g[y][x])

print(ans)

Measured memory_bytes: 821724
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 998244353
#define int long long int
#define double long double
#define inf (int)(1e15)
#define all(x) (x).begin(), (x).end()
#define pair pair<int, int>
typedef vector<int> vi;   // Vector of long long
typedef vector<vi> vvi;   // Vector of vi
typedef vector<pair> vii; // Vector of pairs
typedef vector<vii> vvii; // Vector of Vector of pairs
typedef vector<bool> vb;  // Vector of bool
#define pq priority_queue // Max heap (To convert to min heap, use negative sign before every value)
#define ff first          // For pairs
#define ss second
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, -1, 0, 1};
const int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}, dy8[] = {1, -1, 1, 0, -1, 1, -0, -1};
#define testcases(t) \
    int(t);          \
    cin >> (t);      \
    while ((t)--)
int power(int a, int b)
{
    int res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = (res * a) % mod;
        b = b >> 1;
        a = (a * a) % mod;
    }
    return res;
}
signed main()
{
    int n, s, ans = 1, maxLevel = -1;
    cin >> n;
    if (n == 1)
    {
        cin >> s;
        if (s == 0)
            cout << 1 << endl;
        else
        {
            cout << 0 << endl;
        }
        return 0;
    }
    vi sz(n + 1, 0);
    for (int i = 0, level; i < n; i++)
    {
        cin >> level;
        if (i == 0 && level != 0)
            ans = 0;
        sz[level]++;
        maxLevel = max(maxLevel, level);
    }
    if (sz[0] > 1)
        ans = 0;
    for (int i = 1; i <= maxLevel; i++)
    {
        ans = (ans * (power(sz[i - 1], sz[i]))) % mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int H, W; cin >> H >> W;
  vector<string> vs(H); FOR(i,0,H) cin >> vs[i];
  int num[26]; CLR(num);
  FOR(i,0,H) {
    FOR(j,0,W) {
      num[vs[i][j]-'a']++;
    }
  }
  if(H % 2 == 0 && W % 2 == 0) {
    FOR(i,0,26) {
      if(num[i] % 4 != 0) {
        puts("No");
        return 0;
      }
    }
    puts("Yes");
  } else if(abs(H - W) % 2 == 1) {
    int sum = 0;
    // 4つあるやつ先に
    FOR(i,0,26) {
      sum += num[i] / 4 * 4;
      num[i] -= num[i] / 4 * 4;
    }
    int two = 0;
    FOR(i,0,26) {
      two += num[i] / 2;
    }
    sum += two * 2;
    if(sum == H * W) {
      if(H % 2 == 0) {
        if(two <= H / 2) {
          puts("Yes");
        } else {
          puts("No");
        }
      } else {
        if(two <= W / 2) {
          puts("Yes");
        } else {
          puts("No");
        }
      }
    } else {
      puts("No");
    }
  } else {
    int sum = 0;
    // 4つあるやつ先に
    FOR(i,0,26) {
      sum += num[i] / 4 * 4;
      num[i] -= num[i] / 4 * 4;
    }
    int two = 0, one = 0;
    FOR(i,0,26) {
      two += num[i] / 2;
      one += num[i] % 2;
    }
    sum += two * 2 + one;
    if(sum == H * W && one == 1 && two <= (W / 2 + H / 2)) {
      puts("Yes");
    } else {
      puts("No");
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

using namespace std;
// using namespace __gnu_pbds;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair <int,int> pii;
typedef pair <ll,ll> pll;

#define un(x)           x.erase(unique(all(x)), x.end())
#define xx              first
#define yy              second
#define pb              push_back
#define all(v)          v.begin(),v.end()

#define D(x)            cerr << #x " = " << x << '\n'
#define DBG             cerr << "Hi!" << '\n'

#define CLR(a)          memset(a,0,sizeof(a))
#define SET(a)          memset(a,-1,sizeof(a))

// inline int setBit(int n,int pos) { return n = n | (1 << pos); }
// inline int resetBit(int n,int pos) { return n = n & ~(1 << pos); }
// inline bool checkBit(int n,int pos) { return (bool)(n & (1 << pos)); }

// int fx[] = {+0, +0, +1, -1, -1, +1, -1, +1};
// int fy[] = {-1, +1, +0, +0, +1, +1, -1, -1};

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// unsigned int num = rng();
// shuffle(V.begin(), V.end(), rng);

/******************************************************************************************/

//const int MAX = 500010;
//const int INF = 0x3f3f3f3f;
//const int MOD = 1000000007;


//inline int add(int a, int b) { return a + b >= MOD ? a + b - MOD : a + b; }
//inline int sub(int a, int b) { return a - b < 0 ? a - b + MOD : a - b; }
//inline int mul(int a, int b) { return (a * 1LL * b) % MOD; }

int n, x, y;
int ans[2010];

int get_dis(int a, int b) {
	if(a <= x) {
		if(b >= y) {
			return x - a + 1 + b - y;
		}
		else {
			return min(b - a, x - a + 1 + y - b);
		}
	}
	else if(a < y) {
		if(b <= y) {
			return min(b - a, a - x + 1 + y - b);
		}
		else {
			return min(b - a, a - x + 1 + b - y);
		}
	}
	else {
		return b - a;
	}

}


int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
	
	cin >> n >> x >> y;
	for(int i=1;i<=n;i++) {
		for(int j=i+1;j<=n;j++) {
			ans[get_dis(i, j)]++;
		}
	}

	for(int i=1;i<n;i++) cout << ans[i] << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <deque>

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> d(N);
    for (int i=0;i<N;++i) {
        cin >> d[i];
    }

    sort(d.begin(), d.end());
    cout << (d[N/2] - d[N/2-1]) << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <cstring>
#include <math.h>
#include <bitset>
#include <time.h>
#include <set>
#include <algorithm>
#define MODD 1000000007
#define ll long long
using namespace std;


int main() {
    
    string S;
    cin>>S;
    string a1;
    
    if (S[0]==S.back()) {
        if (S.size()%2==0)
            a1="First";
        else
            a1="Second";
    } else {
        if (S.size()%2==0)
            a1="Second";
        else
            a1="First";
    }
    
    cout << a1 << endl;
    
    
}

Measured memory_bytes: 640
#include<iostream>
// cout endl cin //
#include<cstdio>
// printf scanf //
#include<cctype>
// 文字の判別や変換 //
using namespace std;

int main(){
    char ch;
    int cnt[26]={};
    
    while(cin >> ch){
        ch = tolower(ch);
        if (isalpha(ch)){
            cnt[ch-'a']++;
        }
    }
    
    for ( int i=0; i<26; i++){
        printf ("%c : %d\n", i+'a',cnt[i]);
    }
    return 0;
}


Measured memory_bytes: 3104
import math

#nの素因数分解(O(n**0.5)
def prime_factor(n):
    ass = []
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.append(i)
            n = n//i
    if n != 1:
        ass.append(n)
    return ass


N = int(input())
ans = 0
howmany = []
nums = sorted(prime_factor(N))
if len(nums)>0:
    count = 1
else:
    count = 0
for one, two in zip(nums,nums[1:]):
    if one != two:
        howmany.append(count)
        count = 1
    else:
        count += 1
else:
    howmany.append(count)


for i in howmany:
    for j in range(1,20):
        if j * (j + 1) // 2 > i:

            ans += j - 1
            break

print(ans)


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

int c = 0;

void merge(int a[], int l, int m, int r)
{
	int n1 = m - l;
	int n2 = r - m;
	vector<int> L(n1 + 1), R(n2 + 1);

	for (int i = 0; i < n1; i++)
		L[i] = a[l + i];

	for (int i = 0; i < n2; i++)
		R[i] = a[m + i];

	L[n1] = 1000000001;
	R[n2] = 1000000002;
	int i = 0, j = 0;

	for (int k = l; k < r; k++) {
		if (L[i] <= R[j]) {
			a[k] = L[i];
			i++;
		}
		else {
			a[k] = R[j];
			j++;
		}
		c++;
	}
}

void mergeSort(int a[], int l, int r)
{
	if (l + 1 < r) {
		int m = (l + r) / 2;
		mergeSort(a, l, m);
		mergeSort(a, m, r);
		merge(a, l, m, r);
	}
}

int main()
{
	int n = 0, a[500000] = { 0 };

	cin >> n;

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

	mergeSort(a, 0, n);

	for (int i = 0; i < n - 1; i++)
		cout << a[i] << " ";

	cout << a[n - 1] << endl;
	cout << c << endl;

	return 0;
}

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

int main() {
  int A,B,C,K;
  cin>>A>>B>>C>>K;
  if(K<=A){
    cout<<K<<endl;
  }
else if(K<=A+B){
  cout<<A<<endl;
}
else{
  cout<<A-(K-A-B)<<endl;
}
}

Measured memory_bytes: 3624
w, h, n = map(int, input().split())
x1 = 0
y1 = 0
x2 = w
y2 = h
f = 0
for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        x1 = max(x, x1)
    elif a == 2:
        x2 = min(x, x2)
    elif a == 3:
        y1 = max(y, y1)
    elif a == 4:
        y2 = min(y, y2)
    
    if x1 >= x2 or y1 >= y2 or x2 <= 0 or y2 <= 0:
        f = 1
if f:
    print("0")
else:
    print((x2-x1)*(y2-y1))

Measured memory_bytes: 62652
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>


using namespace std;

int main(){
	long long int H, W;
	cin >> H >> W;
	long long int ans;

	if (H == 1 || W == 1) {
		ans = 1;
	}
	else {
		ans = (H * W + 1) / 2;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include <unordered_map>
#include <cmath>
#include <functional>
#include <map>
#include <cstdlib>

using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;

template <class T>
void debug(T& v)
{
    for(auto& x: v) cout << x << " ";
    cout << endl;
}

int main()
{
    int N;
    cin >> N;
    vector<int> A(N-1);
    for(int i=0; i<N-1; i++){
        cin >> A[i];
        A[i]--;
    }

    vector<int> ans(N);
    for(auto& x: A) ans[x]++;

    for(auto& x: ans) cout << x << endl;
}

Measured memory_bytes: 4792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

string s, t;

int main(void){
    
    cin >> s >> t;
    
    for(int i = 0; i < s.size(); ++i){
        string a;
        for(int j = i; j < s.size(); ++j) a += s[j];
        for(int j = 0; j < i; ++j) a += s[j];
        if(a == t){ printf("Yes\n"); return 0; }
    }
    printf("No\n");
    
    return 0;
}

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


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

int main(){
    long long n;
    cin >> n;
    long long ans=0;
    long long t;
    for(long long i=1;i<=sqrt(n)*10;i++){
        if(n<=i)break;
        if((n-i)%i==0&&(n-i)/i>0){
        t=(n-i)/i;
        if(n%t!=n/t)continue;
        ans+=t;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
const ll INF = 1e18;
#define print(x) cout << (x) << endl;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)

int n, W;
int weight[3010], value[3010]; // 品物の個数は 100 個なので少し余裕持たせてサイズ 110 に

// DPテーブル
int dp[3010][10010] = {0}; // テーブルの初期値はすべて 0 にしておきます

// 復元用テーブル
int prev_w[3010][10010];

int main() {
    // 入力受け取り
    cin >> n >> W;
    W = W-1;
    for (int i = 0; i < n; ++i) cin >> weight[i] >> value[i];

    vector<vector<int> > xy(n, vector<int>(2));
    for (int i = 0; i < n; i++) {
        xy.at(i).at(1) = i;
        xy.at(i).at(0) = value[i];
    }

    // DPループ
    for (int i = 0; i < n; ++i) {
        for (int w = 0; w <= W; ++w) {

            // i 番目の品物を選ぶ場合を考える
            if (w >= weight[i]) {
                if (dp[i+1][w] < dp[i][w-weight[i]] + value[i]) {
                    dp[i+1][w] = dp[i][w-weight[i]] + value[i];
                    prev_w[i+1][w] = w - weight[i];
                }
            }

            // i 番目の品物を選ばない場合を考える
            if (dp[i+1][w] < dp[i][w]) {
                dp[i+1][w] = dp[i][w];
                prev_w[i+1][w] = w;
            }
        }
    }

    // 最適値の出力
    // cout << dp[n][W] << endl;


    // 復元
    // cout << "Selected items are..." << endl;
    int cur_w = W;
    for (int i = n-1; i >= 0; --i) {
        // 選んでいた場合
        if (prev_w[i+1][cur_w] == cur_w - weight[i]) {
            // cout << i << " th item (weight = " << weight[i] << ", value = " << value[i] << ")" << endl;
            xy.at(i).at(0) = 0;
        }

        // 復元テーブルをたどる
        cur_w = prev_w[i+1][cur_w];
    }
    sort(xy.begin(), xy.end());
    cout << dp[n][W] + xy.at(n-1).at(0) << endl;
}

Measured memory_bytes: 233344