akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
 
typedef struct{
    long long int code;
    int steps;
} puzz;
 
int q[1000000][14],size[100000];
long long int FR,TO,SW;
puzz* hash[60000][100];
 
void swap (int* x,int* y){
    int z;
    z=*x;
    *x=*y;
    *y=z;
}
 
long long int convert(int a[]){
    long long int ret=0;
    int i;
    for(i=0;i<13;i++)ret=ret*13+a[i];
    return ret;
}
 
void hashadd(long long int code,int step){
    int ccc=code%60000;
    puzz* ppp=(puzz*)malloc(sizeof(puzz));
    ppp->code=code;
    ppp->steps=step;
    if(size[ccc]>99){fprintf(stderr,"SIZE OVER!! (%d)\n",ccc);return;}
    hash[ccc][size[ccc]]=ppp;
    size[ccc]++;
}
 
int hashsearch(long long int code){
    int ccc=code%60000;
    int i=size[ccc]-1;
    for(;i>=0;i--){
        if(hash[ccc][i]->code==code)return hash[ccc][i]->steps;
    }
    return -1;
}
 
void mark(int x,int y){
    int k;
    long long int cd;
 
    swap(&q[FR][x],&q[FR][y]);
    cd=convert(q[FR]);
 
    if(SW==1 || hashsearch(cd)<0){
        for(k=0;k<14;k++){q[TO][k]=q[FR][k];}
        q[TO][13]++;
        if(SW==0)hashadd(cd,q[TO][13]);
        TO++;
    }
 
    swap(&q[FR][x],&q[FR][y]);
 
}
 
void check(){
    if(q[FR][0]==0){mark(0,2);}
    if(q[FR][1]==0){mark(1,2);mark(1,5);}
    if(q[FR][2]==0){mark(2,0);mark(2,1);mark(2,3);mark(2,6);}
    if(q[FR][3]==0){mark(3,2);mark(3,7);}
    if(q[FR][4]==0){mark(4,5);}
    if(q[FR][5]==0){mark(5,1);mark(5,4);mark(5,6);mark(5,9);}
    if(q[FR][6]==0){mark(6,2);mark(6,5);mark(6,7);mark(6,10);}
    if(q[FR][7]==0){mark(7,3);mark(7,6);mark(7,8);mark(7,11);}
    if(q[FR][8]==0){mark(8,7);}
    if(q[FR][9]==0){mark(9,5);mark(9,10);}
    if(q[FR][10]==0){mark(10,6);mark(10,9);mark(10,11);mark(10,12);}
    if(q[FR][11]==0){mark(11,7);mark(11,10);}
    if(q[FR][12]==0){mark(12,10);}
}
 
 
int main(){
    int i,ans;
    long long int cd;
 
    for(i=1;i<12;i++)q[0][i]=i;
    q[0][0]=0;q[0][12]=0;q[0][13]=0;
    hashadd(convert(q[0]),0);
 
    FR=0;TO=1;SW=0;
 
    while(FR<TO && q[FR][13]<=13){
        check();
        FR++;
    }

    while(scanf("%d",&q[0][0])*q[0][0]>=0){
        for(i=1;i<13;i++)scanf("%d",&q[0][i]);
        q[0][13]=0;FR=0;TO=1;SW=1;ans=9999;
 
        while(FR<TO){
            cd=hashsearch(convert(q[FR]));
            if(cd>=0){
                ans=(int)cd+q[FR][13];
                break;
            }
            if(q[FR][13]<6)check();
            FR++;
        }
 
        if(ans>20)printf("NA\n"); else printf("%d\n",ans);
    }
 
    return 0;
}

Measured memory_bytes: 59212
import java.util.*;

public class Main {

    private static int N;
    private static int A[];

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }
        System.out.println(solve());
    }

    static long solve() {

        Map<Integer, Integer> counter = new HashMap<>();
        for (int i = 0; i < N; i++) {
            int a = A[i];
            Integer n = counter.get(a);
            //noinspection Java8MapApi
            if( n != null ) {
                counter.put(a, n + 1);
            } else {
                counter.put(a, 1);
            }
        }

        List<Pair> ps = new ArrayList<>();
        for (Map.Entry<Integer, Integer> entry : counter.entrySet()) {
            ps.add(new Pair(entry.getKey(), entry.getValue()));
        }

        Comparator<Pair> c = Comparator.comparingInt(p -> p.n);
        ps.sort(c.reversed());

        int ans = N;

        int size = ps.size();
        for (int i = 0; i < size; i++) {
            Pair p = ps.get(i);
            if( p.n <= 1 ) continue;

            if( p.n >= 3 ) {
                int r = p.n - 2;
                if( r % 2 == 0 ) { // 4, 6
                    ans -= r;
                    p.n = 2;
                } else { // 3, 5...
                    ans -= r+1;
                    p.n = 1;
                }
            }

            if( p.n == 2 ) {
                // 周囲を食べる
                // 次を食えるようなら次を食べる
                if( i != size-1 ) {
                    ps.get(i+1).n -= 1;
                }
                p.n = 1;
                ans -= 2;
            }
        }

        return ans;
    }

    private static class Pair {
        private final int a;
        private int n;

        public Pair(int a, int n) {
            this.a = a;
            this.n = n;
        }
    }
}


Measured memory_bytes: 57512
#include <stdio.h>
int main(void)
{
  char s[500001], c, ans[300001];
  int q, t, f, i, j, left_end, right_end, rightward_flg;

  scanf("%s", &s[200000]);            // 標準入力からの値取得
  scanf("%d", &q);                    // 標準入力からの値取得

  rightward_flg = 1;
  left_end = 199999;
  for (right_end = 200000; s[right_end] != '\0'; right_end++)
    ;
  
  for (i = 0; i < q; i++) {
    scanf("%d", &t);                  // 標準入力からの値取得
    if (t == 1) {
      rightward_flg = ~rightward_flg;
    } else {
      scanf("%d %c", &f, &c);         // 標準入力からの値取得
      if (f == 1) {
        if (rightward_flg == 1) {
          s[left_end--] = c;
        } else {
          s[right_end++] = c;
        }
      } else {
        if (rightward_flg == 1) {
          s[right_end++] = c;
        } else {
          s[left_end--] = c;
        }
      }
    }
  }

  // 出力
  if (rightward_flg == 1) {
    s[right_end] = '\0';
    printf("%s\n", &s[++left_end]);
  } else {
    for (i = --right_end, j = 0; i > left_end; i--) {
      ans[j++] = s[i];
    }
    ans[j] = '\0';
    printf("%s\n", ans);
  }
  return 0;
}

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

#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define ll long long

ll fact(int n){
  int i;
  static ll a[100];

  memset(a,0,sizeof(a));
  a[0] = a[1] = 1;
  REP(i,1,n+1) a[i] = a[i-1] * i;

  return a[n];
}

int main(){
  int n;

  scanf("%d",&n);
  //DP
  printf("%lld\n", fact(n));

  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

const int N = 3000;
double prob[N][N];

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  int n; cin >> n;
  prob[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    double p; cin >> p;
    prob[i][0] = prob[i - 1][0] * (1 - p);
    for (int j = 1; j <= i; j++) {
      prob[i][j] = prob[i - 1][j] * (1 - p) + prob[i - 1][j - 1] * p;
    }
  }
  double ans = 0;
  for (int h = (n + 1) / 2; h <= n; h++) {
    ans += prob[n][h];
  }
  cout << fixed << setprecision(10) << ans << endl;

  return 0;
}


Measured memory_bytes: 49884
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <unordered_map>
#include <queue>
#include <set>
using namespace std;


int main(){
    long long n, answer;
    cin >> n;
    for (int i = sqrt(n) + 1; i >= 1; i--){
        if (n % i == 0){
            answer = i;
            break;
        }
    }
    answer += n / answer;
    cout << answer - 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define X first
#define Y second
bool on(P p1,P p2,P p3){
  P v1=P(p2.X-p1.X,p2.Y-p1.Y),v2=P(p3.X-p1.X,p3.Y-p1.Y);
  if(v1.X*v2.X<0||v1.Y*v2.Y<0) return 0;
  if(!v1.X) return !v2.X&&abs(v2.Y)<abs(v1.Y);
  if(!v1.Y) return !v2.Y&&abs(v2.X)<abs(v1.X);
  if(v1.X*v1.X+v1.Y*v1.Y<v2.X*v2.X+v2.Y*v2.Y) return 0;
  return v1.X*v2.Y-v1.Y*v2.X==0;
}
int main(){
  int n;
  while(cin>>n,n){
    P ed[2][n];
    for(int i=0;i<n;i++)
      cin>>ed[0][i].X>>ed[0][i].Y>>ed[1][i].X>>ed[1][i].Y;
    vector<int> G[n],G2[n];
    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	if(i==j) continue;
	bool f=0;
	for(int x=0;x<2;x++)
	  for(int y=0;y<2;y++)
	    f|=ed[x][i]==ed[y][j];
	if(f){
	  G[i].push_back(j);
	  continue;
	}
	for(int x=0;x<2;x++)
	  f|=on(ed[0][i],ed[1][i],ed[x][j]);
	if(f) G2[i].push_back(j),G2[j].push_back(i);
      }
    }
    int ans[10]={};
    bool used[n];
    memset(used,0,sizeof(used));
    for(int i=0;i<n;i++){
      if(used[i]) continue;
      int ec=0;
      map<P,int> mp;
      vector<int> v;
      queue<int> q;
      q.push(i);
      while(!q.empty()){
	int p=q.front();q.pop();
	if(used[p]) continue;
	used[p]=1;
	mp[ed[0][p]]++;
	mp[ed[1][p]]++;
	v.push_back(p);
	for(int u:G[p]) q.push(u);
	for(int u:G2[p]) q.push(u),ec++;
      }
      ec/=2;
      int m=v.size(),o=mp.size();
      if(m==1) ans[1]++;
      if(m==3){
	if(o==5) ans[4]++;
	if(o==4) ans[7]++;
      }
      if(m==4){
	if(o==4) ans[0]++;
	if(o==6) ans[3]++;
	if(o==5) ans[9]++;
      }
      if(m==5){
	if(ec==2) ans[8]++;
	if(ec==1) ans[6]++;
	if(ec==0){
	  int a,b,c,d;
	  for(int j=0;j<m;j++){
	    if(mp[ed[0][v[j]]]==1){
	      a=v[j];b=0;
	      break;
	    }
	    if(mp[ed[1][v[j]]]==1){
	      a=v[j];b=1;
	      break;
	    }
	  }
	  for(int j=0;j<m;j++){
	    if(a==v[j]) continue; 
	    if(ed[!b][a]==ed[0][v[j]]){
	      c=v[j];d=1;
	      break;
	    }
	    if(ed[!b][a]==ed[1][v[j]]){
	      c=v[j];d=0;
	      break;
	    }
	  }
	  P v1=P(ed[b][a].X-ed[!b][a].X,ed[b][a].Y-ed[!b][a].Y);
	  P v2=P(ed[d][c].X-ed[!d][c].X,ed[d][c].Y-ed[!d][c].Y);
	  
	  if(v1.X*v2.Y-v1.Y*v2.X>0) ans[2]++;
	  else ans[5]++;
	}
      }
    }
    for(int i=0;i<10;i++) cout<<ans[i]<<" \n"[i==9];
  }
  return 0;
}

Measured memory_bytes: 3104
import sys

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    N, W = map(int, readline().split())
    WV = np.array([[int(x) for x in readline().split()] for _ in range(N)])
    UV = np.sum(WV[:, 1])
    UW = np.sum(WV[:, 0])

    dp = np.full([UV+1], UW*2, np.int64)
    dp[0] = 0

    for w, v in WV:
        p_dp = dp.copy()
        np.minimum(dp[v:], p_dp[:-v] + w, out=dp[v:])

    print(max(list(np.where(dp <= W)[0])))


main()


Measured memory_bytes: 15968
#Coins
A,B,C,X=map(int,open(0).read().split())
c = 0
for k in range(A+1):
    Y = X - 500*k
    for l in range(B+1):
        Z = Y - 100*l
        for m in range(C+1):
            U = Z - 50*m
            if U == 0:
                c += 1
print(c)

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

int main() {
	string s;
	cin >> s;
	int n = s.size();
	s.push_back('R');
	vector<int> child;
	char currentState = 'R';
	int r = 0, l = 0;
	for (int i = 0; i < n + 1; i++) {
		if (currentState == s[i]) {
			if (currentState == 'R') r++;
			else l++;
		}
		else {
			if (currentState == 'R') {
				currentState = 'L';
				l++;
			}
			else {
				int a, b;
				/*if (max(r, l) % 2 == 0) {
					a = (r + l) / 2;
					b = (r + l + 1) / 2;
				}
				else {
					a = (r + l + 1) / 2;
					b = (r + l) / 2;
				}*/

				a = (r + 1) / 2 + l / 2;
				b = r / 2 + (l + 1) / 2;

				for (int j = 0; j < r - 1; j++) {
					child.push_back(0);
				}
				child.push_back(a);
				child.push_back(b);
				for (int j = 0; j < l - 1; j++) {
					child.push_back(0);
				}

				currentState = 'R';
				l = 0;
				r = 0;
				r++;
			}
		}
	}

	cout << child[0];
	for (int i = 1; i < n; i++) {
		cout << " " << child[i];
	}

	return 0;
}

Measured memory_bytes: 1144
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	class P{
		int x;
		int y;
		P(int x, int y){
			this.x=x;
			this.y=y;
		}
		@Override
		public String toString() {
			return "P [x=" + x + ", y=" + y + "]";
		}
	}
	public static void main(String[] args) {
		Main main = new Main();
		main.run();
	}


	public void run() {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		char m[][] = new char[h][w];
		for(int i=0; i<h; i++) {
			m[i] = sc.next().toCharArray();
		}
		int used[][] = new int[h][w];
		int ans = 0;
		for(int i=0; i<h; i++) {
			for(int j=0; j<w; j++) {
				for(int k=0; k<h; k++) {
					Arrays.fill(used[k], -1);
				}
				if(m[i][j] == '#') continue;
				used[i][j]=0;
				ans = Math.max(ans, bfs(h,w, j, i, used, m))  ;
			}
		}
		System.out.println(ans);
		sc.close();
	}

	private int bfs(int h, int w, int sx, int sy, int used[][], char m[][]) {

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

		ArrayDeque<P> q = new ArrayDeque<P>();
		q.add(new P(sx,sy));

		int ans = 0;
		while(! q.isEmpty()) {

			P p = q.poll();
			for(int i=0; i<4; i++) {
				int tx = p.x+dx[i];
				int ty = p.y+dy[i];
				if(tx<0 || tx>=w || ty<0 || ty>=h) continue;
				if(m[ty][tx]=='#') continue;
				if(used[ty][tx]>=0) continue;
				used[ty][tx]=used[p.y][p.x]+1;
				ans = Math.max(ans, used[ty][tx]);
				q.add(new P(tx, ty));
			}

		}
		return ans;
	}


}


Measured memory_bytes: 24660
// ABC_079_C

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

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

	int a = s[0] - '0';
	int b = s[1] - '0';
	int c = s[2] - '0';
	int d = s[3] - '0';


	if(a+b+c+d == 7) cout << a << "+" << b << "+" << c << "+" << d << "=" << 7 << "\n";
	else if(a+b+c-d == 7) cout << a << "+" << b << "+" << c << "-" << d << "=" << 7 << "\n";
	else if(a+b-c+d == 7) cout << a << "+" << b << "-" << c << "+" << d << "=" << 7 << "\n";
	else if(a+b-c-d == 7) cout << a << "+" << b << "-" << c << "-" << d << "=" << 7 << "\n";
	else if(a-b+c+d == 7) cout << a << "-" << b << "+" << c << "+" << d << "=" << 7 << "\n";
	else if(a-b+c-d == 7) cout << a << "-" << b << "+" << c << "-" << d << "=" << 7 << "\n";
	else if(a-b-c+d == 7) cout << a << "-" << b << "-" << c << "+" << d << "=" << 7 << "\n";
	else cout << a << "-" << b << "-" << c << "-" << d << "=" << 7 << "\n";

	return 0;
}

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

int main() {
	int t[3];
	for (int i = 0; i< 3; i++) {
		cin >> t[i];
	}

	int min = 1e6;
	for (int i = 0; i < 3-1; i++) {
		for (int j = i+1; j < 3; j++) {
			int total = t[i] + t[j];
			if (total < min) {
				min = total;
			}
		}
	}
	cout << min << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int h, w;
vector<string> a;

int vectormax(vector<vector<int>> dist) {
  int ans = 0;
  for (int i = 0; i < dist.size(); i++) {
    ans = max(ans, *max_element(dist[i].begin(), dist[i].end()));
  }
  return ans;
}

int main() {
  cin >> h >> w;
  a.resize(h);
  for (int i = 0; i < h; i++) {
    cin >> a[i];
  }
  queue<pair<int, int>> que;
  vector<vector<int>> dist(h, vector<int>(w, -1));

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (a[i][j] == '#') {
        dist[i][j] = 0;
        que.push(make_pair(i, j));
      }
    }
  }

  while (!que.empty()) {
    pair<int, int> temp = que.front();
    que.pop();

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

    for (int i = 0; i < 4; i++) {
      int x, y;
      x = temp.first + dx[i];
      y = temp.second + dy[i];
      if (x >= 0 && x < h && y >= 0 && y < w && dist[x][y] == -1) {
        dist[x][y] = dist[temp.first][temp.second] + 1;
        que.emplace(make_pair(x, y));
      }
    }
  }

  cout << vectormax(dist) << endl;
}


Measured memory_bytes: 13456
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <time.h>
using namespace std;

/* ?????????????????°???????´? */
void trace(int arr[], int n) {
    int i;
    for (i = 0; i < n; i++ ) {
        if(i > 0) {
            printf(" ");
        }
        printf("%d", arr[i]);
    }
    printf("\n");
}

int bubbleSort(int arr[], int n){
    int count = 0;
    for(int j = n; j>0 ;j--){
        for(int i = 1;i<j;i++){
            if(arr[i] < arr[i-1]){
                swap(arr[i],arr[i-1]);
                count++;
            }
        }
    }

    return count;
}




int main(){
    int n;
    int arr[110];
    cin>>n;
    for (int i = 0; i < n;i++) {
        cin>>arr[i];
    }

    int count = bubbleSort(arr,n);
    trace(arr,n);
    cout<<count<<endl;
}

Measured memory_bytes: 3212
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>
#include <utility>

bool yokocango[2][16004];
bool tatecango[2][16004];

int main(){
  std::vector<int > yoko, tate;
  std::string s;
  std::cin >> s;
  int x, y;
  std::cin >> x >> y;
  int direction = 0;
  int counter=0;
  for (int i=0; i<s.length(); i++){
    if (s[i]=='T') {
      if (direction==0) yoko.push_back(counter);
      else tate.push_back(counter);
      direction = 1 - direction;
      counter=0;
    } else {
      counter++;
    }
  }
  if (counter!=0) {
    if (direction==0) yoko.push_back(counter);
    else tate.push_back(counter);
    direction = 1 - direction;
    counter=0;    
  }
  for (int i=0; i<16004; i++){
    yokocango[0][i] = false;
    tatecango[0][i] = false;
    yokocango[1][i] = false;
    tatecango[1][i] = false;
  }
  yokocango[0][8000]=true;
  tatecango[0][8000]=true;
  counter=0;
  for (int n : yoko){
    //printf("yoko=%d\n", n);
    for (int i=0; i<16004; i++){
      if (yokocango[counter%2][i]){
	if (i-n>=0 && counter>0) yokocango[1-counter%2][i-n] = true;
	if (i+n<=16000) yokocango[1-counter%2][i+n] = true;
	yokocango[counter%2][i]=false;
      }
    }
    counter++;
  }
  counter = 0;
  for (int n : tate){
    //    printf("tate=%d\n", n);
    for (int i=0; i<16004; i++){
      if (tatecango[counter%2][i]){
	if (i-n>=0) tatecango[1-counter%2][i-n] = true;
	if (i+n<=16000) tatecango[1-counter%2][i+n] = true;
	tatecango[counter%2][i]=false;;
      }
    }
    counter++;
  }
  if (yokocango[yoko.size()%2][x+8000] && tatecango[tate.size()%2][y+8000]) printf("Yes\n");
  else printf("No\n");
  return 0;
}
 

Measured memory_bytes: 3220
N, M = list(map(int, input().split()))
C = 10**9+7
S = set()
for _ in range(M):
    S.add(int(input()))
dp = [0]*(N+1)
dp[0] = 1
if not 1 in S:
    dp[1] = 1
for i in range(2, N+1):
    if i in S:
        continue
    dp[i] = (dp[i-1]+dp[i-2]) % C
print(dp[N])


Measured memory_bytes: 86092
import java.util.*;
//import java.util.stream.Collectors;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		Integer[] a = new Integer[9];
		Arrays.setAll(a, i -> Integer.parseInt(sc.next()));
		List<Integer> list = new ArrayList<>(Arrays.asList(a));
		int n = Integer.parseInt(sc.next());
		for(int i=0; i<n; i++){
			Integer b = Integer.parseInt(sc.next());
			if(list.contains(b)){
				list.set(list.indexOf(b), 0);
			}
		}
		String result = "No";
		if(
			(list.get(0) == list.get(1) && list.get(1) == list.get(2))
			|| (list.get(3) == list.get(4) && list.get(4) == list.get(5))
			|| (list.get(6) == list.get(7) && list.get(7) == list.get(8))
			|| (list.get(0) == list.get(3) && list.get(3) == list.get(6))
			|| (list.get(1) == list.get(4) && list.get(4) == list.get(7))
			|| (list.get(2) == list.get(5) && list.get(5) == list.get(8))
			|| (list.get(0) == list.get(4) && list.get(4) == list.get(8))
			|| (list.get(2) == list.get(4) && list.get(4) == list.get(6))
		){
			result = "Yes";
		}
		System.out.println(result);
	}
}


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

int main(){
  string a;
  int b,c,i,d;
  cin >> a;
  b = 0;
  c = 0;
  d = 0;
  for(i = 0;i<a.length();i++){
    if(a[i] == 'A' ||a[i] == 'T' ||a[i] == 'G' ||a[i] == 'C' ){
      b += 1;
      c = 1;
    }else{
      c = 0;
    }
    if(c == 0){
      if(b > d){
        d = b;
      }
      b = 0;
    }
  }
  if(b > d){
        d = b;
      }
  cout << d << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    char s1[11],s2[11],s3[11];
    char d = 'A'-'a';
    scanf("%s %s %s", s1,s2,s3);
    printf("%c%c%c\n", s1[0]+d,s2[0]+d,s3[0]+d);
    return 0;
}


Measured memory_bytes: 128
N,X = map(int,input().split())
L = list(map(int,input().split()))

D = [0] * (N + 1)

counter = 0

for i in range(1,len(L)+1):
	D[i] = D[i - 1] + L[i - 1]
	
	
for i in range(0,len(D)):
	if D[i] <= X:
		counter += 1
	
print(counter)

Measured memory_bytes: 3064
#include<iostream>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
	int a=0,len,c=0,d=0;
	char s[200000];
	cin>>s;
	len=strlen(s);
	for(int i=0;i<len;i++){
		if(s[i]=='A'){
			d=i;
			break;
		}	
	}
		for(int i=len-1;i>0;i--){
		if(s[i]=='Z'){
			c=i;
			break;
		}
		
}
	a=c-d+1;
	cout <<abs(a);
}

Measured memory_bytes: 384
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define ll long long
#define INF 1<<31-1
#define LNF 9223372036854775807
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
//#define MOD 998244353
#define NUM 200010
 

int main(){
  ll N, M;
  ll A[100];
  ll sum=0, cnt=0;

  scanf("%lld%lld", &N, &M);

  for (int i = 0; i < N; i++)
  {
      scanf("%lld", A + i);
      sum += A[i];
  }
  
  for (int i = 0; i < N; i++)
  {
      if(A[i] * 4 * M >= sum) cnt++;
  }
  
  if (cnt < M)
  {
      printf("No\n");
  }
  else
  {
      printf("Yes\n");
  }
  
  return 0;
}

Measured memory_bytes: 128
N, M = map(int, input().split())
suki_lists = []
for _ in range(N):
    i = [int(s) for s in input().split()]
    suki_lists.append(i[1::])

all_suki_e = 0
for e in range(1, M + 1):
    for sukis in suki_lists:
        # print(e, sukis)
        if e in sukis:
            pass
        else:
            # print("out")
            break
    else:
        # print("pass")
        all_suki_e += 1

print(all_suki_e)


Measured memory_bytes: 3060
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception{
		new Main(new Scanner(System.in), System.out, System.err).exec();
	}
	public final Scanner sc;
	public final PrintStream out, err;
	public Main(final Scanner sc, final PrintStream out, final PrintStream err) {
		this.sc = sc;this.out = out;this.err = err;
	}
	static public final long pair(int a, int b) {return (((long)a) << 32) + b;}
	static public final int getPair1(long v) {return (int)(v >> 32);}
	static public final int getPari2(long v) {return (int)(v & 0xFFFFFFFF);}

	static public final long quad(long a, long b, long c, long d) {
		return ((a&0xFFFF)<< 48) + ((b&0xFFFF)<< 32) + ((c&0xFFFF)<< 16) +(d&0xFFFF);}
	static public final int getQuad1(long v) {return (int)( v >> 48          );}
	static public final int getQuad2(long v) {return (int)((v >> 32) & 0xFFFF);}
	static public final int getQuad3(long v) {return (int)((v >> 16) & 0xFFFF);}
	static public final int getQuad4(long v) {return (int)( v        & 0xFFFF);}

	static public final long record(int e, int m, int i) {
		return quad(-1, e, m, i);
	}
	static public final int re(long record) {
		return getQuad2(record);
	}
	static public final int rm(long record) {
		return getQuad3(record);
	}
	static public final int ri(long record) {
		return getQuad4(record);
	}

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

	private int p;
	private int[] inv;
	private int[] fact;
	private int[] finv;
	public final int mod(long v) {
		v %= p;
		return (int)(v < 0 ? v+p : v);
	}
	public final int mul(long a, long b) {
		return mod(a*b);
	}
	public final void initFact(double limit, double p) {
		initFact((int)limit, (int)p);
	}
	public final void initFact(int limit, int p) {
		this.p = p;
		this.inv = new int[limit+1];
		this.fact = new int[limit+1];
		this.finv = new int[limit+1];
		fact[1] = finv[1] = inv[0] = inv[1] = 1;
		for(int i=2;i<=limit;i++) {
			int a = p / i;
			int b = p % i;
			inv[i]  = mul(-a, inv[b]);
			fact[i] = mul(fact[i-1], i);
			finv[i] = mul(finv[i-1], inv[i]);
		}
	}
	public final int comb(int m, int n) {
		return mul(mul(fact[m], finv[n]), finv[m-n]);
	}
	//------------------------------------------
	static long lcm (long a, long b) {
		long temp;
		long c = a;
		c *= b;
		while((temp = a%b)!=0) {
			a = b;
			b = temp;
		}
		return (long)(c/b);
	}

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



	public void exec() throws Exception{
		final int N = sc.nextInt();
		final int K = sc.nextInt();
		final int R = sc.nextInt();
		final int S = sc.nextInt();
		final int P = sc.nextInt();
		final String T = sc.next();

		int score = 0;
		for(int offset=0;offset<K;offset++) {
			char last = '0';
			for(int index = offset; index<T.length();index+=K) {
				char now = T.charAt(index);
				if(last != now) {
					switch(now) {
					case 'r':
						score+=P;
						break;
					case 's':
						score+=R;
						break;
					case 'p':
						score+=S;
						break;
					}
					last = now;
				}else {
					last = '0';
				}
			}
		}
		out.println(score);

	}
}


Measured memory_bytes: 25044
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define pb push_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define chmin(x,y) if(x>y)x=y
#define chmax(x,y) if(x<y)x=y
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll,vector<ll>,greater<ll>> SPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
using vc=vector<char>;
using vvc=vector<vector<char>>;
const ll inf=100100100100;
const int Inf=1001001001;
const int mod=1000000007;
const double pi=3.141592653589793;

int main(){
  int n,a,b;cin>>n>>a>>b;
  cout<<min(n*a,b)<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
        int a[] = new int[n];
        int c[] = new int[n-1];
        int point = 0;

        for(int i = 0;i < n;i++){
            a[i] = sc.nextInt();
        }
        for(int i = 0; i < n; i++){
            int b = sc.nextInt();
            point += b;
        }
        for(int i = 0; i < n-1; i++){
            c[i] = sc.nextInt();
        }
        for(int i = 1; i < n;i++){
            if(a[i] - 1 == a[i-1])
                point += c[a[i-1]-1];
        }
        System.out.println(point);
    }
}

Measured memory_bytes: 21588
#include <stdio.h>
#include <stdlib.h>

int main()
{
	int i, j, N, A[16], x[16][16], y[16][16];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) {
		scanf("%d", &(A[i]));
		for (j = 1; j <= A[i]; j++) scanf("%d %d", &(x[i][j]), &(y[i][j]));
	}
	
	int honest[16] = {}, max = 0, count;
	while (1) {
		for (i = 1; i <= N; i++) if (honest[i] == 0) break;
		if (i > N) break;
		for (honest[i--] = 1; i >= 1; i--) honest[i] = 0;
		
		for (i = 1; i <= N; i++) {
			if (honest[i] == 0) continue;
			for (j = 1; j <= A[i]; j++) {
				if (honest[x[i][j]] != y[i][j]) break;
			}
			if (j <= A[i]) break;
		}
		
		if (i <= N) continue;
		count = 0;
		for (i = 1; i <= N; i++) count += honest[i];
		if (count > max) max = count;
	}
	
	printf("%d\n", max);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 128
# coding: UTF-8
n = int(raw_input())
count = 0
for i in range(n):
    num = int(raw_input())
    if (num < 2):
        continue
    elif (num == 2):
        count += 1
        continue
    elif (num % 2 == 0):
        continue
    if pow(2,num-1,num) == 1:
        count += 1
print(count)



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

using namespace std;

typedef long long llint;

int n;
string s[101010];
map<string, llint> mp;

int main() {
  cin >> n;
  llint ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    sort(s[i].begin(), s[i].end());
    ans += mp[s[i]];
    mp[s[i]]++;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 18176
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
	for(int z;cin>>z,z;){
		long long res=1ll<<50;
		for(int i=1;i<z;i++)
			for(int j=1;j<z;j++){
				long long temp=(long long)z*z*z-i*i*i-j*j*j;
				if(temp>0)
					res=min(res,temp);
			}
		cout<<res<<endl;
	}
	
	return 0;
}

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

using namespace std;
const long long k=1e9 + 7;

int main()
{
	long long n,m,buffer;
	cin >> n >> m;
	vector<long long> stair(n , 0);
	vector<int> danger(n , 0);
	for (int i = 0; i < m; i++)
	{
		cin >> buffer;
		danger[buffer] = 1;
	}
	if (n == 1)
	{
		cout << 1;
	}
	else
	{
		stair[0] = 1;
		if (danger[1] == 0) stair[1] = 1;
		for (int i = 2; i < n; i++)
		{
			if (danger[i] == 0) stair[i] = (stair[i - 1] + stair[i - 2]) % k;
		}
		cout << (stair[n - 1] + stair[n - 2]) % k;
	}
}

Measured memory_bytes: 1408
data = [[[0 for r in range(10)] for f in range(3)] for b in range(4)]
n = int(input())
for _ in range(n):
    (b, f, r, v) = [int(i) for i in input().split()]
    data[b - 1][f - 1][r - 1] += v
 
for b in range(4):
    for f in range(3):
        for r in range(10):
            print('', data[b][f][r], end='')
        print()
    if b != 3:
        print('#' * 20)

Measured memory_bytes: 7720
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
typedef long long ll;
ll MOD = 1e9+7;

using namespace std;

int main()
{
	string s;
	int ans=0;
	
	cin>>s;
	cout<<s[0]<<s.length()-2<<s[s.length()-1]<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin>>s>>t;
  string ans="No";
  vector<char> S(s.size());
  vector<char> T(t.size());
  for(int i=0;i<s.size();i++){
    S[i]=s.at(i);
  }
  for(int i=0;i<t.size();i++){
    T[i]=t.at(i);
  }
  sort(S.begin(),S.end());
  sort(T.rbegin(),T.rend());
  string u,v;
  for(int i=0;i<s.size();i++){
    u+=S[i];
  }
  for(int i=0;i<t.size();i++){
    v+=T[i];
  }
  if(u<v){ans="Yes";}
  cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		List<String> sl = new ArrayList<String>(Arrays.asList(s.split("/")));
		
		if(Integer.parseInt(sl.get(0)) < 2019) {
			System.out.println("Heisei");
		}else if(Integer.parseInt(sl.get(1)) < 5){
			System.out.println("Heisei");
		}else {
			System.out.println("TBD");
		}
		
		sc.close();
		
		
		
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i < (n);i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define SCANF(i) int i;scanf("%d",&i)
using namespace std;
using P = pair<int,int>;
const long long INF = 1LL << 60;
const int IINF=100000000;
const int MOD = (int)1e9 + 7;
typedef long long ll;
//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    //sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
vector<int> dx={1,0,-1,0};vector<int> dy={0,-1,0,1};

ll modpow(ll n,ll m,ll mod){
    ll res = 1;
    while(m>0){
        if(m & 1)res = res * n % mod;
        n = n * n % mod;
        m >>= 1;
    }
    return res;
};
signed main () {
    ll n,m;scanf("%lld %lld",&n,&m);ll mod = 1000000007;
    ll ans = modpow(n,m,mod);
    printf("%lld\n",ans);
}


Measured memory_bytes: 3268
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n, m, c = inintm()
B = inintl()
ans = 0

for i in range(n):
    A = inintl()
    point = 0
    for j in range(m):
        point += A[j]*B[j]
    point += c
    if point > 0:
        ans += 1

print(ans)

Measured memory_bytes: 62268
import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


if __name__ == '__main__':
    N, M = map(int, sys.stdin.readline().rstrip().split())
    PY = []
    for i in range(M):
        P, Y = map(int, sys.stdin.readline().rstrip().split())
        PY.append([Y, P, i + 1])
    PY.sort()

    # cnt: key=県, value=すでに幾つの市がその県に属しているか
    # res: [市の番号, 県の番号, 順番]
    cnt = {}
    res = []
    for y, p, i in PY:
        if p not in cnt:
            cnt[p] = 1
        else:
            cnt[p] += 1
        res.append([i, p, cnt[p]])

    res.sort()
    for i, p, x in res:
        print('{:06}{:06}'.format(p, x))


Measured memory_bytes: 42172
#include<bits/stdc++.h>
using namespace std;
int main() {
	string a,b;
	cin>>a>>b;
	for(int i=0;i<a.size();i++) {
		if(a[i]!=b[i]) {
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;

int main(void){
    int n, m;
    cin >> n >> m;
    
    vector<int> a(m), b(m);
    vector<pair<int, int>> bridge(m);
    
    for (int i = 0; i < m; i++) {
        cin >> a[i] >> b[i];
        bridge[i] = make_pair(b[i], a[i]);
    }
    
    sort(bridge.begin(), bridge.end());
    
    int cna = 0, ans = 0;
    for (int i = 0; i < m; i++) {
        if (cna < bridge[i].second) {
            ans++;
            cna = bridge[i].first - 1;
        }
    }
    
    cout << ans << endl;
    
}


Measured memory_bytes: 1792
'use strict';
process.stdin.on('data', function(chunk) {
  var inputs = chunk.toString().trim();
  var S = Number(inputs);
  var h = Math.floor(S/3600);
  var m = Math.floor((S-(h*3600))/60);
  var s=S%60;

console.log([h,m,s].join(':'));
});
process.stdin.resume();
process.stdin.setEncoding('utf8');

Measured memory_bytes: 15532
N = int(input())
A = list(map(int, input().split()))
ans = right = total = 0
for left in range(N):
    while right < N and total ^ A[right] == total + A[right]:
        total += A[right]
        right += 1
    ans += right - left
    if left == right:
        right += 1
    else:
        total -= A[left]
print(ans)

Measured memory_bytes: 24840
#include<bits/stdc++.h>
#include<stdlib.h>
#define ll long long
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    if(a>0&&a<10&&b>0&&b<10)
        cout<<a*b<<endl;
    else
        cout<<"-1"<<endl;
    return 0;
}

Measured memory_bytes: 256
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
b = int(input())
print(a[b-1])

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

long long n, a, b;
long long x[100005] = {0}, ans = 0;

int main() {
  cin >> n >> a >> b;
  for(int i = 0; i < n; ++i) cin >> x[i];
  for(int i = 1; i < n; ++i)
    ans += min(b, a * (x[i] - x[i - 1]));
  cout << ans << endl;
  return 0;
}

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

int main()
{
    int A,B,C;
    cin >> A >> B >> C;
    vector<int> v {A,B,C};
    sort(v.begin(),v.end());
    string one = to_string(v[2]);
    string two = to_string(v[1]);
    int three = v[0];
    string onetwo = one + two;
    cout << stoi(onetwo) + three;

}

Measured memory_bytes: 256
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T, typename U> using P = pair<T, U>;
using ll = int64_t;
using PLL = P<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace __init {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
#include "../debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

int main() {
    ll r, D, x;
    cin >> r >> D >> x;
    for(ll i = 0; i < 10; i++) {
        x = r * x - D;
        cout << x << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;

int main()
{
    int64_t N, T;
    std::cin >> N >> T;

    std::vector<int64_t> P;
    for (size_t i = 0; i < N; ++i) {
        int64_t t;
        std::cin >> t;
        P.push_back(t);
    }

    int64_t tot = 0;
    int64_t s = 0;
    int64_t e = 0;
    
    for (size_t i = 0; i < N; ++i) {
        auto t = P[i];
        if (e < t) {
            tot += e - s;
            s = t;
            e = t+T;
        }
        else {
            e = t+T;
        }
    }

    tot += e - s;

    std::cout << tot << std::endl;

    return 0;
}


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

/*  prime_factor(n)
    入力：整数 n
    出力：nの素因数分解
    計算量：O(√n)前後
    2^0が入ってしまうことに注意。
*/
template <typename T>
vector<pair<T, T>> prime_factor(T n) {
    vector<pair<T, T>> ret;
    for (T i = 2; i * i <= n; i++) {
        T tmp = 0;
        while (n % i == 0) {
            tmp++;
            n /= i;
        }
        ret.push_back(make_pair(i, tmp));
    }
    if (n != 1) ret.push_back(make_pair(n, 1));
    return ret;
}
int main() {
    long long N;
    cin >> N;
    long long ans = 0;
    vector<pair<long long, long long>>f = prime_factor(N);
    long long count,sum;
    for (auto next : f) {
        count = 0;
        sum = 0;
        while (sum + count < next.second) {
            count ++ ;
            sum += count;
        }
        ans += count;
    }
    cout << ans << endl;
}



Measured memory_bytes: 19772
while(n=gets.to_i)>0
l=(1..n).map{{}}
gets.to_i.times{a,b,c=eval"[#{gets}]";;l[a][b]=l[b][a]=c/100-1}
m=(1..n-1).to_a
s=0
o=[0]
(n-1).times{
a,b=o.product(m).min_by{|i,j|l[i][j]||1e9}
s+=l[a][b]
m-=[b]
o+=[b]
}
p s
end

Measured memory_bytes: 6956
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        xx: [u64;n]
    }
    let mut s = xx.clone();
    s.sort();
    let m1 = s[n/2-1];
    let m2 = s[n/2];
    for x in xx {
        println!("{}",
            if x <= m1 {m2} else {m1});
    }
}


Measured memory_bytes: 12412
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cmath>
#include <climits>
#include <map>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)
#define rep1(i, n) for(int i = 1; i <= (int) n; i++)
#define all(v) v.begin(),v.end()

int main() {
    int a,b;
    cin >> a >> b;
    cout << a*b << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f first
#define s second
#define pb push_back
#define INF 100000005
typedef pair<int, int> ii;
typedef vector <int> vi;
typedef vector <ii> vii;
string st;
int k,x,n;
signed main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin>>st;
    n=st.size();
    k=n;
    for (int i=1;i<n;i++){
        if (st[i]!=st[i-1]){
        k=min(k,max(i,n-i));
        }
    }
    cout<<k;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,k;
	string s;
	cin>>n>>k>>s;
	s[k-1]=(char)('a'+(s[k-1]-'A'));
	cout<<s<<endl;
}


Measured memory_bytes: 256
//@author :  |< U $ |-|
#include<cmath>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<deque>
#include<queue>
#include<algorithm>
#include<list>
#include<cstring>
#define ll long long
#define vi vector<long long>
#define pb push_back
#define pop pop_back
#define pi pair<long long ,long long>
#define vp vector<pair<long long,long long> >
#define mkp make_pair
#define in(i,n) for(i=0;i<n;i++)
#define fon(i,n,m) for(i=n;i<m;i++)
#define rfon(i,n,m) for(i=n;i>=m;i--)
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);
#define map map<long long,long long>
#define inm1(b)  memset(b,-1,sizeof(b))
#define in0(b) memset(b,0,sizeof(b))
#define ininf(b) memset(b,1000000001,sizeof(b))
#define MOD         1000000007
#define I 10000000001
#define TakeInput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
using namespace std;
ll gcd(ll a, ll b) {  if (a == 0)  return b; return gcd(b % a, a); }

int main()
{
    jaldi
    #ifndef ONLINE_JUDGE 
    //TakeInput
    #endif
    
    ll n,m,k,i,j;
    cin>>n>>m;
    ll f[n+1],r[n+1];
    in0(f);
    in0(r);
    set<ll> s;
    ll wrong=0;
    while(m--){
        ll p;
        string w;
        cin>>p>>w;
        //cout<<f[p]<<endl;
        if(w=="WA" && f[p]==0){
           r[p]++;
        }
        if(w=="AC" && f[p]==0){
            f[p]++;
            s.insert(p);
            wrong+=r[p];
        }
    }
    cout<<s.size()<<" "<<wrong;


}
 
 








 



Measured memory_bytes: 6528
#include <iostream>

#include <algorithm>
#include <cmath>
#include<string>
#include<array>
#include<vector>
#include<functional>
#include<unordered_map>
#include<map>
#include<numeric>
#include<limits>
#include<utility>
#include<queue>
#include<random>

using namespace std;
typedef long long LL;

int main() {


	int a, b = 0, c = 0;
	//----------------------
	double n, X, Z,A,B,N,ans1,ans2;
	double ans ;

	cin >> N;
	cin >> A;
	cin >> B;

	ans1 = N*A;
	ans2 = B;


	ans = min(ans1, ans2);

	
	
	cout << ans << endl;

	//------------------------
	//cin >> Z;

	return 0;
}

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

int main() {
    int n;
    cin >> n;
    int a[n], b[n], c[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i] >> c[i];
    }
    int dp_a[n], dp_b[n], dp_c[n];
    dp_a[0] = a[0];
    dp_b[0] = b[0];
    dp_c[0] = c[0];
    for (int i = 1; i < n; i++) {
        dp_a[i] = a[i] + max(dp_b[i - 1], dp_c[i - 1]);
        dp_b[i] = b[i] + max(dp_c[i - 1], dp_a[i - 1]);
        dp_c[i] = c[i] + max(dp_a[i - 1], dp_b[i - 1]);
    }
    cout << max(dp_a[n - 1], max(dp_b[n - 1], dp_c[n - 1])) << endl;
    return 0;
}


Measured memory_bytes: 2560
import math
import queue
from collections import defaultdict
 
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def printQueue(q):
	r=q
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)

a,b = readInts()
for x in range(10*b,10*b+10):
	if math.floor(x*0.08)==a:
		print(x)
		exit()

print(-1)

Measured memory_bytes: 3948