akhauriyash/Code-Regression huggingface dataset:
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.Math;

public class Main {
    public static void main(String[] args) {
        FS reader = new FS();
        // write reader
        String S   = reader.next();
        String T   = reader.next();
        int ans = 0;
        for (int i=0; i<3; i++) {
            if (S.charAt(i) == T.charAt(i)) ans++;
        }

        System.out.println(ans);
    }
    
    public static void solver() {
        // write logic
    }
    
    // Read Class
    static class FS {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
    
        private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
        private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
        private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public int nextInt() {
            return (int)nextLong();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if(b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
    }
}



Measured memory_bytes: 21076
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class Main {
    public static void main(String[] args) throws Exception {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

        char c = br.readLine().charAt(0);

        br.close();

        bw.write(Character.isUpperCase(c) ? 'A' : 'a');

        bw.flush();

    }
}

Measured memory_bytes: 32548
from collections import deque, defaultdict, Counter

n,k,q = map(int,input().split())
# N人がK点持っており、Q回クイズが行われた

A = [int(input()) for i in range(q)]

# Aは正解者のリスト

### 最終的に１点以上持っている人がＯＫ

# 正解している人に点数をプラス

cntA = Counter(A)

### 出力は i さんが ＯＫ ならYes, Fail なら NO

for i in range(1,n+1):
    if( k-q + cntA[i] >= 1):
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 11904
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF (1LL<<57)
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define whoami(x) cerr<<#x<<" "<<x<<"\n";
#define mp make_pair
#define ins insert
#define sz size

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;

struct h_llint {
  static uint64_t splitmix64(uint64_t x) {    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

struct h_pair{
  size_t operator()(const PLL&x)const{
    return hash<ll>()(((ll)x.ff)^(((ll)x.ss)<<32));
  }
};

typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;
typedef unordered_map<ll, int, h_llint> UMLI;
typedef unordered_map<ll, ll, h_llint> UMLL;
typedef unordered_map<PLL, int, h_pair> UMPI;
typedef unordered_map<PLL, ll, h_pair> UMPL;

int ar[MV];
ll arr[MV];
VI G[MV];

void solve(int T)
{
	memset(ar, -1, sizeof(ar));
	int n;
	cin>>n;
	int tx = 0;
	for(int i=0;i<n;i++)
	{
		int t;
		cin>>t;
		if(t == tx+1)
		tx = t;	
	}
	if(!tx)
	cout<<"-1\n";
	else cout<<(n - tx)<<"\n";
	return;	
}

int main(void)
{
	FLASH();
	int T;
	T = 1;

#ifdef ONLINE_JUDGE
	time_t time_t1, time_t2;
	time_t1 = clock();
#endif

	while(T--)
	solve(T);

#ifdef ONLINE_JUDGE
	time_t2 = clock();
	SETF();
	cout<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
	UNSETF();
#endif

	return 0;
}

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

int main() {
  int a,b;
  cin >> a >> b;

  if ((a > 9) or (b > 9)){
    cout << -1 << endl;
    return 0;
  }

  cout << a*b << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>

int n, m;
int a[200010];

bool Check(int mid) {
	for(int i = 0; i < n-1; i ++) {
		if(a[n + i] <= mid && a[n + i + 1] <= mid) return true;
		if(a[n - i] <= mid && a[n - i - 1] <= mid) return true;
		if(a[n + i] > mid && a[n + i + 1] > mid) return false;
		if(a[n - i] > mid && a[n - i - 1] > mid) return false;
	}
	return a[1] <= mid;
}

int main() {
	scanf("%d", &n);
	m = (n << 1) - 1;
	for(int i = 1; i <= m; i ++)
		scanf("%d", &a[i]);
	
	int l = 1, r = m, mid, ans = 0;
	for(; l <= r; ) {
		mid = l + r >> 1;
		if(Check(mid)) r = (ans = mid) - 1;
		else l = mid + 1;
	}
	printf("%d\n", ans);
	return 0;
}

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

int main(){
  int N,N1,N2,N3,N4,N5,N6;
  cin>>N;
  N1=N/100;
  N2=N%100;
  N3=N2/10;
  N4=N2%10;
  N5=N4/1;
  N6=N4%1;
  
  if(N1==7 || N3==7  || N4==7){
    cout<<"Yes"<<endl;
  }
  else cout<<"No"<<endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )

#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

const int COINS[] = { 10, 50, 100, 500 };

VI change( int pay )
{
	VI res( 4 );
	for ( int i = 3; 0 <= i; i-- )
	{
		res[i] = pay / COINS[i];
		pay %= COINS[i];
	}
	res.PB( pay );
	return res;
}

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

	bool firstcase = true;
	for ( int pay; cin >> pay, pay; )
	{
		VI have( 4 );
		FOR( h, have )
		{
			cin >> h;
		}

		int resnum = INT_MAX;
		VI res( 4 );
		REP( i, 0, have[0]  + 1)
		{
			REP( j, 0, have[1] + 1 )
			{
				REP( k, 0, have[2] + 1 )
				{
					REP( l, 0, have[3] + 1 )
					{
						int total = i * COINS[0] + j * COINS[1] + k * COINS[2] + l * COINS[3];
						if ( total < pay )
						{
							continue;
						}

						VI tmp = change( total - pay  );
						VI payment { i, j, k, l };

						bool ok = true;
						REP( i, 0, 4 )
						{
							ok &= !( tmp[i] && payment[i] );
						}
						if ( !ok )
						{
							continue;
						}

						int s = accumulate( ALL( have ), 0 ) - accumulate( ALL( payment ), 0 ) + accumulate( ALL( tmp ), 0 );
						if ( s < resnum )
						{
							resnum = s;
							res = payment;
						}
					}
				}
			}
		}

		if ( !firstcase )
		{
			cout << endl;
		}
		else
		{
			firstcase = false;
		}

		REP( i, 0, 4 )
		{
			if ( !res[i] )
			{
				continue;
			}
			cout << COINS[i] << ' ' << res[i] << endl;
		}
	}

	return 0;
}

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

string s;
int k;

void solve()
{
	const int n = s.length();
	if(s == string(n, s[0])){
		cout << 1LL*n*k/2 << '\n';
	}else{
		int cnt = 1;
		ll ans = 0;
		for(int i=1;i<n;++i){
			if(s[i]==s[i-1])cnt++;
			else{
				ans += cnt/2;
				cnt = 1;
			}
		}
		ans += cnt/2;
		if(s[0]!=s[n-1]){
			cout << 1LL*k*ans << '\n';
		}else{
			int a=1,b=1;
			int i=1,j=n-2;
			while(s[i]==s[0])a++,i++;
			while(s[j]==s[n-1])b++,j--;
			cout << 1LL*ans*k - 1LL*(k-1)*(a/2+b/2-(a+b)/2) << '\n';
		}
	}
}

int main()
{
	cin >> s >> k;
	solve();
	return 0;
}

Measured memory_bytes: 3608
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)

	max := 1
	si := make(map[string]int, n)
	for i := 0; i < n; i++ {
		var s string
		fmt.Scanf("%s", &s)
		_, already := si[s]
		if already {
			si[s] = si[s] + 1
			if si[s] > max {
				max = si[s]
			}
		} else {
			si[s] = 1
		}
	}

	a := List{}
	for k, v := range si {
		if v == max {
			e := Entry{k, v}
			a = append(a, e)
		}
	}
	sort.Sort(a)

	for _, v := range a {
		fmt.Println(v.name)
	}
}

type Entry struct {
	name  string
	value int
}
type List []Entry

func (l List) Len() int {
	return len(l)
}

func (l List) Swap(i, j int) {
	l[i], l[j] = l[j], l[i]
}

func (l List) Less(i, j int) bool {
	if l[i].value == l[j].value {
		return (l[i].name < l[j].name)
	} else {
		return (l[i].value > l[j].value)
	}
}


Measured memory_bytes: 37248
#include<bits/stdc++.h>
using namespace std;
int main(void){
    int N,K;
    cin>>N>>K;
    vector<int>p(N);
    for(int i=0;i<N;i++){
        cin>>p[i];
    }
    for(int i = 0;i<N-1;i++){
        for(int j =i;j<N;j++){
            int buf;
            if(p[i]>p[j])swap(p[i],p[j]);
        }
    }
    int ans =0;
    for(int i=0;i<K;i++){
        ans += p[i];
    }

    cout<<ans<<endl;

    return 0;
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n;
  cin >> n;
  double x = 0;
  REP(i,n){
    double a;
    cin >> a;
    x += 1.0f / a;
  }
  cout << fixed << setprecision(10);
  ANS(1.0f / x);
  return 0;
}

Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))

def gcd(a, b):
  if b == 0:
    return a
  return gcd(b, a%b)

def lcm(a, b):
  return a*b//gcd(a,b)

alcm = a[0]
for i in a[1:]:
  alcm = lcm(alcm, i)

res = 0

for i in range(N):
  res += (alcm-1) % a[i]

print(int(res))

Measured memory_bytes: 3316
#define HAVE_STRUCT_TIMESPEC
#include<cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <queue>
using namespace std;
int n,m,ans;
char s[25][25];
bool vis[25][25];
struct node{
    int x,y,dis;
};
int direction[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
void bfs(int x,int y){
    if(s[x][y]=='#')
        return ;
    memset(vis,0,sizeof(vis));
    queue<node>q;
    q.push((node){x,y,0});
    vis[x][y]=1;
    while(!q.empty()){
        node now=q.front();
        q.pop();
        ans=max(ans,now.dis);
        for(int i=0;i<4;++i){
            int temp_x=now.x+direction[i][0],temp_y=now.y+direction[i][1];
            if(temp_x<=0||temp_x>n||temp_y<=0||temp_y>m||s[temp_x][temp_y]=='#'||vis[temp_x][temp_y])
                continue;
            q.push((node){temp_x,temp_y,now.dis+1});
            vis[temp_x][temp_y]=1;
        }
    }
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>m;
    for(int i=1;i<=n;++i)
        cin>>s[i]+1;
    for(int i=1;i<=n;++i)
        for(int j=1;j<=m;++j)
            bfs(i,j);
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
import sys
stdin=sys.stdin

ip=lambda: int(sp())
lp=lambda:list(map(int,stdin.readline().split()))
sp=lambda:stdin.readline().rstrip()


from collections import Counter

class union_find():
    def __init__(self,n):
        self.n=n
        ##親要素のノード番号を格納。par[x]==xのときそのノードは根
        ##親とはその上にノードなし！！　
        self.par=[-1 for i in range(n)]
        self.rank=[0]*(n)

    def find(self,x):
        if self.par[x]<0:
            return x
        else:
            self.par[x]=self.find(self.par[x])
            
            return self.par[x]

    def union(self,x,y):
        x=self.find(x)
        y=self.find(y)

        ##木の高さを比較し、低い方から高い方へ辺をはる
        if x==y:
          return

        if self.par[x]>self.par[y]:
          x,y=y,x
          
        self.par[x]+=self.par[y]
        self.par[y]=x

    def same(self,x,y):
        return self.find(x) == self.find(y)
    
    def size(self,x):
      return -self.par[self.find(x)]
      
    def members(self,x):
      root=self.find(x)
      return [i for i in range(self.n) if self.find(i)==root]
    
    def roots(self):
      return [i for i, x in enumerate(self.par) if x<0]
    
    def all_group_member(self):
      return {r:self.members(r) for r in self.roots()}
    
n,m=lp()
uf=union_find(n)

for _ in range(m):
  a,b=lp()
  uf.union(a-1,b-1)
  
print(len(uf.roots())-1)



Measured memory_bytes: 13968
#pragma GCC optimize("O3")
#include<stdint.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/rope>
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define VIS(it,con) for(auto it=con.begin();it!=con.end();++it)
#define pob pop_back
#define pf push_front
#define pof pop_front
#define MIN(x,y) (x=min(x,(y)))
#define MAX(x,y) (x=max(x,(y)))
#define mid (l+r>>1)
#define lch (idx*2+1)
#define rch (idx*2+2)
/*****************************************************************************/
#include<bits/stdc++.h>
#define int int_fast64_t
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> VI;
#define REP(i,j,k) for(int i=(j);i<(k);++i)
#define RREP(i,j,k) for(int i=(j)-1;i>=(k);--i)
#define ALL(a) a.begin(),a.end()
#define MST(a,v) memset(a,(v),sizeof a)
#define pb push_back
#define F first
#define S second
#define endl '\n'
//																#define __debug
#ifdef __debug
	#define IOS (void)0
	#define de(...) cerr<<__VA_ARGS__
	#define ar(a,s,t) {REP(__i,s,t)de(a[__i]<<' ');de(endl);}
#else
	#define IOS cin.tie(0),cout.tie(0),ios_base::sync_with_stdio(false)
	#define de(...) (void)0
	#define ar(...) (void)0
#endif
/***********************************default***********************************/
const int maxn=2009,inf=1ll<<60;
int n,res=inf,sz[maxn],lb[maxn],rb[maxn];
string s;
vector<int>G[maxn];

void dfs(int u,int f){
	sz[u]=s[u]=='1';
	rb[u]=0;
	REP(i,0,G[u].size()){
		int v=G[u][i];
		if(v==f)continue;
		dfs(v,u);
		sz[u]+=sz[v];
		rb[u]+=rb[v]+sz[v];
	}
	lb[u]=rb[u]&1;
	REP(i,0,G[u].size()){
		int v=G[u][i];
		if(v==f)continue;
		MAX(lb[u],lb[v]+sz[v]-(rb[u]-rb[v]-sz[v]));
	}
}

main(){
	IOS;
	cin>>n>>s;
	REP(i,1,n){
		int a,b;cin>>a>>b,--a,--b;
		G[a].pb(b),G[b].pb(a);
	}
	REP(i,0,n){
		dfs(i,-1);
		MIN(res,lb[i]?inf:rb[i]);
	}
	cout<<(res<inf?res/2:-1)<<endl;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <algorithm>

#define BUF 200002
#define LIM_N 100001

char str[BUF];

int A, P;

void receive_input() {
	fgets(str, sizeof(str), stdin);
	sscanf(str, "%d %d", &A, &P);
}

int solve() {
	return (A * 3 + P) / 2;
}

int main(void) {
	receive_input();

	// solve();
	printf("%d\n", solve());

	return 0;
}


Measured memory_bytes: 128
import Data.List
import Data.Bits
import qualified Data.ByteString.Char8 as BC 

query :: [Int] -> Int
query = sum . map ((`shiftR` 1) . length) . group

main :: IO ()
main = do
  getLine
  ais <- unfoldr (BC.readInt . BC.dropWhile (== ' ')) <$> BC.getLine
  putStrLn $ show $ query ais

Measured memory_bytes: 508
import java.io.*;
import java.util.*;

public class Main {
    void run() {
        while(true) {
            int T = readInt();
            if (T == 0) break;

            for (; T > 0; T--) {
                int[] a = new int[5];
                int[] b = new int[5];
                for (int i = 1; i <= 4; i++) {
                    a[i] = readInt();
                }
                for (int i = 1; i <= 4; i++) {
                    b[i] = readInt();
                }
                sysout.printf(
                        "%d %d %d %d\n",
                        a[1] * b[1] - a[2] * b[2] - a[3] * b[3] - a[4] * b[4],
                        a[1] * b[2] + a[2] * b[1] + a[3] * b[4] - a[4] * b[3],
                        a[1] * b[3] - a[2] * b[4] + a[3] * b[1] + a[4] * b[2],
                        a[1] * b[4] + a[2] * b[3] - a[3] * b[2] + a[4] * b[1]
                );
            }
        }
    }

    public static void main(String[] args) {
        new Main().run();
    }

    // flush automatically iff you call `println` or `printf` or `format`.
    PrintWriter sysout = new PrintWriter(System.out, true);

    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer buffer = new StringTokenizer("");

    String read() {
        if (!buffer.hasMoreTokens()) {
            try {
                buffer = new StringTokenizer(in.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return buffer.nextToken();
    }

    int readInt() {
        return Integer.parseInt(read());
    }

    long readLong() {
        return Long.parseLong(read());
    }

    double readDouble() {
        return Double.parseDouble(read());
    }

    String readLine() {
        buffer = new StringTokenizer("");
        try {
            return in.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

Measured memory_bytes: 19676
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}
const int dm = 1400000;
char dn[dm], * di = dn;
const int MAX = 20000;
class unko {
public:
	char C[MAX * 6 + 10];
	int K[MAX + 10];
	constexpr unko() : C(), K() {
		auto di = C + 1;
		C[0] = '0';
		K[0] = 0;
		K[1] = 1;
		rep1(i, MAX) {
			int X = i;
			int keta = 0;
			char c[10] = {};
			while (X) {
				*(c + keta) = '0' + X % 10;
				X /= 10;
				keta++;
			}
			for (int j = keta - 1; j >= 0; j--)* di++ = (*(c + j));
			K[i + 1] = K[i] + keta;
		}
	}
};
constexpr unko f;
inline void putint(int X) {
	if (X > 20000) {
		int ue = X / 10;
		for (int i = f.K[ue]; i < f.K[ue + 1]; i++)* di++ = f.C[i];
		*di++ = '0' + (X - ue * 10);
	}
	else for (int i = f.K[X]; i < f.K[X + 1]; i++)* di++ = f.C[i];
	*di++ = '\n';
}

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


	int N = getint(), K = getint();

	int A[200001];
	rep(i, N) A[i] = getint();
	ll owa = ll(N) * N;

	rep(p, K) {
		int B[200001] = {};
		rep(i, N) {
			B[max(0, i - A[i])]++;
			B[min(N, i + A[i] + 1)]--;
		}
		ll kei = B[0];
		A[0] = B[0];
		rep1(i, N - 1) {
			kei += (A[i] = A[i - 1] + B[i]);
		}
		if (kei == owa) break;
	}

	rep(i, N) putint(A[i]);
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 6168
#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string.h>
#include <stdlib.h>
#include <limits>
#include <iomanip>
using namespace std;

double walk( int X, int P ){
    return pow( (X - P), 2 );
}

int main(){

    int N;
    cin >> N;
    vector<int> X(N, 0);
    for( int i = 0 ; i < N ; i++ ) cin >> X[i];

    sort( X.begin(), X.end() );
    long walk_min = 99999999999;
    for( int i = X[0] ; i <= X[N-1] ; i++ ){
        long sum_hp = 0;
        for( int j = 0 ; j < N ; j++ ){
            sum_hp += walk( X[j], i );
        }
        walk_min = min( sum_hp, walk_min );

    }

    cout << walk_min << endl;

}

Measured memory_bytes: 256
# 私はDFSを書けるようになるまで諦めない！！
n, q = map(int, input().split())
edges = [[]for _ in range(n)]
count = [0]*n
for _ in range(n-1):
    a, b = map(lambda x: int(x)-1, input().split())
    edges[a].append(b)
    edges[b].append(a)
for _ in range(q):
    p, x = map(int, input().split())
    count[p-1] += x

stack = [0]
INF = 10**18
counter = [INF]*n
counter[0] = count[0]
while stack:
    v1 = stack.pop()
    for v2 in edges[v1]:
        if counter[v2] != INF:
            continue
        counter[v2] = counter[v1] + count[v2]
        stack.append(v2)

print(*counter)


Measured memory_bytes: 106752
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

long long gcd(long long a, long long b){
  return b == 0LL ? a : gcd(b, a % b);
}

ll f(ll a, ll b, ll c){
	ll a1 = a/b;
	ll a2 = a/c;
	ll a3 = a/((b*c)/gcd(b,c));
	return a1+a2-a3;
}

int main() {
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll ans = f(b,c,d)-f(a-1,c,d);
	cout << b-(a-1)-ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <string>
#include<math.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
int main() {
    int a, b;
    cin >> a >> b;
    if (b%a == 0) {
        cout << a + b << endl;
    }
    else {
        cout << b - a << endl;
    }
    return 0;
}


Measured memory_bytes: 256
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools


#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]
#CW = [list(map(int, list(input()))) for _ in range(H)]


S = str(input())

if("Sunny"==S):
  print("Cloudy")
elif("Cloudy"==S):
  print("Rainy")
else:
  print("Sunny")



Measured memory_bytes: 68608
n, c, k = map(int,input().split())
T = [int(input()) for i in range(n)]
T.sort()

ans = 0
i = 0
while i < n:
    s = T[i] + k
    j = 0
    while i+j < n and j < c and T[i+j] <= s:
        j += 1
    ans += 1
    i += j

print(ans)

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

using namespace std;

struct dice{
  int u,n,e,s,w,d;
};

int main(){

  dice d;
  int tmp;
  string s;

  cin>>d.u>>d.s>>d.e>>d.w>>d.n>>d.d;
  cin>>s;

  for(int i=0;i<s.size();i++){
    if(s[i]=='N'){
      tmp=d.u;
      d.u=d.s;
      d.s=d.d;
      d.d=d.n;
      d.n=tmp;
    }
    else if(s[i]=='E'){
      tmp=d.u;
      d.u=d.w;
      d.w=d.d;
      d.d=d.e;
      d.e=tmp;
    }
    else if(s[i]=='S'){
      tmp=d.u;
      d.u=d.n;
      d.n=d.d;
      d.d=d.s;
      d.s=tmp;
    }
    else if(s[i]=='W'){
      tmp=d.u;
      d.u=d.e;
      d.e=d.d;
      d.d=d.w;
      d.w=tmp;
    }
  }
  cout<<d.u<<endl;
}

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

int main(){
  int N, sum=0;
  cin >> N;
  for (int i=1;i<=N;i++){
    if (int(log10(i)+1) % 2 == 1) 
      sum++;
  }
  cout << sum << endl;
  return 0;
}


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

using namespace std;

#define pb push_back

const int maxi = 1e6+10;
string s,t;
vector<int> v[maxi];
int n;
int cnt[maxi];
int cnt1[maxi];
set<int> st[1000];
int main()
{
     cin>>s;
     cin>>t;

     int n = s.size();
     int m = t.size();

     for (int i=0;i<n;i++){
       cnt[s[i]]++;
       st[s[i]].insert(i);
     }

     for (int i=0;i<m;i++)
            cnt1[t[i]]++;

     for (int i='a';i<='z';i++)
        if (cnt1[i]>0 && cnt[i]==0) return !printf("-1\n");

    int last = -1;
    long long  ans = 0;
    for (int i=0;i<m;i++)
    {
        if (st[t[i]].lower_bound(last+1)==st[t[i]].end())
        {
            last = *st[t[i]].begin();
            ans+=n;
        } else
        {
            last = *st[t[i]].lower_bound(last+1);
        }
    }

    ans+=last+1;
    printf("%lld\n",ans);
    return 0;
}
//pisacu joj pisma duga
//iz Zagore iz Drnisa
//razglednice tople s juga
//z Banata poslije Nisa

//ti si sunce moga neba
//tebi mogu reci
//ti si jedina od svih
//koja tajne moje cuva
//ti si moja ljubav prva <3


Measured memory_bytes: 32384
#include <stdio.h>

int main(void){
    int a,e,b=0,c=0;
    double d,f,g;
    scanf("%d",&a);
    c=a;
    e=a%2;
    if(e!=0){
    
    b=a/2;
    b=b+1;
    }else{
        b=a/2;
    }
    f=b;
    g=c;
    d=f/g;
    printf("%lf\n",d);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
#include <list>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
#define for1(i,n) for (ll i=0;i<(n);i++)
#define for2(i,m,n) for (ll i=(m);i<(n);i++)
#define for3(i,m,n,d) for (ll i=(m);i<(n);i+=(d))
#define DEBUG 0
template <class T>
void dumplist(T list)
{
    for (auto item : list) {
        cout << item << " ";
    }
    cout << endl;
}

void solve()
{
    const ll inf = 1LL << 60;
    ll N,M,L,R,l,r;
    cin >> N >> M;
    L = 0;
    R = inf;
    for1(i,M) {
        cin >> l >> r;
        L = max(L, l);
        R = min(R, r);
    }
    ll ans = R - L + 1;
    if (ans < 0) {
        ans = 0;
    }
    cout << ans << endl;
}

int main()
{
    do {
        solve();
    } while (DEBUG);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int N;
    ll C;
    cin >> N >> C;
    vector<ll> x(N), v(N);
    rep(i, 0, N) cin >> x[i] >> v[i];

    ll vsum = 0;
    vector<ll> f(N + 1);
    f[0] = 0;
    rep(i, 0, N)
    {
        vsum += v[i];
        f[i + 1] = vsum - x[i];
    }

    vector<ll> g(N + 1);
    g[0] = f[0];
    rep(i, 0, N)
    {
        g[i + 1] = max(g[i], f[i + 1]);
    }

    vsum = 0;
    vector<ll> ff(N + 1);
    ff[0] = 0;
    rep(i, 0, N)
    {
        vsum += v[N - 1 - i];
        ff[i + 1] = vsum - (C - x[N - 1 - i]);
    }

    vector<ll> gg(N + 1);
    gg[0] = ff[0];
    rep(i, 0, N)
    {
        gg[i + 1] = max(gg[i], ff[i + 1]);
    }

    ll ans = 0;

    for (int b = 0; b <= N; ++b)
    {
        ll score = 0;
        if (b == 0)
        {
            score = g[N];
        }
        else
        {
            score = ff[N - b + 1] - (C - x[b - 1]) + g[b - 1];
        }
        chmax(ans, score);
    }

    for (int a = 0; a <= N; ++a)
    {
        ll score = 0;
        if (a == 0)
        {
            score = gg[N];
        }
        else
        {
            score = f[a] - x[a - 1] + gg[N - a];
        }
        chmax(ans, score);
    }

    cout << ans << endl;
}


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

int main(){
  char x;
  int offset = 32;
  cin >> x;
  if (x<=90){
    cout << 'A' << endl;
    /*int y = x + 32;
    char z = (char)y;
    cout << z << endl;*/
  }else if(x>=97){
    cout << 'a' << endl;
    /*int y = x - 32;
    char z = (char)y;
    cout << z << endl;*/
  }
}


Measured memory_bytes: 3568
#include <iostream>
#include <string>
#include <map>
#include <algorithm>
using namespace std;

int main()
{
	int n, m;
	cin >> n;
	auto c = map<string, int>();
	for(auto i = 0; i < n; ++i){
		string s;
		cin >> s;
		++c[s];
	}
	cin >> m;
	for(auto i = 0; i < m; ++i){
		string s;
		cin >> s;
		--c[s];
	}
	int ans = 0;
	for(auto it : c){
		ans = max(ans, it.second);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
/*
--------------              |   /
      |                     |  /
      |                     | /
      |             *       |/          |    |         ------            *
      |                     |           |    |        /      \
      |             |       |\          |    |       |       |\          |
   \  |             |       | \         |    |       |       | \         |
    \ |             |       |  \        |    |        \     /   \        |
     V              |       |   \        \__/|         -----     \       |
*/
#include <bits/stdc++.h>
using namespace std;

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
#define mem(i,j) memset(i,j,sizeof (i));
#define F first
#define S second
#define lowbit(x) ((x)&(-(x)))
#define siz(v) (int)(v).size()
typedef int64_t ll;
typedef uint64_t ull;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
/*-----------------------------------------------------------------------------------------------------*/

signed main() {
	EmiliaMyWife
	
	int n;
	cin >> n;
	vector<int> arr(n);
	ll ans = 0;
	for(int i = 0; i < n; i++)
		cin >> arr[i];
	sort(arr.begin(), arr.end(), greater<int>());
	int x = n-2;
	ans = arr[0];
	for(int i = 1; i < n; i++) {
		int w = min({x, 2});
		ans += arr[i]*w;
		x-=w;
	}
	cout << ans << '\n';

	return 0;
}


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

int LCSLength();
char X[1000],Y[1000];

int main(){
  int i,q;

  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%s%s",X,Y);
    printf("%d\n",LCSLength());
  }

  return 0;
}

int LCSLength(){
  int i,j,m,n,c[1001][1001];

  m=strlen(X);
  n=strlen(Y);
  
  for(i=0;i<=m;i++) c[i][0]=0;
  for(j=0;j<=n;j++) c[0][j]=0;
  for(i=1;i<=m;i++){
    for(j=1;j<=n;j++){
      if(X[i-1]==Y[j-1]) c[i][j]=c[i-1][j-1]+1;
      else if(c[i-1][j]>=c[i][j-1]) c[i][j]=c[i-1][j];
      else c[i][j]=c[i][j-1];
    }
  }

  return c[m][n];
}

Measured memory_bytes: 4512
#include <bits/stdc++.h>
using namespace std;
struct node{
	long long int a,b;
};
bool cmp(node e,node f)
{
	if(e.a!=f.a)
	return e.a<f.a;
	else
	return e.b>f.b;
}
int main()
{
    long long int n,m,y=0;
    cin>>n>>m;
    node d[n+1];
    for(int i=1;i<=n;i++)
    cin>>d[i].a>>d[i].b;
    sort(d+1,d+n+1,cmp);
    for(int i=1;i<=n;i++)
	{
	   if(d[i].b<m)
	   {
	       y+=d[i].a*d[i].b;
		   m-=d[i].b;
	   }
	   else
	   {
		    y+=d[i].a*m;
    	    break;
       }
    }
    cout<<y;
    return 0;
}

Measured memory_bytes: 1792
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;

	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			int n = sc.nextInt();
			if(n==0) break;
			int maxn = 0;
			int map[][] = new int[10][10];
			for(int[] a: map) fill(a, INF);
			for(int i=0;i<n;i++) {
				int a = sc.nextInt();
				int b = sc.nextInt();
				int c = sc.nextInt();
				maxn = max(maxn, max(a,b));
				map[a][b] = map[b][a] = c;
			}
			maxn++;
			for(int i=0;i<maxn;i++) map[i][i] = 0;
			for(int k=0;k<maxn;k++) for(int i=0;i<maxn;i++) for(int j=0;j<maxn;j++) {
				map[i][j] = min(map[i][j], map[i][k] + map[k][j]);
			}
//			for(int[] a: map) debug(a);
			
			int node = -1;
			int min = INF;
			for(int i=0;i<maxn;i++) {
				int sum = 0;
				for(int j=0;j<maxn;j++) sum += map[i][j];
				if(min > sum) {
					node = i;
					min = sum;
				}
			}
			System.out.println(node + " " + min);
			
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 12000
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

class AtCoder
{
    const int MOD = 1000000007;
    public void Slove()
    {
        var n = int.Parse(Console.ReadLine());

        long[] dpAGX = new long[n + 1];
        long[] dpAXG = new long[n + 1];
        long[] dpAG = new long[n + 1];
        long[] dpAC = new long[n + 1];
        long[] dpAT = new long[n + 1];
        long[] dpGA = new long[n + 1];
        long[] dpA = new long[n + 1];
        long[] dpG = new long[n + 1];
        long[] dp = new long[n + 1];
        dp[0] = 1;
        foreach(int i in Enumerable.Range(1, n))
        {
            //dp[j] + dpAC[j] + + dpGA[j] + dpA[j] + dpAT[j] + dpAGX[j] + dpAG[j] + dpG[j] + dpAXG[j];
            int j = i - 1;
            foreach(char c in "ACGT")
            {
                if(c == 'A')
                {
                    dpA[i] += dp[j] + dpAC[j] + dpGA[j] + dpA[j] + dpAT[j] + dpAGX[j];
                    dpGA[i] += dpG[j] + dpAXG[j] + dpAG[j];
                }
                else if(c == 'C')
                {
                    dpAC[i] += dpA[j] ;
                    dp[i] += dp[j] + dpAC[j] + dpAT[j] + dpG[j];
                }
                else if(c == 'G')
                {
                    dpAXG[i] += dpAG[j] + dpAT[j] ;
                    dpG[i] += dp[j] + dpAGX[j] + dpG[j] + dpAXG[j];
                    dpAG[i] += dpA[j] + dpGA[j];
                }
                else
                {
                    dp[i] += dp[j] + dpAC[j] + dpAT[j] + dpAGX[j] + dpG[j] + dpAXG[j];
                    dpAGX[i] += dpAG[j] ;
                    dpAT[i] += dpA[j] + dpGA[j];
                }
            }
            dpAG[i] %= MOD;
            dpGA[i] %= MOD;
            dpAC[i] %= MOD;
            dpA [i] %= MOD;
            dpG [i] %= MOD;
            dpAXG[i]%= MOD;
            dpAT [i]%= MOD;
            dp  [i] %= MOD;
            dpAGX[i] %= MOD;
        }
        long result = (dp[n] + dpAC[n] + dpAG[n] + dpGA[n] + dpA[n] + dpG[n] + dpAXG[n] + dpAT[n] + dpAGX[n]) % MOD;
        Console.WriteLine(result);
    }
    static void Main()
    {
        var ac = new AtCoder();
        ac.Slove();
    }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
const int MAXN=100010,P=998244353;
int n,ans,d[MAXN],cnt[MAXN];
int main () {
	scanf("%d",&n);
	for (int i=1;i<=n;i++) {
		scanf("%d",&d[i]);
		cnt[d[i]]++;
	}
	ans=1;
	for (int i=1;i<=n;i++) {
		if (i==1&&d[i]>0) {printf("0\n");return 0;}
		if (i>1&&d[i]==0) {printf("0\n");return 0;}
		if (i==1) {continue;}
		ans=(1ll*ans*cnt[d[i]-1])%P;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 1024
W, H, N = map(int, input().split())
grid = [[0] * W for _ in range(H)]
for _ in range(N):
    xi, yi, a = map(int, input().split())
    X = range(W)
    Y = range(H)
    if a in (1, 2):
        X = range(xi) if a == 1 else range(xi, W)
    elif a in (3, 4):
        Y = range(yi) if a == 3 else range(yi, H)
    for x in X:
        for y in Y:
            grid[y][x] |= 1
print(sum(map(lambda x: x.count(0), grid)))


Measured memory_bytes: 3064
import java.util.Scanner;

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

        int[] wt = new int[n];
        int[] v = new int[n];
        int total = 0;

        for(int i = 0; i < n; i++){
            wt[i] = sc.nextInt();
            v[i] = sc.nextInt();
            total += v[i];
        }

        long[][] dp = new long[n+1][total+1];

        for(int i = 0; i < n+1; i++){
            for(int j = 0; j < total+1; j++){
                dp[i][j] = Integer.MAX_VALUE;
            }
        }

        dp[0][0] = 0;

        for(int i = 1; i < n+1; i++){
            for(int j = 1; j < total+1; j++){
                dp[i][j] = Math.min(dp[i-1][j],j-v[i-1] >= 0 ? dp[i-1][j-v[i-1]]+wt[i-1] : Integer.MAX_VALUE);
            }
            dp[i][v[i-1]] = Math.min(dp[i][v[i-1]],wt[i-1]);
        }

        long val = 0;

        for(int i = 0; i < total+1; i++){
            if(dp[n][i] <= w)
                val = i;
        }

        System.out.println(val);
    }
}


Measured memory_bytes: 133460
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B = []
C = []
for i in range(Q):
    b, c = map(int, input().split())
    B.append(b)
    C.append(c)

A_new = {}
for a in A:
    if not a in A_new:
        A_new[a] = 1
    else:
        A_new[a] += 1

sum = 0
for i in range(0, 1):
    b = B[i]
    c = C[i]
    if b in A_new:
        n = A_new[b]
        A_new[b] = 0
        if c in A_new:
            A_new[c] += n
        else:
            A_new[c] = n
    key_list = A_new.keys()
    res = 0
    for k in key_list:
        res += A_new[k] * k
    print(res)
    sum = res


for i in range(1, Q):
    b = B[i]
    c = C[i]
    dif = 0
    if b in A_new:
        n = A_new[b]
        A_new[b] = 0
        if c in A_new:
            A_new[c] += n
        else:
            A_new[c] = n
        dif = c * n - b * n
    sum += dif
    print(sum)


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

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

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

}

Measured memory_bytes: 3760
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string S; cin >> S;
  if(S == "RRS" || S == "SRR") cout << 2 << endl;
  else if(S == "RRR") cout << 3 << endl;
  else if(S == "SSS") cout << 0 << endl;
  else cout << 1 << endl;
}

Measured memory_bytes: 3624
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let (P, Q, R) = read!(i64, i64, i64);
    let m = min(P + Q, min(P + R, Q + R));
    println!("{}", m)
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>

using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; i++)
#define rep(i,b) Rep(i,0,b)
#define rrep(i,a) for(int i = a; i >= 0; i--)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

/*
// 最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

// 最小公倍数
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}*/


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

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

	// 最大値を求める
	ll m = -inf;
	vector<pair<int, int>> xy;

	// マイナスとプラスの組でやると、無駄がない
	// 始めにソート
	sort(allof(a));

	int posNum = 0;
	int negaNum = 0;
	int pi = 0;
	rep(i, n) {
		if (a[i] > 0) posNum++;
		else if (a[i] < 0) {
			negaNum++;
			pi = i;
		}
	}
	pi++;
	int zeroNum = n - posNum - negaNum;

	//cout << posNum << " " << negaNum << " " << zeroNum << endl;
	if (zeroNum == n) {
		cout << 0 << endl;
		rep(i, n - 1) {
			cout << 0 << " " << 0 << endl;
		}
		return 0;
	}

	if (n == 2) {
		cout << a[1] - a[0] << endl;
		cout << a[1] << " " << a[0] << endl;
		return 0;
	}

	// 正の数、負の数がそれぞれ一つでもあると、すべて簡単

		// 一番小さい負の数以外の負の数を一番大きい正の数に食わせる
		// 正の数も同様に
	int mi = a[0];
	int ma = a[n - 1];
	pi = min(pi, n - 1);
	Rep(i, 1, pi) {
		xy.push_back({ ma, a[i] });
		ma -= a[i];
	}
	Rep(i, pi, n - 1) {
		xy.push_back({ mi, a[i] });
		mi -= a[i];
	}
	// 最後に合成
	xy.push_back({ ma, mi });
	m = ma - mi;

	cout << m << endl;
	rep(i, n - 1) {
		cout << xy[i].first << " " << xy[i].second << endl;
	}
	//cout << xy.size() << endl;

	return 0;
}


Measured memory_bytes: 3188
func main() {
    let N = Int(readLine()!)!
    let a = (0..<N).map { _ in readLine()! }
    
    let c0 = a.filter {$0 == "AC"}.count
    let c1 = a.filter {$0 == "WA"}.count
    let c2 = a.filter {$0 == "TLE"}.count
    let c3 = a.filter {$0 == "RE"}.count

    print("AC x ", c0)
    print("WA x ", c1)
    print("TLE x ", c2)
    print("RE x ", c3)
}

main()


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

int main(){
  int a,b,k=0,sc[1001]={0};
  string s;
  cin>>a;
  cin>>s;
  cin>>b;
  k=0;
  for(int i=0;i<a;i++){
    if(k==b)break;
    if(s[i]=='0'){
      s[i]='1';
      sc[i]++;
      k++;
    }
  }
  if(k<b){
    for(int i=a-1;i>=0;i--){
      if(k==b)break;
      if(s[i]=='1'&&sc[i]==0){
	s[i]='0';
	k++;
      }
    }
  }
  for(int i=0;i<a;i++)cout<<s[i];
  cout<<endl;
  return 0;
}

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

int main(){
	int N, k;
	cin >> N;
	vector<int> A, pref(N, 0);
	for(int i =0; i < N; i++){
		cin >> k;
		A.push_back(k);
		if(i == 0){ pref[0] = k; }
		if(i != 0){
			pref[i] = pref[i - 1] + k;
		}
	}
	int sum = 100000000;
	for (int i = 0; i < N - 1; i++){
		int y = pref[i], u = pref[N - 1] - pref[i];
		if(abs(y - u) <= sum){
			sum = abs(y - u);
		}
	}
	cout << sum ;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <unordered_map>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n; ll x;
  cin>>n>>x;
  ll s[200001];
  s[0]=0;
  for(int i=1; i<=n; i++){
    ll xi; cin>>xi;
    s[i]=s[i-1]+xi;
  }
  ll ans=1e18;
  for(int d=1; d<=n; d++){
    ll ans1=x*(ll)(n+d)+5*(s[n]-s[n-d]);
    for(int i=1; n-i*d>0; i++){
      ans1+=(3+2*(ll)i)*(s[n-i*d]-s[max(n-(i+1)*d, 0)]);
      if(ans1>1e18) break;
    }
    ans=min(ans, ans1);
  }
  cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)
#define FOR(i, m, n) for(int i = (m); i < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << ": " << x << endl;

using namespace std;
typedef long long ll;

signed main() {
  int n;
  cin >> n;
  int x = n % 10;
  if(x == 3) {
    cout << "bon" << endl;
  } else if(x == 0 || x == 1 || x == 6 || x == 8) {
    cout << "pon" << endl;
  } else {
    cout << "hon" << endl;
  }
  return 0;
}


Measured memory_bytes: 3636