akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>

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

using namespace std;

int main(){
	int a,b;
	cin >> a >> b;
	int cnt;
	int ans;
	if(a > b){
		cnt = a;
		ans = b;
	}
	else{
		cnt = b;
		ans = a;
	}
	rep(i,cnt){
		cout << ans;
	}

    return 0;
}

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

int main() {
  
  int a,b;
  cin >> a >> b;
  
  if(a+b < 24) cout << a+b << endl;
  else cout << a+b-24 << endl;
  
}


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

int main() {
  int n;
  string s;
  cin>>n>>s;
  int count=0;
  for(int i=0;i<s.size();i++){
    if(s.at(i)=='R'){
      count++;
    }
  }
  if(s.size()-count<count){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
  
}


Measured memory_bytes: 256
mod = 1000000007
n = gets.to_i
a = gets.chomp.split.map(&:to_i).sort

s = (n+1) % 2
i = 0

if s == 0
    if s != a[i]
        puts 0
        exit 0
    end

    i += 1
    s += 2
end

while i < n-1
    if s == a[i] && a[i] == a[i+1]
        i += 2
        s += 2
        next
    end

    puts 0
    exit 0
end

res = 1

1.upto(n/2) do
    res = res * 2 % mod
end

puts res

Measured memory_bytes: 10240
#include<bits/stdc++.h>
using namespace std;
using ll = long long ;
#define REP(i,n) for(ll i = 0 ; i < n ; i ++)
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << std::endl;
        //use cerr if u want to display at the bottom
    }
    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...);
    }
#else
#define trace(...)
#endif
#define mod 998244353
int main() {
    ll n,s;
    cin >> n >> s ;
    ll a[n];
    REP(i,n) cin >> a[i] ;
    ll dp[n+1][s+1] ;
    memset(dp,0,sizeof dp) ;
    dp[0][0] = 1;
    for(int i = 0 ; i < n ; i ++) {
        for(int j = 0 ; j <= s ; j ++) {
            dp[i+1][j] = (dp[i+1][j]+2*dp[i][j])%mod;
            if(j + a[i] <= s) {
                dp[i+1][j+a[i]] = (dp[i+1][j+a[i]] + dp[i][j])%mod;
            }
        }    
    }
    cout << dp[n][s] << endl;
    return 0; 
}

Measured memory_bytes: 74008
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using ll = long long;
#define int long long
int cost[9] = {2,5,5,4,5,6,3,7,6};
vector <char>  ok ;
string smax(string s, string t){
    if(s.size()>t.size()) {return s; }
    else if(s.size()<t.size()) {return t; }
    else { return max(s,t); }
}
signed main(void){
    int n,m; cin>>n>>m;
    rep(i,m) {char a; cin>>a; ok.push_back(a);}
    vector <string> dp (10050, "-");
    int x = ok.size();
    dp[0] = "";
    for(int i=0;i<n;i++){
        if(dp[i] == "-") continue;
        rep(j, x){
            //cout<<dp[i] + ok[j]<<endl;
            dp[i + cost[ok[j] - '1']] = smax(dp[i + cost[ok[j] - '1']], dp[i] + ok[j]);
        }
    }
    cout<<dp[n]<<endl;
}


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

#define gc() getchar()

#define ll long long
#define ri register int 

using std::max;

inline int read()
{
	int ret=0;char ch=gc();
	while(!isdigit(ch))ch=gc();
	while(isdigit(ch))
	{
		ret=ret*10+ch-'0';
		ch=gc();
	}
	return ret;
}

const int MAXN=1e6+10;
const int MOD=1e9+7;

int n;
ll f[MAXN][3];

int main()
{
//	freopen("in.in","r",stdin);
	
	n=read();
	
	f[0][0]=1;
	for(ri i=1;i<=n;++i)
	{
		f[i][0]=8*f[i-1][0]%MOD;
		f[i][1]=(2*f[i-1][0]+9*f[i-1][1])%MOD;
		f[i][2]=(f[i-1][1]+10*f[i-1][2])%MOD;
	}
	printf("%lld\n",f[n][2]);
	
	return 0;
}

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

int main() {
    int N, M; cin >> N >> M;
    vector<int> roads(N,0), a(M,0), b(M,0);
    
    for (int i = 0; i < M; i++){
        cin >> a.at(i) >> b.at(i) ;
    }

    for (int i = 0; i < M; i++){
        roads.at(a.at(i) - 1)++;
        roads.at(b.at(i) - 1)++;
    }

    for (int i = 0; i < N; i++) cout << roads.at(i) << endl;
}

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <complex>
#include <stack>
using namespace std;

int main(){
    char s;
    int ans = 0;
    for(int i = 0; i < 4; i++){
        scanf("%c",&s);
        if(s == '+'){
            ans++;
        }else{
            ans--;
        }
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
//    return *(long long*)a - *(long long*)b;
}
//  qsort(A, b, sizeof(int), compare_int);

int main()
{
 
//  int a, b, c, d, e, X, Y;
  int a, b;
  //  double  c;
  long long  A[1000001]={};
  long long  B[1000001]={};
//  int  B[100003]={};
  int  L[1003]={};


//  long long  a, b, c, d, X, Y;
  long long  c, d, X, Y;
  long long JPY;
  double BTC;
  char s[100001]={};
  char t[100001]={};
//  int N, M;
//  int A[1000000001]={};
//  long long  C[101]={};
  int i,j,k;
  int flag=0;
//  int flag[10000003]={};
  int tmp=0;
//  int min=1000000;
  long long min=10000000001;
  int len=0;
  int cnt=0;
  int cnt0=0;
  int cnt1=0;
  int num=0;
//  double ans=0.0;
  long long ans=0;
  int max=0;
  int sum=0;
//  char alp[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

  //  a=0;
//  scanf("%lld %lld", &a, &b);
  scanf("%s", &s);
  len=strlen(s);
  for(i=0;i<len;i++){
    if(s[i]=='A'||s[i]=='T'||s[i]=='C'||s[i]=='G'){
      cnt++;
      flag=1;
    }
    else flag=0;
    if(flag==0||i==len-1){
      if(max<cnt) max=cnt;
      cnt=0;
    }
//      printf("%d\n",cnt);
  }

  printf("%d\n",max);
//    else  
  
return 0;
}


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

#define inp 200005
#define check exit(0)
#define nl cout<<endl;
#define mod 1000000007 
#define ll long long int
#define trace(x) cerr<<#x<<" : "<<x<<endl;
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define deb(v) for(int i=0;i<v.size();i++) {cout<<v[i]; (i==v.size()-1) ? cout<<"\n":cout<<" "; }

using namespace std;

// Pick yourself up, 'cause...

vector<int> g[inp];
int n;
vector<vector<ll>> dp(inp,vector<ll>(2,0));
vector<bool> vis(inp,false);

void func(int cn , int p) // 0 white , 1 black
{
    if(vis[cn]) return;

    vis[cn]=true;

    ll white = 1;
    ll black = 1;
    for(int c:g[cn])
    {
        if(c==p) continue;
        func(c , cn);
        white *= (dp[c][0] + dp[c][1]);
        black *= dp[c][0];
        white%=mod;
        black%=mod;
    }
    dp[cn][0]=white;
    dp[cn][1]=black;
}

int main()
{
    jaldi

    cin>>n;

    for(int i=1;i<n;i++)
    {
        int u,v;
        cin>>u>>v;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    func(1 , 0);
     
    cout << ( dp[1][0] + dp[1][1] ) % mod;
    
    return 0;
}

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

int main() {
  string s, t;
  cin >> s >> t;
  int ans = 1e9;
  rep(si,s.size()) {
    if (si+t.size() > s.size()) break;
    int cnt = 0;
    rep(i,t.size()) {
      if (s[si+i] != t[i]) cnt++;
    }
    ans = min(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

string S, T;
int main(){
    int a;
    cin >> S;
    cin.ignore();
    cin >> T;
    cin.ignore();

    int cnt = 0;
    for(int i = 0; i < S.size(); i++){
        if(S[i] != T[i]) ++cnt;
    }

    cout << cnt << endl;

    return 0;
}

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

int main(){
	int n;
	cin >> n;
	string s[n];
	REP(i,n) cin >> s[i];
	int m;
	cin >> m;
	string t[m];
	REP(i,m) cin >> t[i];
	int cnt[n] = {};
	REP(i,n){
		REP(j,n){
			if(s[i] == s[j])cnt[i]++;
		}
		REP(j,m){
			if(s[i] == t[j])cnt[i]--;
		}
	}
	int max = 0;
	REP(i,n){
		if(cnt[i] > max) max = cnt[i];
	}
	cout << max << endl;
}

Measured memory_bytes: 256
<?php

fscanf(STDIN, "%d %d", $n, $m);

$array = [];

for ($i = 1; $i <= $n; $i++) {
    $array[$i] = 0;
}

$min = 1;
$max = $n;
for ($i = 1; $i <= $m; $i++) {
    fscanf(STDIN, "%d %d", $l, $r);

    if ($l > $min) {
        $min = $l;
    }
    if ($r < $max) {
        $max = $r;
    }

}
if($max < $min){
echo 0;
}else{
echo $max - $min + 1;
}


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

int main()
{
  int n;
  string a, b;
  cin >> n;
  cin >> a >> b;
  for (int i = 0; i < n; i++) {
    cout << a[i] << b[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX 500111
#define mod 1000000007
const long long  inf = 2000000000000000000;
using namespace std;
vector<string> v;
int main(){ 
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); 
    string s;
    cin>>s;
    int k,n = s.size();
    cin>>k;

    for(int i =0 ; i < n; i++){
        string temp = "";
        for(int j = i ; j < min(i + k,n) ; j++){
            temp += s[j];
            v.push_back(temp);
        }
    }
    sort(v.begin(), v.end());
    v.resize(distance(v.begin(), unique(v.begin(), v.end())));
    // for(auto x : v)cout<<x<<" "; 
    cout<<v[k-1];
    return 0;
}

Measured memory_bytes: 1660
#include <iostream>
using namespace std;
int main() {
  int A,B,x ;
  A>1 && A<=1000000000;
  B>1 && B<=1000000000;
  char op ;
  cin>>A>>op>>B ;
  if (op=='+') cout<<A+B ;
  if (op=='-') cout<< A-B;
  return 0 ; 

}

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

DPLIST=[[None]*N for i in range(N)]

for i in range(N):
    DPLIST[i][i]=0

SUM=[0]
for i in range(N):
    SUM.append(SUM[-1]+A[i])

for i in range(1,N):
    for j in range(i,N):

        ANS=float("inf")

        for k in range(j-i,j):

            if ANS>DPLIST[j-i][k]+DPLIST[k+1][j]+SUM[j+1]-SUM[j-i]:
                ANS=DPLIST[j-i][k]+DPLIST[k+1][j]+SUM[j+1]-SUM[j-i]
        
        DPLIST[j-i][j]=ANS

print(DPLIST[0][N-1])

Measured memory_bytes: 46300
#include <stdio.h>
int main(){
  int N;
  scanf("%d", &N);
  if (N%10==3) {
    printf("bon");
  }
  else if (N%10==0||N%10==1||N%10==6||N%10==8) {
    printf("pon");
  }
  else {
    printf("hon");
  }
  return 0;
}

Measured memory_bytes: 1708
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.IOException;
import java.util.stream.Stream;
import java.util.Arrays;
import java.util.function.Function;
import java.util.function.LongBinaryOperator;
import java.util.stream.Collectors;
import java.util.List;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.ArrayDeque;


public class Main {
    public static void main(String[] args) throws Exception {
        ArrayList<String> lines = getContents();
        int n = Integer.parseInt(lines.get(0).split(" ")[1]);
        
        Function<Stream<String>, Queue<QueueProcess>> makeQueue = stream -> {
            Queue<QueueProcess> queue = new ArrayDeque<QueueProcess>();
            stream.map(str -> str.split(" "))
                .forEach(s -> queue.add(new QueueProcess(s[0], Integer.parseInt(s[1]))));
            return queue;
        };

        Queue<QueueProcess> queue = makeQueue.apply(lines.stream().skip(1));
        int time = 0;
        while(!queue.isEmpty()){
            QueueProcess qp = queue.poll();
            int m = qp.time - n;
            if(m > 0){
                qp.time = m;
                queue.add(qp);
                time += n;
            }else{
                time += qp.time;
                System.out.printf("%s %d\n", qp.name(), time);
            }
        }
    }
    
    public static ArrayList<String> getContents() throws IOException{
        String line;
        ArrayList<String> list = new ArrayList<String>();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        while((line = br.readLine()) != null) list.add(line);
         
        return list;
    }
}

class QueueProcess{
    private String _name;
    public String name(){ return _name; }
    public int time;
    public QueueProcess(String name, int time){
        this._name = name;
        this.time = time;
    }
}


Measured memory_bytes: 113544
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int a, b;
    cin >> a >> b;
    string s, t;
    for(int i = 0; i < b; i++) s += to_string(a);
    for(int i = 0; i < a; i++) t += to_string(b);
    
    if(s < t) cout << s << "\n";
    else cout << t << "\n";
    return 0;
}


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

#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 EPS (1e-7)

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

int vx[]={0,1,0,-1};
int vy[]={1,0,-1,0};

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

const ll mod=1e9+7;
const int INF=INT_MAX/2;
const int MAX=1e9;


int main(){
	string s;
	int x,y,n;
	cin>>s;
	cin>>x>>y;
	n=s.size();
	vector<int> lr;
	vector<int> ud;
	int cnt=0;
	int sx=0;
	int sy=0;
	int length=0;
	REP(i,n){
		if(cnt==0){
			if(s[i]=='F'){
				sx++;
			}else if(s[i]=='T'){
				cnt++;
				length=0;
			}
		}else if(cnt%2==0){
			if(s[i]=='F'){
				length++;
			}else if(s[i]=='T'){
				cnt++;
				lr.push_back(length);
				length=0;
			}
		}else if(cnt%2==1){
			if(s[i]=='F'){
				length++;
			}else if(s[i]=='T'){
				cnt++;
				ud.push_back(length);
				length=0;
			}
		}
	}
	if(length>0){
		if(cnt%2==0)lr.push_back(length);
		else ud.push_back(length);
	}
	int xmax=sx;
	int ymax=0;
	REP(i,lr.size()){
		xmax+=lr[i];
	}
	REP(i,ud.size()){
		ymax+=ud[i];
	}

	//dpx[i][x]:i番目にxにいるかどうか
	int dpx[lr.size()+1][xmax*2+10];
	int dpy[ud.size()+1][ymax*2+10];
	REP(i,lr.size()){
		REP(j,xmax*2){
			dpx[i][j]=0;
		}
	}
	REP(i,ud.size()){
		REP(j,ymax*2){
			dpy[i][j]=0;
		}
	}
	dpx[0][sx+xmax]=1;
	dpy[0][ymax]=1;

	for(int i=0;i<lr.size();i++){
		for(int j=0;j<xmax*2+2;j++){
			if(dpx[i][j]==1){
				dpx[i+1][j+lr[i]]=1;
				dpx[i+1][j-lr[i]]=1;
			}
		}
	}

	for(int i=0;i<ud.size();i++){
		for(int j=0;j<ymax*2+2;j++){
			if(dpy[i][j]==1){
				dpy[i+1][j+ud[i]]=1;
				dpy[i+1][j-ud[i]]=1;
			}
		}
	}

	if(x>xmax || y>ymax){
		cout<<"No"<<endl;
	}else if(dpx[lr.size()][x+xmax]==1 && dpy[ud.size()][y+ymax]==1){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}


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

using namespace std;

#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                        \
	sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
	{
sim > struct rge
{
	c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifdef LOCAL
	~debug()
	{
		cerr << endl;
	}
	eni(!=) cerr << boolalpha << i;
	ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d)
{
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c &)
	{
		ris;
	}
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define forn(i, n) for (ll i = 0; i < int(n); i++)
#define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define M_PI 3.14159265358979323846
#define EPS 1e-7

ll f (string p, string k)
{
        set<char> st;
        ll res = 0;
        for (int i = 0; i < p.length(); ++i) st.insert(p[i]);
        for (int i = 0; i < len(k); ++i)
        {
                if (st.find(k[i]) != st.end()) 
                {
                        res++;
                        st.erase(k[i]);
                }
        }
        return res;
}

void solve()
{	
        int n; cin >> n;
        string s; cin >> s;
        ll res = 0;
        for(int i = 1; i < n; ++i)
        {
                string p = s.substr(0, i);
                string k = s.substr(i, n - i);
                res = max(res, f(p, k));
        }
        cout << res ;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	solve();
}

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

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

    n=a/k;
    if (k*(n+1) <= b || a%k==0){
        cout << "OK" << endl;
        return 0;
    }

    cout << "NG" << endl;
    return 0;
}

Measured memory_bytes: 3620
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var strA = cin.Read;
        	WriteLine(strA.Count(strA => strA == '1'));
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

Measured memory_bytes: 26652
S = int(input())
ans = [000, 111, 222, 333, 444, 555, 666, 777, 888, 999]

ans_ = 0
for a in ans:
    if a - S >= 0:
        ans_ = a
        break


if ans_ == 0:
    print("000")
else:
    print(str(ans_))


Measured memory_bytes: 2940
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t
#include <math.h>

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int64_t get_int(void) {
    int64_t ans;
    scanf("%lld", &ans);
    return ans;
}
int get_int3(int *a1, int *a2, int *a3) {
  scanf("%d %d %d", a1, a2, a3);
  return 0;
}

// <arr[0]> <arr[1]> .. <arr[size-1]>
int fget_array(int64_t *arr, int size) {
    int i;
    for(i = 0; i < size; i++) {
        scanf("%lld", &arr[i]);
    }
    return 0;
}

#define NUM_MAX 100000

void get_shortest(int64_t *arr, int anum, int64_t *brr, int bnum, int64_t *out) {
    int left, right = 0;
    for(left = 0; left < anum; left++) {
        for(; right < bnum; right++) {
            if(brr[right] > arr[left]) break;
        }
        
        int64_t res = labs(brr[right] - arr[left]);
        if(right != 0) res = min(res, labs(brr[right-1] - arr[left]));
        out[left] = res;
    }
    return;
}
#define INF (int64_t)(1e+11)
#define QUERY_MAX 100000

int lower_bound(int64_t *arr, int size, int64_t key) {
    int low = -1;
    int high = size;
    while(low + 1 < high) {
        int mid = (low + high) / 2;
        if(arr[mid] <= key) {
            low = mid;
        } else {
            high = mid;
        }
    }
    return low;
}

int main(void) {
    int anum, bnum;
    int queries;
    get_int3(&anum, &bnum, &queries);

    static int64_t arr[NUM_MAX];
    static int64_t brr[NUM_MAX];
    // already sorted
    fget_array(arr, anum);
    fget_array(brr, bnum);

    static int64_t ashortest[NUM_MAX];
    static int64_t bshortest[NUM_MAX];
    get_shortest(arr, anum, brr, bnum, ashortest);
    get_shortest(brr, bnum, arr, anum, bshortest);

    int i, j;
    static int64_t ans[QUERY_MAX];
    int idx = 0;
    for(i = 0; i < queries; i++) {
        int64_t x = get_int();
        int64_t res = INF;
        int aidx = lower_bound(arr, anum, x);
        // for A -> B
        for(j = aidx; j < anum; j++) {
            if(j < 0) continue;
            if(j > aidx+1) break;;
            res = min(res, labs(x-arr[j])+ashortest[j]);
        }
        // for B -> A
        int bidx = lower_bound(brr, bnum, x);
        for(j = bidx; j < bnum; j++) {
            if(j < 0) continue;
            if(j > bidx+1) break;;
            res = min(res, labs(x-brr[j])+bshortest[j]);
        }
        ans[idx++] = res;
    }

    for(i = 0; i < idx; i++) {
        printf("%lld\n", ans[i]);
    }
    return 0;
}

Measured memory_bytes: 5120
s=list(map(int,input()))
s2=list(reversed(s))

res = 0
for i in range(len(s)-1):
	if s[i] == s[i+1]:
		if s[i+1] == 0:
			s[i+1]=1
		else:
			s[i+1]=0
		res = res + 1

res2 = 0
for i in range(len(s2)-1):
	if s2[i] == s2[i+1]:
		if s2[i+1] == 0:
			s2[i+1]=1
		else:
			s2[i+1]=0
		res2 = res2 + 1

print(min(res,res2))

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

typedef long long LL;

template<typename T>
void printmatrix(vector<vector<T> > ar){
    for (int i = 0; i < (int)ar.size(); i++) {
        for (int j = 0; j < (int)ar.size(); j++) {
            cout << ar[i][j];
        }
        cout << endl;
    }
}

template<typename T>
void printvector(vector<T> vec){
    for (int i = 0; i < (int)vec.size(); i++) {
        cout << vec[i] << endl;
    }
}

template<typename T>
void unique(vector<T>& vec){
    sort(vec.begin(), vec.end());
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
}

template<typename T>
vector<T> cumsum(vector<T> vec){
    vector<T> newvec((T)vec.size());
    int tmp = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
        tmp += vec[i];
        newvec[i] = tmp;
    }

    return newvec;
}


int main(int argc, char const* argv[])
{
    int a,b,c,x;
    cin >> a >> b >> c >> x;

    int count=0;
    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 == x) {
                    count++;
                }
            }
        }
    }

    cout << count << endl;

    return 0;
}

// sortの仕方
// int a[N];
// array<int,N> ar;
// vector<int> v;
//
// sort(a, a+N); // 配列
// sort(ar.begin(), ar.end()); // array
// sort(v.begin(), v.end()); // vector 昇順
// sort(v.begin(), v.end(), greater<int>()); // 降順

// Template
// template <class T>
// T foomax(T x, T y){
//   if (x > y){
//     return x;
//   }else{
//     return y;
//   }
// }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1000000007;
constexpr lint INF = mod * mod;
constexpr int MAX = 200010;

void extend(int c, vector<int> &cnt, int &tmp){
    if(++cnt[c] == 1) ++tmp;
}

void shrink(int c, vector<int> &cnt, int &tmp){
    if(--cnt[c] == 0) --tmp;
}

int main(){
    int n, q;
    scanf("%d%d", &n, &q);
    int c[n];
    rep(i, n) scanf("%d", &c[i]), --c[i];
    vector<tuple<int, int, int>> query(q); // (id, [l, r))
    rep(i, q){
        int l, r;
        scanf("%d%d", &l, &r);
        --l;
        query[i] = {i, l, r};
    }

    int width = 700;
    sort(query.begin(), query.end(), [&](const tuple<int, int, int> &a, const tuple<int, int, int> &b){
        if(get<1>(a) / width == get<1>(b) / width) return get<2>(a) < get<2>(b);
        return get<1>(a) / width < get<1>(b) / width;
    });

    vector<int> cnt(n, 0);
    int tmp = 0, tl = 0, tr = 0, ans[q];
    for(auto [id, l, r]: query){
        while(tr < r) extend(c[tr++], cnt, tmp);
        while(tl > l) extend(c[--tl], cnt, tmp);
        while(tr > r) shrink(c[--tr], cnt ,tmp);
        while(tl < l) shrink(c[tl++], cnt, tmp);
        ans[id] = tmp;
    }
    rep(i, q) printf("%d\n", ans[i]);
}

Measured memory_bytes: 15384
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
#define all(v) v.begin(),v.end()
typedef vector<int> vi;
typedef vector<ll> vl;
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}
ll com(ll n,ll r){
    ll x=1,y=1;
    ll tmp=n;
    while(tmp>=n-r+1){
        x=x*tmp%mod;
        tmp--;
    }
    while(r>0){
        y=y*r%mod;
        r--;
    }
    return x*rep_jijo(y,mod-2)%mod;
}

int main(){
    string s;
    int k;
    cin >> s >> k;
    k--;
    int len=s.size();
    map<string,int>mp;
    for(int i=0;i<=len-1;i++){
        string t=s.substr(i,1);
        mp[t]++;
    }
    for(int i=0;i<=len-2;i++){
        string t=s.substr(i,2);
        mp[t]++;
    }
    for(int i=0;i<=len-3;i++){
        string t=s.substr(i,3);
        mp[t]++;
    }
    for(int i=0;i<=len-4;i++){
        string t=s.substr(i,4);
        mp[t]++;
    }
    for(int i=0;i<=len-5;i++){
        string t=s.substr(i,5);
        mp[t]++;
    }
    int j=0;
    for(auto p:mp){
        if(j==k){
            cout << p.first <<endl;
            return 0;
        }
        j++;
    }

    
    return 0;
}


Measured memory_bytes: 1920
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<long long, long long>;
const int INF = numeric_limits<int>::max();
const ll INFL = numeric_limits<ll>::max();
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

ll factorial(ll n) {
    ll res = 1;
    for (ll i = 1; i <= n; i++) {
        res *= i;
    }
    return res;
}

bool fn_is_prime(ll n) {
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return n != 1;
}

bool isOK(int index, int key, vector<ll>& a) {
    if (a[index] >= key) return true;
    else return false;
}

int binary_search(int key, vector<ll>& a) {
    int ng = -1;
    int ok = a.size();

    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key, a)) ok = mid;
        else ng = mid;
    }
    return ok;
}

struct UnionFind {
    vector<int> r;

    UnionFind(int N) {
        r = vector<int>(N, -1);
    }

    int root(int x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }

    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }

    int size(int x) {
        return -r[root(x)];
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }
};

int main()
{
    string a, b, c; cin>> a >> b >> c;
    if (a[a.length()-1] == b[0] && b[b.length()-1] == c[0])
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}



signed main(){
	int a,b,q	; cin>>a>>b>>q;
	VL s(a+2,LINF), t(b+2,LINF), x(q); s[0]=-1*LINF; t[0]=-1*LINF;
	reps(i,a)cin>>s[i]; reps(i,b)cin>>t[i];	rep(i,q)cin>>x[i];
	// cerr << endl;
	// 二分探索で、東側で最も近い神社と寺のindexを求める。
	rep(i,q){
		int sl = 1, sr = a+2;
		while(sr-sl>1){
			int mid=(sl+sr)/2;
			if(s[mid]>=x[i]) sr=mid;
			else sl=mid;
		}
		int tl = 1, tr = b+2;
		while(tr-tl>1){
			int mid=(tl+tr)/2;
			if(t[mid]>=x[i]) tr=mid;
			else tl=mid;
		}
		// cerr << sr SP tr << endl; // ここが0なら二分探索失敗。
		ll ks[2],kt[2]; ks[0]=s[sr-1]; ks[1]=s[sr]; kt[0]=t[tr-1]; kt[1]=t[tr];
		// cerr << x[i] SP ks[0] SP ks[1] SP kt[0] SP kt[1] << endl;
		ll ret = LINF*2;
		rep(j,2){
			rep(k,2){
				ll tmp1 = abs(x[i]-ks[j])+abs(ks[j]-kt[k]);
				ll tmp2 = abs(x[i]-kt[j])+abs(kt[j]-ks[k]);
				// cerr << tmp1 SP tmp2 << ' ';
				chmin(ret,min(tmp1,tmp2));
			}
		}
		// cerr<<endl;
		cout<<ret<<endl;
	}
	return 0;
}


Measured memory_bytes: 3712
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
char ch[1001][1001];
int m,n;
bool a,e;
int main()
{
    cin>>m>>n;
   for(int i=2;i<m+2;i++)
   {
     for(int j=2;j<n+2;j++)
     {
     cin>>ch[i][j];
     }
   }
   for(int i=1;i<m+3;i++)
   {
     for(int j=1;j<n+3;j++)
     {
         if(i==1||j==1||i==m+2||j==n+2)cout<<"#";
        else cout<<ch[i][j];
     }
     cout<<endl;
   }
    return 0;
}


Measured memory_bytes: 384
# YouTube解説
MOD = 1000000007
n, k = [int(x) for x in input().split()]
d = [0] * (k + 1)

for i in range(1, k + 1):
    d[i] = pow(k // i, n, MOD)

for i in range(k, 0, -1):  # 大きいほうから
    for j in range(i * 2, k + 1, i):  # iの倍数
        # d[6] = d'[6] - d[12] - d[18] ...
        d[i] -= d[j]
        d[i] %= MOD
ans = 0
for i, item in enumerate(d):
    ans += i * item
    ans %= MOD
print(ans)


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

struct Node {
	int l, r, p;
};

void preOrder(Node node[], int id) {
	cout << " " << id;
	if (node[id].l != -1)preOrder(node, node[id].l);
	if (node[id].r != -1)preOrder(node, node[id].r);
}

void inOrder(Node node[], int id) {
	if (node[id].l != -1)inOrder(node, node[id].l);
	cout << " " << id;
	if (node[id].r != -1)inOrder(node, node[id].r);
}

void postOrder(Node node[], int id) {
	if (node[id].l != -1)postOrder(node, node[id].l);
	if (node[id].r != -1)postOrder(node, node[id].r);
	cout << " " << id;
}

int main(void) {
	int i, n, id, left, right;
	Node node[25];

	cin >> n;

	for (i = 0;i<n;i++) {
		node[i].l = node[i].r = node[i].p = -1;
	}

	for (i = 0;i<n;i++) {
		cin >> id >> left >> right;

		node[id].l = left;
		node[id].r = right;
		if (left != -1) {
			node[left].p = id;
		}
		if (right != -1) {
			node[right].p = id;
		}
	}

	while (node[id].p != -1) {
		id = node[id].p;//find root
	}

	cout << "Preorder" << endl;
	preOrder(node, id);
	cout << endl << "Inorder" << endl;
	inOrder(node, id);
	cout << endl << "Postorder" << endl;
	postOrder(node, id);
	cout << endl;

	return 0;
}



Measured memory_bytes: 3096
D = int(input())
N = 26
c = [int(i) for i in input().split()]
last = [0 for i in range(N)]

for i in range(D):
  s_d = [int(j) for j in input().split()]
  d_score = -1
  ans = -1
  for j in range(N):
    last_day = i + 1 - last[j]
    arg = s_d[j] - c[j]*last_day
    if d_score < arg:
      d_score = arg
      ans = j+1
  print(ans)
  last[ans-1] = i+1

Measured memory_bytes: 9220
#include<bits/stdc++.h>
using namespace std;
struct E{int v,next;}g[200005];
int n,h[100005],t,ans;
void ins(int u,int v){g[++t].v=v,g[t].next=h[u],h[u]=t;}
inline int read(){
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
    return x*f;
}
int dfs(int now,int last){
	int tot=0;
	for(int i=h[now];i;i=g[i].next) if(g[i].v!=last) tot+=dfs(g[i].v,now);
	if(tot>=2){puts("First");exit(0);}
	if(tot==0) return 1;
	return 0;
}
int main(){
	int u,v;
	n=read();
	for(int i=1;i<n;++i){
		u=read(),v=read();
		ins(u,v),ins(v,u);
	}
	ans=dfs(1,-1);
	if(ans) puts("First");
	else puts("Second");
}

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

typedef unsigned long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;

#define INF (int)(1e9)

#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,start,end) for(int i=(start);i<=(end);i++)
#define all(n) begin(n),end(n)

#define DEBUG

int main()
{
	char c[3][3];
	rep(i,3)rep(j,3) cin >> c[i][j];

	rep(i,3)rep(j,3)
	{
		if(i == j) cout << c[i][j];
	}
	cout << endl;
	return 0;
}

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

int main(void){
    int n = 0; 
    int d[101];
    int ans = 0;

    scanf("%d", &n);

    for(int i = 0; i <= 100; i++){
        d[i] = 0; 
    }

    for(int i = 0; i < n; i++){
        int tmp = 0;
        scanf("%d", &tmp);
        d[tmp] = 1;
    }

    for(int i = 0; i <= 100; i++){
        if(d[i] == 1){
            ans++;
        } 
    }
    printf("%d\n", ans);

    return 0;

} 


Measured memory_bytes: 256
n,m,k = map(int,input().split())
for i in range((n+1)//2+1):
    for j in range((m+1)//2+1):
        if i*m+j*n-2*i*j == k or i*m+j*n-2*i*j == n*m-k:
            print("Yes")
            exit()
print("No")





Measured memory_bytes: 39664
fn main() {
    let v = read_vec::<u32>();
    let a = v[0];
    let b = v[1];

    if (a + b) % 2 == 0 {
        println!("{}", (a+b)/2);
    } else {
        println!("{}", (a+b)/2 + 1);
    }
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

Measured memory_bytes: 4352
### constant

MAX_T = 180

M_NG = 0
M_OK = 1
M_EXIT = 2

DIRCH = {'E' => 0, 'N' => 1, 'W' => 2, 'S' => 3}
DIRS = [[1, 0], [0, -1], [-1, 0], [0, 1]]

### main

while true
  w, h = gets.strip.split(' ').map{|s| s.to_i}
  break if w == 0 && h == 0

  maze = h.times.map{[]}
  prss = []

  for y in (0...h)
    hl =  gets.strip
    for x in (0...w)
      case hl[x]
      when '#'
        maze[y][x] = M_NG
      when '.'
        maze[y][x] = M_OK
      when 'X'
        maze[y][x] = M_EXIT
      when 'E', 'N', 'W', 'S'
        maze[y][x] = M_NG
        prss << [x, y, DIRCH[hl[x]]]
      end
    end
  end
  #p maze
  #p prss

  t = 1

  while t <= MAX_T && ! prss.empty?
    mvpos = {}

    ## 1. change direction
    for prs in prss
      for dd in [3, 0, 1, 2]
        d0 = (prs[2] + dd) % 4
        x0 = prs[0] + DIRS[d0][0]
        y0 = prs[1] + DIRS[d0][1]
        if maze[y0][x0] != M_NG
          prs[2] = d0
          d1 = (d0 + 2) % 4
          key = [x0, y0].join(',')
          if ! mvpos.key?(key) || mvpos[key][0] > d1
            mvpos[key] = [d1, x0, y0, prs]
            #p mvpos[key]
          end
          break
        end
      end
    end

    ## 2. move
    for mvs in mvpos.values
      d1, x0, y0, prs = mvs
      maze[prs[1]][prs[0]] = M_OK
      if maze[y0][x0] == M_EXIT
        prss.delete(prs)
      else
        prs[0] = x0
        prs[1] = y0
        maze[y0][x0] = M_NG
      end
    end

    break if prss.empty?

    t += 1
  end

  puts (t <= MAX_T ? t : 'NA')
end

Measured memory_bytes: 6164
#include<bits/stdc++.h>
#define MOD 1000000007
#define randome_generate srand(std::chrono::high_resolution_clock::now().time_since_epoch().count())
using namespace std;
int n,x,y;
vector<int> ga[100100];
vector<int> ch[100100];
long long dp[100100][2];
void tigen(int u,int p=-1){
	for(int i=0;i<ga[u].size();i++){
		int v=ga[u][i];
		if(v==p)
			continue;
		tigen(v,u);
		ch[u].push_back(v);
	}
}
void solve(int u){
	//not choose:0
	//choose:1
	for(int i=0;i<ch[u].size();i++){
		int v=ch[u][i];
		solve(v);
		dp[u][0]*=(dp[v][0]+dp[v][1])%MOD;//white:all
		dp[u][1]*=(dp[v][0])%MOD;//black:only white
		dp[u][0]%=MOD;
		dp[u][1]%=MOD;
	}
}
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	for(int i=1;i<n;i++){
		cin>>x>>y;
		ga[x].push_back(y);
		ga[y].push_back(x);
	}
	tigen(1);
	for(int i=1;i<=n;i++){
		dp[i][0]=dp[i][1]=1;
	}
	solve(1);
	cout<<(dp[1][0]+dp[1][1])%MOD<<endl;
	return 0;
}


Measured memory_bytes: 19712
#include <iostream>

int main() {
  int s;
  std::cin >> s;
  int cnt = 1;
  while(true){
    if(s == 4 || s==2 || s ==1) {
      std::cout << cnt+3 << std::endl;
      return 0;
    }
    cnt++;
    if(s&1)
      s = 3*s+1;
    else
      s /= 2;    
  }
  return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
  input! {
    r: f64
  };
  let res = 2_f64 * std::f64::consts::PI * r;
  println!("{}", res);
}


Measured memory_bytes: 2212
#include<iostream>
#include<vector>
#include<string>
#include<cstdlib>
#include<sstream>
#include<queue>
#include<deque>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<set>
#include<iomanip>
#define INF 2147483647
#define lli long long int
#define MOD 1000000007

using namespace std;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;

void printv(vi v){
	for(int i = 0; i < v.size(); i++){
		cout << v[i] << " ";
		}cout << endl;
		return ;
		}

int main() {
	while(1){
	
	int n,s; cin >> n >> s;
	if (n + s == 0) break;
	int ans = 0;
	vi loop(10,1);
	for (int i = 0; i < 10; i++){
		if (10 - i > n){
			loop[9-i] = 0;
		}
		
	}

	
	
	vi aold_used(10,0);
	vi bold_used(10,0);
	vi cold_used(10,0);
	vi dold_used(10,0);
	vi eold_used(10,0);
	vi fold_used(10,0);
	vi gold_used(10,0);
	vi hold_used(10,0);
	vi iold_used(10,0);
	vi jold_used(10,0);
	for (int a = 0; a <= 9*loop[0]; a++){
		vi used(10,0);
		aold_used = used;
		used[a] = 1;
		for (int b = a*loop[1]; b <= 9*loop[1]; b++){
			bold_used = used;
			if (used[b] == 1 and loop[1] != 0) continue;
			else if(loop[1] != 0) used[b] = 1;
			for (int c = b*loop[2]; c <= 9*loop[2]; c++){
				cold_used = used;
				if (used[c] == 1 and loop[2] != 0) continue;
				else if(loop[2] != 0) used[c] = 1;
				for (int d = c*loop[3]; d <= 9*loop[3]; d++){
					dold_used = used;
					if (used[d] == 1 and loop[3] != 0) continue;
					else if(loop[3] != 0) used[d] = 1;
					for (int e = d*loop[4]; e <= 9*loop[4]; e++){
						eold_used = used;
						if (used[e] == 1 and loop[4] != 0) continue;
						else if(loop[4] != 0) used[e] = 1;
						for (int f = e*loop[5]; f <= 9*loop[5]; f++){
							fold_used = used;
							if (used[f] == 1 and loop[5] != 0) continue;
							else if(loop[5] != 0) used[f] = 1;
							for (int g = f*loop[6]; g <= 9*loop[6]; g++){
								gold_used = used;
								if (used[g] == 1 and loop[6] != 0) continue;
								else if(loop[6] != 0) used[g] = 1;
								for (int h = g*loop[7]; h <= 9*loop[7]; h++){
									hold_used = used;
									if (used[h] == 1 and loop[7] != 0) continue;
									else if(loop[7] != 0) used[h] = 1;
									for (int i = h*loop[8]; i <= 9*loop[8]; i++){
										iold_used = used;
										if (used[i] == 1 and loop[8] != 0) continue;
										else if(loop[8] != 0) used[i] = 1;
										for (int j = i*loop[9]; j <= 9*loop[9]; j++){
											jold_used = used;
											if (used[j] == 1 and loop[9] != 0) continue;
											else if(loop[9] != 0) used[j] = 1;
											if (a + b + c + d + e + f + g + h + i + j == s){
												//cout << a << " " << b << " " << c << " " << d << " " << e << " " << f << " " << g << " " << h << " " << i << " " << j << endl;
												ans++;
											}
											used = jold_used;
										}	
										used = iold_used;
									}
									used = hold_used;
								}
								used = gold_used;
							}
							used = fold_used;
						}
						used = eold_used;
					}
					used = dold_used;
				}
				used = cold_used;
			}
			used = bold_used;
		}
		used = aold_used;
	}

	cout << ans << endl;
	}
}

Measured memory_bytes: 3036
#include<bits/stdc++.h>
using namespace std;
int main(){
  int d,n;cin>>d>>n;
  if(n<100){
    if(d==0)cout<<n<<endl;
    else if(d==1)cout<<n*100<<endl;
    else cout<<n*10000<<endl;
  }
  else{
    if(d==0)cout<<101<<endl;
    else if(d==1)cout<<10100<<endl;
    else cout<<1010000<<endl;
  }
}
  


Measured memory_bytes: 256
main = interact $ unlines . show' . official_house . read' . tail . lines
 where
  read' = map ((\[b,f,r,v] -> ((b-1)*30 + (f-1)*10 + r, v)) . map read . words)
  show' = insertAt 3 "####################" . map (unwords.("":)) . groupAt 10 . map (show . snd)
  
official_house moves = foldr move [(n,0)| n<-[1..120]] moves
 where move (c,v) floor = foldr (\(n,p) acc -> if n==c then (n,p+v):acc else (n,p):acc) [] floor

groupAt n xs = if null xs then [] else take n xs : groupAt n (drop n xs)
insertAt n is xs = if length xs <= n then xs else take n xs ++ [is] ++ insertAt n is (drop n xs)

Measured memory_bytes: 5392
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		int n=s.length();
		long answer=0;
		char[] input=s.toCharArray();
		
		for(int mask=0;mask<(1<<n-1);mask++){
			StringBuilder sb=new StringBuilder();
			long sum=0;
			for(int i=0;i<n;i++){
				sb.append(input[i]);
				
				if((mask & (1<<i)) !=0){
					sum+=Long.parseLong(sb.toString());
					sb.setLength(0);
				}
			}
			
			if(sb.length()!=0){
				sum+=Long.parseLong(sb.toString());
			}
			
			answer+=sum;
		}
		System.out.println(answer);
	}
}


Measured memory_bytes: 23892
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,m,x = iim()
l = []
A = list(range(n))

for _ in A:
    l.append(iil())

ans = 1e9
for i in range(1 << n):
    output = []
    for j in range(n):
        if ((i >> j) & 1) == 1:
            output.append(A[j])
    sc = [0]*(m+1)
    for k in output:
        sc = [x+y for x,y in zip(sc,l[k])]
    if min(sc[1:]) >= x:
        ans = min(ans,sc[0])
print(ans if ans < 1e9 else -1)

Measured memory_bytes: 9216
#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3

# c0 c1 c2
# c3 c4 c5
# c6 c7 c8

# 入力値受取り
c = [0] * 9
for i in range(3):
    tmp = list(map(int, input().split()))
    for j in range(3):
        c[i * 3 + j] = tmp[j]

# 縦差分CHECK
if not(c[0] - c[3] == c[1] - c[4] and c[0] - c[3] == c[2] - c[5] and c[3] - c[6] == c[4] - c[7] and c[3] - c[6] == c[5] - c[8]):
    print('No')
    exit()

# 横差分CHECK
if not (c[0] - c[1] == c[3] - c[4] and c[0] - c[1] == c[6] - c[7] and c[1] - c[2] == c[4] - c[5] and c[1] - c[2] == c[7] - c[8]):
    print('No')
    exit()

print('Yes')


Measured memory_bytes: 3064
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
#define rep(i,j,n) for (int i = j; i < (n); i++)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1e9;

int main(){

  int n,k;cin>>n>>k;
  int x[n+10];rep(i,0,n)cin>>x[i];

  int mi=1e9+7;
  rep(i,0,n-k+1){
    mi=min(mi,x[i+k-1]-x[i]+min(abs(x[i]),abs(x[i+k-1])));
  }

  out(mi);

  return 0;
}


Measured memory_bytes: 640