akhauriyash/Code-Regression huggingface dataset:
// //AUTHOR:BlackBox Inc.//
	// #include<bits/stdc++.h>
	// #include<unordered_map>
	// #include<tr1/unordered_map>
	// #define ll long long
	// #define ull unsigned long long
	// #define vi vector<int>
	// #define vlli vector<long long int>
	// #define vvi vector<vector<int>>
	// #define vpii vector<pair<int,int>>
	// #define vs vector<string>
	// #define lin1(x) ll int x; x = scan();
	// #define lin2(x,y) ll int x, y; x = scan(), y = scan();
	// #define lin3(x,y,z) ll int x, y, z; x = scan(), y = scan(), z = scan();
	// #define pb(x) push_back(x)
	// #define makep(x,y) make_pair(x,y)
	// #define mx(a,b) (a)>(b)?(a):(b)
	// #define mn(a,b) (a)<(b)?(a):(b)
	// #define fori(s,e) for(i=s;i<=e;i++)
	// #define forj(s,e) for(j=s;j<=e;j++)
	// #define fork(s,e) for(k=s;k<=e;k++)
	// #define rep(i,s,e) for(int i=s;i<=e;i++)
	// #define brep(i,s,e) for(int i=s;i>=e;i--)
	// #define all(x) x.begin(),x.end()
	// #define mem(x,y) memset(x,y,sizeof(x));
	// #define bits1(x) __builtin_popcount(x)
	// #define pi 3.14159265358979323846264338327950
	// #define MOD7 1000000007
	// #define MOD9 1000000009
	// #define fast std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
	// using namespace std;
	// using namespace std::tr1;

	// int main()
	// {
	// #ifdef RAHUL
	//     freopen("input.txt","r",stdin);
	// #endif


	// ll a, b;
	// cin>>a>>b;

	// ll arr[b];
	// ll sum=0;
	// for (int i = 0; i < b; ++i)
	// {
	// 	/* code */
	// 	cin>>arr[i];
	// 	sum+=arr[i];
	// }

	// if(a-sum<0){
	// 	cout<<"-1"<<endl;
	// }
	// else{
	// 	cout<<a-sum<<endl;
	// }

	// return 0;
	// }
//AUTHOR:BlackBox Inc.//
#include<bits/stdc++.h>
#include<unordered_map>
#include<tr1/unordered_map>
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vlli vector<long long int>
#define vvi vector<vector<int>>
#define vpii vector<pair<int,int>>
#define vs vector<string>
#define lin1(x) ll int x; x = scan();
#define lin2(x,y) ll int x, y; x = scan(), y = scan();
#define lin3(x,y,z) ll int x, y, z; x = scan(), y = scan(), z = scan();
#define pb(x) push_back(x)
#define makep(x,y) make_pair(x,y)
#define mx(a,b) (a)>(b)?(a):(b)
#define mn(a,b) (a)<(b)?(a):(b)
#define fori(s,e) for(i=s;i<=e;i++)
#define forj(s,e) for(j=s;j<=e;j++)
#define fork(s,e) for(k=s;k<=e;k++)
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define brep(i,s,e) for(int i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x));
#define bits1(x) __builtin_popcount(x)
#define pi 3.14159265358979323846264338327950
#define MOD7 1000000007
#define MOD9 1000000009
#define fast std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
using namespace std::tr1;

int main()
{
#ifdef RAHUL
    freopen("input.txt","r",stdin);
#endif


int t;
cin>>t;
double rahul;
rahul=2*pi*t;
std :: cout << std :: setprecision (20)<< std :: fixed << rahul << std :: endl ;
return 0;
}

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

int main(void){
  int N;
  cin>>N;
  for(int i=1;i<=9;i++){
    if(N%i==0 & (N/i)<=9){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int a[100100],b[100010];
int main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		b[a[i]-1]=i+1;
	}
	for(int i=0;i<n;i++)
	cout<<b[i]<<' '; 
 } 

Measured memory_bytes: 1536
#include <stdio.h>
#include <string.h>

int main(void){
	char s[105];
	scanf("%[^\n]", s);
#ifdef DEBUG
printf("%d\n", strlen(s));
#endif
	int min = 114514;
	for(char a = 'a'; a <= 'z'; a++){
		int count = 0;
		int max = 0;
		for(int i = strlen(s)-1; i >= 0; i--){
			if(s[i] == a){
				if(max < count){
					max = count;
				}
				count = 0;
			}
			else count++;
		}
		if(max < count){
			max = count;
		}
		if(min > max){
			min = max;
		}
	}
	printf("%d\n", min);
	return 0;
}

Measured memory_bytes: 128
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF (1LL<<60)
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
#define MSB(x) (63-__builtin_clzll(x))
#define pcnt(x) (__builtin_popcountll(x))
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n;
  cin >> n;

  vector<int> a(n);
  REP(i,n) cin >> a[i];
  
  int sum = accumulate(a.begin(),a.end(),0LL), ans = sum, now = sum;
  REP(i,n){
    now -= a[i];
    ans = min(ans,abs(now-(sum-now)));
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1792
import bisect
import math
from queue import Queue
import sys
from copy import copy, deepcopy
from collections import defaultdict, Counter, deque
from itertools import combinations, permutations
from heapq import heapify, heappop, heappush

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


inf = float("inf")

def main():

    H, W = map(int, readline().split())
    S = [[s for s in input()] for h in range(H)]
    
    ret = 0
    
    delta = [(-1, 0), (1, 0), (0, -1), (0, 1)]
    
    
    
    for h in range(H):
        for w in range(W):
            if S[h][w] == '.':
                tmp_ret = 0
                maze = deepcopy(S)
                maze[h][w] = tmp_ret
                
                q1 = Queue()
                q1.put((h, w))
                
                q2 = Queue()
                
                while not (q1.empty() and q2.empty()):
                    while not q1.empty():
                        h, w = q1.get()
                        for dh, dw in delta:
                            if h + dh < H and h + dh >= 0 \
                            and w + dw < W and w + dw >= 0 \
                            and maze[h + dh][w + dw] == '.':
                                maze[h + dh][w + dw] = tmp_ret
                                q2.put((h + dh, w + dw))

                    if not q2.empty():
                        q1 = q2
                        q2 = Queue()
                        tmp_ret += 1
                        
                ret = max(ret, tmp_ret)
    
    print(ret)


if __name__ == "__main__":
    main()

Measured memory_bytes: 4080
import java.util.ArrayDeque;
import java.util.Scanner;

import static java.lang.Integer.parseInt;

import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String symbol;
        ArrayDeque<Integer> stack = new ArrayDeque<Integer>();

        while (sc.hasNext()) {
            symbol = sc.next();

            if (symbol.equals("+")) {
                stack.push(stack.pop() + stack.pop());
            } else if (symbol.equals("-")) {
                stack.push((stack.pop() * -1) + stack.pop());
            } else if (symbol.equals("*")) {
                stack.push(stack.pop() * stack.pop());
            } else {
                stack.push(Integer.parseInt(symbol));
            }
        }
        System.out.println(stack.pop());
    }
}


Measured memory_bytes: 26188
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<pair<long long,long long>>A(N);
  for(int i=0;i<N;i++){
    cin>>A.at(i).second>>A.at(i).first;
  }
  sort(A.begin(),A.end());
  long long sum=0;
  bool flag=true;
  for(int i=0;i<N;i++){
    sum=sum+A.at(i).second;
    if(sum>A.at(i).first){
      flag=false;
      break;
    }
  }
  if(flag==true){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define pb push_back
#define f first
#define s second
#define fast_cin ios_base::sync_with_stdio(false);cin.tie(NULL);
#define precise fixed(cout);cout<<setprecision(16);
using namespace std;

ostream& operator << (ostream &out, vector<int> &v) { for(auto a:v) out << a<<" "; out<<endl; }

int main()
{
  int A,B;
  cin >> A >> B;
  priority_queue < ll, std::vector<ll>, std::less<ll> > mxheap;	// mxheap.push(), mxheap.top(), mxheap.pop()
  mxheap.push(A);
  mxheap.push(B);
  int res=0;
  for(int i=0;i<2;i++){
    int u=mxheap.top();
    mxheap.pop();
    res+=u;
    mxheap.push(u-1);
  }
  cout <<res<<endl;
}


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

int main(){
  ll x;
  cin >> x;
  ll X=100;
  ll count=0;
  while(x>X){
   X*=1.01; 
   count++;
  }
  
  cout << count << endl;
  
}
  
  


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

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

using ll = long long;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;
const ll mod = 1000000007LL;

int main() {
  string S;
  cin>>S;
  reverse(S.begin(),S.end());
  int l = S.size();
  int ans = 0;
  int over = 0;
  for(int i = 0; i < l; i++){
    int t = S[i]-'0';
    t+=over;
    over = 0;
    if(t>=10) {
      t-=10;
      over = 1;
    }
    if(t<=4) ans += t;
    if(t==5){
      int s;
      if(i!=l-1) s = S[i+1]-'0';
      if(i==l-1||s<=4) ans+=t;
      else if(s>=5) {
        ans+=(10-t);
        over=1;
      }
    }
    if(t>=6) {
      ans += (10-t);
      over = 1;
    }
    if(i==l-1&&over!=0) ans+=over;
  }
  cout<<ans<<endl;
}

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

int main(){

	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif

	ios::sync_with_stdio(false),cin.tie(0);

	int H; int W; int K; cin >> H >> W >> K;

	char tab[H][W];
	int nb = 0;

	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			cin >> tab[i][j];
			if(tab[i][j] == '#') nb++;
		}
	}
	int col[W];
	for(int i=0;i<W;i++) col[i] = 0;
	int row[H];
	for(int i=0;i<H;i++) row[i] = 0;

	for(int i=0;i<H;i++){
		for(int j=0;j<W;j++){
			if(tab[i][j]=='#') {
				row[i]++;
				col[j]++;
			}
		}
	}
	int ans = 0;

	int m = 0;
	while(m<(1 << H+W)){
		int kk = nb;
		for(int i=0;i<H;i++){
			if((1<<i)&m){
				kk -= row[i];
			}
		}
		for(int j=H;j<H+W;j++){
			if((1<<j)&m){
				kk -= col[j-H];
			
			for(int l=0;l<H;l++){
				if((1<<l)&m && tab[l][j-H] == '#'){
					kk += 1;
				}
			}
			}
		}		
		if(kk==K) ans++;
		m++;
	}



	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
long long a, b, c; 
long long p,i;
int main()
{
	while (~scanf("%lld", &a))
	{
		p = 1;
		for (i = 1; i <= a; i++)
		{
			p = (p*i) % 1000000007;
		}
		printf("%d\n", p);
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
typedef long long ll;
ll ean=0; 

ll a[12345];
int main(){
	 int n;
	 cin>>n;
	 int sum=0;
	 for(int i=1;i<=n;i++)cin>>a[i];
	 for(int i=1;i<=n;i++){
	 	for(int j=i+1;j<=n;j++){
	 		for(int k=j+1;k<=n;k++){
	 			if((a[i]!=a[j])&&(a[i]!=a[k])&&(a[j]!=a[k]))
	 			if((a[i]+a[j]>a[k])&&(a[j]+a[k]>a[i])&&(a[i]+a[k]>a[j]))sum++;
			 }
		 }
	 }
	 cout<<sum<<endl;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long n,x,i,j,k,cnt=0;
    cin>>n>>x;
    long long a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    if(a[0]>x)
	 {
	 	cnt+=a[0]-x;
	 	a[0]=x;
	 }
    for(i=1;i<n;i++)
    {
        if(a[i-1]+a[i]>x)
        {
            cnt+=a[i-1]+a[i]-x;
            a[i]-=(a[i-1]+a[i]-x);
        }
    }
    cout<<cnt<<endl;

}


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

int main()
{
  string s;
  cin>>s;
  if(s[0]!=s[1] && s[1]!=s[2] && s[2]!=s[3]){
    cout<<"Good"<<endl;
    }
    else cout<<"Bad"<<endl;
    
    return 0;
}
  

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int n,k,ans=1 ;
    scanf ("%d%d",&n,&k) ;
    for (int i=0; i<n; i++) {
        if (ans<k) {
            ans*=2 ;
        } else {
            ans+=k ;
        }
    }
    printf ("%d\n",ans) ;
    return 0 ;
}

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

const int N = 1e5 + 1;

#define int long long

int dp[403][403];
int n, a[401], pr[401];

main()
{
	cin >> n;
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	
	for(int i = 1; i <= n; i++)
		pr[i] = pr[i - 1] + a[i];
	
	for(int i = 1; i < n; i++)
		dp[i][i + 1] = a[i] + a[i + 1];
	
	for(int len = 3; len <= n; len++)
	{
		for(int l = 1; l + len - 1 <= n; l++)
		{
			int rr = l + len - 1;
			dp[l][rr] = 1e15;
			for(int r = l; r <= l + len - 1; r++)
			{
				int sz1 = pr[rr] - pr[r];
				int sz2 = pr[r] - pr[l - 1];
				dp[l][rr] = min(dp[l][rr], dp[l][r] + sz2 + dp[r + 1][rr] + sz1);
			}
		}
	}
	
	cout << dp[1][n] << endl;
}


Measured memory_bytes: 1536
#include <stdio.h>

int main(void){
    char s[11];
    int max, head, pointer, length;

    scanf("%s", s);

    head = 0;
    max = 0;
    while(s[head] != '\0'){
        pointer = head;
        length = 0;

        while(s[pointer] == 'A' || s[pointer] == 'C' || s[pointer] == 'G' || s[pointer] == 'T'){
            length++;
            pointer++;
        }
        if(length > max){
            max = length;
        }
        head++;
    }

    printf("%d\n", max);

    return 0;
}

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

int main(){
    long int a, b;
    cin>>a>>b;
    cout<<(a/b)<<' '<<(a%b)<<' '<< fixed << setprecision(5)<<(static_cast<double>(a)/b)<<endl;
    return 0;
}


Measured memory_bytes: 3228
#include <bits/stdc++.h>
#define fr(a, b, c) for(int a = b, __ = c; a < __; ++a)
#define dbg(x) cerr << ">>>> " << x << endl;
#define _ << " , " <<

using namespace std;
typedef pair<int, int> ii;

map<ii, int> res;

const int mv = 2e5 + 20;
int rt1[mv], rt2[mv];


void init(int n){
	fr(i, 0, n){
		rt1[i] = i;
		rt2[i] = i;
	}
}

int root(int *rt, int i){
	if(rt[i] == i)
		return i;
	else 
		return rt[i] = root(rt, rt[i]);
}

void conn(int *rt, int i, int j){
	int pi = root(rt, i), pj = root(rt, j);
	if(pi == pj)
		return;

	rt[pi] = pj;
}


int main(){
	ios::sync_with_stdio(0);
	int n, k, l;
	cin >> n >> k >> l;

	init(n);

	fr(i, 0, k){
		int a, b;
		cin >> a >> b;
		--a, --b;
		conn(rt1, a, b);
	}

	fr(i, 0, l){
		int a, b;
		cin >> a >> b;
		--a, --b;
		conn(rt2, a, b);
	}

	fr(i, 0, n){
		res[ii(root(rt1, i), root(rt2, i))]++;
	}

	fr(i, 0, n){
		if(i)
			cout << " ";
		cout << res[ii(root(rt1, i), root(rt2, i))];
	}
	cout << endl;
	return 0;
}


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

vector<int> edge[100010];

int dfs(int from, int par) {
	int ret = 0, no = 0;
	for(int to : edge[from]) {
		if(to == par) continue;
		int d = dfs(to, from);
		ret += d;
		if(d == 0) {
			++no;
		}
	}
	ret += max(0, no - 1);
	return ret;
}

int main() {
	int n; cin >> n;
	for(int i = 0; i < n - 1; ++i) {
		int a, b; cin >> a >> b;
		edge[a].push_back(b);
		edge[b].push_back(a);
	}
	int root = 0;
	{
		int maxi = 0;
		for(int i = 0; i < n; ++i) {
			int sz = edge[i].size();
			if(sz > maxi) {
				root = i;
				maxi = sz;
			}
		}
		if(maxi <= 2) {
			cout << 1 << '\n';
			return 0;
		}
	}
	cout << dfs(root, -1) << '\n';
	return 0;
}


Measured memory_bytes: 13784
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a%b); }

const int MAXN=200;
const int MAXX=100000;
const int MOD=1000000007;
void inc(int &a,int b) { if((a+=b)>=MOD) a-=MOD; }

int n,sx;
int a[MAXN];

int ways[MAXN+1][MAXX+1];


int solve() {
	sort(a,a+n); reverse(a,a+n);
	memset(ways,0,sizeof(ways)); ways[0][sx]=1;
	REP(i,n) REPE(x,sx) if(ways[i][x]!=0) {
		inc(ways[i+1][x],(ll)(n-i-1)*ways[i][x]%MOD);
		inc(ways[i+1][x%a[i]],ways[i][x]);
	}
	int ret=0; REPE(x,sx) inc(ret,(ll)x*ways[n][x]%MOD); return ret;
}

void run() {
	scanf("%d%d",&n,&sx);
	REP(i,n) scanf("%d",&a[i]);
	printf("%d\n",solve());
}

int main() {
	run();
	return 0;
}

Measured memory_bytes: 78720
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
long long mod = 1e9+7;
const int maxn=2e5+7;
typedef vector<map<char,int>> vmap;

void insertstring(string s,vmap &trie){
    int cc,cn=0;

    for(int i=0;i<s.length();i++){
        char cc = s[i];
        if(trie[cn].count(cc)){
            cn = trie[cn][cc];
        }
        else{
            trie.resize(trie.size()+1);
            trie[cn][cc] = trie.size()-1;
            cn = trie.size()-1;
        }
    }
}

string dfs(vmap trie,int &k,int x){
    if(k==0) return "";
    map<char,int> br = trie[x];
    string tmp="";
    for(auto i:br){
        tmp = i.first + dfs(trie,--k,i.second);
        if(k==0){
            return tmp;
        }
    }
    return tmp;
}

int main(){
    int k,k1;
    string s;
    cin>>s>>k;
    k1=k;
    vmap trie(1);
    
    for(int i=0;i<26;i++){
        for(int j=0;j<s.length();j++){
            if(s[j]-'a' == i){
                insertstring(s.substr(j),trie);                
            }            
        }
        string ans = dfs(trie,k,0);
        if(k==0){
            cout<<ans;
            break;
        }
        else k=k1;
    }

    

}

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

#define REP(i,n) for(int i = 0; i < (n); ++i)
#define REP1(i,n) for(int i = 1; i <= (n); ++i)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; --i)
#define ALL(a) begin(a), end(a)
#define MP(a,b) make_pair((a), (b))
#define ROUNDUP(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))
#define X first
#define Y second
#define DEBUG(a) cout << #a << ": " << a << "\n"
// #define DEBUG(a) {}

using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;

constexpr int MOD = 1e9 + 7;
constexpr int INF = 1e9 + 1;
constexpr ll LLINF = 4 * 1e18 + 1;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

template<typename T>
T debug(T x) {
	DEBUG(x);
	return x;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, k;
	cin >> n >> k;
	ll ans = 0;
	if(k == 0){
		cout << (ll)n * n << "\n";
		return 0;
	}
	for(int b = k + 1; b <= n; ++b){
		ans += n / b * (b - k) + max(0, n % b - k + 1);
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep0(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep1(i,n) for(long long i=1;i<=(long long)(n);i++)
#define all(v) v.begin(),v.end()
#define Sort(v) sort(all(v))
#define Reverse(v) reverse(all(v))
#define Rsort(v) sort(all(v),greater)
#define pub(v) push_back(v)
#define pob(v) pop_back(v)
typedef long long ll;
typedef vector<ll> vel;
typedef vector<vector<ll>> vel2d;
typedef string str;
typedef pair<ll,ll> pal;
typedef vector<str> ves;
typedef vector<char> vech;


int main() {
    ll A,B,ans=0; cin>>A>>B;
    for(ll i=A;i<=B;i++){
        str s=to_string(i),t="00000";
        rep0(i,5){t[i]=s[4-i];}
        //cout<<s<<endl;
        //cout<<t<<endl;
        if(s==t){ans++;}
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
use std::io;
use std::str::FromStr;

type Point = (i32, i32, i32);

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn input_tuple() -> (i32, i32, i32) {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    let vec: Vec<i32> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();
    (vec[0], vec[1], vec[2])
}

fn solve(x: i32, y: i32, points: &Vec<Point>) -> i32 {
    let mut height = -1i32;
    for i in 0..points.len() {
        if points[i].2 != 0 {
            height = (x - points[i].0).abs() + (y - points[i].1).abs() + points[i].2;
        }
    }
    if height == -1i32 {
        return -1;
    }

    for point in points {
        if point.2 == 0 {
            if height - (x - point.0).abs() - (y - point.1).abs() > 0 {
                return -1;
            } else {
                continue;
            }            
        }
        if (x - point.0).abs() + (y - point.1).abs() + point.2 != height {
            return -1;
        }
    }
    height
}

fn main() {
    let n: i32 = input();
    let mut points: Vec<Point> = Vec::new();
    for _ in 0..n {
        let point = input_tuple();
        points.push(point);
    }
    for i in 0..101 {
        for j in 0..101 {
            let ans = solve(i, j, &points);
            if ans != -1 {
                println!("{} {} {}", i, j, ans);
                return;
            }
        }
    }
}


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

int main() {
  int N;
  string S;
  cin >> N >> S;
  int A = N;
  for(int i = 0; i < N - 1; i++){
    if(S.at(i) == S.at(i + 1))
      A--;
  }
  cout << A << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vstr=vector<string>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define _GLIBCXX_DEBUG
int main()
{
    string s;
    cin>>s;
    int d=s.size();
    int sum=0;
    if(d%2){
        rep(i,(d-1)/2){
            if(s[i]!=s[d-i-1])sum++;
        }
    }
    else{
        rep(i,d/2){
            if(s[i]!=s[d-i-1])sum++;
        }
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(k,i,n) for(long long i=k;i<n;++i)
typedef long long ll;
using namespace std;
int main(void){
    // Your code here!
    int N,ans=0;
    cin>>N;
    int A[N][N][2],a[N];
    rep(0,i,N){
        cin>>a[i];
        rep(0,j,a[i])cin>>A[i][j][0]>>A[i][j][1];
    }
    for (int bit = 0; bit < (1<<N); ++bit) {
        int S[N];
        int c=0;
        bool T=true;
        for (int i = 0; i < N; ++i) {
            if (bit & (1<<i)) { // i が bit に入るかどうか
                S[i]=1;
                ++c;
            }else{
                S[i]=0;
            }
        }
        for (int i = 0; i < N; ++i) {
            if(S[i]==1)rep(0,j,a[i]){
                if(S[A[i][j][0]-1]!=A[i][j][1])T=false;
            }
        }
        if(T==true)ans=max(c,ans);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(S: str):
    stack = []
    N = len(S)
    for i, s in enumerate(S):
        if i == 0:
            stack.append(s)
        else:
            if len(stack) == 0:
                stack.append(s)
            else:
                if s != stack[-1]:
                    tmp = stack.pop()
                else:
                    stack.append(s)
    print(N - len(stack))

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    S = str(input())
    solve(S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3956
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;

string solve(string s) {
  vector<bool> cnt(26,false);
  REP(i,s.length()) {
    cnt[s[i]-'a'] = true;
  }
  REP(i,26) {
    if(!cnt[i]) {
      char c = 'a'+ i;
      s += c;
      break;
    }
  }
  return s;
}

string solve26(string s) {
  for(int i = 24; i >= 0; i--) {
    string s1 = s.substr(0,i);
    string s2 = s.substr(i);
    char c = s[0];
    sort(s2.begin(),s2.end());
    REP(j,s2.length()) {
      if(s1 + s2[j] > s) return	s1+s2[j];
    }
  }
  return "-1";
}

int main() {
  string s;
  while(cin >> s) {
  string ans = "-1";
  if(s == "zyxwvutsrqponmlkjihgfedcba") ;
  else if(s.length() == 26) {
    ans = solve26(s);
  } else {
    ans = solve(s);
  }
  //  cout << s << endl;                                                                
  cout << ans << endl;
  //  cout << endl;                                                                     
}
  return 0;
}


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

int main(void){
    int n, b;
    vector<int> v;
    cin >> n;
    for(int i = 0;i<n;i++){
        cin >> b;
        v.push_back(b);
    }
    sort(v.begin(), v.end());
    b = 0;
    for(int a : v) b += a;
    b -= v.back() / 2;
    cout << b << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[30];
int main()
{
	std::ios::sync_with_stdio(false);
	string s;
	cin>>s;
	int n=s.size();
	for(int i=0;i<n;i++)
	{
		if(!a[s[i]-'a'+1]) a[s[i]-'a'+1]++;
	}
	for(int i=1;i<=26;i++)
	{
		if(!a[i])
		{
			cout<<char(i+'a'-1)<<endl;
			return 0;
		}
	}
	cout<<"None"<<endl; 
	return 0;
}


Measured memory_bytes: 512
//#include <bits/stdc++.h>
#include <utility>
#include <math.h>
#include <string.h>
#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 <queue>
#include <bitset>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> point;
#define F first
#define S second



int main()
{
	#ifdef DGC
		//freopen("a.txt", "r", stdin);
	#endif
	ios_base::sync_with_stdio(0), cin.tie(0);

	int n;
	cin >> n;
	if (n == 7 || n == 5 || n == 3)
		cout << "YES\n";
	else
		cout << "NO\n";

	return 0;
}


Measured memory_bytes: 256
//21171_somesh || asomesh999

#include<bits/stdc++.h>
using namespace std;
#define fr(i,a,b) for(long long i=a;i<b;i++)
#define io ios::sync_with_stdio(false);cin.tie(NULL);
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
long int mod=1000000007;

int main()
{
	io
	#ifdef CODE
		clock_t startTime = clock();
		freopen("input.txt","r",stdin);
	#endif

	ll n;
	cin >> n;
	ll sum = 0;
	fr(i, 1, n + 1) {
		fr(j, 1, n + 1) {
			fr(k, 1, n + 1) {
				ll g = __gcd(i, j);
				g = __gcd(g, k);
				sum += g;
			}
		}
	}
	cout << sum;

	#ifdef CODE
		cerr << endl <<setprecision(20)<< double( clock() - startTime ) / (double)CLOCKS_PER_SEC<< " seconds." << endl;
	#endif
	return 0;
}

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

using namespace std;

typedef long long ll;
const ll inf = 0x3f3f3f3f;
#define case(i) "Case #" << i << ": "
 
template <typename S, typename T>
ostream& operator<<(ostream& out, pair<S, T> const& p) {
    out << '(' << p.first << ", " << p.second << ')';
    return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> const& v) {
    ll l = v.size();
    for (ll i = 0; i < l - 1; i++) out << v[i] << ' ';
    if (l > 0) out << v[l - 1];
    return out;
}

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

    int n;
    cin >> n;
    set<int> st;
    for(int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        st.insert(x);
    }

    if(st.size() == n) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 9600
res = 0
while True:
    try:
        cc = list(input())
        if not len(cc):
            break
    except:
        break
    l = len(cc)
    if l == 1:
        res += 1
    elif l % 2 == 0:
        if cc[:l // 2] == cc[:l // 2 - 1:-1]:
            res += 1
    else:
        if cc[:(l + 1) // 2] == cc[:(l - 1) // 2 - 1:-1]:
            res += 1
print(res)

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

int main(){
    int a = 0, b = 0, c = 0, sum = 0, count = 0;
    cin >> a >> b >> c >> sum;
    for ( int i = 0; i <= a; i++ ){
        for ( int j = 0; j <= b; j++ ){
            for ( int k = 0; k <= c; k++ ){
                if ( 500 * i + 100 * j + 50 * k == sum )
                    count++;
            }
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#define rep(i,n) for (int i = 0; i < n; i++)
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const ll INF = 1e18;


int main() {
	string s, t; cin >> s >> t;
	vector<vector<int>> dp(s.size() + 1);
	rep(i, s.size() + 1) {
		dp[i].resize(t.size() + 1, 0);
	}
	rep(i, s.size()) {
		rep(j, t.size()) {
			if (s[i] == t[j]) dp[i + 1][j + 1] = dp[i][j] + 1;
			else dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
		}
	}
	string ans = "";
	int x = s.size(), y = t.size();
	while (x > 0 && y > 0) {
		if (dp[x][y] == dp[x - 1][y]) {
			x--;
		}
		else if (dp[x][y] == dp[x][y - 1]) {
			y--;
		}
		else {
			x--; y--;
			ans = s[x] + ans;
		}
	}
	cout << ans << endl;
	return 0;
}

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

typedef long long ll;

int main() {
    string S;
    cin >> S;
    if (S == "RRR") cout << "3\n";
    else if (S == "SSS") cout << "0\n";
    else if (S == "RRS" || S == "SRR") cout << "2\n";
    else cout << "1\n";
}

Measured memory_bytes: 3616
package main

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

func hit(cnt, hp int) int {
	if hp <= 1 {
		return cnt + hp
	}
	return 1 + hit(cnt, hp/2)*2
}

func main() {
	sc.Split(bufio.ScanWords)
	h := nextInt()
	puts(hit(0, h))
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(i=a;i<n;++i)
#define irep(i,n,a) for(i=n;i>a;--i)
#define mod 1000000007
#define pb push_back
#define big 9223372036854775807
#define big1 LONG_MAX
#define big2 ll_MAX
#define big3 1000000000
#define sma1 LONG_MIN
#define sma2 ll_MIN
#define sma3 -1000000000
#define mp make_pair
#define dub double
#define ivec vector<ll>
#define lvec vector<long long>
#define cvec vector<char>
#define svec vector<string>
#define mt make_tuple
#define MOD 998244353
#define pi acos(-1.0)/*
#define ss second.second
#define ff first.first
#define f first
#define s second
#define sf second.first
#define fs first.second*/
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

ll N,M,X,ans=big;
ll a[13][13],c[13];


void solve(ll p,ll *send,ll cos)
{
    if(p>N)
        return;

    ll i,s2[13]={0};

    for(i=1;i<=M;++i)
    {
        s2[i]=a[p][i]+send[i];
    }

    for(i=1;i<=M;++i)
    {
        if(s2[i]<X)
            break;
    }

    if(i>M)
        ans = min(ans,cos+c[p]);

    solve(p+1,s2,cos+c[p]);
    solve(p+1,send,cos);

}


int main()
{

    ll i,j;

    cin>>N>>M>>X;

    for(i=1;i<=N;++i)
    {
        cin>>c[i];
        for(j=1;j<=M;++j)
            cin>>a[i][j];
    }

    ll send[13]={0};

    solve(1,send,0);


    if(ans==big)
        cout<<-1;
    else
        cout<<ans;

    return 0;
}

Measured memory_bytes: 3504
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl

#define all(x) x.begin(),x.end()
typedef pair<int,int> P;
typedef pair<int,P> PP;

int n,t;
int a[100005];
int saitei;
int M;int mc;
int main()
{
	cin>>n>>t;
	rep(i,n)
	{
		cin>>a[i];
	}
	rep(i,n)
	{
		if(i==0)
		{
			M=0;
			mc=0;
			saitei=a[i];
		}
		else saitei=min(saitei,a[i]);
		if(a[i]-saitei>M)
		{
			M=a[i]-saitei;
			mc=1;
		}
		else if(a[i]-saitei==M)mc++;
	}
	cout<<mc<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>

using namespace std;

int main(){
  char c, ch;
  int cnt[26] = { };

  while(cin >> ch){
    if(!('A' <= ch && ch <= 'Z' || 'a' <= ch && ch <= 'z')){ continue; }
    if('A' <= ch && ch <= 'Z'){
      ch = ch - 'A' + 'a';
    }
    cnt[ch-'a']++;
  }

  for(int i = 0; i < 26; i++){
    c = 'a' + i;
    cout << c << " : " << cnt[i] << endl;
  }

  return 0;
}



Measured memory_bytes: 3068
x = int(input())
t = 7
amari = 0
flag = 0

for i in range(x):
    if t%x == 0:
        print(i+1)
        flag = 1
        break
    else:
        amari = t%x
        t = 7+(amari*10)


if flag == 0:
    print(-1)


Measured memory_bytes: 9060
#include<bits/stdc++.h>
#define LL long long
#define MOD 1000000007

using namespace std;

int main()
{
	ios_base::sync_with_stdio(0);
  	cin.tie(0);
  	cout.tie(0);
  	string a;
  	cin>>a;
  if(a.compare("ABC")==0)
    cout<<"ARC";
  else
    cout<<"ABC";
return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<queue>
#include<utility>
#include<stdio.h>
using namespace std;
typedef pair<int,int> P;
int main(){
  const int INF=(1<<29);
  int min[1010],fix[1010];
  int map[1010][1010];
  int s1; 
  int n,m,i,j,x,y,z,count=0; 
  priority_queue<P,vector<P>,greater<P> > que; 
  scanf("%d\n",&n);
  for(i=0;i<=n;i++){
    min[i]=INF,fix[i]=0;
  }
  for(i=0;i<=n;i++){
    for(j=0;j<=n;j++){
      map[i][j]=-1;
    }
  }
  for(i=0;i<n;i++){
    scanf("%d %d",&x,&m);
    for(j=0;j<m;j++){
      scanf("%d %d",&y,&z);
    if(map[x][y]==-1 || map[x][y]>z){
    map[x][y]=z;
    }
    }
    scanf("\n");
  }
  s1=0;
  que.push(P(0,s1));
  min[s1]=0;
  while(!que.empty()){
    P p=que.top();
    que.pop();
    int v=p.second;
    if(min[v]<p.first){
      continue;
    }
    for(i=0;i<=n;i++){
      if(map[v][i]!=-1 && min[i]>min[v]+map[v][i] && fix[i]==0){
        min[i]=min[v]+map[v][i];
        que.push(P(min[v]+map[v][i],i));
      }
    }
    fix[v]=1;
  }
  for(i=0;i<n;i++){
  printf("%d %d\n",i,min[i]);
  }
  return 0;
}


Measured memory_bytes: 3568
#include<cstdio>
using namespace std;
main(){
  int n;
  while(1){
    scanf("%d",&n);
    if(!n) break;
    int sum=0;
    for(int i=0;i<n/4;i++){
      int a;
      scanf("%d",&a);
      sum+=a;
    }
    printf("%d\n",sum);
  }
}

Measured memory_bytes: 1028
n=int(input())
a=sorted(list(map(int,input().split())))

M=1000005
l=[0 for i in range(M)]
for i in a:
    if(l[i]!=0):
        l[i]=2
        continue
    for j in range(i,M,i):
        l[j]+=1
ans=0
for i in a:
    if(l[i]==1):ans+=1
print(ans)

Measured memory_bytes: 165492
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "YES"; }
  string_type do_falsename() const { return "NO"; }
};

void solve(ll K) {
  const int N = 50;
  vector<ll> res(N, N - 1 + K / N);
  REP(i,N) {
    res[i] -= K % N;
    if (i < K % N) res[i] += N + 1;
  }
  cout << N << endl;
  REP(i,N) cout << res[i] << " \n"[i == N - 1];
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll K;
	scanf("%lld", &K);
	solve(K);
	return 0;
}


Measured memory_bytes: 256
// Problem : C - Step
// Contest : AtCoder - AtCoder Beginner Contest 176
// URL : https://atcoder.jp/contests/abc176/tasks/abc176_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <stdio.h>
#include <math.h>
#include <cstdlib>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
const int INF = 1e9 + 5;
const int MOD = 1000000007;
const int MAX = 10000005;
const double PI = acos(-1.0);
#define pb push_back
#define vll vector<long long int>
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define       ll         long long
#define       ull        unsigned long long
#define       pii        pair <ll,ll>
#define       mii        map <ll,ll>
#define       msi        map <string,ll>
#define       pb         push_back
#define       nl         "\n"
#define       sp         " "
#define       vl        vector<ll>
#define       vi        vector<int>


int main()
{
    FastIO;

    ll n;
    cin>>n;
    ll a[n];
    for(ll i=0;i<n;i++)
    {
    	cin>>a[i];
    }
    ll ans=0;
    for(ll i=0;i<n-1;i++)
    {
    	if(a[i]>a[i+1])
    	{
    		ans=ans+(a[i]-a[i+1]);
    		a[i+1]=a[i+1]+(a[i]-a[i+1]);
    	}
    }
    
	cout<<ans;
    return 0;
}


Measured memory_bytes: 5112
//
// Created by Myabu on 2020/01/12.
//

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <math.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <numeric>

using namespace std;


int main(void){
    int X,A,B;

    cin>>X>>A>>B;

    X -= A;

    while(true){
        if(X-B < 0){
            break;
        }
        X -= B;
    }

    cout<<X<<endl;

    return 0;
}

Measured memory_bytes: 256
use proconio::input;
use proconio::marker::Bytes;

fn dist(a: &[u8], b: &[u8], min_dist: usize) -> usize {
    assert_eq!(a.len(), b.len());
    let mut dist: usize = 0;
    for i in 0 .. b.len() {
        if a[i] != b[i] {
            dist += 1;
            if dist >= min_dist {
                return dist;
            }
        }
    }
    return dist;
}

fn main() {
    input!{
        s: Bytes,
        t: Bytes,
    }

    let mut min_dist: usize = t.len();
    for i in 0 .. s.len() - t.len() + 1 {
        let d = dist(&s[i .. i + t.len()], &t, min_dist);
        if d < min_dist {
            min_dist = d;
            if min_dist == 0 {
                break;
            }
        }
    }
    println!("{}", min_dist);
}


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

int main(void){
  int n,m; cin >> n >> m;

  int ans = n*(n-1)/2+m*(m-1)/2;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
n=int(input())

x=[-1]*(n+1) #2以上の自然数に対して最小の素因数を表す
x[0]=0
x[1]=1
i=2
prime=[]
while i<=n:
    if x[i]==-1:
        x[i]=i
        prime.append(i)
    for j in prime:
        if i*j>n or j>x[i]:break
        x[j*i]=j
    i+=1

def f(k):
    z=[]
    if k==1:
        return 1
    p=x[k]
    c=1
    while k>1:
        if p!=x[k//p]:
            z.append(c)
            c=1
        else:
            c+=1

        k=k//p
        p=x[k]

    ans=1
    for i in range(len(z)):
        ans=ans*(z[i]+1)
    return ans

s=0
for i in range(1,n):
    s+=f(i)
print(s)



Measured memory_bytes: 78980
S = input()

result = 0
for i in range(len(S)):
    if(i%2 == 0):
        if(S[i] == "L"):
            result = 1
            break
    elif(i%2 == 1):
        if(S[i] == "R"):
            result = 1
            break


if(result == 0):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#ifndef bhartiya
    // #pragma GCC optimize("Ofast")
    // #pragma GCC optimize("unroll-loops")
    // #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif

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

typedef long long ll;
typedef pair<ll, ll> pll;
// not that imp
typedef pair<pll, ll> plll;
typedef vector<ll> vl;
typedef vector<pll> vll;

#define pb push_back
#define bitc  __builtin_popcountl
#define mp make_pair
#define ff first
#define ss second

#define swap(a,b) {a=a^b;b=a^b;a=a^b;}
#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)

#ifdef bhartiya
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); \
					  cout << "\n\nTime elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
}
#else
#define endl '\n'
#define trace(...)
#define start_routine()
#define end_routine()
#endif

#define inf 200000000000000ll
#define mod 1000000007ll
#define eps 1e-7

ll gcd(ll a, ll b){ return b==0 ? a : gcd(b, a%b); }
const ll maxn = 405;
ll a[maxn];
ll pr[maxn];
ll dp[maxn][maxn];

int main()
{ 
    start_routine();
	ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.precision(10);
    cin.exceptions(cin.failbit);
    #ifdef bhartiya
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int t = 1;
    // cin>>t;
    while(t--){
        ll n,x;
        cin>>n;
        rep(i,n){
            cin>>a[i];
            // dp[1][i] = a[i];
        }
        pr[0] = a[0];
        fr(i,1,n-1){
            pr[i] = a[i] + pr[i-1];
        }
        fr(i,2,n){
            fr(j,0,n-i){
                dp[i][j] = inf;
                rep(k,i-1){
                    dp[i][j] = min(dp[i][j], dp[k+1][j] + dp[i-k-1][j+k+1]);
                }
                trace(dp[3][2]);
                if(j>0)
                    dp[i][j] += pr[j+i-1] - pr[j-1];
                else
                {
                    dp[i][j] += pr[j+i-1];
                }
                
            }
        }
        trace(dp[4][0]);
        trace(dp[3][2]);
        trace(dp[2][2]);
        trace(dp[2][0]);
        cout<<dp[n][0];
        
    }
    end_routine();
}


Measured memory_bytes: 1536
#include<iostream>
#include<stdio.h>

using namespace std;

int main(void){
	int col[4][3][10],num,flo,room,per,kaisuu,i,x,y,z;
	scanf("%d",&kaisuu);
	for(i = 0;i < 4;i++){
		for(x = 0;x < 3;x++){
			for(y = 0;y < 10;y++){
				col[i][x][y] = 0;
			}
		}
	}
	for(i = 0;i < kaisuu;i++){
		scanf("%d %d %d %d",&num,&flo,&room,&per);
		col[num - 1][flo - 1][room - 1] = col[num - 1][flo - 1][room - 1] + per;
	}
	for(i = 0;i < 4;i++){
		for(x = 0;x < 3;x++){
			for(y = 0;y < 10;y++){
				printf(" %d",col[i][x][y]);
			}
			printf("\n");
		}
		if(i == 3){
		}else{
			for(z = 0;z < 20;z++){
				printf("#");
			}
			printf("\n");
		}
	}

	return 0;
}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
#define rep(i,n)  for(ll i=0; i<n; i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define INF 1e9
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main(){
  int h,w; cin >> h >> w;
  vector<vector<char>> s(h+2,vector<char>(w+2));
  rep(i,h) rep(j,w) cin >> s[i+1][j+1];

  rep(i,h+1){
    rep(j,w+1){
      if(s[i][j]=='#' && s[i][j+1]!='#' && s[i][j-1]!='#' && s[i-1][j]!='#' && s[i+1][j]!='#'){
        cout << "No\n";
        return 0;
      }
    }
  }
  cout << "Yes";
  cout << "\n";
  return 0;
}


Measured memory_bytes: 256