akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

typedef int64_t ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

// エラトステネスの篩でN 以下の素数判定を行う
// 素数: 1, 素数じゃない: 0
// [0, 0, 1, 1, 0, 1, ...]
vector<int> createEratos(int n)
{
  vector<int> isprime(n+1, 1);
  isprime[0] = 0;
  isprime[1] = 0;

  for (int i = 2; i * i <= n; i++) {
    if (isprime[i]) {
      int j = i + i;
      while (j <= n) {
        isprime[j] = 0;
        j = j + i;
      }
    }
  }
  return isprime;
}

// n = 10: 2^1 * 5^1 [0, 0, 1, 0, 1, 0, ...]
// n = 12: 2^2 * 3^1 [0, 0, 2, 1, 0, 0, ...]
vector<int> primeFactor(const int& n)
{
  vector<int> prime = createEratos(n);

  int m = n;
  for (int i = 2; i <= n; i++) {
    if (prime[i]) {
      prime[i] = 0;
      while (m % i == 0) {
        prime[i]++;
        m /= i;
      }
    }
  }
  return prime;
}

vector<pair<ll, int>> factorize(ll n) {
  vector<pair<ll, int>> res;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i) continue;
    res.emplace_back(i, 0);
    while (n % i == 0) {
      n /= i;
      res.back().second++;
    }
  }
  if (n != 1) res.emplace_back(n, 1);
  return res;
}

//組み合わせの数nCrを計算
ll calcNumOfCombination(ll n, ll r){
  mint num(1);
  for(ll i = 1; i <= r; i++){
    num = num * (n - i + 1) / i;
  }
  return num.x;
}

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

  ll n, m;
  cin >> n >> m;

  mint ans(1);
  auto factors = factorize(m);
  for (auto& factor : factors) {
    ans *= calcNumOfCombination(factor.second + n - 1, n - 1);
  }

  cout << ans.x << endl;

  return 0;
}


Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count=0

for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      if 500*a+100*b+50*c == X:
        count+=1
        
print(count)
    

Measured memory_bytes: 9072
#include<bits/stdc++.h>
#define int long long
using namespace std;
int get(int x){
  return (x*(x-1))/2;
}
signed main(){
  int n,d,ans;
  cin>>n>>d;
  if(d==1)ans=get(n);
  else if(d==2)ans=get(n)-1;
  else if(d==3)ans=get(n-2)+2;
  else ans=get(n-(d+1)+2)+(d-1);
  
  if(d>=3&&(n-1)!=d)ans+=(n-(d+1));
  
  cout<<ans<<endl;
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
#define M 500005
using namespace std;
struct node{double t,v;}q[M]={0},p;
int head=0,tail=0;
int main(){
	double l=0,ll=0,now=0;
	int n; scanf("%d",&n);
	scanf("%lf",&ll); l=ll;
	while(n--){
		scanf("%lf%lf",&p.t,&p.v);
		while(p.v>l){
			if(q[head].v+l<=p.v)
			now-=q[head].v*q[head].t,l+=q[head++].v;
			else{
				double x=p.v-l;
				now-=x*q[head].t;
				l+=x;
				q[head].v-=x;
			}
		}
		l-=p.v; now+=p.v*p.t; q[++tail]=p;
		while(head<tail&&q[tail-1].t>=q[tail].t){
			q[tail-1].t=(q[tail-1].t*q[tail-1].v+q[tail].t*q[tail].v)/(q[tail-1].v+q[tail].v);
			q[tail-1].v+=q[tail].v;
			tail--;
		}
        printf("%.10lf\n",now/(ll-l));
    }
}

Measured memory_bytes: 18304
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int N,M,K;
    cin >> N >> M >> K;
    // 順番によらない
    // 片側に寄せても結果は同じ
    // 2重ループで全探索できる
    for(int y=0;y<=N;y++){
        for(int x=0;x<=M;x++){
            if(K == (M*y - y*x + x*(N-y))){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <set>
#define INF (2000000000)
#define MOD (1000000007)
using namespace std;

typedef vector<int> VI;
typedef vector<int>::iterator VII;
typedef vector<double> VD;
typedef vector<double>::iterator VDI;
typedef pair<int, int> P;


typedef struct
{
	int head[5000];
	VI to;
	VI next;
	VI cost;
} EDGE;

int N, K;
int C[5000], R[5000];
EDGE road;
EDGE taxi;
int d[5000];
int range[5000];

void SearchTaxi()
{
	for (int i = 0; i < N; i++){
		memset(range, -1, sizeof(range));
		
		range[i] = R[i];
		
		while (true){
			bool update = false;
			
			for (int i = 0; i < N; i++){
				for (int e = road.head[i]; e != -1; e = road.next[e]){
					if (range[road.to[e]] < range[i] - 1){
						range[road.to[e]] = range[i] - 1;
						update = true;
					}
				}
			}
			
			if (!update) break;
		}
		
		for (int j = 0; j < N; j++){
			if (range[j] != -1){
				taxi.next.push_back(taxi.head[i]);
				taxi.head[i] = taxi.next.size() - 1;
				taxi.to.push_back(j);
				taxi.cost.push_back(C[i]);
			}
		}
	}
}

void SearchMinCost()
{
	for (int i = 1; i < N; i++){
		d[i] = INF;
	}
	
	while (true){
		bool update = false;
		
		for (int i = 0; i < N; i++){
			for (int e = taxi.head[i]; e != -1; e = taxi.next[e]){
				if (d[i] != INF && d[taxi.to[e]] > d[i] + taxi.cost[e]){
					d[taxi.to[e]] = d[i] + taxi.cost[e];
					update = true;
				}
			}
		}
		
		if (!update) break;
	}
}

int main()
{
	memset(road.head, -1, sizeof(road.head));
	memset(taxi.head, -1, sizeof(taxi.head));
	
	scanf("%d %d", &N, &K);
	
	for (int i = 0; i < N; i++){
		scanf("%d %d", &C[i], &R[i]);
	}
	
	for (int i = 0; i < K; i++){
		int a, b;
		scanf("%d %d", &a, &b);
		a--; b--;
		
		road.next.push_back(road.head[a]);
		road.head[a] = road.next.size() - 1;
		road.to.push_back(b);
		
		road.next.push_back(road.head[b]);
		road.head[b] = road.next.size() - 1;
		road.to.push_back(a);
	}
	
	SearchTaxi();
	SearchMinCost();
	
	printf("%d\n", d[N - 1]);
	
	return 0;
}

Measured memory_bytes: 167476
#include<stdio.h>

int main(){
	int Alice, Bob;
	scanf("%d%d", &Alice, &Bob);
	
	if(Alice == Bob){
		printf("Draw\n");
		return 0;
	}
	
	else if(Alice == 1 || Alice > Bob && Bob != 1){
		printf("Alice\n");
		return 0;
	}
	else{
		printf("Bob\n");
		return 0;
	}
}

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

using namespace std;

typedef long long ll;

int main(){
        int N;
        cin>>N;
        ll cnt[5];
        string s="MARCH";
        for(int i=0;i<5;i++){
                cnt[i]=0;
        }
        for(int i=0;i<N;i++){
                string ss;
                cin>>ss;
                for(int j=0;j<5;j++){
                        if(ss[0]==s[j]){
                                cnt[j]++;
                        }
                }
        }
        ll res=0;
        for(int i=0;i<5;i++){
                for(int j=i+1;j<5;j++){
                        for(int k=j+1;k<5;k++){
                                if(cnt[i]!=0&&cnt[j]!=0&&cnt[k]!=0){
                                        res+=(cnt[i]*cnt[j]*cnt[k]);
                                }
                        }
                }
        }
        cout<<res<<endl;
        return 0;
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(){
	string s;
	int startA, startZ;
	int maxL = 0;
	cin >> s;
	for(int i = 0; i < s.length(); i++){
		if(s[i]=='A'){
			startA = i;
			break;
		}
    }
    for(int x = s.length()-1; x > 0; x--){
    	if(s[x]=='Z'){
    		startZ = x;
    		break;
		}
	}
	string total = s.substr(startA, (startZ-startA+1));
	cout << total.length()<< endl;
	return 0;
}


Measured memory_bytes: 772
n=int(input())
b=True
now=1
score=0
ans=[]
while b:
  if n-score>now:
    score+=now
    ans.append(now)
    now+=1
  else:
    ans.append(now)
    score+=now
    key=score-n
    b=False
for i in ans:
  if i!=key:
    print(i)

Measured memory_bytes: 3572
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = ll(A); I < ll(B); ++I)
#define FORR(I,A,B) for(ll I = ll((B)-1); I >= ll(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;
#define out(a) cout<<fixed<<setprecision((a))


int main(){
	ll N,A[3],B[3];
	cin >> N;
	FOR(i,0,3)cin>>A[i];
	FOR(i,0,3)cin>>B[i];
	ll dpAB[5001]={};
	FOR(i,0,N){
		if(i)dpAB[i] = max(dpAB[i],dpAB[i-1]);
		FOR(j,0,3){
			if(i+A[j]<5001)
				dpAB[i+A[j]] = max(dpAB[i+A[j]],dpAB[i]+(B[j]-A[j]));
		}
	}
	dpAB[N] = max(dpAB[N],dpAB[N-1]);
	N += dpAB[N];

	vector<ll> dp(N+1,0);
	FOR(i,0,N){
		if(i)dp[i] = max(dp[i],dp[i-1]);
		FOR(j,0,3){
			if(i+B[j]<=N)
				dp[i+B[j]] = max(dp[i+B[j]],dp[i]+(A[j]-B[j]));
		}
	}
	N = N+max(dp[N-1],dp[N]);
	cout << N << endl;
}

Measured memory_bytes: 195584
n = gets.to_i
nums = gets.split
as = []
n.times do |i|
  as << nums[i].to_i
end

def division(array)
  count_even = 0
  array.each do |num|
    if num.even?
      count_even += 1
    end
  end
  return false if count_even != array.length
  array.map! do |num|
    num / 2
  end
  return true
end

count_divide = 0
while true do
  flag = division(as)
  if flag
    count_divide += 1
  else
    break
  end
end

puts count_divide


Measured memory_bytes: 14296
/*
ABHIJEET BISWAS
CSE 4th SEM 
MNNIT ALLAHBAD
https://atcoder.jp/contests/dp/tasks/dp_i
*/

#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1e18
#define ll long long
#define ld long double
#define pii pair<int,int>
#define pli pair<long long,int>
#define pll pair<long long,long long>
#define MAX 1000009
#define pb push_back
#define mp map<int,int>
#define f first
#define s second
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
ld pi=2.0*acos(0.0);
int main() {
	fastIO
	int n;
	cin>>n;
	ld arr[n+1];
	ld dp[n+1][n+1];
	for(int i=1;i<=n;i++)
	cin>>arr[i];
	dp[0][0]=1;
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<=i;j++)
		{
			if(j==0)
			dp[i][j]=dp[i-1][j]*(1-arr[i]);
			else if(j==i)
			dp[i][j]=(dp[i-1][j-1]*arr[i]);
			else
			dp[i][j]=(dp[i-1][j]*(1-arr[i])+dp[i-1][j-1]*arr[i]);
		}
	}
	ld ans=0;
	for(int i=n/2+1;i<=n;i++)
	ans+=dp[n][i];
	cout<<setprecision(10)<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 140160
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();

    if (n < 600) {
      System.out.println(8);
    } else if (n < 800) {
      System.out.println(7);
    } else if (n < 1000) {
      System.out.println(6);
    } else if (n < 1200) {
      System.out.println(5);
    } else if (n < 1400) {
      System.out.println(4);
    } else if (n < 1600) {
      System.out.println(3);
    } else if (n < 1800) {
      System.out.println(2);
    } else if (n < 2000) {
      System.out.println(1);
    }
  }
}

Measured memory_bytes: 27032
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<String> list = new ArrayList<String>();

        for(int i = 0;i<n;i++){
            list.add(sc.next());
        }

        List<String> list2 = new ArrayList<String>(new HashSet<>(list));

        if(list2.size()==3){
            System.out.println("Three");
        }else{
            System.out.println("Four");
        }

    }
}


Measured memory_bytes: 23764
from itertools import accumulate
n = int(input())
s = str(input())
tt = [1 if i  == "W" else 0 for i in s]
B = [0] + tt
B = list(accumulate(B))
#print(B)
ans = float('Inf')
for i in range(0,n+1):
    #w = s[:i].count("W")
    ##W = sum(tt[:i])
    w = B[i]
    #print(W,w)
    #e = s[i:].count("E")
    #E = len(tt[i:]) - sum(tt[i:])
    e = n - i - B[-1] + B[i]
    #print(E,e)
    #ans = min(ans,W+E)
    ans = min(ans,w+e)
print(ans)


Measured memory_bytes: 20248
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include<random>
using namespace std;
#define N (1000000000+7)
#define M 998244353
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;
 
const int inf = (int)1e9;

ll A(ll x){
    if(x>=0)return x;
    else return -x;
}
 
ll gcd(ll a, ll b) {
	if (b > a) {
		ll tmp = b;
		b = a;
		a = tmp;
	}
	if (a%b == 0)return b;
	else return gcd(b, a%b);
}
 
 
ll cnt[10010];

 
int main(void){
	int n;
	cin>>n;
	for(int x=1;x*x<=n;x++){
		for(int y=1;y*y<=n;y++){
			for(int z=1;z*z<=n;z++){
				if(x*x+y*y+z*z+x*y+y*z+z*x>10000)continue;
				cnt[x*x+y*y+z*z+x*y+y*z+z*x]++;
				//cout<<x*x+y*y+z*z+x*y+y*z+z*x<<endl;
				//if(x*x+y*y+z*z+x*y+y*z+z*x==n)ans++;
			}
		}
	}
	for(int i=1;i<=n;i++)cout<<cnt[i]<<endl;
    return 0;
}

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

struct Point{
  double x,y;

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

  Point operator + (const Point &p)const{
    return Point(x + p.x , y + p.y);
  }

  Point operator - (const Point &p)const{
    return Point(x - p.x , y - p.y);
  }

  Point operator * (const double &k)const{
    return Point(x * k , y * k);
  }

  Point operator / (const double &k)const{
    return Point(x / k , y / k);
  }
  double norm(){
    return x*x + y*y;
  }
  double dot(const Point &p)const{
    return x*p.x + y*p.y;
  }
};
typedef Point Vector;

struct Segment{
  Vector s, t;

  Segment(){}
  Segment(Vector s, Vector t) : s(s), t(t) {}

  Point Projection(Point &p){
    Vector base = t - s;
    double t = (p-s).dot(base) / base.norm();
    return s + base*t;
  }
  Point Reflection(Point &p){
    return p + (Projection(p) - p) * 2.0;
  }
};

int main(){
  Point p1, p2, p3;
  int q;

  std::cin >> p1.x >> p1.y >> p2.x >> p2.y >> q;
  Segment s = Segment(p1, p2);
  for(int i = 0 ; i < q ; i++){
    std::cin >> p3.x >> p3.y;
    Point p = s.Reflection(p3);
    printf("%.10f %.10f\n",p.x ,p.y);
  }

  return 0;
}

Measured memory_bytes: 1248
# Problem E - Crested Ibis vs Monster

# input
H, N = map(int, input().split())
magic_list = []
for i in range(N):
    A, B = map(int, input().split())
    magic_list.append([A, B])

# initialization
dp = [float('INF')]*(H+1)
dp[0] = 0
mg_len = len(magic_list)

# dp
for i in range(1, H+1):
    for j in range(mg_len):
        a = magic_list[j][0]
        b = magic_list[j][1]
        last_p = i - a
        if last_p<0:
            last_p = 0
        tmp = dp[last_p] + b
        dp[i] = min(dp[i], tmp)

# output
print(dp[H])


Measured memory_bytes: 42348
"""
Writer:SPD_9X2
https://atcoder.jp/contests/arc099/tasks/arc099_c

なるべく均等に分けるのが正解
制約を受けるのはv-uの辺が存在しない場合
補グラフで考えると、辺がある2点は同じ側に属してはいけない、という問題になる

→2部グラフにならない連結成分がある場合-1

あとは、連結成分ごとにどちらに属すかを決め、その差を最小化すればよい
→dpで見つけられる！

"""
import sys
N,M = map(int,input().split())

AB = []
olis = [ [1] * N for i in range(N) ]
for i in range(N):
    olis[i][i] = 0

for i in range(M):

    A,B = map(int,input().split())
    A -= 1
    B -= 1
    olis[A][B] = 0
    olis[B][A] = 0

non_visit = [True] * N
state = [None] * N
dif = []
ns = [0,0]

#2部グラフ探索

def dfs(p,nst):

    if non_visit[p]:
        non_visit[p] = False
        state[p] = nst
        ns[nst] += 1
        
        for j in range(N):
            if p!=j and olis[p][j] == 1:
                dfs(j,nst^1)
    
    elif nst != state[p]:
        print (-1)
        sys.exit()

    return;

for i in range(N):

    ns = [0,0]

    if non_visit[i]:
        dfs(i,0)
        #print (i)
        dif.append(abs(ns[0]-ns[1]))

dp = [False] * 1500
dp[0] = True

for i in dif:

    ndp = [False] * 1500

    for j in range(1500):

        if dp[j]:
            ndp[(j-i)%1500] = True
            ndp[(j+i)%1500] = True

    dp = ndp

for i in range(N):

    if dp[i] or dp[-1*i]:

        for j in range(N):

            if abs(N-j - j) == i:
                x = j
                y = N-j

                print (x*(x-1)//2 + y*(y-1)//2)
                sys.exit()
                
    


Measured memory_bytes: 74456
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int mod=1e9+7;
const int M=100009;

inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}
inline int ad(int x,int y){int ret=(x%mod+y%mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline int sub(int x,int y){int ret=((x%mod)-(y%mod)+mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline int gun(int x,int y){int ret=((x%mod)*(y%mod))%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}


 main()

{
    fast
    string s;
    cin>>s;
    map<char,bool>vis;
    string chk="";
    for(char ch='z';ch>='a';ch--)chk+=ch;
    for(char x:s)
    {
       vis[x]=true;
    }
    if(s==chk)
    {
        cout<<"-1"<<endl;
    }
    if(s.size()==26)
    {
        for(int i=25;i>=0;i--)
        {
            int flag=0;
            char ok;
            for(int j=i+1;j<26;j++)
            {
                if(s[j]>s[i])
                {
                    if(flag==0)ok=s[j];
                    else if(s[j]<ok)ok=s[j];
                    flag=1;
                }
            }
            if(flag==1)
            {
                string ses=s.substr(0,i);
                ses+=ok;
                cout<<ses<<endl;
                return 0;
            }
        }
    }
    else
    {
       for(char ch='a';ch<='z';ch++)
       {
           if(vis[ch]!=true)
           {
               s+=ch;
               break;
           }
       }
       cout<<s<<endl;
    }
    return 0;

}





































Measured memory_bytes: 256
N,M=map(int,input().split())
LIST=[0]*(10**5+1)
PLIST=[0]*(10**5+1)

C=0
P=0
for i in range(M):
    A=list(map(str,input().split()))
    if(A[1]=="WA"):
        if(LIST[int(A[0])]==0):
            PLIST[int(A[0])]+=1
    else:
        if(LIST[int(A[0])]==0):
            C+=1
            LIST[int(A[0])]=1

for i in range(len(LIST)):
    P+=LIST[i]*PLIST[i]

print(C,P)


Measured memory_bytes: 51032
using System;
using System.Linq;

class Program
{
    static void Main(string[] args) {
        int[] nk = Console.ReadLine().Split().Select(int.Parse).ToArray();
        long[] h = Console.ReadLine().Split().Select(long.Parse).ToArray();
        Console.WriteLine(dp(nk[0],nk[1],h)[nk[0]-1]);
    }
    static long[] dp(int n, int k, long[] h) {
        long[] dp = new long[n];
        dp[0] = 0;
        for(int i = 1; i < n; i ++) {
            for(int j = 1; j <= Math.Min(k,i); j ++) {
                if(j==1) dp[i] = Math.Abs(h[i]-h[i-j]) + dp[i-j];
                else dp[i] = Math.Min(dp[i],  Math.Abs(h[i]-h[i-j]) + dp[i-j]);
            }
        }
        return dp;
    }
}

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

int main() {
    ll x, y;
    cin >> x >> y;

    int cnt = 0;

    while (x <= y) {
        ++cnt;
        x *= 2;
    }

    cout << cnt << endl;
}

Measured memory_bytes: 3620
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << x << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
int n;
ll a,b;
vector<ll>h;
bool ok(ll t){//t回でできますか
    ll cnt = 0;
    rep(i,n){
        if(h[i]-b*t>0){
            cnt+=(h[i]-t*b+a-b-1)/(a-b);
        }
    }
    return cnt<=t;
}
int main(){
    cin >> n >> a >> b;
    h.resize(n);
    rep(i,n){
        cin >> h[i];
    }
    ll l = 0;
    ll r = 1000000004;
    while(r-l>1){
        ll mid = (l+r)/2;
        if(ok(mid)){
            r = mid;
        }else{
            l = mid;
        }
    }
    cout << r << endl;
    
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1e+7
int main()
{
    string s;
    cin>>s;
    int n=s.size();
    if(s[n-1]=='s')
    {
        s+='e';
        s+='s';
    }
    else{
        s+='s';
    }
    cout<<s<<endl;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	string t;
	cin>>s;
	cin>>t;
	if(s.length()!=t.length())
	{
		cout<<-1;
		return 0;
	}
	int ctr=0;
	for(int i=0;i<s.length();i++)
	{
		if(s[i]!=t[i])
		{
			ctr++;
		}
	}
	cout<<ctr<<endl;
}

Measured memory_bytes: 3824
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <stack>
using namespace std;
int main()
{
    int a,b,i;
    scanf("%d %d",&a,&b);
    for(i=1;i<=20000;i++)
        if(int(i*0.08)==a&&int(i*0.1)==b)
    {
        printf("%d\n",i);
        break;
    }
    if(i==20001)
        cout<<"-1"<<endl;
    return 0;
}


Measured memory_bytes: 256
s=list(input())
k=int(input())

al=list('bcdefghijklmnopqrstuvwxyza')

ans=''
for i in range(len(s)):
    d=25-al.index(s[i])
    if d<=k or s[i]=='a':
        ans+='a'
        k-=d
    else:
        ans+=s[i]
k=k%26
f=al.index(ans[-1])
kai=list(ans)
kai.pop(-1)
ans=''.join(kai)
ans+=al[min(f+k,f+k-26)]
print(ans)

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

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

  if (A + B > C + D) {
    cout << "Left" << endl;
  }
  else if (A + B == C + D){
    cout << "Balanced" << endl;
  }
  else{
	cout << "Right" << endl;
  }
}


Measured memory_bytes: 256
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

class UnionFind {
private:
	unsigned size_; 
	std::vector<unsigned> par, rank;
public:
	UnionFind() : size_(0), par(std::vector<unsigned>()), rank(std::vector<unsigned>()) {};
	UnionFind(unsigned size__) : size_(size__) {
		par.resize(size_); rank.resize(size_);
		for (unsigned i = 0; i < size_; i++) par[i] = i, rank[i] = 0;
	}
	unsigned size() { return size_; }
	//unsigned root(unsigned x) { return par[x] == x ? x : par[x] = root(par[x]); }
	unsigned root(unsigned x)
	{
		while(par[x] != x)
		{
			par[x] = par[par[x]];
			x = par[x];
		}
		return x;
	}
	bool same(unsigned x, unsigned y) { return root(x) == root(y); }
	void unite(unsigned x, unsigned y) {
		x = root(x), y = root(y);
		if (x == y) return;
		if (rank[x] < rank[y]) par[x] = y;
		else if (rank[x] == rank[y]) par[y] = x, rank[x]++;
		else par[y] = x;
	}
	bool operator==(const UnionFind &u) { return par == u.par; }
	bool operator!=(const UnionFind &u) { return par != u.par; }
};

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	int N, M;
	
	cin >> N >> M;
	int ll = 1, rr = N;
	rep(i, M)
	{
		int l,r;
		cin >> l >> r;
		ll = max(ll, l);
		rr = min(rr, r);
	}

	if (ll > rr)
	{
		cout << 0 << endl;
	}
	else
	{
		cout << rr - ll + 1 <<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define ceiling(a,b) (((a)+(b)-1)/(b))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
 
const int maxn=100005;
//i_am_noob
int n;

struct noob{string name; int score,pos;}a[105];
bool comp(noob n1, noob n2){return n1.name!=n2.name?n1.name<n2.name:n1.score>n2.score;}

signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n;
	rep(n) cin >> a[i].name >> a[i].score;
	rep(n) a[i].pos=i+1;
	sort(a,a+n,comp);
	rep(n) print1(a[i].pos);
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

int main(){
    ll n, k;
    cin >> n >> k;
    string s;
    getline(cin, s);
    getline(cin, s);

    ll i = 0;
    ll j = 0;
    ll num = 1;
    ll cur_k = k;
    while(i <= j && i < n - 1){
        if(s.at(i) == '0'){
            cur_k--;
        }
        while(cur_k >= 0 && j < n - 1){
            if(s.at(j) == '1' && s.at(j + 1) == '0'){
                if(cur_k > 0){
                    cur_k--;
                }else{
                    break;
                }
            }
            j++;
        }
        num = max(num, j - i + 1);
        if(cur_k > 0){ break; }
        while(cur_k == 0 && i < j && i < n - 1){
            if(s.at(i) == '0' && s.at(i + 1) == '1'){
                cur_k++;
            }
            i++;
        }
    }
    cout << num << endl;
}


Measured memory_bytes: 512
import sys
input = sys.stdin.readline
U = 1000
MOD = 10**9+7
 
fact = [1]*(U+1)
fact_inv = [1]*(U+1)
 
for i in range(1,U+1):
    fact[i] = (fact[i-1]*i)%MOD
fact_inv[U] = pow(fact[U], MOD-2, MOD)
 
for i in range(U,0,-1):
    fact_inv[i-1] = (fact_inv[i]*i)%MOD

def comb(n, k):
    if k < 0 or k > n:
        return 0
    z = fact[n]
    z *= fact_inv[k]
    z %= MOD
    z *= fact_inv[n-k]
    z %= MOD
    return z

n, k = map(int, input().split())
A = list(map(int, input().split()))
F = [[0]*(n+1) for _ in range(k+1)]
F[0][0] = 1
for i in range(k):
  for j in range(n+1):
    for m in range(j+1):
      F[i+1][j] += comb(j, m) * F[i][m] * comb(n-(j-m), A[i]-(j-m))
    F[i+1][j] %= MOD
ans = F[k][n]
print(ans)

Measured memory_bytes: 50396
//------------------------------------------------------------------------------MANAS UNIYAL---------------------------------------------------------
//                                                                              NEVER GIVE UP
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
#define ll long long
#define pb push_back
#define fi first 
#define se second
#define pii pair<ll,ll>
#define INF 0x3f3f3f3f
#define LINF 98765432123456789
#define testcases() ll t; cin>>t; while(t--)
#define debug1(x) cout<<#x<<" "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define debug4(w,x,y,z) cout<<#w<<" "<<w<<" "<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define rep(i,start,end) for(ll i=start;i<end;i++)
 
//----------------------------------------------------------------------------------------------------------------------------------------------------

int main()
{
	fast;
    int n;
	cin>>n;
	bool flag = false;
	while(n)
	{
		int a = n%10;
		if(a==7)
			flag = true;
		n/=10;
	}
	flag?cout<<"Yes":cout<<"No";
	return 0;
}


Measured memory_bytes: 3652
import sys


size = int(input())
nums = list(map(int, input().split()))

cnt = 0
while True:
    for i in range(0, size):
        if nums[i] % 2 == 0:
            nums[i] = nums[i] / 2
        else:
            print(cnt)
            sys.exit()
            
    # 一周回ったらカウントアップ
    cnt += 1

# まず来ないはずだけど、念のため
print(cnt)

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

int main(void) {
	int a, b, n;
	int i;
	char str[80], out[80];
	
	while (fgets(str, sizeof(str), stdin) != NULL) {
		sscanf(str, "%d %d", &a, &b);
		n = a+b;
		sprintf(out, "%d", n);
		printf("%d\n", strlen(out));
	}
	
	return 0;
}

Measured memory_bytes: 616
n = int(input())
a = list(map(int,input().split()))
q = int(input())
for j in range(q):
  b, e, t = map(int,input().split())
  for k in range(e - b):
      aa = a[b+k]
      a[b+k] = a[t+k]
      a[t+k] = aa
  
print(a[0],end="")
for aa in a[1:]:
  print(" {}".format(aa),end="")
print()



Measured memory_bytes: 5824
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int a,b;
  cin>>a>>b;
  int count=0;
  REP(i,a,b+1){
    if(i%10==i/10000%10 && i/10%10==i/1000%10){
      count++;
    }
  }
  cout<<count<<'\n';
  return(0);
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod  1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/



int main(){
  int N;
  cin >> N;
  vector<int> h(N);
  rep(i, N) cin >> h[i];

  int ans = 0;

  for(int i = 0; i < N; i++){
    int mini = INT_MAX, first = -1, end = -1;
    for(int i = 0; i < N; i++){
      if(h[i] != 0 && first == -1){
	first = i;
      }
      if(h[i] == 0 && first != -1){
	end = i;
	break;
      }
      if(h[i] != 0) mini = min(mini, h[i]);
    }
    if(end == -1) end = N;
    if(first == -1) break;

    for(int i = first; i < end; i++){
      h[i] -= mini;
    }
    ans += mini;
  }
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Math;

class program
{
    static public int mod = 1000000007;
    static void Main()
    {
        var s = rstr();
        int n = s.Length;
        for(int i = 0;i < n/2; i++)
        {
            if(s[i] != s[n - i - 1])
            {
                Write("No");
                return;
            } 
        }
        for (int i = 0; i < n / 4; i++)
        {
            if (s[i] != s[(n/2) - i - 1])
            {
                Write("No");
                return;
            }
            if (s[i + (n/2) + 1] != s[n - i - 1])
            {
                Write("No");
                return;
            }
        }
        Write("Yes");
    }

    static int pow(int a, int b) { string binary = Convert.ToString(b, 2); int bileng = binary.Length; long a_power = a; long value = 1; for (int i = bileng - 1; i >= 0; i--) { if (binary[i] == '1') { value = value * a_power % mod; } a_power = a_power * a_power % mod; } return (int)value; }
    static string rstr() { return ReadLine(); }
    static int rint() { return int.Parse(ReadLine()); }
    static long rlong() { return long.Parse(ReadLine()); }
    static string[] stra() { return ReadLine().Split(' '); }
    static char[] chara() { string[] a = stra(); string b = ""; for (int i = 0; i < a.Length; i++) { b += a[i]; } return b.ToCharArray(); }
    static int[] inta() { string[] read_str_array = ReadLine().Split(' '); int[] return_int_array = new int[read_str_array.Length]; for (int countup_i = 0; countup_i < read_str_array.Length; countup_i++) { return_int_array[countup_i] = int.Parse(read_str_array[countup_i]); } return return_int_array; }
    static long[] longa() { string[] read_str_array = ReadLine().Split(' '); long[] return_long_array = new long[read_str_array.Length]; for (long countup_i = 0; countup_i < read_str_array.Length; countup_i++) { return_long_array[countup_i] = long.Parse(read_str_array[countup_i]); } return return_long_array; }
    static double[] doublea() { string[] read_str_array = ReadLine().Split(' '); double[] return_double_array = new double[read_str_array.Length]; for (long countup_i = 0; countup_i < read_str_array.Length; countup_i++) { return_double_array[countup_i] = double.Parse(read_str_array[countup_i]); } return return_double_array; }
    static long GCD(long a, long b) { if (a < b) { long temp = a; a = b; b = temp; } if (a % b == 0) { return b; } else { long temp = b; b = a % b; a = temp; return GCD(a, b); } }
    static long LCM(long a, long b) { return a * b / GCD(a, b); }
    static void WriteArray2(int[,] a, int b, int c) { for (int i = 0; i < b; i++) { for (int j = 0; j < c; j++) { if (j != 0) Write(" "); Write(a[i, j]); } WriteLine(); } }
    static void WriteArray(int[] a, int b) { for (int i = 0; i < b; i++) { Write(" "); Write(a[i]); } WriteLine(); }
}


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

int main(void){
	int n, a, res = 0;
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> a;
		if(i % 2 == 1 && a % 2 == 1){
			res++;
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
typedef long long LL;
typedef pair<int , int > P;
const int maxn=3005;
const LL INF=1e13+5;

int main()
{
    string arr;
    cin >> arr;
    LL sum=0;
    for(int i=0;i<arr.length();i++)
        sum+=arr[i]-'0';
    if(sum%(1LL*9))
        cout << "No";
    else
        cout << "Yes";

}


Measured memory_bytes: 3752
#include <iostream>
#include <map>
#include <cmath>
#include <algorithm>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <istream>
#include <unordered_set>
#include <unordered_map>
#include <random>
#include <time.h>
#include <chrono>
#include <cstdio>
#include <fstream>
using namespace std;
#define ll long long
#define ld long double
#define all(x) x.begin() , x.end()
#define deb(z) cout << #z << ' ' << z << '\n';
#define pb push_back
const ll N = 2e5 + 4;
ll mn[4 * N] , mx[4 * N];
void upd1(ll v , ll l , ll r , ll i , ll x) {
    if(l + 1 == r) {
        mx[v] = x;
        return;
    }
    ll m = (r + l) / 2;
    if(m > i) {
        upd1(2 * v + 1 , l , m , i , x);
    } else {
        upd1(2 * v + 2 , m , r , i , x);
    }
    mx[v] = max(mx[2 * v + 1] , mx[2 * v + 2]);
}
void upd2(ll v , ll l , ll r , ll i , ll x) {
    if(l + 1 == r) {
        mn[v] = x;
        return;
    }
    ll m = (r + l) / 2;
    if(m > i) {
        upd2(2 * v + 1 , l , m , i , x);
    } else {
        upd2(2 * v + 2 , m , r , i , x);
    }
    mn[v] = min(mn[2 * v + 1] , mn[2 * v + 2]);
}
ll gmx(ll v , ll l , ll r , ll L , ll R) {
    if(l >= L && r <= R) {
        return mx[v];
    }
    if(l >= R || r <= L) {
        return 0;
    }
    ll m = (r + l) / 2;
    return max(gmx(2 * v + 1 , l , m , L , R) , gmx(2 * v + 2 , m , r , L , R));
}
ll gmn(ll v , ll l , ll r , ll L , ll R) {
    if(l >= L && r <= R) {
        return mn[v];
    }
    if(l >= R || r <= L) {
        return 1e9;
    }
    ll m = (r + l) / 2;
    return min(gmn(2 * v + 1 , l , m , L , R) , gmn(2 * v + 2 , m , r , L , R));
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen("test.txt" , "r" , stdin);
    //freopen("jump.out" , "w" , stdout);
    ll n;
    cin >> n;
    vector <ll> p(n);
    for(auto &x : p) {
        cin >> x;
    }
    p.insert(p.begin() , 0);
    p.push_back(0);
    for(int i = 0; i < 4 * N; i++) {
        mx[i] = 0;
        mn[i] = 1e9;
    }
    upd1(0 , 0 , N , 0 , 0);
    upd2(0 , 0 , N , 0 , p.size() - 1);
    vector <ll> left(p.size()) , right(p.size());
    for(int i = 1; i + 1 < p.size(); i++) {
        left[i] = i - gmx(0 , 0 , N , 0 , p[i]);
        upd1(0 , 0 , N , p[i] , i);
    }
    for(int i = p.size() - 2; i >= 1; i--) {
        right[i] = gmn(0 , 0 , N , 0 , p[i]) - i;
        upd2(0 , 0 , N , p[i] , i);
    }
    ll answer = 0;
    for(int i = 1; i + 1 < p.size(); i++) {
        //cout << left[i] << ' ' << right[i] << '\n';
        answer += left[i] * right[i] * p[i];
    }
    cout << answer;
    return 0;
}

Measured memory_bytes: 20512
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
#include <limits>
#include <numeric>
#include <type_traits>
#define int long long
#define ll long long
#define mod  1000000007
#define inf 1e17
#define rep(i,j,n) for(int i=j;i<n;i++)
#define P pair<int,int>
double pi = 3.141592653589793;
using namespace std;
//ここから始めよう
signed main(){
    int n,k;cin>>n>>k;
    int num[114514]={};
    int sum[114514]={};
    vector<int>a;a.push_back(0);
    rep(i,1,n+1){
        cin>>num[i];num[i]%=k;
        sum[i]=(sum[i-1]+num[i])%k;
        a.push_back(sum[i]%k);
    }
    int ans=0;
    sort(a.begin(),a.end());
    int cnt=1;
    rep(i,1,a.size()){
        if(a[i]==a[i-1])cnt++;
        else {
            ans+=cnt*(cnt-1)/2;cnt=1;
        }
    }ans+=cnt*(cnt-1)/2;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3192
import java.util.Scanner;
public class Main {
@SuppressWarnings("resource")
public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int ans=0;
	String buf;
	String buf1[]=new String[3];
	String buf2[]=new String[3];

	buf=sc.next();
	buf1=buf.split("");
	buf=sc.next();
	buf2=buf.split("");
	for(int i=0;i<3;i++) {
		if(buf1[i].equals(buf2[i]))
			ans++;
	}
	System.out.println(ans);
}
}


Measured memory_bytes: 21588
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <cstdio>
typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define max3(x, y, z) max(x, max(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif
using namespace std;
int main() {
  string a;
  cin >> a;
  rep(i, 3) {
    if (a[i] == '1') {
      cout << 9;
    }
    if (a[i] == '9') {
      cout << 1;
    }
  }
}
/*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
for (int i = 0; i < N; i++) {
cin >> list[i];
}
// for文
for (int i = 0; i < N; i++) {
}
//配列
vector<int> list;
list.at(i)
vector<vector<int>> list(10, vector<int>(10));
sort(all(list));
sort(all(list), greater<int>());
//配列の内容表示
dout << "====listの内容====\n";
for (int i = 0; i < N; i++) dout << list[i] << endl;
dout << "====ここまで====\n";
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>


using namespace std;
#define PI acos(-1)
using P =pair<int,int>;

int main(){
    int n,m;
    int wa[105000];
    bool ac[105000];
    int acnum=0;
    int wanum=0;
    rep(i,n){
        wa[i]=0;
        ac[i]=0;
    }
    cin>>n>>m;
    while(m--){
        int a;
        string b;
        cin>>a>>b;
        if(ac[a])continue;
        if(b=="AC"){
            acnum++;
            wanum+=wa[a];
            ac[a]=1;
        }else{
            wa[a]++;
        }
    }
    
    cout<<acnum<<" "<<wanum<<endl;
    }


Measured memory_bytes: 4108
var input = function()
{
  return require('fs').readFileSync('/dev/stdin', 'utf8').split('\n')[1].split(' ').map(Number);
};

var out = function(x)
{
  console.log(x);
  return x;
}

var add =function(a,b)
{
  return a+b;
}

var calc = function(x)
{
  var str = Math.min.apply(null,x) + ' ' + Math.max.apply(null,x) + ' ' + x.reduce(add);
  out(str);
  return str;
};

calc(input());

Measured memory_bytes: 9832
K,N = map(int,input().split())
A_str = input().split()
A = [int(h) for h in A_str]
D = []
for i in range(1,N):
  D.append(A[i]-A[i-1])
D.append(A[0]+(K-A[N-1]))
maximum = max(D)
print(K-maximum)

Measured memory_bytes: 27980
#include <stdio.h>

int main(){
  int a, b, c, max = 0;
  
  scanf("%d%d%d", &a, &b, &c);
  
  if(a + b == c || a + c == b || b + c == a){
    printf("Yes");
  }else{
    printf("No");
  }
  return 0;
}

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

vector<int> p;

bool isPrime(const int n) {
    for(int i = 0; i < (int)p.size(); i++) {
        if(n%p[i]==0) return false;
    }
    return true;
}

int main() {
    int n,a,ans;
    cin >> n;
    vector<int> v(5,0);
    for(int i = 2; i <= n; i++) {
        if (isPrime(i)) {
            a = 0;
            for(int j = i; n / j > 0; j *= i) {
                a += n / j;
            }
            p.push_back(i);
            if (a >= 2) v[0]++;
            if (a >= 4) v[1]++;
            if (a >= 14) v[2]++;
            if (a >= 24) v[3]++;
            if (a >= 74) v[4]++;
        }
    }
    ans =   v[1] * (v[1] - 1) / 2 * (v[0] - 2)
          + v[2] * (v[1] - 1)
          + v[3] * (v[0] - 1)
          + v[4];
    cout << ans << endl;
    return 0;
}

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

int main(){
    int n;
    cin>>n;
    int a[n];
    int ans=0;
    for(int i=0;i<n;i++){
       cin>>a[i];
       if(i%2==0){
           if(a[i]%2 !=0){
               ans++;
           }
       }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3640
package main

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

func main() {
	k := readInt()

	ans := 0
	for i := 1; i <= k; i++ {
		for j := 1; j <= k; j++ {
			for l := 1; l <= k; l++ {
				ans += gcd(i, gcd(j, l))
			}
		}
	}

	fmt.Println(ans)
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

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

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	log.SetFlags(log.Lshortfile)
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 1776
#include <iostream>
#include <algorithm>
#include <deque>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
#include <string>
#include <iostream>
using namespace std;
int main() {
    int a; int b;
    cin >> a >> b;
    if (a % b == 0) { cout << a / b; }
    else { cout << a / b + 1; }

	return 0;
}

  

Measured memory_bytes: 256