akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main{

	/*
	 * ????????°???????????¨?????????????????????
	 */
	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		// ??????????????°
		int set = Integer.parseInt(br.readLine());
		// ?????¬?????????????????????????????????
		Player isono = new Player("Isono-kun");
		Player nakajima = new Player("Nakajima-kun");

		// ??????????????????????????????????????????????´?
		for (int cnt = 0; cnt < set; cnt++)
			isono.getGesture().add(Action.valueOf(br.readLine()));
		for (int cnt = 0; cnt < set; cnt++)
			nakajima.getGesture().add(Action.valueOf(br.readLine()));

		// ????????????????????????????????????
		for (int turn = 0; turn < set; turn++) {
			// ???????????\????????????2???????????????
			for (int swap = 0; swap < 2; swap++) {
				Player p1 = swap == 0 ? isono : nakajima;
				Player p2 = swap == 0 ? nakajima : isono;

				switch (p2.getGesture().get(turn)) {
				case kougekida:
					// p2???????????????
					if (p2.getForce() == 0 && !(p1.getGesture().get(turn) == Action.kougekida)) {
						System.out.println(p1.getPlayerName());
						return;
					}
					// ????????¨??????????????¢?????????
					if (p1.getGesture().get(turn) == Action.kougekida) {
						if (p1.getForce() > p2.getForce()) {
							System.out.println(p1.getPlayerName());
							return;
						}
					}
					break;

				case tameru:
					// ????????§???????????´????????????
					if (p1.getGesture().get(turn) == Action.kougekida && p1.getForce() > 0) {
						System.out.println(p1.getPlayerName());
						return;
					}
					break;

				case mamoru:
					// ???????????????????????\????????????????????????
					if (p1.getGesture().get(turn) == Action.kougekida && p1.getForce() >= 5) {
						System.out.println(p1.getPlayerName());
						return;
					}
					break;
				}
			}
			// ???????????¢?????¨??£?????´??????????????????0?????????
			if (isono.getGesture().get(turn) == Action.kougekida)isono.setForce(0);
			if (nakajima.getGesture().get(turn) == Action.kougekida)nakajima.setForce(0);
			// ?????????
			if (isono.getGesture().get(turn) == Action.tameru)isono.setForce(isono.getForce() + 1);
			if (nakajima.getGesture().get(turn) == Action.tameru)nakajima.setForce(nakajima.getForce() + 1);
		}
		System.out.println("Hikiwake-kun");
	}// ?????????????????????????????????
}// ??????????????????????????????

enum Action {
	kougekida, tameru, mamoru
}// Action?????????????????????

/**
 * ?????¬??????????????¶???
 *
 * @author ?????????????????§???
 */
class Player {

	private int force = 0;
	private String PlayerName;
	private ArrayList<Action> gesture = new ArrayList<Action>();

	public ArrayList<Action> getGesture() {
		return gesture;
	}

	public String getPlayerName() {
		return PlayerName;
	}

	public int getForce() {
		return force;
	}

	public void setForce(int force) {
		this.force = force;
	}

	Player(String name) {
		this.PlayerName = name;
	}
}// Player?????????????????????

Measured memory_bytes: 24500
#include<stdio.h>
#include<math.h>
#include<string.h>

main(){
  char Week[100];
  int i=0;
  gets(Week);
  
  if(Week[0]=='S' && Week[1] == 'U' && Week[2]=='N'){
    printf("7");
  }
  else if(Week[0]=='S' && Week[1] == 'A' && Week[2]=='T'){
  
    printf("1");
  }
  else if(Week[0]=='F' && Week[1] == 'R' && Week[2]=='I'){
    printf("2");
  }
  else if(Week[0]=='T' && Week[1] == 'H' && Week[2]=='U'){
    printf("3");
  }
  else if(Week[0]=='W' && Week[1] == 'E' && Week[2]=='D'){
    printf("4");
  }
  else if(Week[0]=='T' && Week[1] == 'U' && Week[2]=='E'){
    printf("5");
  }
  else if(Week[0]=='M' && Week[1] == 'O' && Week[2]=='N'){
    printf("6");
  }
  
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>

#include <climits>
#include <cmath>

//#include <show_vec.hh>

#define DEBUG if(false)

using namespace std;

int diffs(int n){
  int ans = 0;
  while(true){
    if((ans+1)*(ans+2)/2 <= n){
      ans++;
    }else{
      break;
    }
  }
  return ans;
}

int main(){
  long long N;
  cin >> N;
  if(N == 1){ cout << 0 << endl; return 0; }
  long long end = sqrt(N);
  long long i = 2;
  unordered_map<long long, int> um;
  while(i <= end){
    if(N % i == 0){
      N = N / i;
      end = sqrt(N);
      um[i]++;
    }else{
      i++;
    }
  }
  um[N]++;

  int times = 0;
  for(auto itr = um.begin(); itr != um.end(); ++itr) {
    //cout << itr->first << " : " << itr->second << endl;
    times += diffs(itr->second);
  }

  cout << times << endl;

  return 0;
}


Measured memory_bytes: 3616
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int x = sc.nextInt();
		
		// 計算
	    String result = "NO";
	    if(x == 7 || x == 5 || x == 3) result = "YES";

		// 出力
		System.out.println(result);
        
	}
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#ifdef ONLINE_JUDGE
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define fu(a,b,c) for(int a=b;a<=(int)c;++a)
#define fd(a,b,c) for(int a=b;a>=(int)c;--a)
#define cu(a,b,c) for(int a=b;a<(int)c;++a)
#define cd(a,b,c) for(int a=(b)-1;a>=(int)c;--a)
#define gcd(a,b) __gcd(a,b) 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define MOD 1000000007 
#define MAXN 52
#define MAXH 20
#define MAXM 52
#define INF 100000000
#define ll long long
#define ull unsigned long long
#define RNG rng mt19937(time(NULL))
#define udist(a,b) uniform_int_distribution<uint32_t> distribution(a,b)
#define max3(a,b,c) max(a, max(b, c))
#define min3(a,b,c) min(a, min(b, c))
#define gmax(a,b) a = max(a, b)
#define gmin(a,b) a = min(a, b)
#define whatis(x) cerr << #x << " is " << x << endl;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.1415926535897932384626433
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int main(){
	vector<int> v(5);
	cu(i,0,5)cin >> v[i];
	int k;
	cin >> k;
	sort(all(v));
	cout << (v[4] - v[0] > k?":(":"Yay!") << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <utility>
using namespace std;

int main() {
  int N,L;
  cin>>N>>L;
  
  vector<int> taste(N);
  for(int i=0;i<N;++i){
    taste[i]=L+i;
  }
  
  int x=10000;
  int sum=0;
  int ans=0;
  
  for(int i=0;i<N;++i){
    sum+=taste[i];
  }
  
  for(int i=0;i<N;++i){
    int tmp_sum=sum-taste[i];
    int z=abs(sum-tmp_sum);
    
    if(z<x){
      x=z;
      ans=tmp_sum;
    }
    
  }
  cout<<ans<<endl;
}


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

int main(){
    int n;
    cin>>n;
    vector<int> d(n);
    rep(i, n) cin >> d[i];
    sort(d.begin(), d.end());
    int ans = d[n/2] - d[n/2 - 1];
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
auto ____ = [] () {ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); };
const int MAXN = 2e3+7;
int n,A[MAXN];
int main(){
    ____();
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> A[i];
    sort(A+1,A+1+n);
    int tot = 0;
    for(int i = n; i >= 1; i--){
        for(int j = i-1 ;j >= 1; j--){
            for(int k = j-1 ;k >= 1; k--){
                if(A[k]+A[j]<=A[i]) break;
                tot++;
            }
        }
    }
    cout << tot << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main()
{
    string N;
    cin >> N;
 
    for (size_t i = 0; i < 3; i++)
    {
        if (N[i] == '7')
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int h[n+1];
	h[0]=0;
	for(int i=1;i<=n;i++)
	cin>>h[i];
	int ans[n+1];
	ans[0]=ans[1]=0;
	ans[2]=abs(h[2]-h[1]);
	for(int i=3;i<=n;i++)
	ans[i]=min(ans[i-1]+abs(h[i]-h[i-1]),ans[i-2]+abs(h[i]-h[i-2]));
	cout<<ans[n];
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
#include <math.h>
using namespace std;

class Point {
    public:
    double x, y;

    Point(double x = 0, double y = 0): x(x), y(y) {}

    Point operator + (Point p) { return Point(x+p.x, y+p.y); }
    Point operator - (Point p) { return Point(x-p.x, y-p.y); }
    Point operator * (double a) { return Point(a*x, a*y); }
    Point operator / (double a) { return Point(x/a, y/a); }

    double abs() {return sqrt(norm()); }
    double norm() {return x*x + y*y; }
};

typedef Point Vector;


double dot(Vector a, Vector b) {
    return a.x * b.x + a.y * b.y;
}

double cross(Vector a, Vector b) {
    return a.x*b.y - a.y*b.x;
}

int main(){
    //cinの入力元をテキストファイルに(テスト用)
    #if 0
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
    #endif

    int q;
    cin >> q;

    for(int i=0; i<q; i++){
        Point p0, p1, p2, p3;
        cin >> p0.x >> p0.y >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y;

        Vector u = p1-p0;
        Vector v = p3-p2;

        double Dot = dot(u,v);
        double Cross = cross(u,v);
        
        int out;
        if(Cross==0){out = 2;} // Parallel
        else if (Dot==0){out = 1;} // Orthogonal
        else{out = 0;} //otherwise
        
        cout << out << "\n";
    }
    return 0;
}



Measured memory_bytes: 3228
a, b, c, x, y = map(int, input().split())
ab = c*2
if a+b > ab:
    t = ab*min(x,y)
    d = max(x,y)-min(x,y)
    if x>y: dd = a*d
    else: dd = b*d
    print(t+ab*d if dd>ab*d else t+dd)
else:
    print(a*x+b*y)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<map>
#include<cassert>
#include<algorithm>
#include<deque>
#define F first
#define S second
#define pb push_back

using namespace std;
typedef pair<int,int> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<P> VP;
typedef vector<VP> VVP;

class Pox
{
public:
  int p;
  int ST;
  int cost;
  Pox(int p = 0,int ST = 0,int cost = 0):p(p),ST(ST),cost(cost){}
};

int main()
{
  int N,M,L,K,A,H;
  while(cin >> N >> M >> L >> K >> A >> H,(N || M || L || K || A || H))
    {
      VVP G;
      G.resize(N);
      int mincost[N][M+1];
      bool hospital[N];
      for(int i=0;i<N;i++)
	hospital[i] = false;
      for(int i=0;i<N;i++)
	for(int j=0;j<=M;j++)
	  mincost[i][j] = (1<<28);

      for(int i=0;i<L;i++)
	{
	  int num;
	  cin >> num;
	  hospital[num] = true;
	}

      for(int i=0;i<K;i++)
	{
	  int X,Y,T;
	  cin >> X >> Y >> T;
	  G[X].push_back(P(Y,T));
	  G[Y].push_back(P(X,T));
	}

      deque<Pox> deq;
      deq.pb(Pox(A,M,0));
      mincost[A][M] = 0;
      int ans = (1<<28);

      while(!deq.empty())
	{
	  Pox pox = deq.front(); deq.pop_front();
	  int p = pox.p;
	  int ST = pox.ST;
	  int cost = pox.cost;

	  if(cost >= ans)
	    continue;	 

	  if(p == H)
	    {
	      ans = min(ans,cost);
	      continue;
	    }

	  for(int i=0;i<G[p].size();i++)
	    {
	      P np = G[p][i];
	      int nST = ST - np.S;
	      
	      if(nST < 0)
		continue;	      
	      
	      if(!hospital[np.F])
		{	
		  if(mincost[np.F][nST] > cost + np.S)
		    {
		      mincost[np.F][nST] = cost + np.S;
		      if(deq.front().cost < cost+np.S)
			deq.push_back(Pox(np.F,nST,cost+np.S));
		      else 
			deq.push_front(Pox(np.F,nST,cost+np.S));
		    }

		}
	      else
		{

		  for(int j=0;j<=M-nST;j++)
		    {
		      assert(nST+j <= M);
		      if(mincost[np.F][nST+j] > cost + np.S + j)
			{
			  mincost[np.F][nST+j] = cost + np.S + j;
			  if(deq.front().cost < cost+np.S+j)
			    deq.pb(Pox(np.F,nST+j,cost+np.S+j));
			  else 
			    deq.push_front(Pox(np.F,nST+j,cost+np.S+j));
			}	  
		    }
		  
		}

	    }

	}
      ans == (1<<28)?cout << "Help!" << endl:cout << ans << endl;
    }
  return 0;
}

Measured memory_bytes: 1504
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <queue>
#define MP make_pair
using ll = long long;
using namespace std;

struct edge{
  ll to, cost;
};
typedef pair<ll, ll> P;

ll inf = 100000000000000;
void dk(vector<ll>&d, int N, int K, vector<vector<edge> >&E)
{
  d[K] = 0;
  priority_queue<P, vector<P>, greater<P> > que;
  que.push(P(0, K));
  while(!que.empty()){
    P p = que.top();
    que.pop();
    int v = p.second;
    if(d[v] < p.first)
      continue;
    for(int i=0; i < E[v].size(); i++){
      edge e = E[v][i];
      if(d[e.to] > d[v] + e.cost){
	d[e.to] = d[v] + e.cost;
	que.push(P(d[e.to], e.to));
      }
    }
  }
}

int main()
{
  int N;
  cin >> N;
  vector<vector<edge> >E(N);
  vector<ll>d(N, inf);
  for(int i=0; i < N-1; i++){
   ll a,b,c;
   cin >> a >> b >> c;
   a--;
   b--;
   edge e;
   e.to = b;
   e.cost = c;
   E[a].push_back(e);
   e.to = a;
   E[b].push_back(e);
  }
  int Q,K;
  cin >> Q >> K;
  K--;
  vector<vector<int> >A(Q, vector<int>(2));
  for(int i=0; i < Q; i++){
    int x,y;
    cin >> x >> y;
    x--;
    y--;
    A[i][0] = x;
    A[i][1] = y;
  }
  dk(d,N,K,E);
  for(int i=0; i < Q; i++){
    int x,y;
    x = A[i][0];
    y = A[i][1];
    cout << d[x] + d[y] << endl;
  }
  /*
  for(int i=0; i < N; i++){
    for(int j=0; j < T[i].size(); j++)
      cout << T[i][j].to << endl;
  }
  */
  return 0;
}


Measured memory_bytes: 16624
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=1e9+7;
ll mul(ll a,ll b){
  return (a*b)%mod;
}
ll pow(ll x,ll n){
  if(n==0)return 1;
  ll res=pow(mul(x,x),n/2);
  if(n%2==1)res=mul(res,x);
  return res;
}
ll divi(ll a,ll b){
  return mul(a,pow(b,mod-2));
}
ll add(ll a,ll b){
  return (a+b)%mod;
}

ll N,D,X;
ll dp[2005][2005];

int main(){
  while(1){
    cin>>N>>D>>X;
    if(N==0&&D==0&&X==0)break;
    ll ans=0,cnt=D%mod;
    dp[0][0]=1;
    for(int i=1;i<=min(N,D);i++){
      ll sum=0;
      for(int j=1;j<=N;j++){
        sum=add(sum,dp[i-1][j-1]);
        if(j-X>=0)sum=add(sum,mod-dp[i-1][j-X]);
        dp[i][j]=sum;
      }
      ans=add(ans,mul(dp[i][N],cnt));
      cnt=mul(cnt,(D-i)%mod);
      cnt=divi(cnt,i+1);
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 32492
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int[] b=new int[a];
        int c=0;
        int sum=0;
        for(int i=0;i<a;i++){
            b[i]=sc.nextInt();
            c=Math.max(c,b[i]);
            sum+=b[i];
        }
        if(c<sum-c){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 23124
#include <stdio.h>

typedef struct {
	int key, id;
} data;

typedef struct {
	data obj[200001];
	int size;
} max_heap;

void push(data x, max_heap* h)
{
	int i = h->size;
	data tmp;
	h->obj[(h->size)++] = x;
	while (1) {
		if (i == 0) break;
		else if (h->obj[i].key > h->obj[(i-1)/2].key) {
			tmp = h->obj[(i-1)/2];
			h->obj[(i-1)/2] = h->obj[i];
			h->obj[i] = tmp;
			i = (i - 1) / 2;
		} else break;
	}
}

data pop(max_heap* h)
{
	int i = 0, j;
	data output = h->obj[0], tmp;
	h->obj[0] = h->obj[--(h->size)];
	while (1) {
		if (i * 2 + 1 >= h->size) break;
		else if (i * 2 + 2 >= h->size) j = i * 2 + 1;
		else if (h->obj[i*2+1].key > h->obj[i*2+2].key) j = i * 2 + 1;
		else j = i * 2 + 2;
		if (h->obj[j].key > h->obj[i].key) {
			tmp = h->obj[j];
			h->obj[j] = h->obj[i];
			h->obj[i] = tmp;
			i = j;
		} else break;
	}
	return output;
}

int main()
{
	int i, N, A[200001], B[200001];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%d", &(A[i]));
	for (i = 1; i <= N; i++) scanf("%d", &(B[i]));

	data d;
	max_heap h;
	h.size = 0;
	for (i = 1; i <= N; i++) {
		if (A[i] > B[i]) break;
		else if (A[i] == B[i]) continue;
		d.key = B[i];
		d.id = i;
		push(d, &h);
	}
	if (i <= N) {
		printf("-1\n");
		fflush(stdout);
		return 0;
	}
	
	int j, k;
	long long ans = 0;
	while (h.size > 0) {
		d = pop(&h);
		j = d.id;
		i = (j + N - 2) % N + 1;
		k = j % N + 1;
		if (B[j] <= B[i] + B[k]) break;
		if ((B[j] - A[j]) % (B[i] + B[k]) == 0) {
			ans += (B[j] - A[j]) / (B[i] + B[k]);
			B[j] = A[j];
		} else if (B[j] - (B[i] + B[k]) > A[j]) {
			ans += B[j] / (B[i] + B[k]);
			B[j] %= B[i] + B[k];
			d.key = B[j];
			push(d, &h);
		} else break;
	}

	for (i = 1; i <= N; i++) if (A[i] != B[i]) break;
	if (i > N) printf("%lld\n", ans);
	else printf("-1\n");
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 4856
n, k = map(int, input().split())
d = {}

for _ in range(n):
    a,b = map(int, input().split())
    if a in d:
        d[a] += b
    else:
        d[a] = b

key_l = list(d.keys())
key_l.sort()

ans = key_l[-1]
i = 0
for key in key_l:
    i+=d[key]
    if i >= k:
        ans = key
        break
print(ans)

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

#define     fast()              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define     ll                  long long int
#define     test()              ll t; cin>>t; while(t--) 
#define     lp0(i,begin,end)    for(ll i=begin;i<end;i++)
#define     lp1(i,begin,end)    for(ll i=begin;i<=end;i++)
#define     rlp(i,begin,end)    for(ll i=end;i>=begin;i--)
#define     prec(n)             fixed<<setprecision(n)
#define     initial(a,i)        memset(a,i,sizeof(a))
#define     pb                  push_back
#define     PI                  3.1415926535897932384626433832795
#define     MOD                 1000000007
#define     F                   first
#define     S                   second
#define     all(a)              (a).begin(),(a).end()
#define     BPC(x)              __builtin_popcountll(x)
#define     gcd(a,b)            __gcd(a,b)

ll gcd(ll a,ll b) {if (a==0) return b;return gcd(b%a,a);}

ll power(ll x,ll n)
{
    ll result = 1;
    while (n)
    {
        if (n & 1)
            result = result * x;
        n = n / 2;
        x = x * x;
    }
    return result;
}


// Solution Function
void solution(ll compte)
{
    // cout<<compte<<"\n";
    ll n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    s[k-1]=tolower(s[k-1]);
    cout<<s<<"\n";
}
// Driver Function
int main()
{
    ll compte = 1;
    //test()
    //{
        solution(compte);
        compte++;
    //}
    return 0;
}


Measured memory_bytes: 3580
#include <iostream>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <algorithm>
#include <functional>
#include <cstring>
#include <limits.h>
#define FOR(i,k,n)  for (int i=(k); i<(int)(n); ++i)
#define REP(i,n)    FOR(i,0,n)
#define FORIT(i,c)	for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define SZ(i) ((int)i.size())
#define pb          push_back
#define mp          make_pair
#define mt          make_tuple
#define get0(x)     (get<0>(x))
#define get1(x)     (get<1>(x))
#define get2(x)     (get<2>(x))
#define ALL(X)      (X).begin(),(X).end()
#define LLMAX       9223372036854775807LL
#define LLMIN       -9223372036854775808LL
#define IMAX        2147483647
#define IMIN        -2147483648
typedef long long LL;
using namespace std;

int H,W;
vector<string> purple,red,blue;

int main(void){
    cin>>H>>W;
    REP(i,H){
        string s;
        cin>>s;
        purple.pb(s);
        red.pb(string(W,'.'));
        blue.pb(string(W,'.'));
    }
    REP(i,H)
        REP(j,W){
            if(j!=W-1&&(j==0||i%2==0||purple[i][j]=='#'))
                red[i][j]='#';
            if(j!=0&&(j==W-1||i%2==1||purple[i][j]=='#'))
                blue[i][j]='#';
        }
    REP(i,H)
        cout<<red[i]<<endl;
    cout<<endl;
    REP(i,H)
        cout<<blue[i]<<endl;
     return 0;
}

Measured memory_bytes: 1536
<?php
fscanf(STDIN, "%s", $s);
$len = floor(strlen($s) / 2);
$a = str_split($s);
$b = str_split(strrev($s));
$cnt = 0;

for ($i = 0; $i < $len; $i++) {
  if ($a[$i] !== $b[$i]) {
    $cnt++;
  }
}
echo $cnt;


Measured memory_bytes: 4856
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int l, r, d;
	cin >> l >> r >> d;
	int ans = 0;
	for (int i = l; i <= r; ++i) {
		if (i % d == 0) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3648
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>

// ===============================================================

using namespace std;
using ll = long long;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
using pii = pair<int, int>;
using psi = pair<string, int>;
using ld = long double;
using ull = unsigned long long;

// ========================================================================

ll N = 100000;

ll gcd(ll a, ll b)
{
	if (a % b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd(b, a % b));
	}
}
//最大公約数
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
//最小公倍数
ll box(double a)
{
	ll b = a;
	return b;
}
//切り捨て
ll fff(double a)
{
	ll b = a + 0.5;
	return b;
}
//四捨五入
ll sum(ll n) {
	return (1 + n) * n / 2;
}
//1から整数nまでの合計を出す
bool prime(ll a)//素数判定、primeならtrue,違うならfalse
{
	if (a < 2) return false;
	else if (a == 2) return true;
	else if (a % 2 == 0) return false;
	double m = sqrt(a);
	for (int i = 3; i <= m; i += 2)
	{
		if (a % i == 0)
		{
			return false;
		}
	}

	// 素数である
	return true;
}
//素数判定



ll modpow(ll a, ll n, ll mod) {
	ll hi = 1;
	while (n > 0) {
		if (n & 1) hi = hi * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return hi;
}
//いろいろやります（ただの前座）
ll mg(ll a, ll mod) {
	return modpow(a, mod - 2, mod);
}
//割り算の%INF対策で逆元を出します

//暇ですね(*'▽')

// ========================================================================

int main() {
	ll n; cin >> n;
	ll a = 0;
	ll b;
	for (ll i = 1; i <= sqrt(n); i++) {
		if (n % i == 0) {
			if (max(i, a) == i) {
				a = i;
			}
		}
	}
	b = n / a;
	cout << (to_string(a).size(), to_string(b).size()) << endl;

	return 0;
}

Measured memory_bytes: 3768
fun main(args: Array<String>) {
    val (N, M, X) = readLine()!!.split(" ").map(String::toInt)
    val A = readLine()!!.split(" ").map(String::toInt)
    val cells = IntArray(N + 1)
    A.forEach { cells[it] = 1 }

    Math.min(cells.copyOfRange(0, X).sum(), cells.copyOfRange(X, cells.size).sum()).let(::println)
}



Measured memory_bytes: 37932
#include <iostream>
#include <vector>

int main() {
  int N;
  std::cin >> N;
  std::vector<int> A(N, 0);
  for (int i=0; i<N; i++) {
    std::cin >> A[i];
  }
  for (int i=0; i<N-1; i++) {
    std::cout << A[i] << ' ';
  }
  std::cout << A[N-1] << std::endl;
  
  for (int i=1; i<N; i++) {
    int v = A[i];
    int j = i - 1;
    while (j >= 0 && A[j] > v) {
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    
    for (int i=0; i<N-1; i++) {
      std::cout << A[i] << ' ';
    }
    std::cout << A[N-1] << std::endl;
  }
  
  return 0;
}


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

int x,y, ax, ay;

int main () {
	cin >> x >> y;
	if (x==2) {
		ax=1;
	} else if ((x==4) || (x==6) || (x==9) || (x==11)) {
		ax=2;
	} else {
		ax=3;
	}
	if (y==2) {
		ay=1;
	} else if ((y==4) || (y==6) || (y==9) || (y==11)) {
		ay=2;
	} else {
		ay=3;
	}
	if (ax==ay) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(),(x).end()
typedef long long int ll;
using namespace std;
int main()
{
  int a, b;
  cin >> a>> b;
  cout << a*b/2 << endl;

}


Measured memory_bytes: 764
#include <stdio.h>
#include <string>
#include <iostream>
using namespace std;

int main(void) {
	string a="\0";
	int s;
	cin >> a >> s;
	int x=a.length();
	for(int i=0; i<x; i+=s){
		if(a == "\0"){
			break;
		}
		cout << a[i];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<fstream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#include <random>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
// #define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n;
    string s;
    cin>>n>>s;
    if(n%2==1){
        cout<<"No"<<endl;
        return 0;
    }
    rep(i,n/2){
        if(s[i]!=s[i+n/2]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){

  string s,result;
  int n,i,blank=0;

  cin>>n;
  cin>>s;
  result=s;

  for(i=n-1;i!=-1;i--){
    if(s[i]=='(') blank--;
    else blank++;

    if(blank<0) blank=0;

  }

  for(i=0;i<blank;i++) result='('+result;
  s=result;

  blank=0;
  for(i=0;i<result.size();i++){
    if(s[i]==')') blank--;
    else blank++;
  }

  cout<<result;
  for(i=0;i<blank;i++) cout<<')';
  cout<<endl;

  return 0;

}

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

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

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    deque<int> b;
    if(n % 2 == 0) {
        rep(i,n) {
            int t = a[i];
            if(i % 2 == 0) {
                b.emplace_back(t);
            }
            else {
                b.emplace_front(t);
            }
        }
    }
    else {
        rep(i,n) {
            int v = a[i];
            if(i % 2 == 0) {
                b.emplace_front(v);
            }
            else {
                b.emplace_back(v);
            }
        }
    }
    while(!b.empty()) {
        int ans = b.front();
        b.pop_front();
        printf("%d ", ans);
    }
    printf("\n");
    return 0;
}

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

int BinarySearch(int S[], int start, int end, int key)
{
	int s = start;
	int e = end;
	int m = (e + s) / 2;
	if (e - s == 1)
	{
		if (S[s] == key || S[e] == key)
			return 1;
		else
			return 0;
	}
	if (S[m] == key)
	{
		return 1;
	}
	else if(S[m] < key)
	{
		return BinarySearch(S, m, e, key);
	}
	else if (S[m] > key)
	{
		return BinarySearch(S, s, m, key);
	}
	return 0;
}

int main()
{
	int n, q;
	int S[100000];
	int key;

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

	cin >> q;
	int count = 0;
	for (int i = 0; i < q; i++) {
		cin >> key;
		if (BinarySearch(S, 0, n-1, key))
			count++;
	}
	cout << count << endl;
	return 0;
}



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

#define _GLIBCXX_DEBAC
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/

using namespace std;

int gcd(int a, int b) {
	int c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

int sort_greater(int m,int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
		return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

map<string, int> memo;
int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(),a.end());
	bool b = false;
	for (int i = 0; i < n - 1; i++) {
		if (a[i] == a[i + 1]) {
			b = true;
			break;
		}
	}
	
	if (b) {
		cout << "NO";
	}
	else {
		cout << "YES";
	}
	return 0;
}









Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;

struct node{
    int point;
    int qPoint;
    bool kita;
    vector<int> next;
};

void dfs(vector<node>& tree,int now,int ngo){
    if(tree[now].kita) return;
    tree[now].kita = 1;
    tree[now].point =  tree[now].qPoint + ngo;
    for(int i=0;i<tree[now].next.size();++i){
        dfs(tree,tree[now].next[i],ngo+tree[now].qPoint);
    }
}

int main(){
    int n,q; cin>>n>>q;
    vector<node> tree(n,{0,0,0,{}});
    for(int i=0;i<n-1;++i){
        int a,b;
        cin>>a;
        cin>>b;
        tree[a-1].next.push_back(b-1);
        tree[b-1].next.push_back(a-1);
    }
    for(int i=0;i<q;++i){
        int p,x;
        cin>>p;
        cin>>x;
        tree[p-1].qPoint += x;
    }
    dfs(tree,0,0);
    for(int i=0;i<tree.size();++i) cout<<tree[i].point<<" ";
}

Measured memory_bytes: 25856
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <climits>
#include <iomanip>
#include <sstream>

using namespace std;

using ll = long long;
using ld = long double;
using ull = unsigned long long;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

template <typename T>
T gcd(T a, T b) {
	while (b != 0) {
		T temp = a;
		a = b;
		b = temp % b;
	}

	return a;
}


// cout << setfill('0') << setw(5) << number < endl;
// while(getline(cin, s)) { .. } | `s` is a string
void add_or_subtract(vector<vector<int>> &a, vector<int> &curr, int index, bool Add) {
	for (int i = 0; i < curr.size(); ++i)
		if (Add)
			curr[i] += a[index][i+1];
		else
			curr[i] -= a[index][i+1];
}

bool check(vector<int> &curr, int x) {
	for (auto &a : curr) {
		if (a < x)
			return false;
	}
	return true;
}

void help(vector<vector<int>> &a, vector<int> &curr, int x, int index, int currCost, int &minCost) {
	if (check(curr, x)) {
		// cout << "at index : " << index << " and cost : " << currCost << endl;
		minCost = min(minCost, currCost);
	}
	if (index == a.size())
		return;
	// not including this lot
	help(a, curr, x, index + 1, currCost, minCost);

	// including this lot
	add_or_subtract(a, curr, index, true);
	currCost += a[index][0];
	help(a, curr, x, index + 1, currCost, minCost);
	add_or_subtract(a, curr, index, false);

}

void solve() {
	int n, m, x;
	cin >> n >> m >> x;
	vector<vector<int>> a(n, vector<int>(m + 1));
	vector<int> sum(m);
	
	for (int i = 0; i < n; ++i) {
		cin >> a[i][0];
		for (int j = 1; j <= m; ++j) {
			cin >> a[i][j];
			sum[j-1] += a[i][j];
		} 
	}

	bool flag = true;
	int i = 0;
	for (auto &q : sum) {
		if (q < x) {
			// cout << "index: " << i << endl;
			flag = false;
			break;
		}
		++i;
	}

	if (!flag) {
		cout << -1 << endl;
		return ;
	} 

	int minCost = INT_MAX;
	vector<int> curr(m, 0);
	help(a, curr, x, 0, 0, minCost);
	cout << minCost << endl;
}


int main(){
	IOS;
	#ifndef ONLINE_JUDGE
	    // for getting input from input.txt
	    (void)freopen("input.txt", "r", stdin);
	    // for writing output to output.txt
	    (void)freopen("output.txt", "w", stdout);
	#endif
	
	
	int t = 1;
	// cin >> t;
	while(t--)
		solve();

	return 0;
}



























 

Measured memory_bytes: 3644
mod = 10**9 + 7
n, a, b = map(int, input().split())

ans = pow(2, n, mod)

def C(n, k):
    x, y = 1, 1
    for i in range(k):
        x = x *(n - i) % mod
        y = y *(i+1) % mod

    return (x * pow(y, mod-2, mod)) % mod

print((ans - C(n, a) - C(n, b) - 1) % mod)



Measured memory_bytes: 3060
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author RiaD
 */

#include <iostream>
#include <fstream>

#include <iostream>

using namespace std;

class B {
public:
	void solve(std::istream& in, std::ostream& out) {
		int n, a, b;
		string s;
		in >> n >> a >> b >> s;
		for (char c: s) {
			if(c == 'a') {
				if (a) {
					out << "Yes\n";
					--a;
					continue;
				}
			}
			if (c == 'a' || c == 'b') {
				if (b) {
					out << "Yes\n";
					--b;
					continue;
				}
			}
			out << "No\n";
		}
	}
};


int main() {
	std::ios_base::sync_with_stdio(false);
	B solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	in.tie(0);
	out << std::fixed;
	out.precision(20);
	return 0;
}


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

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

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

	for (int i = 0; i < N-1; i++) {
		if (A[i] > A[i+1]){
			int temp;
			temp = A[i];
			A[i] = A[i+1];
			A[i+1] = temp;
		}
	}

	for (int i = 0; i < N-2; i++) {
		if (A[i] < A[i+1]){
			int temp;
			temp = A[i];
			A[i] = A[i+1];
			A[i+1] = temp;
		}
	}

	// for (int i = 0; i < N; i++) {
	// 	cout << A[i] << endl;
	// }

	cout << A[N-1] - A[N-2] << endl;
}

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

int main() {
  int N;
  cin >> N;
 
  if (N == 1) {
    cout << 1 <<endl;
  }
  else if (2 <= N && N <= 3) {
   cout << 2 << endl; 
  }
  else if (4 <= N && N <= 7) {
   cout << 4 << endl;    
  }
  else if (8 <= N && N <= 15) {
   cout << 8 << endl; 
  }
  else if (16 <= N && N <= 31) {
    cout << 16 << endl;
  }
  else if (32 <= N && N <= 63) {
    cout << 32 << endl;
  }
  else {
    cout << 64 << endl;
  }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://atcoder.jp/contests/abc131/tasks/abc131_d>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll N; cin >> N;
    vector<ll> A(N),B(N);
    for(int i = 0; i < N;i++) cin >> A[i] >> B[i];
    
    vector<pll> events(N);
    for(int i = 0; i < N;i++){
        events[i] = {B[i],A[i]};
    }
    sort(events.begin(),events.end());
    
    ll now = 0;
    for(int i = 0; i < N;i++){
        now += events[i].second;
        if(events[i].first < now) return "No";
    }
    return "Yes";
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<string>() << endl;
    return 0;
}


Measured memory_bytes: 6528
N = int(input())
A = [list(map(int, input().split())) for i in range(2)]
s = []
if N == 1:
  ans = A[0][0]+A[1][0]
  print(ans)
  
else:
  for i in range(N-1):
    a = 0
    for j in range(i+1):
      a += A[0][j]
    for j in range(i,N):
      a += A[1][j]
    s.append(a)
  ans = max(s)
  print(ans)

Measured memory_bytes: 3316
R,G,B,N = map(int,input().split())
A = [R,G,B]
A.sort()
R = A[2]
G = A[1]
B = A[0]
rmax = N//R
gmax = N//G
bmax = N//B

cnt = 0

if R == 1:
    print((N+1)*(N+2)//2)
    exit()

for i in range(rmax+1):
    for j in range(gmax+1):
        if R*i + G*j > N:
            continue
        if ((N-R*i-G*j)%B == 0) and ((N-R*i-G*j)//B <= bmax):
            cnt += 1
print(cnt)

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

string s[3];
int i[3];

int main() {
	inc(i, 3) { cin >> s[i]; }
	
	int t = 0;
	while(i[t] < s[t].size()) {
		t = s[t][ i[t]++ ] - 'a';
	}
	
	printf("%c\n", 'A' + t);
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define eb emplace_back
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 233;
pii a[maxn];
ll ch[maxn];
int n;
void add(int x,ll v){
	for(int i=x;i<=n;i+=i&-i)
		ch[i] += v;
}
ll cal(int x){
	ll sum = 0;
	for(int i=x;i;i-=i&-i)
		sum += ch[i];
	return sum;
}
void add(int l,int r,ll v){
//	cout<<"!"<<l<<" "<<r<<" "<<v<<endl;
	add(l,v);
	add(r+1,-v);
}
int main()
{
	int d,atk;cin>>n>>d>>atk;
	for(int i=1;i<=n;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		y = (y+atk-1)/atk;
		a[i] = mp(x,y);
	}
	sort(a+1,a+1+n);
	int j = 1;
	ll ans = 0;
	for(int i=1;i<=n;i++){
		while(j<n&&a[j+1].first-a[i].first<=2*d)j++;
		ll v = a[i].second-cal(i);
		if(v<=0)continue;
		ans += v;
		add(i,j,v);
	}
	cout << ans << endl;
}


Measured memory_bytes: 3328
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;

public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        string s = Console.ReadLine();
        int res = 0;
        for (int i = 0; i < 1000; i++)
        {
            int ind = 0;
            var target = $"{i:000}";
            foreach (var c in s)
            {
                if (c == target[ind]) ind++;
                if (ind == 3) break;
            }
            if (ind == 3) res++;
        }
        Console.WriteLine(res);
    }
}


Measured memory_bytes: 13212
#include <bits/stdc++.h>
#define pb push_back
#define s(a, x, y) sort(a.begin()+x, a.begin()+y);
#define mp make_pair
#define F first
#define S second
#define ll long long
using namespace std;
ll n, a[200000], S, x;
int main() {
	cin>>n;
	for(int i=0; i<n; i++) {
	    cin>>a[i];
	    S=S^a[i];
	}
	for(int i=0; i<n; i++){
	    x=S^a[i];
	    cout<<x<<" ";
	}
	return 0;
}

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

using ll = long long;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  // 重み付き無向(有向)グラフの隣接リスト
  int n, m; // n:頂点数 m:辺数
  ll s;
  cin >> n >> m >> s;
  
  vector<vector<pair<int, pair<ll, ll>>>> G(n); // G:頂点数nのグラフの隣接リスト
  
  for (int i = 0; i < m; i++) {
    int u, v;
    ll a, b;
    cin >> u >> v >> a >> b;
    u--;
    v--;
    G[u].emplace_back(make_pair(v, make_pair(a, b)));
    G[v].emplace_back(make_pair(u, make_pair(a, b))); // 有向グラフではコメントアウト
  }
  
  vector<ll> c(n), d(n);
  for (int i = 0; i < n; i++) cin >> c.at(i) >> d.at(i);
  
  s = min<ll>(s, 2500);
  vector<vector<ll>> dp(n, vector<ll>(2501, 1e18));
  dp.at(0).at(s) = 0;
  
  priority_queue<tuple<ll, ll, int>, vector<tuple<ll, ll, int>>, greater<tuple<ll, ll, int>>> pq;
  pq.push(make_tuple(0, s, 0));
  while (!pq.empty()) {
    auto [time, silver, node] = pq.top();
    pq.pop();
    if (dp.at(node).at(silver) < time) continue;
    dp.at(node).at(silver) = time;
    if (silver < 2500) {
      ll keep = min<ll>(silver + c.at(node), 2500);
      if (dp.at(node).at(keep) > time + d.at(node)) {
        dp.at(node).at(keep) = time + d.at(node);
        pq.push(make_tuple(time + d.at(node), keep, node));
      }
    }
    for (int i = 0; i < G[node].size(); i++) {
      if (silver < G[node].at(i).second.first) continue;
      if (dp.at(G[node].at(i).first).at(silver - G[node].at(i).second.first) <= time + G[node].at(i).second.second) continue;
      dp.at(G[node].at(i).first).at(silver - G[node].at(i).second.first) = time + G[node].at(i).second.second;
      pq.push(make_tuple(time + G[node].at(i).second.second, silver - G[node].at(i).second.first, G[node].at(i).first));
    }
  }
  
  for (int i = 1; i < n; i++) {
    ll keep = 1e18;
    for (int j = 0; j <= 2500; j++) {
      keep = min(keep, dp.at(i).at(j));
    }
    cout << keep << '\n';
  }
}

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N=INT()
H=LIST()+[INF]

for i in range(N-2, -1, -1):
    if H[i]>H[i+1]:
        H[i]-=1

for i in range(N-1):
    if H[i]>H[i+1]:
        No()
        exit()
Yes()


Measured memory_bytes: 15020
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if(s.contains("a") && s.contains("b") && s.contains("c")) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 35452
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
const long long MOD = 1e9 + 7;

template <typename T> bool chmax(T &a, const T &b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T> bool chmin(T &a, const T &b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}

int main() {
    int N, A;
    cin >> N;
    ll ans = 1;
    vector<int> cap(3, 0);
    rep(x, N) {
        cin >> A;
        int sam = 0;
        rep(i, 3) if(A == cap[i]) sam++;
        rep(i, 3) {
            if(A == cap[i]) {
                cap[i]++;
                break;
            }
        }
        ans *= sam;
        ans %= MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3608