akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

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

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void solve(){
   int T, H, M, S;

    cin >> T;

    H = T / 3600;

    M = (T / 60) % 60;

    S = T % 60;

    cout << H << ':' << M << ':' << S << endl;
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}



Measured memory_bytes: 3164
def 解():
    iN = int(input())
    aA = [int(_) for _ in input().split()]

    iD = sum(aA)
    iF = 0
    iB = iD
    minDiff =  10**9 * 2
    for a in aA[:-1] :
        iF += a
        iB -= a
        thisDiff = abs(iF - iB)
        minDiff = min(minDiff , thisDiff)
    print(minDiff)
解()


Measured memory_bytes: 23788
#include <iostream>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

int main(){
  int n;
  cin >> n;
  bool flag = true;
  rep(i, n){
    int a;
    cin >> a;
    if (a % 2 == 0 && !(a % 3 == 0 || a % 5 == 0))
      flag = false;
  }
  if (flag) cout << "APPROVED" << endl;
  else cout << "DENIED" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  char s1,s2,s3,s4;
  cin>>s1>>s2>>s3>>s4;
  
 if (s1==s2&&s3==s4&&s1!=s3){
   cout<<"Yes"<<endl;
 }
  else if (s1==s3&&s2==s4&&s1!=s2){
   cout<<"Yes"<<endl;
  }
   else if (s1==s4&&s2==s3&&s1!=s2){
   cout<<"Yes"<<endl;
   }
  else{
   cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
n = int(input())
cities = [complex(*map(int, input().split())) for _ in range(n)]
facts = [1]
for i in range(1, n + 1):
    facts.append(facts[-1] * i)
ans = 0.
for i in range(n):
    ci = cities[i]
    for j in range(i + 1, n):
        cj = cities[j]
        dij = abs(ci - cj)
        ans += dij * facts[n - 1] * 2
print(ans / facts[n])


Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] ary = new int[N];
        for(int i = 0; i < N; i++){
            ary[i] = sc.nextInt();
        }
        Arrays.sort(ary);
        int sum = 0;
        for(int num : ary){
            sum += num;
        }
        sum -= ary[N-1];
        System.out.println(ary[N-1] < sum ? "Yes" : "No");
    }
}


Measured memory_bytes: 22868
#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(){
	int A,B;
	cin>>A>>B;
	int ans=1;
	int i=0;
	while(ans<B){
		ans=ans+A-1;
		i++;
	}
	cout<<i<<endl;
return 0;}

/*compile
g++ code.cpp
./a.out
run*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr<<#x<<":"<<x<<endl
#define d2(x, y) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<endl
#define d3(x, y, z) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, double> dd;

const int N = (int)(1e6 + 5);
const int LOG = (int)(20);

lli n, a, b;

int main() {
	fast_io();
	// freopen("inp.in", "r", stdin);

	cin >> n >> a >> b;
	lli smin = (n - 1) * a + b;
	lli smax = (n - 1) * b + a;
	if(smax - smin + 1 <= 0)
		cout << 0;
	else
		cout << smax - smin + 1;
}

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


int main(){
  int N;
  cin >> N;
  vector<int> H(N);
  for(auto& h : H){
    cin >> h;
  }

  for(int ii=N-2; ii>=0; ii--){
    if(H[ii] > H[ii+1]) H[ii]--;
    if(H[ii] > H[ii+1]){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


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

// definitions
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define rep(i, l, r) for (long long i = (l); i < (long long)(r); i++)
#define repb(i, r, l) for (long long i = (r); i > (long long)(l); i--)
#define pb push_back
#define mod1 998244353
#define mod 1000000007
#define MAX_CHAR 256

using namespace std;
typedef vector<long long> vl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector< pair<long long, long long> > vp;
typedef vector<tuple<long long , long long , long long> > vtup;
typedef deque <long long> dq;
typedef long long int lli;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;


// standard functions
ll gcd(ll x, ll y) {
    if (x < y) return gcd(y, x);
    if (y == 0) return x;
    return gcd(y, x % y);
} 
 


ll modexp(ll x, ll ex, ll modp) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x)%modp;
        ex >>= 1ll;
        x = (x * x)%modp;
    }
    return ans;
} 
 
ll nCrModp(ll n, ll r, ll p) 
{ 
    ll C[r+1]; 
    memset(C, 0, sizeof(C)); 
  
    C[0] = 1; 
    for (ll i = 1; i <= n; i++) 
    { 
        for (ll j = min(i, r); j > 0; j--) 
            C[j] = (C[j] + C[j-1])%p; 
    } 
    return C[r]; 
}
 
bool isPrime(ll n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true;  
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 
 
vl countFreq(ll arr[], ll n) 
{ 
    unordered_map<ll, ll> mp; 
    vector <ll> v;
    
    for (ll i = 0; i < n; i++) 
        mp[arr[i]]++; 
   
    for (auto x : mp) 
        v.pb(x.second);
    
    return v;
}

ll binarySearch(ll arr[], ll l, ll r, ll x) 
{ 
    while (l <= r) 
    { 
        ll m = l + (r - l) / 2; 
        if (arr[m] == x) 
            return m; 
        if (arr[m] < x) 
            l = m + 1; 
        else
            r = m - 1; 
    }
    return -1; 
}

const ll MAXSIEVE=(1e3);
ll spf[MAXSIEVE];
void sieve() 
{ 
    spf[1] = 1; 
    for (ll i=2; i<MAXSIEVE; i++) 
        spf[i] = i; 

    for (ll i=4; i<MAXSIEVE; i+=2) 
        spf[i] = 2; 
  
    for (ll i=3; i*i<MAXSIEVE; i++) 
    { 
        if (spf[i] == i) 
        { 
            for (ll j=i*i; j<MAXSIEVE; j+=i) 
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
}

// code beigns in main
int main()
{
    
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll t=1;
    // cin >> t;
    
    while(t--)
    {
        ld r;
        cin >> r;

        ld area=3.1415926*r*2;
        cout << area << endl;
    }
}



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

using namespace std;

int main() {
	int score, total;

	total = 0;
	for (int i = 0; i < 5; ++i) {
		cin >> score;
		total += max(40, score);
	}
	cout << total / 5 << endl;

	return 0;
}


Measured memory_bytes: 3068
#include<iostream>
using namespace std;
int main(void){
  int a,b,c,d=3;
  cin >> a >> b >> c;
  if(a == b){
    d--;
    if(a == c){
    d--;
    }
  }else if(a == c){
    d--;
  }else if(b == c){
    d--;
  }
  cout << d << endl;
  return 0;
}


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

#define pii pair<int,int>
#define pll pair<lld,lld>
#define pb push_back
#define next nextt
#define left leftt
#define right rightt
#define lld long long
#define Inf 1000000000
#define mod 1000000007
#define Linf 1000000000000000000LL
#define get gett

using namespace std;

int N,M,ans;
int a[302][302],it[302],cnt[302];
bool check[302];

bool can(int x){
	for(int i=1; i<=N; i++){
		it[i] = 1;
	}
	for(int i=1; i<=M; i++){
		check[i] = false;
	}
	while(1){
		bool flag = false;
		for(int i=1; i<=M; i++) cnt[i] = 0;
		for(int i=1; i<=N; i++){
			if(it[i] > M) return false;
			cnt[a[i][it[i]]]++;
		}
		for(int i=1; i<=N; i++){
			if(cnt[a[i][it[i]]] > x){
				check[a[i][it[i]]] = true;
				flag = true;
			}
		}
		for(int i=1; i<=N; i++){
			while(check[a[i][it[i]]]){
				it[i]++;
			}
		}
		if(!flag) break;
	}
	return true;
}

int main(){
	scanf("%d %d",&N,&M);
	for(int i=1; i<=N; i++){
		for(int j=1; j<=M; j++){
			scanf("%d",&a[i][j]);
		}
	}
	int l,r;
	l = 1; r = N;
	while(l <= r){
		int m = (l+r)/2;
		if(can(m)){
			ans = m;
			r = m-1;
		}else l = m+1;
	}
	printf("%d\n",ans);

	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/
 

// void chmod(ll &M){
//     if(M >= mod) M %= mod;
//     else if(M < 0){
//         M += (abs(M)/mod + 1)*mod;
//         M %= mod;
//     }
// }


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

    string s; cin >> s;
    int ans = 1;
    string pre = to_string(s[0]);
    int n = s.length();
    
    for(int i=1; i<n; ++i){
        if(i == n-1){
            if(to_string(s[i]) != pre) ++ans;
        }
        else{
            if(to_string(s[i]) != pre){
                ++ans;
                pre = to_string(s[i]);
            }
            else{
                ++i;
                ++ans;
                pre += s[i];
            }
        }
    }

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



Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define pr pair<int,int>
#define mod 1000000007
#define endl "\n"

int power(int a,int b,int m=mod)
{
	if(b==0)	return 1;
	if(b==1)	return a;
	int res=power(a,b/2,m);
	res=(res*res)%m;
	if(b&1)	res=(res*a)%m;
	return res;
}
int modinv(int a,int m=mod){ return power(a,m-2,m);}
int add(int a,int b,int m=mod){	int c=(a%m+b%m);	if(c>=m)	c-=m;	return c;}
int sub(int a,int b,int m=mod){	int c=(a%m-b%m);	if(c<0)		c+=m;	return c;}
int mul(int a,int b,int m=mod){	return (a*b)%m;}
//	x<<1 => x*2		x>>1 => x/2;	cout<<flush;
//	cout<<fixed<<setprecision(10)<<ans<<endl;


void solve()
{
	int n;
	cin>>n;
	int a[n],i,ans=0;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		ans^=a[i];
	}
	for(i=0;i<n;i++)
		cout<<(ans^a[i])<<" ";
	cout<<endl;
	
}

int32_t main()
{
	ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
	int t=1;//cin>>t;
	for(int i=1;i<=t;i++){	solve();}
	return 0;
}

Measured memory_bytes: 5132
"""
from functools import reduce
from operator import mul

N = int(input())
A = list(map(int, input().split()))

result = reduce(mul, A)
print(result if result <= 10**18 else -1)
"""
import sys

N = int(input())
A = list(map(int, input().split()))
A.sort()

result = 1
for a in A:
    result *= a
    if result > 10**18:
        print(-1)
        sys.exit()
else:
    print(result)

Measured memory_bytes: 88940
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static int[] sticks;
	public static int[] maps=new int[2001];
	public static void main(String[] args) throws NumberFormatException, IOException {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		sticks=new int[N];
		for(int i=0;i<N;i++) {
			sticks[i]=sc.nextInt();
		}
		
		Arrays.sort(sticks);
		long ans=0;
		
		for(int i=0;i<N;i++) {
			for(int j=i+1;j<N;j++) {
				for(int l=j+1;l<N;l++) {
					if(sticks[i]+sticks[j]<=sticks[l])
						break;
					
					ans++;
				}
			}
		}
		
		System.out.println(ans);
	}

}

Measured memory_bytes: 26496
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import re
import string

MOD = 1000000007
def func(n):
    ret = 1
    for i in range(n):
        ret *= (i + 1)
        ret %= MOD
    return ret

N, M = map(int, input().split())
if N == M:
    print((2 * func(N)**2) % MOD)
elif abs(N - M) == 1:
    print((func(N) * func(M)) % MOD)
else:
    print(0)


Measured memory_bytes: 5824
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
 
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define INF 1e18+7

using namespace std;

typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpi;
typedef vector<pair<ll, ll> > vpl;

vpi g[100000];
ll dist[100000];

void dfs(int index, int parent){
  for(auto &e : g[index]){
    if(e.first == parent) continue;
    dist[e.first] = dist[index] + e.second;
    dfs(e.first, index);
  }
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
  int n;
  cin >> n;
  rep(i, n-1){
    int a, b, c;
    cin >> a >> b >> c;
    a--; b--;
    g[a].emplace_back(b, c);
    g[b].emplace_back(a, c);
  }
  int q, k;
  cin >> q >> k;
  k--;
  dfs(k, -1);
  rep(i, q){
    int x, y;
    cin >> x >> y;
    x--; y--;
    cout << dist[x]+dist[y] << endl;
  }
 	return 0;
}


Measured memory_bytes: 12800
import operator


def permutations(li):
    """Returns a list of previous, current, and
    next permutations of li.

    >>> permutations([1, 2])
    [[1, 2], [2, 1]]
    >>> permutations([1, 3, 2])
    [[1, 2, 3], [1, 3, 2], [2, 1, 3]]
    """
    def perm(op):
        def func(xs):
            i = len(xs) - 1
            while i > 0 and op(xs[i-1], xs[i]):
                i -= 1
            if i > 0:
                i -= 1
                j = i + 1
                while j < len(xs) and op(xs[j], xs[i]):
                    j += 1
                xs[i], xs[j-1] = xs[j-1], xs[i]
                return xs[:i+1] + list(reversed(xs[i+1:]))
            else:
                return None
        return func

    prev_perm = perm(operator.lt)
    next_perm = perm(operator.gt)

    ps = []

    pp = prev_perm(li[:])
    if pp is not None:
        ps.append(pp)

    ps.append(li[:])

    np = next_perm(li[:])
    if np is not None:
        ps.append(np)
    return ps


def run():
    n = int(input())
    li = [int(x) for x in input().split()]
    assert(n == len(li))

    for ps in permutations(li):
        print(" ".join([str(x) for x in ps]))


if __name__ == '__main__':
    run()



Measured memory_bytes: 5708
import java.util.*;
public class Main
{
    public static void main(String [] args)
    {
        Scanner sc = new Scanner(System.in);
        long x = sc.nextLong();
        long cur = 100; int ans = -1;
        for (int i = 0; i <= 4200; i++) {
            if (cur >= x) {
                ans = i; break;
            }
            cur = (long) ((long) cur * 1.01);
        }
        System.out.println(ans);
    }


}

Measured memory_bytes: 35704
A, B, C, X, Y = map(int, input().split())
sum = 0

while X > 0 or Y > 0:
    if X > 0 and Y > 0:
        if A + B > 2 * C:
            sum += 2 * C
        else:
            sum += A + B
        X -= 1
        Y -= 1
    else:
        if X > 0:
            if A > 2 * C:
                sum += 2 * C
            else:
                sum += A
            X -= 1
        else:
            if B > 2 * C:
                sum += 2 * C
            else:
                sum += B
            Y -= 1

print(sum)


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


int main() {
  long long H;
  cin >> H;
  long long cnt = 0;
  while(H!=0) {
    H = H/2;
    cnt++;
  }
  long long ans = 0;
  for (long long i = 0;i<cnt;i++) {
    ans += pow(2,i);
  }
  cout << ans << endl;
  
}

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

int n,m,a,b,sum;

int main()
{
	scanf("%d",&m);
	a=m/500;
	b=m-a*500;
	n=b/5;
	sum=a*1000+n*5;
	printf("%d",sum);
	return 0;
}

Measured memory_bytes: 256
# coding: utf-8
import itertools
n, d = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]

cnt = 0
for c in list(itertools.combinations(x,2)):
        dist = 0
        for i in range(d):
                dist += (c[0][i]-c[1][i])**2
        dist = dist**0.5
        if dist.is_integer():
                cnt += 1

print(cnt)



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

def solve(H: int, W: int, S: "List[str]"):
    ss = [list(s) for s in S]
    answer = 0
    right = [[0]*W for _ in range(H)]
    left = [[0]*W for _ in range(H)]
    up = [[0]*W for _ in range(H)]
    down = [[0]*W for _ in range(H)]

    for h in range(H):
        for j in range(W):
            if ss[h][j] == ".":
                if j>0:
                    right[h][j] = 1+right[h][j-1]
                else:
                    right[h][j] += 1
            else:
                right[h][j] = 0

        for j in range(W-1,-1,-1):
            if ss[h][j] == ".":
                if j<W-1:
                    left[h][j] = 1+left[h][j+1]
                else:
                    left[h][j] += 1
            else:
                left[h][j] = 0
    for w in range(W):                
        for i in range(H-1,-1,-1):
            if ss[i][w] == '.':
                if i < H-1:
                    up[i][w] = 1 + up[i+1][w]
                else:
                    up[i][w] +=1
            else:
                up[i][w] = 0
        for i in range(0,H):
            if ss[i][w] == '.':
                if i > 0:
                    down[i][w] = 1 + down[i-1][w]
                else:
                    down[i][w] +=1
            else:
                down[i][w] = 0

    for i in range(H):
        for j in range(W):
            answer = max(answer,right[i][j]+left[i][j]+up[i][j]+down[i][j]-3)

    print(answer)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    S = [next(tokens) for _ in range(H)]  # type: "List[str]"
    solve(H, W, S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 323712
#include<iostream>
#include<queue>
#include<bitset>
#include<algorithm>
#include<climits>
#include<vector>
#include<deque>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define fill(x,y) memset(x,y,sizeof(x))
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define dump(a) rep(i,a.size()){ cout<<a[i]<<" "; } cout<<endl;
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define INF INT_MAX/3
#define EPS 1e-7

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

  /* stack<int> s; */
  int l=0,r=0;

  rep(i,n){
    if(s[i]=='('){
      l+=1;
    }else if(s[i]==')'){
      if(l>0){ l-=1; }
      else{ r+=1; }
    }
  }
  rep(i,r) cout<<'(';
  cout<<s;
  rep(i,l) cout<<')';
  cout<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int Max = 5e2 + 5, Mod = 1e9 + 7;

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

Measured memory_bytes: 256
N,M=map(x->parse(Int64,x),split(readline()))
s=zeros(Int,M)
c=zeros(Int,M)
for i in 1:M
    s[i],c[i]=map(x->parse(Int64,x),split(readline()))
end
res=-1
st = (N!=1) ? (10^(N-1)) : 0
for i in st:(10^N-1)
    snum=string(i)
    flag=true
    for j in 1:M
        if snum[s[j]]!=string(c[j])[1]
            flag=false
            break
        end
    end
    if flag 
        res=i
        break
    end
end
print(res)

Measured memory_bytes: 112112
#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
#define fori(i,s,n) for(ll i=s;i<=n;i++)
#define ford(j,s,n) for(int i=n;i>=s;i--)
#define pb push_back
#define TEST int t; cin>>t; for(int T=1;T<=t;T++)
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    if(n>=30) cout<<"Yes";
    else cout<<"No";
    return 0;
}


Measured memory_bytes: 3608
#define _CRT_SECURE_NO_WARNINGS
//#pragma comment(linker, "/STACK:128777216")
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
#include<complex>
using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;


const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

const int MAX = 2000 + 47;
const int MOD = 1000 * 1000 * 1000 + 7;

//#define DEBUG
int A[MAX];
int IND[MAX];

vector<int> g[MAX];
int U[MAX];
vector<int> L[MAX];
vector<int> P;
int sz;

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

int merge(int v, vector<int> A)
{
	if (v != -1)
	{
		L[sz].push_back(v);
	}

	P.assign(SZ(A), 0);
	while (1)
	{
		int ind = -1;
		FOR(i, 0, SZ(A))
		{
			if (P[i] < SZ(L[A[i]]))
			{
				ind = i;
				break;
			}
		}

		if (ind == -1) break;
		FOR(i, 0, SZ(A))
		{
			if (P[i] < SZ(L[A[i]]) && L[A[i]][P[i]] > L[A[ind]][P[ind]])
			{
				ind = i;
			}
		}

		L[sz].push_back(L[A[ind]][P[ind]]);
		P[ind]++;
	}

	sz++;
	return sz - 1;
}

int dfs(int v)
{
	U[v] = 1;
	vector<int> A;
	FOR(i, 0, SZ(g[v]))
	{
		int to = g[v][i];
		if (U[to]) continue;
		A.push_back(dfs(to));
	}

	return merge(v, A);
}

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	//ios::sync_with_stdio(false); cin.tie(0);
	int n;
	cin >> n;
	FOR(i, 0, n)
	{
		cin >> A[i];
	}

	sort(A, A + n);
	FOR(i, 0, n)
	{
		FOR(j, 0, n)
		{
			if (i == j) continue;
			if (gcd(A[i], A[j]) == 1) continue;
			g[i].push_back(j);
		}
	}

	FOR(i, 0, n)
	{
		sort(ALL(g[i]));
	}

#ifdef DEBUG
	cout << "B=" << endl;
	FOR(i, 0, n)
	{
		cout << A[i] << " ";
	}
	cout << endl;
	cout << "g=" << endl;
	FOR(i, 0, n)
	{
		cout << i << ": ";
		FOR(j, 0, SZ(g[i])) cout << g[i][j] << " ";
		cout << endl;
	}
#endif
	vector<int> D;
	FOR(i, 0, n)
	{
		if (!U[i])
		{
			D.push_back(dfs(i));
		}
	}

	int p = merge(-1, D);
	FOR(i, 0, SZ(L[p]))
	{
		int ind = L[p][i];
		cout << A[ind] << " ";
	}

	cout << endl;
}

Measured memory_bytes: 26624
#include <iostream>
#include <string>
#include <cctype>
#include <cmath>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <map> // pair
#include <set>
#define MAXSIZE 200000
#define PI 3.141592653589
using namespace std;

template<typename T>
T add(T a,T b){
  return a+b;
}

namespace A
{
  int f(void){
    return 1;
  }
}

int main(){

  int height[10]={0};
  for(int i=0;i<10;i++){
    std::cin >> height[i];
  }

  sort(height,height+10);
  reverse(height,height+10);
  for(int i=0;i<3;i++){
    std::cout << height[i] << '\n';
  }

}



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

#define all(a) (a).begin(),(a).end()

using State = string::const_iterator;
State en;

string String(State &begin);
char Letter(State &begin);
char Alpha(State &begin);

string Cipher(State &begin){
  string ret;
  while(begin != en and *begin != ']'){
    ret += String(begin);
  }
  return ret;
}

string String(State &begin){
  string ret;
  if(*begin == '['){
    ++begin;
    ret = Cipher(begin);
    reverse(all(ret));
    ++begin;
  }else{
    ret = {Letter(begin)};
  }
  return ret;
}

char Letter(State &begin){
  int pm = 0;
  int ret;
  while(1){
    if(*begin == '+'){
      pm++;
      ++begin;
    }else if(*begin == '-'){
      pm--;
      ++begin;
    }else{
      ret = Alpha(begin);
      break;
    }
  }
  if(ret == '?') return 'A';
  ret += pm;
  while('Z' < ret) ret -= 26;
  while(ret < 'A') ret += 26;
  return ret;
}

char Alpha(State &begin){
  char ret = *begin;
  ++begin;
  return ret;
}

signed main(){
  string s;
  while(cin >> s, s != "."){
    en = s.end();
    State beg = s.begin();
    cout << Cipher(beg) << endl;
  }
}


Measured memory_bytes: 3172
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;

int counter(int num);

int n;
vector<int> a(20);
vector<vector<int>> x(20, vector<int>(20));
vector<vector<int>> y(20, vector<int>(20));

int main(){
    cin >> n;
    int i, j;
    for (i = 1; i <= n; i++){
        cin >> a.at(i);
        for (j = 1; j <= a.at(i); j++){
            cin >> x.at(i).at(j) >> y.at(i).at(j);
        }
    }
    int bits;
    int ans = 0;    
    for (bits = 0; bits < (1 << n); bits++){
        bool flg = true;
        for (i = 1; i <= n; i++){
            if( !(bits & (1 << (i-1)))){
                continue;
            }
            for (j = 1; j <= a.at(i); j++){
                if (((bits >> (x.at(i).at(j)-1)) & 1) ^ (y.at(i).at(j)) ){
                    flg = false;
                }
            }
        }
        if (flg == true){
            ans = max(ans, counter(bits));
        }
    }
    cout << ans << endl;
    return 0;
}

int counter(int num){
    //  数値が全部0であれば再帰終了
    if (num == 0){
        return 0;
    }
    //  LSBと1でand演算、1であればカウント
    //  右ビットシフトして再帰
    return counter(num >> 1) + (num & 1);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll MOD = (ll)1e9 + 7;
const double EPS = 1e-9;

int main () {
    
    int h,w; cin >>h>>w;
    vector<string> ss(h);
    for (int i = 0; i < h; i++) {
        string s; cin >> s;
        ss[i] = s;
    }

    vector<vector<int> > u(h, vector<int>(w));
    vector<vector<int> > d(h, vector<int>(w));
    vector<vector<int> > r(h, vector<int>(w));
    vector<vector<int> > l(h, vector<int>(w));

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (ss[i][j] == '#') {
                l[i][j] = 0;
            } else {
                if (j-1 >= 0 && ss[i][j-1] == '.') {
                    l[i][j] = l[i][j-1] + 1;
                } 
            } 
        }
    }
    for (int i = 0; i < h; i++) {
        for (int j = w-1; j >= 0; j--) {
            if (ss[i][j] == '#') {
                r[i][j] = 0;
            } else {
                if (j+1 < w && ss[i][j+1] == '.') {
                    r[i][j] = r[i][j+1] + 1;
                } 
            } 
        }
    }
    for (int j = 0; j < w; j++) {
        for (int i = 0; i < h; i++) {
            if (ss[i][j] == '#') {
                u[i][j] = 0;
            } else {
                if (i-1 >= 0 && ss[i-1][j] == '.') {
                    u[i][j] = u[i-1][j] + 1;
                } 
            } 
        }
    }
    for (int j = 0; j < w; j++) {
        for (int i = h-1; i >= 0 ; i--) {
            if (ss[i][j] == '#') {
                d[i][j] = 0;
            } else {
                if (i+1 < h && ss[i+1][j] == '.') {
                    d[i][j] = d[i+1][j] + 1;
                } 
            } 
        }
    }

    int res = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            int res0 = 0;
            if (ss[i][j] == '.') {
                res0++;
                if (j > 0) {
                    res0 += l[i][j];
                } 
                if (j < w - 1) {
                    res0 += r[i][j];
                } 
                if (i > 0) {
                    res0 += u[i][j];
                } 
                if (i < h - 1) {
                    res0 += d[i][j];
                } 
            } 
            res = max(res, res0);
        }
    }
    
    cout << res << endl;
    return 0;
}




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

int main() {
  int N = 0, A = 0, count = 0;
  
  cin >> N;
  cin >> A;
  
  while ((A % 2) == 0) {
    A /= 2;
    count++;
  }
  
  for (int i = 0; i < N - 1; i++) {
    
    int c = 0;
    cin >> A;
    
    while (1) {
      if ((A % 2) == 0) {
        A /= 2;
        c++;
      }
      else {
        if (count > c) {
          count = c;
        }
        break;
      }
    }
  }
  
  cout << count << endl;
}


Measured memory_bytes: 256
void main(){
		long a;
		long[2] bb;
		scanf("%ld %ld.%ld", &a, &bb[0], &bb[1]);
		long b = bb[0]*100.to!long + bb[1];
		( a*b/100 ).writeln();
						
}

import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math;

// 1要素のみの入力
T _scan(T= int)(){
		return to!(T)( readln().chomp()  );
		
}

// 1行に同一型の複数入力
T[] _scanln(T = int)(){
		T[] ln;
		foreach(string elm; readln().chomp().split()){
					ln ~= elm.to!T();
						
		}
			return ln;
			
}



Measured memory_bytes: 2588
while True:
  n, w = list(map(int, input().split()))
  if n==0:
    break
  v = [int(input()) for i in range(n)]
  h = [0 for i in range(100)]
  ma = 0
  mi = 1e9
  for i in range(n):
    h[v[i]//w] += 1
    ma = max(ma, v[i]//w)
    mi = min(mi, v[i]//w)
  sm = ma-mi
  h = [h[i]/max(h) for i in range(100)]
  ans = 0.01
  for i in range(mi, ma):
    ans += (sm-i+mi)/(sm+mi)*h[i]
  print(ans)


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

int main()
{
    ll a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    c *= 2;

    ll ans = 0;
    ll cnt = min(x, y);
    ans += cnt * min(a + b, c);
    x-= cnt; y -= cnt;

    if (x > 0) {
        ans += x * min(a, c);
    }
    if (y > 0) {
        ans += y * min(b, c);
    }
    cout << ans << endl;
    return 0;
}

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

#define ms(s, n) memset(s, n, sizeof(s))
#define f(i, a, b) for (int i = (a); i <=(b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<ll> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int MOD2 = MOD + 2; //1007681537;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) - 1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
int modulo(int a, int b) { return (a % b + b) % b; }
#define db(x) cerr << #x << " = " << (x) << " ";
#define endln cerr << "\n";

int main()
{
	IOS;
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll n, x, t;
	cin >> n >> x >> t;
	ll m = (n + x - 1) / x;
	cout << m*t << endl;
	// read the stuff at the bottom
	return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
	* use int when constraints limits are tight
	* Time taken : global variable < pass by refernce < pass by value
	* It takes significant amt. of time in pass by value
*/





























Measured memory_bytes: 3608
#include <iostream>
#include <string>
using namespace std;
int a;
int main() {
  string s;
  a = 0;
  cin >> s;
  for(int i=0;i<4;i++) {
    if(s[i]=='+') {
      a=a+1;
    }
    else if(s[i]=='-') {
      a=a-1;
    }
  }
  cout << a << '\n';
  return(0);
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

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

int main(int argc, char **argv)
{
    ll A, B;
    cin >> A >> B;
    ll K = (A + B) / 2;
    if (abs(A - K) == abs(B - K)) cout << K << endl;
    else cout << "IMPOSSIBLE" << endl;
    return 0;
}


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

using namespace std;

int main()
{
    int n;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++) cin >> a[i];
    sort(a,a+n);
    int sum=0;
    for(int i=0;i<n-1;i++) sum+=a[i];
    if(a[n-1]<sum) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
n,y = map(int,input().split())

count=0
s='-1 -1 -1'
for i in range(n+1):
    for j in range(n+1-i):
        rest_n = n-i-j
        # print(i,j,rest_n, rest)
        rest = y - (10000*i + 5000*j + 1000*rest_n)
        if rest==0:
            s = '{} {} {}'.format(i, j, rest_n)
print(s)

Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {

    public Main(){
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());

        switch (N%10){
            case 0:
            case 1:
            case 6:
            case 8:
                System.out.println("pon");
                break;
            case 3:
                System.out.println("bon");
                break;
            case 2:
            case 4:
            case 5:
            case 7:
            case 9:
                System.out.println("hon");
                break;
        }
    }

    public static void main(String[] args) {
        Main M = new Main();
    }
}


Measured memory_bytes: 35752
import java.util.Scanner

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val c = Array<Int>(9, { 0 })
    for (i in (0..8)) {
        c[i] = scanner.nextInt()
    }
    for (i in (0..1)) {
        for (j in (0..1)) {
            if (c[i + 3 * j] + c[i + 3 * j + 4] != c[i + 3 * j + 1] + c[i + 3 * j + 3]) {
                println("No")
                return
            }
        }
    }
    println("Yes")
}

Measured memory_bytes: 31396
import heapq
n, m = map(int, input().split())
a = list(map(lambda x: -int(x), input().split()))
heapq.heapify(a)

for i in range(m):
    largest = -heapq.heappop(a)
    largest = largest // 2
    heapq.heappush(a, -largest)

print(-sum(a))

Measured memory_bytes: 14184
from functools import reduce

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

def gcd_l(numbers):
    return reduce(gcd,numbers)


N,X = map(int,input().split())
x =list(input().split())
Y = []

for i in range(len(x)):
    y = abs(int(x[i]) - X)
    Y.append(y)
    
D = gcd_l(Y)

print(D)


Measured memory_bytes: 14848
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	global Y
	global X
	global q
	global maps
	global maze

	H,W = inputMap()
	Y = H
	X = W
	mapmap = []
	ser = []
	for i in range(H):
		tmp = input()
		tmp = tmp[:-1]
		mapmap.append(tmp)

		for j,val in enumerate(tmp):
			if val == ".":
				ser.append((i,j))

	maps = [[-1 for _ in range(X)] for _ in range(Y)]
	maze = mapmap
	q = Queue()

	ans = 0
	for i,val in enumerate(ser):
		s,e = val
		tmp = serchs(s,e,s,e)

		for i in maps:
			tmptmp = max(i)
			#print(tmptmp)
			if tmptmp > ans:
				ans = tmptmp

		maps = [[-1 for _ in range(X)] for _ in range(Y)]

	print(ans)

def serchs(start_y,start_x, goal_y,goal_x):
	q.enqueue((start_y, start_x))
	maps[start_y][start_x] = 0
	run()

	return(maps[goal_y][goal_x])

def run():
	while True:
		tmp = q.dequeue()
		if tmp == None:
			return

		y, x = tmp

		counts = maps[y][x] + 1
		if not y <= 0 and maps[y-1][x] == -1 and maze[y-1][x] == ".":
			q.enqueue((y-1, x))
			maps[y-1][x] = counts
		if not x <= 0 and maps[y][x-1] == -1 and maze[y][x-1] == ".":
			q.enqueue((y, x-1))
			maps[y][x-1] = counts
		if not y >= Y-1 and maps[y+1][x] == -1 and maze[y+1][x] == ".":
			q.enqueue((y+1, x))
			maps[y+1][x] = counts
		if not x >= X-1 and maps[y][x+1] == -1 and maze[y][x+1] == ".":
			q.enqueue((y, x+1))
			maps[y][x+1] = counts

class Queue:
    def __init__(self, queue = None):
        if type(queue) is type([]):
            self.queue = queue
        else:
            self.queue = []

    def enqueue(self, e):
        self.queue.append(e)
        return self.queue

    def dequeue(self):
        try:
            qEl = self.queue[0]
            del self.queue[0]
            return qEl
        except IndexError:
            return None


if __name__ == "__main__":
	main()


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

const int MOD = (int)1e9+7;

int main(){
	int W,H,x,y;
	cin >> W >> H >> x >> y;

	if(x*2==W && y*2==H){
		printf("%.10f 1\n",(double)W*H/2);
	}
	else{
		printf("%.10f 0\n",(double)W*H/2);
	}

	return 0;
}


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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

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; }

template<typename T>
void print1(T begin, T end) {
  while (begin != end) {
    cout << (*begin) << " ";
    *begin++;
  }
  cout << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
  for (int i = 0; i < height; i++) {
    for (int j = 0; j < width; j++) {
      cout << " " << Array[i][j];
    }
    cout << endl;
  }
}

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

const int INF = 1e15;

int N;
int h[111111];
int dp[111111];

signed main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> h[i];
  }

  fill(dp, dp+N+10, INF);
  dp[0] = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 1; j <= 2; j++) {
      if (i + j < N) {
        chmin(dp[i+j], dp[i] + abs(h[i] - h[i+j]));
      }
    }
  }

  cout << dp[N-1] << endl;

  return 0;
}

Measured memory_bytes: 1792
#[allow(dead_code)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(dead_code)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(dead_code)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        aa: [usize1; n - 1],
    }
    let mut rr = vec![0; n];
    for ap in aa {
        rr[ap] += 1;
    }
    for r in rr {
        println!("{}", r);
    }
}


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

typedef long long ll;
typedef long double ld;

map <string, int> cnt;

int main(){
    ios_base::sync_with_stdio(false), cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n;
    cin >> n;
    while(n--){
        string s;
        cin >> s;
        cnt[s]++;
    }
    cout << "AC x " << cnt["AC"] << "\n";
    cout << "WA x " << cnt["WA"] << "\n";
    cout << "TLE x " << cnt["TLE"] << "\n";
    cout << "RE x " << cnt["RE"] << "\n";
    return 0;
}


Measured memory_bytes: 3676
def counting_sort(A, k):
    """整数列 A を昇順に計数ソートでソートした新しいリストを返す。

    A 内の整数 x はすべて 0 <= x <= k の範囲にある。
    """
    # A 内の整数 i の出現数を C[i] に記録していく。
    C = [0 for _ in range(0, k + 1)]
    for x in A:
        C[x] += 1
    
    # A 内の整数のうち、i 以下の出現頻度を C[i] に記録する。
    for i in range(1, k + 1):
        C[i] += C[i - 1]
    
    n = len(A)
    B = [ None for _ in range(n) ]
    for j in range(n - 1, -1, -1):
        B[C[A[j]] - 1] = A[j]   # 逆順にすることで安定なソートになる。
        C[A[j]] -= 1
    
    return B

if __name__ == '__main__':
    import sys

    n = int(input())
    A = list(map(int, sys.stdin.readline().split()))
    k = max(A)

    print(*counting_sort(A, k))



Measured memory_bytes: 225720
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> ump;
typedef pair<ll, ll> P;

ump mp;

void solve() {
}

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
        mp = ump();
#pragma clang diagnostic pop
#endif
        ll n, C;
        cin >> n >> C;
        ll D[C][C];
        rep(i, C) rep(j, C) cin >> D[i][j];
        ll c[n][n];
        ll c_count[3][C];
        rep(i, 3) rep(j, C) c_count[i][j] = 0;
        rep(i, n) {
            rep(j, n) {
                cin >> c[i][j], c[i][j]--;
                c_count[(i + 1 + j + 1) % 3][c[i][j]]++;
            }
        }

        ll ans = ll_inf;
        rep(k, C) {
            rep(l, C) {
                if (k == l) continue;
                rep(m, C) {
                    if (l == m || m == k) continue;
                    ll temp = 0;
                    rep(i, C) temp += D[i][k] * c_count[0][i];
                    rep(i, C) temp += D[i][l] * c_count[1][i];
                    rep(i, C) temp += D[i][m] * c_count[2][i];
                    ans = min(temp, ans);
                }
            }
        }
        cout << ans << endl;

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

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

int main(){
    string s; cin >> s;
    int N = s.size();
    bool flg = true;
    for(int i=0; i<N; ++i) {
        if(i==0 && s[i]!='1') flg = false;
        if(i==N-1 && s[i]=='1') flg = false;
        if(i!=N-1 && s[i]!=s[N-i-2]) flg = false;
    }
    if(!flg) cout << -1 << endl;
    else {
        vector<pair<int,int>> res;
        s[N-1] = '1';
        int idx = N-1;
        for(int i=N-2; i>=0; --i) {
            res.push_back(make_pair(i+1,idx+1));
            if(s[i]=='1') idx = i;
        }
        for(auto p:res) printf("%d %d\n", p.first, p.second);
    }
    return 0;
}

Measured memory_bytes: 2420