akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main( void )
{
	int a;
	int b;
	char op;
	int ans;

	while( 1 ){
		scanf( "%d %c %d", &a, &op, &b );
		if( op == '?' ){
			break;
		}

		switch( op ){
			case '+':
				ans = a + b;
				break;
			case '-':
				ans = a - b;
				break;
			case '*':
				ans = a * b;
				break;
			case '/':
				ans = a / b;
				break;
			default:
				break;
		}
		printf("%d\n", ans);
	}

	return 0;
}

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

class UnionFind {
private:
  vector<int> par;
  vector<int> rank;

public:
  UnionFind(int n) {
    par.resize(n);
    rank.resize(n);
    for(int i = 0; i < n; ++i) {
      par[i] = i;
      rank[i] = 0;
    }
  }
  
  int find(int x) {
    if(par[x] == x) {
      return x;
    } else  {
      return par[x] = find(par[x]);
    }
  }

  bool same(int x, int y) {
    return find(x) == find(y);
  }
  
  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if(x == y) return;
    
    if(rank[x] < rank[y]) {
      par[x] = y;
    } else {
      par[y] = x;
      if(rank[x] == rank[y]) ++rank[x];
    }
  }
};

struct Edge {
  int a, b, c;
  bool operator < (const Edge &e) const {
    return c < e.c;
  }
};

int main() {
  for(int n, m; cin >> n >> m && (n|m);) {
    vector<Edge> es;
    while(m--) {
      int a, b, c;
      cin >> a >> b >> c;
      --a; --b;
      es.push_back((Edge){a,b,c});
    }
    sort(es.begin(), es.end());
    UnionFind uf(n);
    int cnt = 0;
    for(int i = 0; i < es.size(); ++i) {
      if(uf.same(es[i].a, es[i].b)) continue;
      uf.unite(es[i].a, es[i].b);
      if(++cnt == n / 2) {
        cout << es[i].c << endl;
        break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1440
#include<iostream>
#include<map>
using namespace std;
const int mo=1e9+7;
main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin>>n;
    map<int,int>m;      
    for(int i=2;i<=n;i++)
    {
        int x=i;
        for(int j=2;j*j<=x;j++)
        {
            while(x%j==0)
            {
                m[j]++;
                x/=j;
            }
        }
        if(x!=1)m[x]++;
    }
    long long ans=1;
    for(auto it:m)ans=(ans*(it.second+1)%mo);
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <map>
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;



int main(){
  int h,a,count =0;
  cin >> h >> a;
 while(h > 0){
   h = h-a;
   count +=1;
 } 
 cout << count;

 
}

Measured memory_bytes: 256
import sys
import numpy as np


def inputs(func=lambda x: x, sep=None, maxsplit=-1):
	return map(func, sys.stdin.readline().split(sep=sep, maxsplit=maxsplit))

def input_row(n : int, type=np.int, **kwargs):
	return np.fromiter(inputs(type, **kwargs), dtype=type)

def input_2d(nrows : int, ncols : int, type=np.int, **kwargs):
	data = np.zeros((nrows, ncols), dtype=type)
	for i in range(nrows):
		data[i, :] = input_row(ncols, type, **kwargs)
	return data



N, = inputs(int)
digit = N % 10

if digit in (2, 4, 5, 7, 9):
	print('hon')
elif digit in (0, 1, 6, 8):
	print('pon')
else:
	print('bon')


Measured memory_bytes: 27124
# https://atcoder.jp/contests/abc085/tasks/abc085_c
n, y = map(int, input().split())

d = {}
for k in range(n + 1):
    s = 1000 * k
    d[s] = k
f = False
for i in range(n + 1):
    for j in range(n + 1):
        total = 10000 * i + 5000 * j
        s = y - total
        if s in d:
            k = d.get(s)
            if i + j + k == n:
                print(i, j, k)
                f = True
                break
    if f:
        break
else:
    print(-1, -1, -1)

Measured memory_bytes: 41196
#include<iostream>
using namespace std;
int main(){
  int n,al[26] = {},i;long long ans = 1;char s;
  while(cin >> s) al[s-'a']++;
  for(i=0;i<26;i++) ans = (ans*(al[i]+1))%1000000007;
  ans--;
  if(ans<0) ans += 1000000007;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cstring>

using namespace std;

int main()
{
    string s;

    while (1) {
        cin >> s;
        if (s == "0") {
            return (0);
        }
        int sum = 0;
        for (int i = 0; i < s.size(); i++) {
            sum += s[i] - '0';
        }
        cout << sum << endl;
    }

}



Measured memory_bytes: 3224
a, b, c, d = map(int, input().split())
if a>=c:
    if b>=d:
        if d<=a:
            print(0)
        else:
            print(d-a)
    else:
        print(b-a)
elif a<c:
    if b>=d:
        print(d-c)
    elif b<=c:
        print(0)
    else:
        print(b-c)

Measured memory_bytes: 3064
#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>;

ll x = 1e9 + 7; 
const int INF = 1001001001;


int main() {
  vector<vector<int>> a(3, vector<int>(3));
  rep(i,3)rep(j,3) {
    cin >> a[i][j];
  }
  int n;
  cin >> n;
  vector<bool> t(101, false);
  rep(i,n) {
    int b;
    cin >> b;
    t[b] = true;
  }
  rep(i,3) {
    if (t[a[i][0]] && t[a[i][1]] && t[a[i][2]]) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  rep(i,3) {
    if (t[a[0][i]] && t[a[1][i]] && t[a[2][i]]) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  if (t[a[0][0]] && t[a[1][1]] && t[a[2][2]]) {
    cout << "Yes" << endl;
    return 0;
  }
  if (t[a[0][2]] && t[a[1][1]] && t[a[2][0]]) {
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
  return 0;
}

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

int main(){
  int x = 0;
  int N;
  int i = 0;
  cin>>N;
  
  while(i<N){
    int l,r;
      cin>>l>>r;
    x += r-l+1;
    i++;
  }
  
  cout<<x<<endl;
}

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

int main(){
    vector<int> a(5);
    for(int i = 0; i<5; i++){
    cin >> a[i]; 
}
int ans = 1;
    for(int i = 0; a[i]!=0; i++){
        ans = ans +1;
    }
cout << ans;
}

Measured memory_bytes: 3620
//do not think about past and stay in this moment
//organize and work - Abhinav IIITA
#include <bits/stdc++.h>
#include <ctime>
using namespace std;
#define int long long
#define ld long double
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end() 
const ld pi = acos(-1.0);
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int mod;
void fx(vector<int> &a,int n, int m){

}

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

int arr[3000000];
void input(int n){
	for(int i=0;i<n;++i)
	cin>>arr[i];
}

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



void q1(){
	int n;
	cin>>n;
	n*=(n+1);
	n/=2;
	cout<<n;
}
// -----------------------------------------------------------------------


void q2(){
	string s,t;
	cin>>s;
	t="";
	int skip=0;
	for(int i=(int)s.size()-1;i>=0;i--){
		if(s[i]=='B'){
			skip++;
		} else{
			if(skip>0){
				skip--;
			} else{
				t+=s[i];
			}
		}
	}
	for(int i=sz(t)-1;i>=0;--i)
	cout<<t[i];
}

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

void q3(){
	int n;
	cin>>n;
	input(n);
	ld sum=0;
	for(int i=0;i<n;++i){
		sum+=arr[i];
	}
	sum/=n;
	int l=sum;
	sum+=1.00;
	int u=sum;
	int pp,p;
	pp=0;
	sum=l;
	for(int i=0;i<n;++i){
		pp+=((arr[i]-sum)*(arr[i]-sum));
	}p=0;sum=u;
	for(int i=0;i<n;++i){
		p+=((arr[i]-sum)*(arr[i]-sum));
	}
	cout<<min(p,pp);
}


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

void q4(){
	string s;
	cin>>s;
	int xp=sz(s);
	for(int i=0;i<xp-2;++i){
		if(s[i]==s[i+1]){
			cout<<i+1<<" "<<i+2<<endl;
			return ;
		}
		if(s[i]==s[i+2]){
			cout<<i+1<<" "<<i+3<<endl;
			return ;
		}
	}
	if(s[xp-1]==s[xp-2]){
		cout<<xp-1<<" "<<xp<<endl;
		return ;
	}
	cout<<"-1 -1\n";
	return ;
}

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


int32_t main()
{
	mod=1e+7;
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); 	
	int t=1;
	//cin>>t;
	while(t--)
	q1();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;


ll cnt[1010];

int main(){
    int n;
    cin >> n;
    REP(i, 2, n+1) {
        ll x = i;
        for(ll y = 2; y*y <= x; ++y) {
            while(x%y == 0) {
                cnt[y]++;
                x /= y;
            }
        }
        if(x != 1) cnt[x]++;
        // cout << i << " => " << x << " ";
        // rep(j, n+1) cout << cnt[j] << " ";
        // cout << endl;
    }
    
    ll ans = 1;
    rep(i, 1010) (ans *= (cnt[i]+1)) %= MOD;
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int n;
ll a[100010];
ll b[100010];
ll c[100010];

int main() {    
    cin >> n;
    imfor(i, n) {
        cin >> a[i];
    }
    imfor(i, n) {
        cin >> b[i];
    }
    imfor(i, n) {
        cin >> c[i];
    }
    sort(a, a + n);
    sort(c, c + n);
    ll ans = 0;
    imfor(i, n) {
        ll lb = -1, ub = n;
        while(ub - lb > 1) {
            ll mid = (lb + ub) / 2;
            if (a[mid] >= b[i]) {
                ub = mid;
            }
            else {
                lb = mid;
            }
        }
        ll ai = ub;
        lb = -1, ub = n;
        while(ub - lb > 1) {
            ll mid = (lb + ub) / 2;
            if (c[mid] >= b[i] + 1) {
                ub = mid;
            }
            else {
                lb = mid;
            }
        }
        ll ci = n - ub;
        //cout << ai << " " << ci << endl;
        ans += ai * ci;
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
import java.util.*;
public class Main
{
  public static void main(String args[])
  {
  Scanner sc=new Scanner(System.in);
  int aa=sc.nextInt();
  int b=sc.nextInt();
   int arr[]=new int[b];
 	for(int i=0;i<b;i++)
 	{
 		arr[i]=sc.nextInt();
 	}
 	int  min=Math.min(arr[b-1]-arr[0], aa-arr[b-1]+arr[b-2]);
 	for(int i=1;i<b-1;i++)
 	{
 		int d=Math.min(arr[i]+aa-arr[i+1],aa-arr[i]+arr[i-1]);
 		min=Math.min(d,min);
 	}
 	System.out.println(min);
  }
}

Measured memory_bytes: 67036
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll n,k;
ll a[200005];
bool x=false;
int main(void){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	map<ll,ll> M;
	ll i=0;
	M[i]=1;
	ll cnt=2;
	while(x==false){
		i=a[i]-1;
		if(M[i]!=0){
			x=true;
		}else{
			M[i]=cnt;
		}
		cnt++;
        if(cnt==k+2){
            cout<<i+1<<endl;
            return 0;
        }
	}
	ll t=cnt-M[i]-1;
	ll s=(k-M[i]+1)%t;
	if(s<0){
		s=s+t;
	}
	ll j=i;
	for(int i=0;i<s;i++){
		j=a[j]-1;
	}
	cout<<j+1<<endl;
	
}


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

import sys
from itertools import accumulate

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 list4d(a, b, c, d, e): return [[[[e] * d for j in range(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(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

MAX = 3234566667
ans = []
def rec(x, di):
    if di == 10:
        return
    if int(x) > MAX:
        return
    ans.append(int(x))
    last = int(x[-1])
    rec(x+str(last), di+1)
    if last != 0:
        rec(x+str(last-1), di+1)
    if last != 9:
        rec(x+str(last+1), di+1)
    return

K = INT()

for i in range(1, 10):
    rec(str(i), 0)

ans.sort()
print(ans[K-1])


Measured memory_bytes: 7524
#include<bits/stdc++.h>
#define int long long
using namespace std;
int k,a,b;
signed main(){
	scanf("%lld%lld%lld",&k,&a,&b);
	if (b<=a+2||k<=a-1) return printf("%lld\n",k+1),0;
	else printf("%lld\n",(b-a)*((k-a+1)/2)+a+((k-a+1)%2)); 
	return 0;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
N, K = MAP()
R, S, P = MAP()
T = list(input())
 
t = []

for i in range(N):
	if T[i] == "r":
		t.append(P)
	if T[i] == "p":
		t.append(S)
	if T[i] == "s":
		t.append(R)
 
ans = sum(t)
 
for i in range(N-K):
	if T[i] == T[i+K]:
		ans -= t[i+K]
		T[i+K] = "O"
 
print(ans)

Measured memory_bytes: 7008
#include <vector> 
#include <algorithm> 
#include <bits/stdc++.h> 
#include <stdlib.h> 
#include <stdio.h> 
#include <functional> 
#include<math.h> 
#include<cstring>
using namespace std;

long long int gcd(long long int x,long long int y){
    long long int a = x,b = y;
    long long int p = 0;
    while(p == 0){
        if(x < y){
            long long int z = x;
            x = y;
            y = z;
        }
        if(x % y == 0){
            p = y;
        }
        else{
            x = x % y;
        }
    }
    
    p = a / p * b;
    return p;
    
    
}



int main(void){
    // Your code here!
    
    int N;
    cin >> N;
    long long int ans;
    cin >> ans;
    for(int i = 1; i < N;i++){
        long long int b;
        cin >> b;
        ans = gcd(ans,b);
    }
    cout << ans << endl;
    
    
    
 
}

Measured memory_bytes: 256
def check(pos):
    for a in pos:
        for b in pos:
            if abs(a - b) > k:
                return False
    return True

pos = [None] * 5
for i in range(0, 5):
    pos[i] = int(input())
k = int(input())

print("Yay!" if check(pos) else ":(")



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

int main(){
    int n,cnt;
    cin>>n;
    vector<int> a;
    for(int i=0;i<n;i++)
    {
        cin>>cnt; 
        a.push_back(cnt);
    }
    vector<int> health;
    for(int j=0;j<n;j++)
    {
        for(int k=j+1;k<n;k++)
        {
        health.push_back(a[j]*a[k]);
        }
    }
    cout<<accumulate(health.begin(),health.end(),0);

}

Measured memory_bytes: 256
using System;
    class Program
    {
        static void Main(string[] args)
        {
            // 整数の入力
            int a = int.Parse(Console.ReadLine());
            // スペース区切りの整数の入力
            var input = Console.ReadLine().Split(' ');

            int s = 0;
            foreach(var i in input)
            {
                if (int.Parse(i) % 2 == 1)
                {
                    s += 1;
                }
            }

            var ans = s % 2 == 0 ? "YES" : "NO";
            //出力
            Console.WriteLine(ans);

        }
    }

Measured memory_bytes: 11608
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
const int maxn = 510;
int v[maxn][maxn];
int k, n;
int main()
{
	std::ios::sync_with_stdio(false);
	cin >> k;
	if(k == 1)
	{
		cout << 1 << endl << 1 << endl;
		return 0;
	}
	n = (k + 3) / 4 * 2;
	for(int i = 0; i < n; i ++)
		for(int j = 0; j < n; j ++)
			v[i][j] = (i + j) % n + 1;
	for(int i = 1; i < n; i += 2)
		for(int j = 0; j < n; j ++)
			if(v[i][j] + n <= k)
				v[i][j] += n;
	cout << n << endl;
	for(int i = 0; i < n; i ++)
	{
		for(int j = 0; j < n; j ++)
			cout << v[i][j] << " " ;
		cout << endl;
	}
	return 0;
}

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

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

#ifndef ATAKYN
#define endl '\n'
#endif

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

    int n, m;
    cin >> n >> m;

    vector<vector<int>> graph(n + 1);
    vector<int> in_deg(n + 1);
    vector<int> dp(n + 1);

    int a, b;
    for (int i = 1; i <= m; i++) {
        cin >> a >> b;
        graph[a].push_back(b);
        in_deg[b] += 1;
    }

    queue<int> q;
    for (int i = 1; i <= n; i++) {
        if (in_deg[i] == 0)
            q.push(i);
    }

    while (!q.empty()) {
        int curr = q.front(); q.pop();
        for (int edge : graph[curr]) {
            dp[edge] = max(dp[edge], dp[curr] + 1);
            in_deg[edge] -= 1;
            if (in_deg[edge] == 0)
                q.push(edge);
        }
    }

    int ans = 0;
    for (int i = 1; i <= n; i++)
        ans = max(ans, dp[i]);

    cout << ans << endl;
}



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



signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    ll n,a,b;
    cin>>n>>a>>b;
    ll s[13],t[13];
    s[0]=a,t[0]=b;
    for(int i=1;i<=12;i++){
        if(i%2==1){
            s[i] = s[i-1]-t[i-1];
            t[i]=t[i-1];
        }
        else{
            s[i]=s[i-1];
            t[i] = s[i-1]+t[i-1];
        }
    }
    n %= 12;
    cout << s[n] << " " << t[n] << endl;
     
}



Measured memory_bytes: 3208
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1e18;

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

int main() {
  ll k;
  cin >> k;
  ll ans=0;
  for(ll i=1;i<=k;i++) {
    for(ll j=i;j<=k;j++) {
      for(ll l=j;l<=k;l++) {
        ll tmp=gcd(gcd(i,j),l);
        if(i!=j&&j!=l) {
          tmp*=6;
        }
        else if(i!=j||j!=l) {
          tmp*=3;
        }
        ans+=tmp;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <deque>
using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef pair<string,string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;



int main(){
  int n;
  cin >> n;
  int a[n];
  REP(i,n) cin >> a[i];

  sort(a,a+n);
  int result = unique(a, a+n) - a;
  if(result %2 == 0){
    cout << result -1 << endl;
  }else{
    cout << result << endl;
  }

  return 0;
}


Measured memory_bytes: 640
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            list.add(sc.nextInt());
        }
        System.out.println(list.stream().distinct().count());
    }
}


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

using namespace std;

const uint64_t B = 103, H = 1e+17+3;

inline uint64_t ctoi(char c) { return c - 'a' + 1; }

uint64_t to_hash(const string &s)
{
  uint64_t _hash = 0;
  for (uint64_t i = 0; i < s.size(); ++i) {
    _hash = (_hash * B) % H;
    _hash = (_hash + ctoi(s[i])) % H;
  }
  return _hash;
}

inline uint64_t build_mask(uint64_t L) {
  uint64_t mask = 1;
  for (uint64_t i = 0; i < L - 1; ++i) {
    mask = (mask * B) % H;
  }
  return mask;
}

inline uint64_t change_hash(uint64_t _hash, uint64_t mask, char c1, char c2)
{
  uint64_t x = (ctoi(c1) * mask) % H;
  _hash = ((_hash + H) - x) % H;
  _hash = (_hash * B) % H;
  _hash = (_hash + ctoi(c2)) % H;
  return _hash;
}

bool find(uint64_t N, const string &S, uint64_t L)
{
  uint64_t mask = build_mask(L);
  
  uint64_t hash = to_hash(S.substr(0, L));
  
  map<uint64_t, set<uint64_t, greater<uint64_t>>> m;
  m[hash].insert(0);
  
  for (uint64_t i = 1; i <= S.size() - L; ++i) {
    hash = change_hash(hash, mask, S[i - 1], S[i + L - 1]);
    
    if (m[hash].size() > 0 && i >= L) {
      auto itr = m[hash].lower_bound(i - L);
      if (itr != m[hash].end()) {
        return true;
      }
    }
    
    m[hash].insert(i);
  }
  
  return false;
}

int main()
{
  uint64_t N;
  cin >> N;
  
  string S;
  cin >> S;
  
  uint64_t hi = N, lo = 0;
  
  while (hi - lo > 1) {
    uint64_t L = (hi + lo) >> 1;
    if (find(N, S, L)) {
      lo = L;
    } else {
      hi = L;
    }
  }
  
  if (find(N, S, hi)) {
    cout << hi << endl;
  } else {
    cout << lo << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1016
#include <stdio.h>
#include <string.h>
int main(void){

    int n,m,max = 0;

    scanf("%d",&n);
    char red[n][11];
    for(int i=0;i<n;++i){
        scanf("%s",red[i]);
    }
    scanf("%d",&m);
    char blue[m][11];
    for(int i=0;i<m;++i){
        scanf("%s",blue[i]);
    }

    for(int i=0;i<n;++i){
        int count =0;
        for(int l=i;l<n;++l){
            if(strncmp(red[i],red[l],11) == 0){
                ++count;
            }
        }
        for(int p=0;p<m;++p){
            if(strncmp(red[i],blue[p],11) == 0){
                --count;
            }
        }
        if(max < count) max = count;
    }
    printf("%d",max);

    return 0;
}

Measured memory_bytes: 128
N,M=map(int,input().split())
A=[int(s) for s in input().split()]

total=sum(A)

pop_List=[]
for i in range(N):
    if A[i]<total/(4*M):
        pop_List.append(i)

#popにより減った分をループするindex番号で補正する
count=0
for i in pop_List:
    i=i-count
    A.pop(i)
    count+=1

print("Yes" if len(A)>=M else "No")

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long LL;
const LL mo=1e9+7;
const int N=1e6;
int n;
LL ans=0,f[N+10],sum[N+10];
int main() {
    scanf("%d",&n);
    f[0]=f[1]=f[2]=1;
    sum[0]=1;
    sum[1]=2;
    sum[2]=3;
    for (int i=3;i<n;i++) {
        f[i]=(f[i-1]+sum[i-3])%mo;
	sum[i]=(sum[i-1]+f[i])%mo;	
    }
    for (int i=0;i<n-1;i++) {
	ans=(ans+f[i]*(n-1)%mo*(n-1))%mo;
	int l=max(2,n-i-1);
	ans=(ans+(n-l+1)*f[i])%mo;
    }
    ans=((ans+f[n-1]*n)%mo+mo)%mo;
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 15872
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int count = 0;
    bool ans = true;
    if (s[0] != 'A') {
      ans = false;
    }

    rep(i, s.size()) {
      if (s[i] >= 'A' && s[i] <= 'Z') {
        ++count;
      }
    }
    if (count != 2) {
      ans = false;
    }
    count = 0;
    FOR(i, 2, s.size() - 1) {
      if (s[i] == 'C') {
        ++count;
      }
    }
    if (count != 1) {
      ans = false;
    }

    if (ans) {
      cout << "AC" << '\n';
    } else {
      cout << "WA" << '\n';
    }

    return 0;
}


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

using namespace std;

int main()
{
	int n, k;
	cin >> n >> k;
	int ans = 1;
	for(int i = 0; i < n; i++)ans = min(ans * 2, ans + k);
	cout << ans << endl;

	return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n);

    for(int i = 0; i < n; ++i) {
        a[i] = b[n - 1 - i] = (i+1) * 20001;
    }

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

    for(int i = 0; i < n; ++i) {
        cout << a[i];
        if (i == n - 1) cout << endl;
        else cout << " ";
    }

    for(int i = 0; i < n; ++i) {
        cout << b[i];
        if (i == n - 1) cout << endl;
        else cout << " ";
    }
}


Measured memory_bytes: 768
#include <iostream>
#include<map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

const int maxn = 100000;
const int mhw = 300;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない


int main() {

	int a, b,c;
	cin >> a >> b >> c;
	if (a == b && b == c && c == a) {
		Yes;
	}
	else {
		No;
	}


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}


int main()
{
	int n; cin >> n;
	std::vector<int> H(109);
	rep(i, n) cin >> H[i];

	int ans = 0;

	for (int i = 0; i < n; ++i)
	{
		bool is_candidate = true;
		
		for (int j = 0; j < i; ++j)
		{
			if (H[j] > H[i]) is_candidate = false;
		}
		if (is_candidate) ++ans;
	}

	cout << ans << endl;


}

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

typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;

bool is_integer(double x) {
    return std::floor(x)==x;
}

int main(){
    int n,x,t;
    cin >> n >> x >> t;

    if(n%x==0){
        cout << n/x*t << endl;
    }else{
        cout << (n/x+1)*t << endl;
    }

    return 0;
}

Measured memory_bytes: 3596
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>

using namespace std;

int main(){

	int X;
	int t;

	cin >> X >>t;

	if(X <= t){
		cout << 0;
	}else{
		cout << X - t;
	}


	return 0;

}


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

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

    int N, K;
    string S;

    cin >> N >> K >> S;
    deque<int> zero_list;

    bool is_zero_continuous = false;
    int num_one_and_zero = 0; // sum of zeros and ones just before zeros
    int tmp_ans = 0;
    int ans = 0;
    for (int i = 0; i < N; ++i) {
        if (S[i] == '0') {
            if (!is_zero_continuous && zero_list.size() == K) {
                if (tmp_ans > ans) ans = tmp_ans;
                tmp_ans -= zero_list.front();
                zero_list.pop_front();
            }
            is_zero_continuous = true;
            ++num_one_and_zero;
            ++tmp_ans;
        } else {
            if (is_zero_continuous) {
                is_zero_continuous = false;
                zero_list.push_back(num_one_and_zero);
                num_one_and_zero = 0;
            }
            ++num_one_and_zero;
            ++tmp_ans;
        }
    }

    if (tmp_ans > ans) ans = tmp_ans;
    cout << ans << endl;

    return 0;
}


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

namespace My
{
template <typename ArrayT>
static void DumpArray(const ArrayT &arr)
{
#if defined(HOME)
	for (auto it = std::begin(arr); it != std::end(arr); ++it) {
		cerr << *it << " ";
	}
	cerr << endl;
#endif
}
template <typename T>
static void DumpGrid(const vector<vector<T>> &grid)
{
#if defined(HOME)
	REP (i, grid.size()) {
		REP (j, grid[i].size()) {
			cerr << grid[i][j] << " ";
		}
		cerr << endl;
	}
#endif
}
template <class ArrayT, typename T>
static void InitArray(ArrayT &arr, T initValue)
{
	for (auto &v : arr) {
		v = initValue;
	}
}
template <typename T>
static bool ReplaceIfSmaller(T &target, T value)
{
	if (value < target) {
		target = value;
		return true;
	} else {
		return false;
	}
}
template <typename T>
static bool ReplaceIfBigger(T &target, T value)
{
	if (target < value) {
		target = value;
		return true;
	} else {
		return false;
	}
}

class Solver
{
  public:
	Solver() {}

	void Solve(istream &cin, ostream &cout) {
		int N;
		cin >> N;

		map<int, int> ai;
		map<int, int> aj;
		REP (i, N) {
			int A;
			cin >> A;

			// j - i = Ai + Aj
			// j - Aj = i + Ai
			ai[i + A] += 1;
			aj[i - A] += 1;
		}

		ll ans = 0;
		for (auto &&kv : ai) {
			ans += aj[kv.first] * (ll)kv.second;
		}

		cout << ans << endl;
	}
};
} // namespace My

#if !defined(BOOST_TEST_MODULE)
#if !defined(GTEST_INCLUDE_GTEST_GTEST_H_)
int main()
{
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);

	My::Solver solver;
	solver.Solve(std::cin, std::cout);

	return 0;
}
#endif
#endif


Measured memory_bytes: 29260
N = int(input())
C = list(input())
RtoW = sum(map(lambda x: x=="R",C))
WtoR = 0
ans = RtoW
for i in range(N):
    if C[i] == "R":
        RtoW -= 1
    else:
        WtoR += 1
    ans = min(ans,max(RtoW,WtoR))

print(ans)

Measured memory_bytes: 77312
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner console = new Scanner(System.in);
		int n = console.nextInt();
		int l = console.nextInt();
		console.nextLine();
		int[] lengths = new int[n];
		for(int i = 0; i < n; i++)
			lengths[i] = console.nextInt();
		
		int finalKnot = -1;
		for(int i = 0; i < n-1; i++) {
			if(lengths[i] + lengths[i+1] >= l) {
				finalKnot = i;
				break;
			}
		}
		if(finalKnot != -1) {
			System.out.println("Possible");
			for(int i = 0; i < finalKnot; i++)
				System.out.println(i+1);
			for(int i = n-1; i > finalKnot; i--)
				System.out.println(i);
		}
		else
			System.out.println("Impossible");
		
	}

}

Measured memory_bytes: 63288
#include <iostream>
#include <string>
using namespace std;
void equal_seven(int a,int b,int c,int d,bool plus,int divi,string S,int result);
int  main(void){
    // Your code here!
    int A,B,C,D;
    int num=0;
    string S;
    cin>>num;
    D=num%10;
    num/=10;
    C=num%10;
    num/=10;
    B=num%10;
    num/=10;
    A=num%10;
    string show;
    
    equal_seven(A,B,C,D,true,1,show,0);
    
}
void equal_seven(int a,int b,int c,int d,bool plus,int divi,string S,int result){
    static bool onetime=false;
    switch(divi){
        case 1:
        result+=a;
        S+=to_string(a);
        break;
        case 2:
        if(plus){
            result+=b;
            S+='+';
            
        }
        else{
            result-=b;
            S+='-';
        }
        S+=to_string(b);
        break;
        case 3:
        if(plus){
            result+=c;
             S+='+';
        }
        else{
            result-=c;
             S+='-';
        }
        S+=to_string(c);
        break;
        case 4:
        if(plus){
            result+=d;
             S+='+';
        }
        else{
            result-=d;
             S+='-';
        }
        S+=to_string(d);
        break;
        default:
        break;
        
    }
    if(divi<4){
    equal_seven(a,b,c,d,true,divi+1,S,result);
    equal_seven(a,b,c,d,false,divi+1,S,result);
    }
    if(divi==4 && result==7){
        if(!onetime){
        S+="=7";
        cout<<S<<endl;
        onetime=true;
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;
int divr[maxn];
/*ll modexpo(ll a,ll b)
{
     ll res=1LL;
     while(b>0)
     {
          if(b&1)res=(res*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return res;
}*/
void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
 
 
 
 
 














int main()
{
    int a,b;
    cin>>a>>b;
    for(int i=1;i<=10000;i++)
    {
         int t1=0.08*i;
         int t2=0.1*i;
         if(t1==a&&t2==b){cout<<i;return 0;}
    }
    cout<<-1;
}
























 
 
 
 
 

















Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
 
using namespace std;
 
int ascSort(const void* v1, const void* v2) {
    const int _v1 = *((const int*)v1);
    const int _v2 = *((const int*)v2);
 
    if ( _v1 < _v2 ) {
        return 1;
    } else if ( _v1 > _v2 ) {
        return -1;
    } else {
        return 0;
    }
}
 
string a[50];
 
int main(){
	int n,x=0;
	char s[202];
	cin >> s;
	n = strlen(s);
	int i,j;
	for(i=n-2;i>=0;i-=2){
		x=0;
		for(j=0;j<i/2;j++){
			if(s[j]!=s[j+i/2]){
				x=1;
				break;
			}
		}
		if(x==0){
			cout << i << endl;
			break;
		}
	}
	return 0;
}

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

int main()
{
  string s;
  cin >> s;
  
  for(int i = 0; i < 3; i++)
  {
    if(s[i] == '1')
    {
		s[i] = '9';
    }
    else if(s[i] == '9')
    {
      s[i] = '1';
    }
  }
    
  cout << s << endl;
  
  return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;

int MOD = 1e9 + 7;
ll INF = 1e18;

int main() {
    int n; cin>>n;
   
    if(n<1200) cout << "ABC" << endl;
    else if(n<2800) cout << "ARC" << endl;
    else cout << "AGC" << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll b[110],T,n,a[210],ans;
string s;
int que(ll x){
	for (int i=60;i>=0;i--)if (x&((1ll)<<i))x^=b[i];
	return (x!=0);
}
void add(ll x){for (int i=60;i>=0;i--){if (x&((1ll)<<i)){if (b[i]==0){b[i]=x;return ;}x^=b[i];}}}
int main(){
	cin>>T;
	while (T--){
		cin>>n;ans=0;
		memset(b,0,sizeof(b));
		for (int i=1;i<=n;i++)cin>>a[i];
		cin>>s;
		for (int i=n;i>=1;i--){
			if (s[i-1]=='0')add(a[i]);
			else ans=ans|que(a[i]);
		}
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 3596
#include<iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<stack>

#define ll long long
#define vl vector<ll>
#define vvl vector< vector<ll> >
#define vb vector<bool>
#define vbb vector< vector<bool> >
#define vs vector<string>
#define vc vector<char>
#define vvc vector< vector<char> >

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

using namespace std;



int main(){
	ll x, y, z; cin >> x >> y >> z;
	ll ans = (x-z) / (y + z);
	cout << ans << endl;
	return 0;
}

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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
 
Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

int main() {
    Int n;
    cin >> n;
    vector<Int> a(n + 2, 0);
    for (Int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    vector<Int> b(n + 1);
    for (Int i = 0; i <= n; i++) {
        b[i] = abs(a[i + 1] - a[i]);
    }
    vector<Int> c = b;
    for (Int i = 0; i < n; i++) {
        b[i + 1] += b[i];
    }
    for (Int i = n; i > 0; i--) {
        c[i - 1] += c[i];
    }
    for (Int i = 1; i <= n; i++) {
        if (i == 1) {
            dump(abs(a[0] - a[2]) + c[i + 1]);
        } else if (i == n) {
            dump(b[i - 2] + abs(a[i + 1] - a[i - 1]));
        } else {
            //cout << b[i - 2] << " " << c[i + 1] << endl;
            dump(b[i - 2] + c[i + 1] + abs(a[i - 1] - a[i + 1]));
        }
    }
    return 0;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
int main(){
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	string s, t;
	cin>>s>>t;
	int ret=0;
	for(int i=0;i<s.size();i++){
		if(s[i]!=t[i])
			ret++;
	}
	cout<<ret<<endl;
	return 0;
}

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

namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {
            ushort a = ushort.Parse(Console.ReadLine());
            ushort b = ushort.Parse(Console.ReadLine());
            ushort c = ushort.Parse(Console.ReadLine());
            ushort d = ushort.Parse(Console.ReadLine());
            ushort e = ushort.Parse(Console.ReadLine());
            ushort k = ushort.Parse(Console.ReadLine());
            if (e - a > k)
            {
                Console.WriteLine(":(");
            }


            else if (b - a < k)
            {
                Console.WriteLine("Yay!");

            }
            Console.ReadLine();
        }

    }
}

    

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

int main() {
string S,T1,T2;
cin >> S;

int N = S.size();

T1 = S.substr(0,(N-1)/2 );
// sort(S.begin(), , greater<char>());

T2 = S.substr((N+3)/2 -1, N);

if (T1 == T2) cout << "Yes"<< endl;
else cout << "No"<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    
    int P = sc.nextInt();
    int Q = sc.nextInt();
    int R = sc.nextInt();
    
    int A = P + Q;
    int B = R + Q;
    int C = P + R;
    int D = Q + R;
    int E = R + P;
    int F = Q + P;
    
    int values[] = {A, B, C, D, E, F};
        int min = values[0];
 
        for (int i = 1; i < values.length; i++) {
            min = Math.min(min, values[i]);
        }
        System.out.println(min);

  }
}

Measured memory_bytes: 23892
# coding: utf-8
# Your code here!

n = int(input())

sub = []
while n > 0:
    if n != 0:
        n -= 1
    sub.append(chr(97 + n % 26))
    n = n // 26

for i in range(len(sub)):
    print(sub[len(sub)-i - 1],end="")


Measured memory_bytes: 8996
#include<stdio.h>
int main(void) {
	char s[101];
	scanf("%s", s);
	int cnt = 0;
	for (int i = 0; s[i] != '\0'; i++) {
		cnt++;
	}
	int ans = 0;
	//printf("%d\n", cnt);
	for (int i = 0; i < cnt / 2; i++) {
		if (s[i] != s[cnt - 1 - i]) {
			ans++;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void) {
	int a,b,c,d,left,right;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	left=a+b;
	right=c+d;
	if(left==right)
		printf("Balanced\n");
	else if(left>right)
		printf("Left\n");
	else if(right>left)
		printf("Right\n");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <queue>

#define rep(i, N) for(int (i) = 0; (i) < (N); (i) ++)
typedef long long ll;
using namespace std;

int main() {
    int N;
    ll K;
    ll ans;
    int a_max = 1e5;
    vector<ll> cnts(a_max + 1);
    cin >> N >> K;
    rep(i, N){
        int a, b;
        cin >> a >> b;
        cnts[a] += b;
    }

    rep(i, a_max){
        cnts[i + 1] += cnts[i];
    }

    rep(i, a_max + 1){
        if(K <= cnts[i]){
            cout << i << endl;
            return 0;
        }
    }

    return 0;
}


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

using namespace std;
typedef long long LL;
const int MaxN = 1e5;




int a[4];

int main()
{
	cin >> a[1] >> a[2] >> a[3];
	sort(a + 1,a + 1 + 3);
	int x = a[3] - a[1];
	int y = a[3] - a[2];
	if(x % 2 == 0 && y % 2 == 0)
	{
		cout << x / 2 + y / 2 << endl;
	}
	else if(x % 2 != 0 && y %2 != 0)
	{
		cout << x / 2 + y / 2 + 1 << endl;
	}
	else 
	{
		cout << x / 2 + y / 2 + 2  << endl;
	}
}


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

int main() {
  int i, N;
  cin >> N;
  string x;
  
  for (i = 0; i < N; i++) {
    cin >> x;
    if (x == "Y") {
    cout << "Four" << endl;
    break;
    }
  }
  
  if (i == N) {
  cout << "Three" << endl;
  }
}

Measured memory_bytes: 3584
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include<iomanip>
#include<functional>
using namespace std;
typedef long long ll;


long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

int main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max({ a * c,b * c,a * d,b * d }) << endl;
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;

using P = pair<ll, int>;
const int RED = 1;
const int GREEN = 2;
const int NONE = 3;

int main() {
    int X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    vector<P> p;
    ll val;
    rep(i, A) {
        cin >> val;
        p.push_back(P{val, RED});
    }

    rep(i, B) {
        cin >> val;
        p.push_back(P{val, GREEN});
    }

    rep(i, C) {
        cin >> val;
        p.push_back(P{val, NONE});
    }

    sort(p.begin(), p.end());
    vector<ll> red, green, none;
    ll ans = 0;
    rep(_, X + Y) {
        P e = p.back();
        p.pop_back();
        ans += e.first;
        if (e.second == RED) {
            red.push_back(e.first);
        } else if (e.second == GREEN) {
            green.push_back(e.first);
        } else {
            none.push_back(e.first);
        }
    }

    if (red.size() <= X && green.size() <= Y) {
        cout << ans << endl;
        return 0;
    }

    if(red.size() > X) {
        while(red.size() > X) {
            ans -= red.back();
            red.pop_back();
            while(true) {
                P e = p.back();
                p.pop_back();
                if(e.second != RED) {
                    ans += e.first;
                    break;
                }
            }
        }
    } else {
        while(green.size() > Y) {
            ans -= green.back();
            green.pop_back();
            while(true) {
                P e = p.back();
                p.pop_back();
                if(e.second != GREEN) {
                    ans += e.first;
                    break;
                }
            }
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 11660