akhauriyash/Code-Regression huggingface dataset:
t1,n1 =  map(int,input().split())
t2,n2 =  map(int,input().split())
t3,n3 =  map(int,input().split())
t4,n4 =  map(int,input().split())
if t1 == 1:
    print(n1*6000)
elif t1 ==2:
    print(n1*4000)
elif t1 ==3:
    print(n1*3000)
elif t1 ==4:
    print(n1*2000)
else:
    pass
if t2 == 1:
    print(n2*6000)
elif t2 ==2:
    print(n2*4000)
elif t2 ==3:
    print(n2*3000)
elif t2 ==4:
    print(n2*2000)
else:
    pass
if t3 == 1:
    print(n3*6000)
elif t3 ==2:
    print(n3*4000)
elif t3 ==3:
    print(n3*3000)
elif t3 ==4:
    print(n3*2000)
else:
    pass
if t4 == 1:
    print(n4*6000)
elif t4 ==2:
    print(n4*4000)
elif t4 ==3:
    print(n4*3000)
elif t4 ==4:
    print(n4*2000)
else:
    pass


Measured memory_bytes: 5608
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using T = tuple<ll,int,int>;
const ll inf = numeric_limits<ll>::max()/3;
const ll mod = 1e9 + 7;

vector<vector<int>> tree; 
vector<int> visit;

ll dfs(int node,ll k,ll dist1, ll dist2) {
  visit[node] = 1;
  if(k - (dist1 + dist2) < 1){
    return 0LL;
  }
  ll res = k - (dist1 + dist2);
  ll ndist2 = dist1;
  for(int next : tree[node]){
    if(!visit[next]){
      res *= dfs(next,k,1,ndist2);
      res %= mod;
      ++ndist2;
    }
  }
  return res;
}

int main(void){
  int n;
  ll k;
  cin >> n >> k;
  tree = vector<vector<int>>(n);
  visit = vector<int>(n,0);
  for(int i = 0;i < n-1;++i){
    int a,b;
    cin >> a >> b;
    --a;--b;
    tree[a].push_back(b);
    tree[b].push_back(a);
  }
  cout << dfs(0,k,0,0) << endl;
  return 0;
}


Measured memory_bytes: 10752
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <stack>
#include <map>

#define ull unsigned long long
#define ll long long

using namespace std;

char x[15];
ll l[200010]={0};

int main(){
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        getchar();
        scanf("%s",x);
        for(int j=0;j<strlen(x);j++){
            l[i]=26*l[i]+(x[j]-'a'+1);
        }
    }
    sort(l,l+n);
    int q=n;
    for(int i=0;i<n-1;i++){
        //printf("%lld\n",l[i]);
        if(l[i]==l[i+1]){
            q--;
        }
    }
    printf("%d",q);
    return 0;
}


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



int main() {
  int x, n;
  cin >> x >> n;
  int p[n];
  rep(i, n) cin >> p[i];
  int ans;
  int mini = 250;
  map<int, bool> can;
  rep(i, 201) can[i] = true;
  rep(i, 201){
    for(int a : p){
      if(i == a){
        can[i] = false;
      }
    }
  }
  rep(i, 201){
    if(can[i]){
      if(mini > abs(x - i)){
        mini = abs(x - i);
        ans = i;
      }
    }
  }
  cout << ans << endl;
}


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

int main()
{
    int n,x;
    int card[4][14]={};
    char m;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>m>>x;
        if(m=='S')card[0][x]=1;
        if(m=='H')card[1][x]=1;
        if(m=='C')card[2][x]=1;
        if(m=='D')card[3][x]=1;
    }
    for(int i=0;i<4;i++){
        for(int j=1;j<=13;j++){
            if(i==0&card[i][j]==0)cout<<"S"<<" "<<j<<endl;
            if(i==1&card[i][j]==0)cout<<"H"<<" "<<j<<endl;
            if(i==2&card[i][j]==0)cout<<"C"<<" "<<j<<endl;
            if(i==3&card[i][j]==0)cout<<"D"<<" "<<j<<endl;
        }
    }
}


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

int main() {
  
long long n,a,b;
cin>>n>>a>>b;
long long sum=a+b;
long long kakeru=n/sum;
long long amari=n%sum;
if(amari>a){
    amari=a;
}
cout<<kakeru*a+amari<<endl;



}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using lint = long;
using llint = long long;
using namespace std;

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

Measured memory_bytes: 3636
//
#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000
#define MOD 1000000007
#define PI 3.14159265
#define EPS 1e-9
#define Pi acos(-1.0)
typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
#define forr(i,a,b) for(int i=(a); i<(b); i++)
#define clean(arr,val) memset(arr,val,sizeof(arr))
#define forn(i,n) forr(i,0,n)
#define PB push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<pll> vpll;

/*CODE START HERE*/
int n, ans;
int main(){
    ios::sync_with_stdio(0);
    cin >> n;
    forr(i,1,INF){
        if(i*i <= n){
            ans = i*i;
        }else{
            break;
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
def 解():
    iA,iB,iC,iD,iE,iF = [int(_) for _ in input().split()]
    #結局全検索
    d = {}
    def searchAll(d,bF): # bF=0 Eにちかづける
        iMaxA = iF // 100*iA
        for i in range(iMaxA+1):
            iMaxB = (iF - 100*iA*i) // iB
            for j in range(iMaxB + 1):
                if i==0 and j==0:
                    continue
                iAB = 100*iA*i + 100*iB*j
                iUlim = iAB * iE //100
                if bF:
                    iUlim = min(iUlim,iF-iAB)
                else:
                    if iUlim > iF - iAB:
                        continue
                iMaxC = iUlim //iC
                for k in range(iMaxC+1):
                    l = (iUlim - iC*k ) //iD
                    iCD = iC*k +iD*l
                    if iUlim -iCD == 0:
                        print(iAB +iCD,iCD)
                        exit()
                    else:
                        iKey = iUlim-iCD
                        if not iKey in d:
                            d[iKey] = (iAB +iCD,iCD)
        return d
    d = searchAll(d,0)
    if not d:
        d = searchAll(d,1)
    iMin = min(d.keys())
    print(" ".join(map(str,d[iMin])))

解()


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

template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }

typedef vector<vector<int>> graph;

constexpr int MAX_N = 900;

enum {ESCAPE, LOOP, CATCH};
enum {Q, A, NUM};

const string message[3] = {
	"Queen can escape.",
	"Queen can not escape and Army can not catch Queen.",
	"Army can catch Queen.",
};

int dp[MAX_N][MAX_N][NUM];

inline int get_index(int x, int y, int w) {
	return x + y * w;
}

inline void add_edge(int a, int b, graph &G) {
	G[a].emplace_back(b);
	G[b].emplace_back(a);
}

inline string solve(int q, int a, const vector<int> &g, const graph &G) {
	const int n = G.size();
	for(int v = 0; v < n; ++v) {
		for(int u = 0; u < n; ++u) {
			dp[v][u][Q] = dp[v][u][A] = LOOP;
		}
	}

	for(int v = 0; v < n; ++v) {
		dp[v][v][Q] = dp[v][v][A] = CATCH;
	}

	for(const auto &e : g) {
		for(int v = 0; v < n; ++v) {
			if(e != v) dp[e][v][Q] = ESCAPE;
		}
	}

	while(true) {
		bool update = false;

		for(int v = 0; v < n; ++v) {
			for(int u = 0; u < n; ++u) {
				if(v == u) continue;

				// queen turn
				if(dp[v][u][Q] != ESCAPE) {
					const int prev = dp[v][u][Q];
					dp[v][u][Q] = CATCH;
					for(const auto &to : G[v]) {
						chmin(dp[v][u][Q], dp[to][u][A]);
					}
					if(dp[v][u][Q] != prev) update = true;
				}

				// army turn
				{
					const int prev = dp[v][u][A];
					dp[v][u][A] = ESCAPE;
					for(const auto &to : G[u]) {
						chmax(dp[v][u][A], dp[v][to][Q]);
					}
					if(dp[v][u][A] != prev) update = true;
				}
			}
		}

		if(!update) break;
	}

	return message[dp[q][a][Q]];
}

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

	for(int w, h; cin >> w >> h && w;) {
		vector<string> field(h);
		for(auto &e : field) cin >> e;

		int next_label = 0;
		vector<vector<int>> label(h, vector<int>(w, -1));
		for(int i = 0; i < h; ++i) {
			for(int j = 0; j < w; ++j) {
				if(field[i][j] != '#') label[i][j] = next_label++;
			}
		}

		int q, a;
		vector<int> g;

		graph G(next_label);

		for(int i = 0; i < h; ++i) {
			for(int j = 0; j < w; ++j) {
				if(field[i][j] == '#') continue;

				const int v = label[i][j];

				switch(field[i][j]) {
				case 'Q': q = v; break;
				case 'A': a = v; break;
				case 'E': g.emplace_back(v); break;
				}

				add_edge(v, v, G);

				if(i < h - 1) {
					if(field[i + 1][j] != '#') {
						add_edge(v, label[i + 1][j], G);
					}
				}

				if(j < w - 1) {
					if(field[i][j + 1] != '#') {
						add_edge(v, label[i][j + 1], G);
					}
				}
			}
		}

		cout << solve(q, a, g, G) << endl;
	}

	return EXIT_SUCCESS;
}

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

#define int long long

int32_t main(){

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

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

      int dp[n];

      for(int i=0;i<n;i++)
         dp[i]=INT_MAX;

      dp[n-1]=0;
      dp[n-2]=abs(a[n-2]-a[n-1]);

      for(int i=n-3;i>=0;i--){
         for(int j=1;j<=k;j++){
            if(i+j<n)
               dp[i]=min(dp[i],abs(a[i]-a[i+j])+dp[i+j]);
         }
      }

      cout<<dp[0];
   
}


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<string>
using namespace std;
const int NIL = -1;
void SearchMaxSubString(string & a,string & b,
						vector<vector<int> > & maxlen,
						int s,
						int t)
{
	int lengthAB = 0;
	if (a[s] == b[t]) {
		lengthAB++;
		if ((s+1) < (int)a.size() && (t+1) < (int)b.size()) {
			if (maxlen[s+1][t+1] == NIL) {
				SearchMaxSubString(a,b,maxlen,s+1,t+1);
			}
			lengthAB += maxlen[s+1][t+1];
		}
		maxlen[s][t] = lengthAB;
	}
	else {
		int lengthA = 0;
		int lengthB = 0;
		if ((s+1) < (int)a.size()) {
			if (maxlen[s+1][t] == NIL) {
				SearchMaxSubString(a,b,maxlen,s+1,t);
			}
			lengthA = maxlen[s+1][t];
		}
		if ((t+1) < (int)b.size()) {
			if (maxlen[s][t+1] == NIL) {
				SearchMaxSubString(a,b,maxlen,s,t+1);
			}
			lengthB = maxlen[s][t+1];
		}
		maxlen[s][t] = std::max(lengthA,lengthB);
	}
}

int main(){
	int n;
	cin >> n;
	for(; n > 0; --n) {
		string a,b;
		cin >> a >> b;
		vector<vector<int> > maxlen;
		maxlen.resize(a.size());
		for(unsigned int i=0;i<a.size();++i) {
			maxlen[i].resize(b.size());
			for(unsigned j=0;j<maxlen[i].size();++j){
				maxlen[i][j] = NIL;
			}
		}
		SearchMaxSubString(a,b,maxlen,0,0);
		cout << maxlen[0][0] << std::endl;
	}
	return 0;
}

Measured memory_bytes: 5228
N, M = map(int, input().split())
H = list(map(int, input().split()))
m = [0] * N
cnt = 0

for _ in range(M):
  a, b = map(int, input().split())
  m[a - 1] = max(m[a - 1], H[b - 1])
  m[b - 1] = max(m[b - 1], H[a - 1])

for i in range(N):
  if H[i] > m[i] or m[i] == 0:
    cnt += 1

print(cnt)

Measured memory_bytes: 20096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int main(){
    int N; cin >> N;
    vector<ll> a(N);
    map<ll, ll> mp;
    bool flg = true;
    for(int i=0; i<N; ++i){
        cin >> a[i];
        ++mp[a[i]];
        if(a[i] != 0) flg = false;
    }

    if(flg){
        cout << "Yes" << endl;
    }
    else if(N%3 != 0){
        cout << "No" << endl;
    }
    else if(mp.size() == 3){
        vector<ll> x(3);
        int id = 0;
        for(auto itr=mp.begin(); itr!=mp.end(); ++itr){
            x[id++] = itr->first;
        }
        if((x[0]^x[2]) == x[1] && mp[x[0]] == mp[x[1]] && mp[x[1]] == mp[x[2]]){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    else if(mp.size() == 2){
        if(mp[0] == N/3){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 5632
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        

        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        int sum =b-a;
        int highB =0;
        
        for(int i=sum;i>0;i--){
            highB +=i;
        }
        
        System.out.println(highB-b);
        
    }
    
} 

Measured memory_bytes: 35436
#include "bits/stdc++.h"
#define rep(i, j) for (long long i = j; i > 0; i--)
using namespace std;

int gcd(long long  i, long long j) {
	int num[3];

	if (i > j) {
		num[0] = i;
		num[1] = j;
	}
	else {
		num[0] = j;
		num[1] = i;
	}
	num[2] = num[0] % num[1];

	while (num[2]) {
		num[0] = num[1];
		num[1] = num[2];
		num[2] = num[0] % num[1];
	}
	return num[1];
}

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


	long long ans = a * b / gcd(a, b);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
I'm working for the day I will surpass you
https://www.a2oj.com/Ladder16.html
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class Main
   {
      public static void main(String omkar[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         N %= 10;
         if(N == 0 || N == 1 || N == 6 || N == 8)
            System.out.println("pon");
         else if(N == 3)
            System.out.println("bon");
         else
            System.out.println("hon");
      }
   }

Measured memory_bytes: 32548
#include <bits/stdc++.h>
#define arep(a,i,n) for(ll i=(a);i<(n);i++)
#define rep(i,n) for(ll i=0;i<(n);i++)
#define cinf(x,n) for(ll i=0;i<(n);i++)cin>>x[i];
#define coutf(x,n) for(ll i=0;i<(n);i++)cout<<x[i]<<endl;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

int num;

int main(){
	string n;
	cin >> n;
	rep(i,n.length()){
		num+=stoi(n.substr(i,1));
		num%=9;
	}
	if(num==0)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

Measured memory_bytes: 3740
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<map>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)



int main(){
    string c;
    cin>>c;
    int digsum=0;
    rep(i,c.length()){
        digsum+=(c[i]-'0');
    }
    if(digsum%9==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3740
//30
#include<iostream>
#include<algorithm>

using namespace std;

int cv(int t){
  return t/100*60+t%100;
}

int main(){
  for(int n,p,q;cin>>n>>p>>q,n|p|q;){
    int pg[24*60]={};
    for(int i=0;i<n;i++){
      int k;
      cin>>k;
      while(k--){
	int s,t;
	cin>>s>>t;
	for(int i=cv(s);i<cv(t);i++){
	  pg[i]++;
	}
      }
    }
    int m=0;
    int c=0;
    for(int i=cv(p);i<cv(q);i++){
      c=(pg[i]!=n)?c+1:0;
      m=max(m,c);
    }
    cout<<m<<endl;
  }
  return 0;
}

Measured memory_bytes: 1164
#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(void){
  int N, A;
  cin >> N >> A;

  cout << N * N - A << endl;
}


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

int main(){
  int N = 0;
  cin >> N;
  vector<int>a(N);

  for(int i = 0; i < N; i++){
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
    int Alice = 0;
    int Bob = 0;
  for(int i = 0; i < N; i+=2){
    Alice += a.at(i);
    }
  for(int i = 1; i < N; i+=2){
    Bob += a.at(i);
    }
  cout << Alice - Bob << endl;
}

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

B = []
T = []

if N % 2 == 0:
  for index, a in enumerate(A):
    if index % 2 == 1:
      T.append(a)
    else:
      B.append(a)
else:
  for index, a in enumerate(A):
    if index % 2 == 0:
      T.append(a)
    else:
      B.append(a)

T.reverse()
T.extend(B)


for b in T:
  print(b, end=" ")

Measured memory_bytes: 100436
// g++ -std=c++11 temp.cpp
#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())

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

#define INF INT_MAX/3

#define MAX_N 1000

string s;
int cnt[26];

int main(){
	cin.sync_with_stdio(false);
	cin>>s;
	rep(i,s.length()){
		cnt[s[i]-'a']++;
	}
	rep(i,26){
		if(cnt[i]%2==1){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}





Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
int main()
{
	int x,y,z;
	while(~scanf("%d %d %d",&x,&y,&z)){
		int flag=0;
		x=x-2*z;
		flag=x/(z+y);
		x=x%(z+y);
		if(x>=y) flag++;
		printf("%d\n",flag);
	}
	return 0;
}

Measured memory_bytes: 128
#include<iostream>

using namespace std;

int main(void)
{
  string s,t; cin>>s>>t;
  int count=0;
  
  for(int i=0;i<3;i++){
    if(s[i]==t[i]){count++;}
  }
  
  cout<<count<<endl;
  return 0;
}

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

int N,M;
Graph G;
int s,t;

ll solve(){
    vector<vector<ll> > dist(N,vector<ll>(3,INF));
    dist[s][0] = 0;
    queue<P> que;
    que.push({s,0});

    while(!que.empty()){
        P p = que.front(); que.pop();
        int v = p.first;
        int parity = p.second;
        for(auto e : G[v]){
            int np = (parity + 1) % 3;
            if(dist[e][np] == INF){
                dist[e][np] = dist[v][parity] + 1;
                que.push({e,np});
            }
        }
    }
    if(dist[t][0] == INF) return -1;
    else return dist[t][0] / 3;
}

int main(){
    //グラフを拡張する距離が3の倍数か判定したいのでparityで0,1,2を持たせる
    cin >> N >> M;
    G.resize(N);
    rep(i,M){
        int u,v;
        cin >> u >> v;
        u--;v--;
        G[u].push_back(v);
    }
    cin >> s >> t;
    s--;t--;
    
    cout << solve() << endl;
    return 0;
}

Measured memory_bytes: 11136
#include <cstdio>
#include <algorithm>

const int MAXN = 1e5 + 5;

int n;
int arr[MAXN];

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%d", &arr[i]);
	}
	std::sort(arr + 1, arr + n + 1);
	printf("%d", arr[(n >> 1) + 1] - arr[n >> 1]);
	return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <vector>
#include <cmath>
#include <stack>
#include <cstdlib>
#include <queue>
#include <map>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>

using namespace std;
typedef long long LL;

int main()
{
    int sx, sy, tx, ty;
    scanf ("%d%d%d%d",&sx,&sy,&tx,&ty);
    for (int i=1;i<=ty-sy;i++)cout<<"U";
    for (int i=1;i<=tx-sx;i++)cout<<"R";
    for (int i=1;i<=ty-sy;i++)cout<<"D";
    for (int i=1;i<=tx-sx;i++)cout<<"L";
    cout<<"L";
    for(int i=0;i<=ty-sy;i++)cout<<"U";
    for(int i=0;i<=tx-sx;i++)cout<<"R";
    cout<<"D";
    cout<<"R";
    for(int i=0;i<=ty-sy;i++)cout<<"D";
    for(int i=0;i<=tx-sx;i++)cout<<"L";
    cout<<"U";
    cout<<endl;
    return 0;
}



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

namespace AtCoder
{
    static class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            var S = IO.GetString();
            var ans = 0;
            for(int i = 0; i < S.Length / 2; i++)
            {
                if (S[i] != S[S.Length - i-1])
                {
                    ans++;
                }
            }

            Console.WriteLine(ans);
        }

    }

    static class IO
    {
        static public string GetString() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public List<string> GetStringList() { return Console.ReadLine().Split(' ').ToList(); }
        static public List<int> GetIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> GetLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteStrings<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
    }
}

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

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

  int L, R;
  L = 0;
  R = str.size() - 1;
  int count = 0;
  while(L <= R){
    if(str[L] != str[R]){
      count++;
    }
    L++;R--;
  }
  cout << count << endl;
  return 0;
}


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

# ABの並びが何セット入るか
AB_set = N // (A+B)

# あまりは何個か
rest = N % (A+B)
if rest > A:
    print(A * AB_set + A)
else:
    print(A * AB_set + rest)


Measured memory_bytes: 2940
import numpy as np

def main():
    A = []
    for _ in range(3):
        A += list(map(int, input().split()))

    N = int(input())

    b = []
    for _ in range(N):
        b.append(int(input()))

    for v in b:
        if v in A:
            index = A.index(v)
            A[index] = 0
    
    bingo_list = [
        [0,1,2],[3,4,5],[6,7,8],
        [0,3,6],[1,4,7],[2,5,8],
        [0,4,8],[2,4,6]
    ]

    for bingo in bingo_list:
        if sum(np.array(A)[bingo]) == 0:
            print("Yes")
            exit()
    
    print("No")

if __name__ == '__main__':
    main()

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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;

#define pb push_back
#define mp make_pair

#define mod 1000000007

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define vin(v, n) for (int i = 0; i < (int)(n); i++) cin >> (v)[i];
#define vout_sp(v, n) for (int i = 0; i < (int)(n); i++) cout << (v)[i] << " ";
#define vout_nl(v, n) for (int i = 0; i < (int)(n); i++) cout << (v)[i] << endl;

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    if(a == 0)
        cout << 1 << endl;
    if(b == 0)
        cout << 2 << endl;
    if(c == 0)
        cout << 3 << endl;
    if(d == 0)
        cout << 4 << endl;
    if(e == 0)
        cout << 5 << endl;
}


Measured memory_bytes: 3608
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <ctime>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <functional>
#include <fstream>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <numeric>
#include <cassert>
using namespace std;

int a[100000];

long long fac[100000];
int N,R;

vector< pair<int,int> > v;
long long dfs(int x){
	if( x >= N ) return 0;
	int bad = 0;
	if( a[x] > x ){
		bad = a[x] - x;
		for(int i = 0 ; i < v.size() ; i++){
			if( x < v[i].second && v[i].second <= a[x] ){
				if( a[x] < v[i].first ){
					bad--;
				}
			}else if( a[x] < v[i].second ){
				if( a[x] > v[i].first ){
					bad++;
				}
			}
		}
	}else{
		bad = 0;
		for(int i = 0 ; i < v.size() ; i++){
			if( x < v[i].second ){
				if( a[x] > v[i].first ){
					bad++;
				}
			}
		}
	}
	//cout << a[x] << " " << bad << endl;
	return ( bad * fac[N-x-1] + dfs(x+1) ) % 1000000007ll;
}
int main(){
	fac[0] = 1;
	for(int i = 1 ; i <= 100000 ; i++) fac[i] = fac[i-1] * i % 1000000007ll;
	
	while( cin >> N >> R && N ){
		for(int i = 0 ; i < N ; i++)
			a[i] = i;
		for(int i = 0 ; i < R ; i++){
			int x,y;
			cin >> x >> y;
			x--,y--;
			swap(a[x],a[y]);
		}
		v.clear();
		for(int i = 0 ; i < N ; i++){
			if( a[i] != i ) v.push_back(make_pair(a[i],i));
		}
		cout << dfs(0) << endl;
	}
	
}

Measured memory_bytes: 3928
//
// Created on 2020/04/16.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {

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

    bool ok = true;
    for (int k = 1; k < n; ++k) {
        if(p[k-1]>p[k]){
            ok = false;
            break;
        }
    }
    if (ok){
        cout<<"YES"<<endl;
        return 0;
    }

    for (int j = 0; j < n - 1; ++j) {
        for (int i = j+1; i < n ; ++i) {
            swap(p[j],p[i]);
            ok = true;
            for (int k = 1; k < n; ++k) {
                if(p[k-1]>p[k]){
                    ok = false;
                    break;
                }
            }
            if (ok){
                cout<<"YES"<<endl;
                return 0;
            }
            swap(p[j],p[i]);
        }
    }

    cout<<"NO"<<endl;
    return 0;
}


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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){cerr<<"\n";} template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	string s;
	cin >>s;
	rep(i, sz(s)) if(s[i]=='?') s[i]='D';
	cout << s <<"\n";
	return 0;
}


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

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<string>vst;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0)
#define all(ct) ct.begin() , ct.end()
#define endl "\n"
#define fr(i,a) for(auto i:a)
#define f(i,a,b) for(int i=a;i<b;++i)
#define fd(i,a,b) for(int i=a;i>=b;--i)
#define pb push_back
#define in(d,v) d.find(v)!=d.end()
#define mp make_pair
#define size(a) int(a.size())

const int mod = 1e9 + 7;
const ll inf = ll(1e18);
const double PI = acos(-1);

ll modexp(ll x,ll n,int md){
    if(n==0)return 1;
    if(n%2==0)return modexp((x*x)%md,n/2,md);
    return (x*modexp((x*x)%md,n/2,md))%md;
}

int main(){
    fastio;
    //clock_t tm = clock();
    int n;string s;
    cin>>s;n=s.length();
    int l1=1,r1=(n-1)/2,l2=(n+3)/2,r2=n;
    while(l1<=r1){
        if(s[l1-1]!=s[r1-1]){
            cout<<"No"<<endl;
            return 0;
        }
        l1++;--r1;
    }
    while(l2<=r2){
        if(s[l2-1]!=s[r2-1]){
            cout<<"No"<<endl;
            return 0;
        }
        l2++;--r2;
    }
    l1=1;r1=n;
    while(l1<=r1){
        if(s[l1-1]!=s[r1-1]){
            cout<<"No"<<endl;
            return 0;
        }
        l1++;--r1;
    }
    cout<<"Yes"<<endl;
    //cout<<((clock()-tm)*1.0)/CLOCKS_PER_SEC<<endl;
}

Measured memory_bytes: 256
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use nalgebra::max;


#[fastout]
fn main() {
    input! {
    n: usize
    }
    let mut an = vec![];
    let mut xyn = vec![];
    for _ in 0..n {
        input! {
        a: usize,
        xy: [(Usize1, usize); a]
        }
        an.push(a);
        xyn.push(xy);
    }
    let mut ans = 0;
    for i in 0..1 << n {
        let mut f = true;
        let honest = (i as usize).count_ones();
        for j in 0..n {
            let (a, xy) = (an[j], &xyn[j]);
            if i & 1 << j == 0 {continue}
            for k in 0..a {
                let (x, y) = xy[k];
                if (i >> x) % 2 != y {
                    f = false;
                    break;
                }
            }
            if !f { break; }
        }
        if !f { continue; }
        ans = max(honest, ans);
    }
    println!("{}", ans);
}


Measured memory_bytes: 2144
#include "bits/stdc++.h"
using namespace std;

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

	if(abs(x-a)<abs(x-b)) cout << 'A' << endl;
	if(abs(x-a)>abs(x-b)) cout << 'B' << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>

using namespace std;
typedef long long ll;

int main()
{
	ll K, A, B;
  	ll num = 1;
  	cin >> K >> A >> B;
  	//A>=Bで交換に意味なし。1枚ずつ増やすだけ増やす
  	if(B - A <= 1){
    	num = 1 + K;
    } else {
        if((1 + K) < A) num = 1 + K;
      	else{
        	ll count = K;
          	count -= (A-1);
          	num = A;
          	while(count > 0){
              	if(count >= 2){
                    num -= A;
                    num += B;
                    count -= 2;
                } else {
                	num += count;
                  	count = 0;
                }
            }
        }
    }
  	cout << num << endl;
  
}

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

ll fc[200010], fci[200010];
ll mod = 1000000007;
int a, b, c, d;

ll pw(ll x, ll k){
	if(k == 0) return 1;
	if(k % 2) return x * pw(x * x % mod, k / 2) % mod;
	return pw(x * x % mod, k / 2);
}

void preproc(){
	fc[0] = 1; fci[0] = 1;
	for(int i = 1; i <= 200005; i++){
		fc[i] = fc[i - 1] * i % mod;
		fci[i] = pw(fc[i], mod - 2);
	}
}

ll cm(int n, int r){
	return fc[n] * fci[r] % mod * fci[n - r] % mod;
}

int main(){
	cin >> a >> b >> c >> d;
	preproc();
	ll ans = cm(a + b - 2, a - 1);
	for(int i = 1; i <= d; i++)
		ans = (ans - cm(i - 1 + a - c - 1, i - 1) * cm(b - i + c - 1, b - i) % mod + mod) % mod;
	cout << ans << '\n';
}

Measured memory_bytes: 3328
N = gets.to_i
P = [-1, -1] + gets.split.map(&:to_i)
X = [-1] + gets.split.map(&:to_i)
$child = Array.new(N+1){[]}
(2..N).each do |i|
    $child[P[i]].push(i)
end

def rec(n)
    len = $child[n].length
    dp = Array.new(len+1){{}}
    dp[0][0] = true
    sum = 0
    len.times do |i|
        a, b = rec($child[n][i])
        sum += a+b
        dp[i].each do |c, _|
            dp[i+1][c+a] = true if c+a <= X[n]
            dp[i+1][c+b] = true if c+b <= X[n]
        end
        if dp[i+1].length == 0
            puts 'IMPOSSIBLE'
            exit
        end
    end
    return [X[n], sum-dp[len].keys.max]
end
rec(1)
puts 'POSSIBLE'

Measured memory_bytes: 9980
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String N = sc.next();
    long sum = 0;
    for (int i = 0; i < N.length(); i++) {
      sum += Character.getNumericValue(N.charAt(i));
    }
    if (sum % 9 != 0) {
      System.out.println("No");
    } else {
      System.out.println("Yes");
    }
  }
}


Measured memory_bytes: 40296
#include<iostream>
using namespace std;
long x, y;
int cnt;
int main()
{
  cin >> x >> y;
  for (int i = 0; i < 65;i++)
  {
    if(x*2<=y)
    {
      cnt++;
      x *= 2;
    }
  }
  cout << cnt+1 << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm> 
#include<cstring>
#include<vector>
#define LL long long
using namespace std;
const int N=2e5+5;
int n,flag,tmp,sz,num[30],tr[N];
LL ans=0;
bool f[N];
char s[N];
vector<int> a[30];
int read()
{
	int x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}
int lowbit(int x){return x&(-x);}
int query(int x){int ans=0;for(;x;x-=lowbit(x))ans+=tr[x];return ans;}
void add(int x,int c){for(;x<=n;x+=lowbit(x))tr[x]+=c;}
int main()
{
	scanf("%s",s+1);n=strlen(s+1);
	for(int i=1;i<=n;i++)num[s[i]-'a']++,a[s[i]-'a'].push_back(i);
	for(int i=0;i<26;i++)if(num[i]&1)flag++;
	if(flag>1){printf("-1");return 0;}
	for(int i=1;i<=n;i++)tr[i]=lowbit(i);
	for(int i=1;i<=n;i++)
	{
		if(f[i])continue;
		tmp=s[i]-'a';sz=a[tmp].size();tmp=a[tmp][sz-1];
		if(i==tmp)ans+=(query(n)-query(i))>>1;
		else ans+=query(n)-query(tmp);
		add(i,-1);add(tmp,-1);f[i]=f[tmp]=true;
		a[s[i]-'a'].erase(a[s[i]-'a'].end()-1);
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 2424
#include<iostream>
#include<bits/stdc++.h>
#include<algorithm>
#define FasterIO     ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define PI acos(-1)
#define all(a) a.begin(),a.end()
#define f first
#define s second
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define mp make_pair
#define f0(i,n) for(i=0;i<n;i++)
#define f1(i,n) for(i=1;i<n;i++)
#define f1n(i,n) for(i=1;i<=n;i++)
#define szf sizeof()
#define sz size()
#define ln length()
using namespace std;
using ll=long long;
int cnt,element;
//long long int arr[100000001];
vector<ll>vec;
int main()
{
    int len,len1,flag=0;
    string str,s;
    cin>>str;
    cin>>s;
    len=str.length();
    len1=s.length();
    if(len+1==len1)
    {
        for(int i=0; i<len; i++)
        {
            if(str[i]!=s[i])
            {
                flag=1;
                break;
            }
        }
        if(flag==1)
        {
            cout<<"No"<<endl;
        }
        else
        {
            cout<<"Yes"<<endl;
        }
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3620
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


class WeightedUnionFind:
    def __init__(self, n_nodes):
        self.n_nodes = n_nodes
        self.parents = [-1] * n_nodes
 
        # 親への重みを管理
        self.weights = [0] * n_nodes
 
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            parent = self.find(self.parents[x])
            # 親への重みを追加しながら根まで走査
            self.weights[x] += self.weights[self.parents[x]]
            self.parents[x] = parent
            return parent
 
    # xからyへの重みがw
    def unite(self, x, y, w):
        w += self.weights[x]
        w -= self.weights[y]
        x = self.find(x)
        y = self.find(y)
 
        if x == y:
            return
 
        if self.parents[x] > self.parents[y]:
            x, y = y, x
            w *= -1
 
        self.parents[x] += self.parents[y]
        self.parents[y] = x
        self.weights[y] = w
        return
 
    def is_same(self, x, y):
        return self.find(x) == self.find(y)
 
    # xからyへの重みの取得
    def get_weight(self, x, y):
        return self.weights[y] - self.weights[x]
 
    def get_size(self, x):
        return -self.parents[self.find(x)]
 
    def get_members(self, x):
        parent = self.find(x)
        return [i for i in range(self.n_nodes) if self.find(i) == parent]
 
    def get_parent_list(self):
        return [i for i, x in enumerate(self.parents) if x < 0]
 
    def get_n_groups(self):
        return len(self.get_parent_list())
 
    def get_members_dict(self):
        return {par: self.get_members(par) for par in self.get_parent_list()}

N, M = MAP()

tree = WeightedUnionFind(N)

for _ in range(M):
	L, R, D = MAP()
	if not tree.is_same(L-1, R-1):
		tree.unite(L-1, R-1, D)
	else:
		if not tree.get_weight(L-1, R-1) == D:
			print("No")
			break
else:
	print("Yes")


Measured memory_bytes: 112852
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int A = sc.nextInt();
			String op = sc.next();
			int B = sc.nextInt();

			if ("+".equals(op)) {
				System.out.println(A + B);
			} else {
				System.out.println(A - B);
			}
		}
	}
}


Measured memory_bytes: 9684
n = int(input())
a = list(map(int,input().split()))
ans = [0]
for i in range(n-1):
    ans.append(2*a[i]-ans[i])
a1 = a[n-1]-ans[n-1]//2
for i in range(n):
    ans[i] = str((-1)**i*a1+ans[i])
print(" ".join(ans))


Measured memory_bytes: 17352
#include <iostream>
#include <cstring>
#include<vector>
#include <algorithm>
#include<cstdlib>
#include<set>
#include<math.h>
#include<map>
#include<unordered_map>
#include<iomanip>
#include<queue>

using namespace std;
using ll = long long;
using ull = unsigned long long;
#define rep(n,x) for(ll i=0;i<n;i++) cin>>x[i];
#define forr(a,b) for(ll i=a;i<b;i++);
ll gcd(ll x, ll y)
{
	if (x % y == 0) return y;
	else return gcd(y, x % y);
}
// 1or素数だと１を返す
ll prime(ll x)
{
	for (ll i = 2; i * i <= x; i++)
	{
		if (x % i == 0) return 0;
	}
	return 1;
}



int main()
{
	ll n, m;
	cin >> n >> m;
	map<ll,ll,greater<ll>> a;
	ll x;
	for (ll i = 0; i < n; i++)
	{
		cin >> x;
		a[x]++;
	}
	ll b, c;
	for (ll i = 0; i < m; i++)
	{
		cin >> b >> c;
		a[c] += b;
	}
	ll ans = 0;
	ll num = 0;
	auto iter = a.begin();
	while ( num + (iter->second)<=n)
	{
		ans += (iter->first) * (iter->second);
		num += (iter->second);
		iter = next(iter, 1);
	}
	ans += (iter->first) * (n - num);
  cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 16068
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <tchar.h>
//#include <intrin.h>

#define F first
#define S second
#define LL long long
#define MOD 1000000007
#define INF 200000000
#define LINF 1000000000000000000

using namespace std;

const int N = 2e5 + 10;

int a[N];
int pr[N];
int su[N];

int main()
{
	int n;
	scanf("%d", &n);

	for (int i = 1;i <= n;i++) 
		scanf("%d", &a[i]);
	
	for (int i = 1;i <= n;i++)
		pr[i] = pr[i - 1] ^ a[i];

	for (int i = n;i >= 1;i--)
		su[i] = su[i + 1] ^ a[i];

	for (int i = 1;i <= n;i++)
		printf("%d ", pr[i - 1] ^ su[i + 1]);
	cin >> n;
}

Measured memory_bytes: 5556
#include <iostream>
#include <string>
using namespace std;
int n;
int main(){
string s[3];
cin >> s[0]>> s[1]>>s[2];
int l[3]={0};
char t[3]={'A','B','C'};
while(1){
  if(s[n][l[n]]=='a') {
    l[n]++;n=0;
    if(l[n]==s[n].size()){
      cout <<t[n]<<endl;
      return 0;
    }
  }
  else if(s[n][l[n]]=='b'){
  l[n]++;n=1;
  if(l[n]==s[n].size()){
    cout <<t[n]<<endl;
    return 0;
  }
  }
  else if(s[n][l[n]]=='c'){
   l[n]++;n=2;
   if(l[n]==s[n].size()){
     cout <<t[n]<<endl;
     return 0;
   }
  }
}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define forN(i, n) for(int i = 0; i <n ; ++i)
#define endl "\n"
typedef long long ll;
using namespace  std;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const int N = 1000 + 5;
ll a ,b ,v, w , t;

int main(){
    fastIO;
    cin>>a>>v>>b>>w>>t;
    if(w>=v){
        cout<<"NO";
    }
    else if((v-w)*t>=abs(a-b)){
        cout<<"YES";
    }
    else{
        cout<<"NO";
    }
}

/*
1

*/



Measured memory_bytes: 3640
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	h := nextInt()
	a := nextInt()
	if (h % a == 0) {
		fmt.Printf("%d", h / a)
	} else {
		fmt.Printf("%d", (h + a) / a)
	}
}


Measured memory_bytes: 640
import heapq
H, W = map(int, input().split())

C = []
costs = {}
for i in range(10):
  C.append(list(map(int, input().split())))
  costs[i] = [float('inf')]*10
  costs[i][i] = 0
costs[-1] = [0]*10

for i in range(10):
  end = set()
  q = []
  heapq.heappush(q, (0, i))
  while len(q):
    c, k = heapq.heappop(q)
    if k == 1:
      break
    if costs[i][k] < c:
      continue
    end.add(k)
    for j in range(10):
      if j not in end:
        costs[i][j] = min(costs[i][j], c+C[k][j])
        heapq.heappush(q, (costs[i][j], j))

ans = 0
for i in range(H):
  ans += sum(map(lambda x: costs[int(x)][1], input().split()))

print(ans)

Measured memory_bytes: 3064
#include<functional>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<string>
#include<cstdio>
#include<vector>
#include<bitset>
#include<cmath>
#include<ctime>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,K=200005,mod=1000000007;
const long long llinf=9223372036854775807ll;
//int & long long
char c;
int main(){
	cin>>c;
	cout<<char(c+1);
	return 0;
}

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

main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long i,j,k,l,m,n,p,t;

while(cin>>n){
 int x[100009]={0};

 l=0;
 for(i=0;i<n;i++){
    cin>>j;
    l+=j;
    x[j]++;
 }

 cin>>m;
 for(i=0;i<m;i++){
    cin>>j>>k;
    l+=x[j]*k;
    l-=x[j]*j;
    x[k]+=x[j];
    x[j]=0;
    cout<<l<<endl;
 }

}
return 0;
}


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

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

    long long res = 0;
    if (K <= A) {
        res = K;
    } else if (A < K && K <= A + B) {
        res = A;
    } else {
        res = A - (K - (A + B));
    }

    cout << res << endl;
}

Measured memory_bytes: 3600
using System;
using System.Collections.Generic;
using System.Linq;
class Ho{
  static void Main(){
    var aho = Console.ReadLine().Split();
    var a = float.Parse(aho[0]);
    var b = float.Parse(aho[1]);
    for(float i=1;i<=1000;i++){
      if(Math.Floor(i*0.08) == a &&  Math.Floor(i*0.1) == b){
        Console.WriteLine(i);
        return;
      }
    }
    Console.WriteLine("-1");
  }
}
 

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

#define mod 1000000007
#define int long long int
#define vi vector<int>
#define pii pair<int,int>
#define vpii vector<pii>
#define vs vector<string>
#define fi first
#define se second
#define psb push_back
#define ppb pop_back
#define fio ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL)
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define all(v) v.begin(),v.end()
#define endl "\n"

const int maxn=1e3+5,maxn2=1e4+5;
int a[maxn],b[maxn];
int dp[maxn2];

int32_t main()
{
	int h,n;
	cin>>h>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i]>>b[i];
	dp[0]=0;
	for(int i=1;i<maxn2;i++)
		dp[i]=mod;
	for(int i=1;i<=h;i++)
		for(int j=1;j<=n;j++)
			dp[i]=min(dp[i],dp[ max(0,i-a[j]) ]+b[j]);
	cout<<dp[h]<<endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) { 
 if (a < b) { a = b; return true; } return false; 
}
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  cin>>n;
  set<ll> s;
  s.insert(n);
  for(ll i=2;i*i<=n;i++){
    if(n%i==0){
      s.insert(i);
      s.insert(n/i);
    }
  }
  ll ans=0;
  for(auto p:s){
    ll now=p;
    ll k=n;
    while(k>=now){
      if(k%now==0) k/=now;
      else if(k>=now) k%=now;
    }
    if(k==1) ans++;
  }
  n--;
  for(ll i=2;i*i<=n;i++){
    if(n%i==0){
      ans+=2;
    }
    if(i*i==n) ans--;
  }
  if(n!=1)ans++;
  COUT(ans);
}

Measured memory_bytes: 512
#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#include <bits/stdc++.h>
#define MOD 1000000007
#define int long long
using namespace std;
#define ss second
#define ff first
int32_t main()
{
    fastio;
    int T,n,m,i,j,k,a,b,c;
    T=1;
    string str;
    while(T --> 0)
    {
        cin>>n>>str;
        vector<int> R,G;
        unordered_map<int,bool> B;
        for(i=0;i<n;i++)
        if( str[i] == 'R')
            R.emplace_back(i);
        else if( str[i] == 'G')
            G.emplace_back(i);
        else
            B[i]=true;
 
        m=B.size();
        int ans=R.size()*G.size()*m;
        for(auto a:R)
        for(auto b:G)
        {
            if( (a+b)%2==0 and B[(a+b)/2] )
                ans--;
            if( B[2*a-b])
                ans--;
            if( B[2*b-a])
                ans--;
        }
        cout<<ans;
    }
    return 0;
}

Measured memory_bytes: 4080