akhauriyash/Code-Regression huggingface dataset:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
# from fractions import gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    A, B, C = MAP()
    c = Counter([A, B, C])

    print("Yes" if len(c.keys()) == 2 else "No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 38640
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define rAll(x) (x).rbegin(),(x).rend()
using namespace std;
using Graph=vector<vector<int>>;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
const int mod=1000000007;
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}
int roundup(int a,int b){return	(a-1)/b+1;}
void YN(bool flg){cout<<(flg?"YES":"NO")<<endl;}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<endl;}
void yn(bool flg){cout<<(flg?"yes":"no")<<endl;}


signed main(){
	double n,m,d;
	cin>>n>>m>>d;
	double one=2*(n-d)/(n*n);
	if(d==0) one/=2;
	printf("%.16f",one*(m-1));
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pi 3.14159265358979323846264
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define vi vector <int>
#define vl vector <long long>
#define vpii vector <pair <int, int> >
#define ll long long
#define fi first
#define se second
int a, b, c, d;
int main() {
    cin >> a >> b >> c;
    d = a*100+b*10+c;
    if (d%4==0) printf("YES\n");
    else printf("NO\n");
    return 0;
}

Measured memory_bytes: 764
n,w=map(int,input().split())
l=[[0,0]]
for _ in range(n):
    l.append(list(map(int,input().split())))
dp=[[-10**10]*(w+1) for _ in range(n+1)]
for k in range(w+1):
    dp[0][k]=0
for i in range(1,n+1):
    for j in range(0,w+1):
        if j-l[i][0]>=0:
            dp[i][j]=max(dp[i-1][j-l[i][0]]+l[i][1],dp[i-1][j])
        else:
            dp[i][j]=dp[i-1][j]
print(dp[n][w])

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

using namespace std;

typedef pair<long,long> Data1;
typedef pair<pair<long,long>,long> Data2;

Data2 a[100001];
Data1 b[100001];
long m,n;

void Docfile()
{
    cin >> n >> m;
    for (int i=1;i<=m;i++)
    {
        cin >> b[i].first >> b[i].second;
        a[i].first.first=b[i].first;
        a[i].first.second=b[i].second;
        a[i].second=i;
    }
}

void Xuli()
{
    sort(a+1,a+1+m);
    long dem=1;
    b[a[1].second].second=1;
    for (int i=2;i<=m;i++)
    {
        if (a[i].first.first==a[i-1].first.first)
            dem++;
        else
            dem=1;
        b[a[i].second].second=dem;
    }
    for (int i=1;i<=m;i++)
    {
        string s1=to_string(b[i].first),s2=to_string(b[i].second);
        for (int j=1;j<=6-s1.length();j++)
            cout << '0';
        cout << s1;
        for (int j=1;j<=6-s2.length();j++)
            cout << '0';
        cout << s2 << endl;
    }
}

int main()
{
    Docfile();
    Xuli();
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
//make_tuple emplace_back next_permutation push_back make_pair second first setprecision

#if MYDEBUG
#include "lib/cp_debug.h"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF=334ll<<53;
constexpr int INF=15<<26;
constexpr LL  MOD=1E9+7;
using Graph = vector<vector<int>>;

struct Problem{
    int n;
    Graph g;
    vector<int> vwin, ewin;
    Problem(LL n):n(n),g(n),vwin(n),ewin(n){};
    void dfs(int prev, int cur){
        DBG(prev,cur)
        if((int)g[cur].size()==1 and g[cur][0]==prev){
            vwin[cur]=1;
        DBG(cur,vwin[cur],ewin[cur])
            return;
        }
        vwin[cur]=1;
        int tmp=0;
        for(auto &x : g[cur]){
            if(x!=prev){
                dfs(cur,x);
                if(vwin[x]==1)ewin[cur]=1,tmp++;
                if(ewin[x]==0)vwin[cur]=0;
            }
        }
        if(tmp>=2)vwin[cur]=1;
        DBG(cur,vwin[cur],ewin[cur])
    }
    void solve(){
        for(int i=0; i<n-1; ++i){
            int a,b;
            cin >> a >> b;
            --a;--b;
            g[a].emplace_back(b);
            g[b].emplace_back(a);
        }
        dfs(-1,0);
        if(vwin[0])cout <<"First"<<"\n";
        else cout << "Second" << "\n";
    }
};

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    long long n=0;
    cin >> n;
    Problem p(n);
    p.solve();
    return 0;
}



Measured memory_bytes: 6784
x = input()
if x =='a':
    print('b')
if x =='b':
    print('c')
if x =='c':
    print('d')
if x =='d':
    print('e')
if x =='e':
    print('f')
if x =='f':
    print('g')
if x =='g':
    print('h')
if x =='h':
    print('i')
if x =='i':
    print('j')
if x =='j':
    print('k')
if x =='k':
    print('l')
if x =='l':
    print('m')
if x =='m':
    print('n')
if x =='n':
    print('o')
if x =='o':
    print('p')
if x =='p':
    print('q')
if x =='q':
    print('r')
if x =='r':
    print('s')
if x =='s':
    print('t')
if x =='t':
    print('u')
if x =='u':
    print('v')
if x =='v':
    print('w')
if x =='w':
    print('x')
if x =='x':
    print('y')
if x =='y':
    print('z')


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

int main(){
	// sengen
	long long h,n,sum = 0;
	long long a;
	// nyuryoku
	cin >> h >> n;
	for(int i=0;i<n;i++){
		cin >> a;
		sum += a;
	}
	// keisan
	if(sum >= h){
		cout << "Yes";
	}else{
		cout << "No";
	}
	// syutsuryoku
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
 
int main()
{
	ll N, K;
	cin >> N >> K;
	vector<ll> w(N), d(N);
	for (int i = 0; i < N; i++) {
		cin >> w[i] >> d[i];
	}
	ll lb = 0, ub = 2e18;
	while (ub - lb > 1) {
		ll m = (lb + ub) / 2, cnt = 1;
		for (int i = 0; i < N; i++) {
			cnt += m >= w[i] ? (m - w[i]) / d[i] + 1 : 0;
		}
		if (cnt > K) {
			ub = m;
		}
		else {
			lb = m;
		}
	}
	cout << ub << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for(ll i=(ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
constexpr ll INF = 1LL<<60;

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

    vector<ll> dp(n+1);
    dp[n-1] = s[n-1] == 'o' ? 1 : 0;
    for(ll i=n-2; i>=0; --i) {
        dp[i] = dp[i+1];
        if(s[i]=='o') chmax(dp[i], 1LL);
        if(i+c+1<n && s[i]=='o') chmax(dp[i], dp[i+c+1]+1); 
    }
    dump(dp);

    ll last = -c-1, cnt = 0;
    REP(i, n) {
        if(s[i]=='x') continue;
        
        ll pos = max(i, last+c) + 1;
        ll tail = (pos<n ? dp[pos] : 0);
        dump(cnt, last, tail);
        if(cnt + tail < k) cout << i+1 << "\n";

        if(i-last>c) {
            cnt++;
            last = i;
        }
    }

    return 0;
}


Measured memory_bytes: 3348
n,k=map(int,input().split())
sunuke=[0]*n
cnt=0
for i in range(k):
	num=int(input())
	a=list(map(int,input().split()))
	#print(i,a)
	for i in a:
		sunuke[i-1]+=1
#print(sunuke)
for i in range(n):
	if sunuke[i]==0:
		cnt+=1
print(cnt)

Measured memory_bytes: 9096
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);++i)
int main() {
  ios::sync_with_stdio(false);
  while(true) {
    int N; cin >> N;
    if(N == 0) break;
    vector<pair<int, int>> doll;
    REP(i,N) {
      int h, r; cin >> h >> r;
      doll.emplace_back(h, r);
    }
    int M; cin >> M;
    N += M;
    REP(i,M) {
      int h, r; cin >> h >> r;
      doll.emplace_back(h, r);
    }
    vector<vector<int>> G(N);
    REP(i,N) {
      REP(j,N) {
        if(doll[i].first > doll[j].first && doll[i].second > doll[j].second) {
          G[i].push_back(j);
        }
      }
    }
    vector<int> d(N, 1);
    while(true) {
      bool update = false;
      REP(i,N) {
        for(int next : G[i]) {
          if(d[next] < d[i] + 1) {
            d[next] = d[i] + 1;
            update = true;
          }
        }
      }
      if(!update) break;
    }
    cout << *max_element(d.begin(), d.end()) << endl;
  }
}

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

int main()
{
  string s;
  cin >> s;
  int ans = 0, m = 0;
  rep(i,s.size()){
    if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
      m++;
      ans = max(ans,m);
    }
    else {
      m = 0;
    }
  }
    
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <cstdio>
#include <cmath>
#include <sstream>
#include <algorithm>

using namespace std;

int main() {
	int N;
	cin >> N;
	
	if (N == 1) {
		cout << 1 << endl;
	}
	else if (N < 4) {
		cout << 2 << endl;
	}
	else if (N < 8) {
		cout << 4 << endl;
	}
	else if (N < 16) {
		cout << 8 << endl;
	}
	else if (N < 32) {
		cout << 16 << endl;
	}
	else if (N < 64) {
		cout << 32 << endl;
	}
	else {
		cout << 64 << endl;
	}
}


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

int main(){
  int n, u, k, tmp, lp;
  vector<int> d;
  vector< vector<int> > v;
  vector< queue<int> > q;
  
  cin >> n;
  v.resize(n+1);
  d.resize(n+1, 1000000007);
  q.resize(1);
  d[1]=0;
  q[0].push(1);
  
  for (int r = 0; r < n; r++) {
	cin>> u >> k;
    for(int i=0;i<k;i++){
      cin>> tmp;
      v[u].push_back(tmp);
    }
  }
  
  for(int r=0;r<n;r++){
    //cout<< "r=" << r <<endl;
    q.resize(q.size()+1);
    lp=q[r].size();
    for(int i=0;i<lp;i++){
      tmp=q[r].front();
      //cout<< "tmp=" << tmp <<endl;
      q[r].pop();
      for(int j=0;j<v[tmp].size();j++){
        //cout<< "push " << v[tmp][j] << "  val " << min(v[tmp][j], d[tmp]+1) <<endl;
        if(d[v[tmp][j]]>d[tmp]+1){
          q[r+1].push(v[tmp][j]);
      		d[v[tmp][j]]=min(d[v[tmp][j]], d[tmp]+1);
        }
      }
    }
  }
  
  for(int i=1;i<=n;i++){
    cout<< i << " ";
    if(d[i]==1000000007) cout<< "-1" <<endl;
    else cout<< d[i] <<endl;
  }
  
  return 0;
}


Measured memory_bytes: 3192
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int ans = Math.min(n * a, b);
		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
import java.util.*;
/*being john malkovich*/
class Main
{
	public static void main(String[] args)
	{
		long max = (long)(Math.pow(10,18));
		// System.out.println(max);
		Scanner s = new Scanner(System.in);
		long x = s.nextLong();
		long y = s.nextLong();

		/*
		if((x*2)%y!=0)
		{
			System.out.println(x*2);
		}
		else if((x*3)%y!=0)
		{
			System.out.println(x*3);
		}
		else
		{
			System.out.println("-1");
		}
		*/

		/*
		
		// else
		{
			int flag = 0;
			for(long i =1;i*x <= max;i++)
			{
				if((i*x)%y!=0)
				{
					flag = 1;
					System.out.println(i*x);		
					break;
				}
			}
			if(flag == 0)
				System.out.println("-1");
		}
		// */
		/*

		if(x!=y && x%y!=0)
		System.out.println(x*y + x);
		else if(x!=y && (x+1)%y!=0)
			System.out.println((x+1)*(y + 1));
		else
		System.out.println("-1");

		*/
		/*

		if(x!=y)
			System.out.println(x);
		else
			System.out.println("-1");
			*/

			if((x*2)%y!=0)
		{
			System.out.println(x*2);
		}
		else if((x*3)%y!=0)
		{
			System.out.println(x*3);
		}
		else if((x*4)%y!=0)
		{
			System.out.println(x*4);
		}
		else if((x*5)%y!=0)
		{
			System.out.println(x*5);
		}
		else if((x*6)%y!=0)
		{
			System.out.println(x*6);
		}
		else
		{
			System.out.println("-1");
		}
	}

}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n+1); i++)
const long long INF = 1LL << 60;
int main(){
  int X,Y,Z;
  cin>>X>>Y>>Z;
  int ans=0;
    if(Y+Z*2<=X){
        X-=Y+Z*2;
        ans++;
        ans+=X/(Y+Z);
    }
  cout<<ans<<endl;
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>

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

int main() {
  int N;
  std::cin >> N;
  std::vector<int> A(N);
  std::vector<int> B(N);
  std::vector<int> C(N-1);
  rep(i,N) std::cin >> A[i];
  rep(i,N) std::cin >> B[i];
  rep(i,N-1) std::cin >> C[i];
  int sum {};
  for (const auto& e : B) sum += e;

  for (auto i = 1;i < N;++i) {
    if (A[i-1]+1 == A[i]) {
      sum += C[A[i-1]-1];
    }
  }
  std::cout << sum << '\n';
}


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

int main()
{
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    string root = "";
    const int dx = tx - sx;
    const int dy = ty - sy;

    cout << string(dy, 'U') << string(dx, 'R');
    cout << string(dy, 'D') << string(dx, 'L');
    cout << 'L' << string(dy + 1, 'U') << string(dx + 1, 'R') << 'D';
    cout << 'R' << string(dy + 1, 'D') << string(dx + 1, 'L') << 'U' << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define dump(a) cout << a << endl; 

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0; true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void ansYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void ansYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

typedef pair<int, int> pai;


//ここまでライブラリ
//ここから本文
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	ansYES((a * 100 + b * 10 + c) % 4 == 0);
}

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

int main() {
  int n;
  ll h;
  cin>>n>>h;
  ll a[n];
  ll b[n];
  rep(i,0,n){
    cin>>a[i]>>b[i];
  }
  ll c=0;
  rep(i,0,n){
    c=max(c,a[i]);
  }
  sort(b,b+n);
  ll ans=0;
  rep(i,0,n){
    if(b[n-1-i]<c) break;
    h-=b[n-1-i];
    ans++;
    if(h<=0) break;
  }
  if(h>0) ans+=(h+c-1)/c;
  cout<<ans<<endl;
}


Measured memory_bytes: 1792
N, M = map(int, input().split())

ss = []
for _ in range(N):
    a, b = map(int, input().split())
    ss.append((a, b))

ss.sort()

m = 0
for a, b in ss:
    m += a * min(b, M)
    M -= b
    if M <= 0:
        break

print(m)

Measured memory_bytes: 16892
#include <bits/stdc++.h>
using namespace std;
#define pi 3.14159265359
#define int long long
#define pii pair<int,int>
const int mod = 1e9+7;
 
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};




int32_t main()
{

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

    
     int s,w;
	 cin>>s>>w;
	 if(w>=s)
	 {
		 cout<<"unsafe\n";
	 }
	 else cout<<"safe\n";


}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
const int maxn=2e3+5;
long double a,b,x;
const long double pi=3.14159265358979;
int main()
{
    cin>>a>>b>>x;
    long double v=a*a*b;
    if(v>=x*2)
    {
        long double l=atan(2.0*x/(a*b*b));
        long double angel=l*180/pi;
        angel=90-angel;
        printf("%.10f",(double)angel);
    }
    else
    {
        long double l=atan((2.0*b-2.0*x/(a*a))/a);
        long double angel=l*180/pi;
        printf("%.10f",(double)angel);
    }
    return 0;
}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x.size())
#define pb push_back
#define mp make_pair
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define int long long
#define endl "\n"

using namespace std;

const int N = 500510;
const int inf = (int)(1e18) + 123;
const int mod = 998244353;
const double eps = 1e-9;


int n;

pair <int, int> p[N];

signed main () {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    for(int i = 1; i <= n; ++i) {
        cin >> p[i].first;
        p[i].second = i;
    }
    sort(p + 1, p + n + 1);
    for(int i = 1; i <= n; ++i) {
        cout << p[i].second << ' ';
    }
    return 0;
}

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

int n,q;
int p[10005];

int find(int x) {
    return p[x]<0?x:p[x]=find(p[x]);
}

void uni(int x,int y) {
    if ((x=find(x))==(y=find(y))) return;
    if (p[y]<p[x]) swap(x,y);
    if (p[x]==p[y]) --p[x];
    p[y]=x;
}

int main() {
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cin>>n>>q;
    memset(p,-1,sizeof p);
    while (q--) {
        int f,x,y; cin>>f>>x>>y;
        if (f==0) uni(x,y);
        else cout<<(find(x)==find(y))<<'\n';
    }
}


Measured memory_bytes: 3256
s = list(input())

if s[0] != "A":
    print("WA")
    exit()
if s[2:-1].count("C") != 1:
    print("WA")
    exit()
for t in s:
    if t.isupper() and t != "A" and t != "C":
        print("WA")
        exit()

print("AC")


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

int main(){
	int h,w,m;
	cin>>h>>w>>m;
	int ph[m], pw[m];
	for(int i=0; i<m; i++){
		cin>>ph[i]>>pw[i]; ph[i]--; pw[i]--;
	}
	int cth[h], ctw[w];
	memset(cth,0,sizeof(cth));
	memset(ctw,0,sizeof(ctw));
	vector<int> at_h[h];
	for(int i=0; i<m; i++){
		cth[ph[i]]++; ctw[pw[i]]++;
		at_h[ph[i]].push_back(pw[i]);
	}
	
	int optH=0,optW=0;
	for(int i=0; i<h; i++) optH=max(optH,cth[i]);
	for(int i=0; i<w; i++) optW=max(optW,ctw[i]);
	
	int ctOptW=0;
	for(int i=0; i<w; i++){
		if(ctw[i]==optW) ctOptW++;
	}
	
	for(int i=0; i<h; i++){
		if(cth[i]!=optH) continue;
		int cr=0;
		for(int j : at_h[i]){
			if(ctw[j]==optW) cr++;
		}
		if(cr!=ctOptW){
			cout<<optH+optW; return 0;
		}
	}
	cout<<optH+optW-1;
}

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

int main() {
  int H, W, n;
  int S[50 + 2 ][50 + 2];
  char sline[60];
  cin >> H >> W;

  // Dummy
  for (int j = 0; j < W + 2; j++) {
	  S[0][j] = 0;
	  S[H + 1][j]  = 0;
  }
  // Input
  for (int i = 1; i < H + 1; i++) {
    cin >> sline;
    S[i][0] = 0;
    for (int j = 1; j < W + 1; j++) {
    	if (sline[j - 1] == '.') {
    		S[i][j] = 0;
    	} else if (sline[j - 1] == '#'){
    		S[i][j] = 1;
    	} else {
    	}
       }
    S[i][W + 1] = 0;
  }
  // OutPut
  for (int i = 1; i < H + 1; i++) {
	  for (int j = 1; j < W + 1; j++) {
		 n = S[i -1][j - 1] + S[i -1][j] + S[i -1][j + 1] +
			   S[i    ][j - 1] +                 S[i    ][j + 1] +
			   S[i+1][j - 1] + S[i +1][j] + S[i +1][j + 1] ;
		if (S[i][j] == 0) {
			cout << n;
		} else {
			cout << "#";
		}
	  }
	  cout << endl;
  }


  return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
#define forit(it, st) for(auto it : st)
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
const int days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int toint(double a){
	return a * 1.08;
}
void solve(){
	int n;
	cin >> n;
	int qq = n / 100;
	int pp = n % 100;
	if(pp <= qq * 5){
		puts("1");
	}
	else puts("0");

}	

 
int main()
{
    Red;
  	// int T; cin >> T; while(T--)
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define MAX 100005
#define NIL -1

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

Node T[MAX];
int n, D[MAX];

void print(int u) {
  int i, c;
  cout << "node " << u << ": ";
  cout << "parent = " << T[u].p << ", ";
  cout << "depth = " << D[u] << ", ";

  if (T[u].p == NIL) cout << "root, ";
  else if (T[u].l == NIL) cout << "leaf, ";
  else cout << "internal node, ";

  cout << "[";

  for (i = 0, c = T[u].l; c != NIL; i++, c = T[c].r) {
    if (i) cout << ", ";
    cout << c;
  }

  cout << "]" << endl;
}

void rec(int u, int p) {
  D[u] = p;
  if (T[u].r != NIL) rec(T[u].r, p);
  if (T[u].l != NIL) rec(T[u].l, p + 1);
}

int main() {
  int i, j, d, v, c, l, r;
  cin >> n;

  for (i = 0; i < n; i++) T[i].p = T[i].l = T[i].r = NIL;
  for (i = 0; i < n; i++) {
    cin >> v >> d;
    for (j = 0; j < d; j++) {
      cin >> c;
      if (j == 0) T[v].l = c;
      else T[l].r = c;
      l = c;
      T[c].p = v;
    }
  }
  for (i = 0; i < n; i++) {
    if (T[i].p == NIL) r = i;
  }

  rec(r, 0);

  for (i = 0; i < n; i++) print(i);

  return 0;
}



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

int main(void){
    int n;
    cin >> n;
    vector<ll> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    sort(a.rbegin(), a.rend());

    ll ans = 0;
    int j = 0;
    for(int i=1; i<=n-1; i++){
        ans += a[j];
        if(i % 2 == 1) j++;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4852
//
// Created by 江口慎悟 on 2019-03-19.
//



#include <iostream>
#include <vector>
#include <unordered_map>

using namespace std;
int b(int N, const vector<int>& d){
    vector<bool> occur(200,false);
    int count = 0;

    for(int i = 0; i < N; i++){
        if(!occur[ d[i] ] ){
            count++;
            occur[ d[i]] = true;
        }
    }

    return count;

}

int b_with_map(int N, const vector<int>& d){
    unordered_map<int, bool>map;

    int count = 0;

    for(int i = 0; i < N; i++){
        if( map.find( d[i] ) == map.end() ){
            map[ d[i] ] = true;
            count++;
        }

    }
    return count;

}

int main(){

    int N; cin >> N;
    vector<int> d(N);
    for(int i = 0; i < N; i++){
        cin >> d[i];
    }
    cout << b_with_map(N, d);

}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
 
int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);
	float n;
	cin>>n;
	float answer=2.00000 * 3.14159265 * n;
	printf("%.5f",answer);
	return 0;
}

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

using namespace std;

inline int ctoi(char c) { if(c < '0' || '9' < c) throw invalid_argument("ctoi error"); return c - '0'; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for(int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T>
inline T gcd(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("gcd error: x <= 0 or y <= 0");
	
	if(x < y) swap(x, y);
	T r = x % y;

	while(r != 0){
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}
template <typename T>
inline T lcm(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("lcm error: x <= 0 or y <= 0");

	return x * y / gcd(x, y);
}

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

	if(s == "ABC") cout << "ARC";
	else cout << "ABC";
	
	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  int n;
  cin>>n;
  int s=0;
  int v=n;
  for(int i=10;i>=0;i--){
    int c=pow(10,i);
    s+=n/c;
    //cout<<s<<endl;
    n-=n/c*c;
    //cout<<n<<endl;
  }
  if(v%s==0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
 // cout<<s<<endl;
}










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

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

    for(int i=0; i<s.size()-1; i++){
        for(int j=i+1; j<s.size(); j++){
            if(s[i]==s[j]) {
                cout << "no" << endl;
                return 0;
            }
        }
    }

    cout << "yes" << endl;

    return 0;
}

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

int main(){
    int d;
    cin >> d;
    if(d==25) cout << "Christmas" << endl;
    else if(d==24) cout << "Christmas Eve" << endl;
    else if(d==23) cout << "Christmas Eve Eve" << endl;
    else cout << "Christmas Eve Eve Eve" << endl;
}

Measured memory_bytes: 3604
function Main(input) {
  input=input.split("\n");
  if(input[input.length-1]===''){
    input.pop();
  }
  const N=input[0].split(' ')[0]-0;
  const K=input[0].split(' ')[1]-0;
  var array=new Array(N+1);
  for(var i=1;i<=N;i++){
    array[i]=Math.max(0,Math.ceil(Math.log2(K/i)));
  }
  array.shift();
  console.log(array.reduce((acc,cur)=>{
    return acc+(1/2)**cur/N;
  },0));

}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 34312
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
#include <numeric>
#include <random>
#include <climits>  // A/Bを計算するときA==LLONG_MIN && B==-1のみ(1ull<<63)で代用
using namespace std;

typedef long long LL;
typedef pair<LL, LL> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;				// VVL v(100,VL(100,0));
typedef vector<pair<LL, LL> > VP;
typedef vector<string> VS;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<LL, pair<P, P> > PP;

#define INF 999999999999999997		// 少し加算したらオーバーフローする
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
#define O(s) cout<<s<<endl;

#define DUMP_VVI(b) if(dbgF){FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}

template<class T>T IN() { T d; cin >> d; return d; }

LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; } // 最大公約数（Greatest Common Divisor）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; } // 最小公倍数（Least Common Multiple）
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); } // うるう年判定
string Replace(string S, string from, string to) { auto p = S.find(from); while (p != string::npos) { S.replace(p, from.size(), to); p = S.find(from, p + to.size()); }return S; }

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int dxx[8] = { 0,1,1,1,0,-1,-1,-1 };
int dyy[8] = { 1,1,0,-1,-1,-1,0,1 };

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

int main() {
	FAST_IO;
	bool dbgF = true; // for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;

	LL N;
	string S;
	LL ans = INF;
	cin >> N >> S;

	// Wの累積和
	VL W_ruiseki(N + 1, 0);
	FOR(i, 0, S.length()) {
		if (i == 0) {
			if (S[i] == 'W')W_ruiseki[i] = 1;
			else W_ruiseki[i] = 0;
		}
		else {
			if (S[i] == 'W')W_ruiseki[i] = W_ruiseki[i - 1] + 1;
			else W_ruiseki[i] = W_ruiseki[i - 1];
		}
	}

	// 先頭から1人ずつ順番にリーダーにしてみて何人向き変える必要あるか調べる
	FOR(i, 0, S.length()) {
		LL nowAns = 0;
		// リーダーより左側にいてW向いている人 + 右側にいてE向いている人
		if (i == 0)nowAns = N - W_ruiseki[N - 1];
		else nowAns = W_ruiseki[i - 1] + (N - 1 - i) - (W_ruiseki[N - 1] - W_ruiseki[i]);

		ans = min(ans, nowAns);
	}

	O(ans);

	return 0;
}

Measured memory_bytes: 2964
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MOD=1e9+7;
const long double Pi=acos(-1);
int main(){
  vector<ll> vec={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  ll K;
  cin>>K;
  cout<<vec.at(K-1)<<endl;
}

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

int main(){
     int n,k;
    cin>>n>>k;
    vector<double>p(n);
    vector<double>sum(n+1);
    for(int i=0; i<n; i++){
        cin>>p.at(i);
        double bu=(1+p.at(i))/2;
        sum.at(i+1)=sum.at(i)+bu;
    }
    double mak=0;
    for(int i=k; i<n+1; i++){
        mak=max(mak,sum.at(i)-sum.at(i-k));
    }
    cout << fixed << setprecision(1);
    cout<<mak<<endl;
}

Measured memory_bytes: 3328
#include<iostream>
#include <iomanip>

using namespace std;

int main()
{
   int a,b;
   double c,d;

   cin >> a >> b;
   cout << a/b << endl;
   cout << a%b << endl;
   c=a;
   d=b;
   cout << fixed << setprecision(5) << c/d << endl;
   return 0;
}



Measured memory_bytes: 3260
#include <cstdint>
#include <iostream>

using namespace std;

int main() {
  int64_t a, b, c, d;
  cin >> a >> b >> c >> d;
  
  cout << max(max(a * c, a * d), max(b * c, b * d)) << endl;
  
  return 0;
}


Measured memory_bytes: 3628
{-# LANGUAGE BangPatterns, OverloadedStrings #-}

import Control.Monad
import Data.Array.Unboxed
import Data.Bits
import Data.Char
import Data.Coerce
import Data.Function
import Data.Int 
import Data.IORef
import Data.List
import Data.Maybe
import qualified Data.Map.Strict as M
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as MV
import qualified Data.ByteString.Char8 as BS

main :: IO ()
main = do
  n <- getInt
  forM_ [1..n] $ print . (fa !) 

fa :: Array Int Int
fa = accumArray (+) 0 (1, 10^4) $ filter ((<=10^4) . fst) [(f x y z, 1) | x <- [1..100], y <- [1..100], z <- [1..100]]
f x y z = x^2 + y^2 + z^2 + x*y + y*z + z*x

-- Input

getInt :: IO Int
getInt = readLn
second :: (b -> c) -> (a, b) -> (a, c)
second f (a, b) = (a, f b)

readInt :: BS.ByteString -> Maybe (Int, BS.ByteString)
readInt = fmap (second BS.tail) . BS.readInt

getIntVec :: Int -> IO (V.Vector Int)
getIntVec n = V.unfoldrN n readInt <$> BS.getLine
 
getIntList :: IO [Int]
getIntList = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine

getIntegerList :: IO [Integer]
getIntegerList = map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine

getIntPair :: IO (Int, Int)
getIntPair = do
  v <- getIntVec 2
  return (v V.! 0, v V.! 1)

-- Search

bisearch :: (Int -> Bool) -> (Int, Int) -> (Int, Int)
bisearch check = bis
  where
    bis (l, r)
      | l + 1 == r = (l, r)
      | check mid  = bis (mid, r)
      | otherwise  = bis (l, mid)
      where
        mid = l + (r - l) `div` 2

-- Modular Arithmetic
--
 
modulo :: Int64
modulo = 10^9+7
addMod, subMod, mulMod :: Int64 -> Int64 -> Int64
addMod !x !y | x + y >= modulo = x + y - modulo
             | otherwise = x + y
subMod !x !y | x >= y = x - y
             | otherwise = x - y + modulo
mulMod !x !y = (x * y) `rem` modulo

newtype N = N { unwrapN :: Int64 } deriving (Eq)
instance Show N where
  show (N x) = show x
instance Num N where
  (+) = coerce addMod
  (-) = coerce subMod
  (*) = coerce mulMod
  fromInteger n = N (fromInteger (n `mod` fromIntegral modulo))
  abs = undefined; signum = undefined
---
 
exEuclid :: (Eq a, Integral a) => a -> a -> (a, a, a)
exEuclid !f !g = loop 1 0 0 1 f g
  where loop !u0 !u1 !v0 !v1 !f 0 = (f, u0, v0)
        loop !u0 !u1 !v0 !v1 !f g =
          case divMod f g of
            (q,r) -> loop u1 (u0 - q * u1) v1 (v0 - q * v1) g r
 
recipM :: Int64 -> Int64
recipM !x = case exEuclid x modulo of
             (1,a,_) -> a `mod` modulo
             (-1,a,_) -> (-a) `mod` modulo
divM :: Int64 -> Int64 -> Int64
divM !x !y = x `mulMod` recipM y
 
instance Fractional N where
  (/) = coerce divM
  recip = coerce recipM
  fromRational = undefined

-- 組み合わせ
powerset :: [a] -> [[a]]  
powerset xs = filterM (\x -> [True, False]) xs


Measured memory_bytes: 5092
N = input()

if N[-1] == '2' or N[-1] == '4' or N[-1] == '5' or N[-1] == '7' or N[-1] == '9':
  print("hon")
elif N[-1] == '0' or N[-1] == '1' or N[-1] == '6' or N[-1] == '8':
  print("pon")
elif N[-1] == '3':
  print("bon")


Measured memory_bytes: 8936
#include<stdio.h>
int main(void){
    int a, b;
    scanf("%d %d", &a, &b);
    if(a > b){
        printf("a > b\n");
    }else if(a < b){
        printf("a < b\n");
    }else{
        printf("a == b\n");
    }
    return 0;
}

Measured memory_bytes: 580
[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

let rec diff xs ys =
    Seq.zip xs ys
    |> Seq.fold (fun s (x, y) -> if x <> y then s + 1 else s) 0

[<EntryPoint>]
let main _ =
    let ss = (read string).ToCharArray() |> Array.toSeq
    let f x = if x = '0' then Some (x, '1') else Some (x, '0')
    min (diff ss (Seq.unfold f '0')) (diff ss (Seq.unfold f '1'))
    |> printfn "%i"
    0

Measured memory_bytes: 21832
package main

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

func main() {
	sc := NewScanner()
	A := sc.NextIntArray()

	A[0], A[1] = A[1], A[0]
	A[0], A[2] = A[2], A[0]
	PrintI(A...)
}

func mapToString(arr []int) []string {
	ret := make([]string, len(arr))
	for i := 0; i < len(arr); i++ {
		ret[i] = strconv.Itoa(arr[i])
	}
	return ret
}

func PrintI(args ...int) {
	fmt.Println(strings.Join(mapToString(args), " "))
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
import java.util.Scanner;

/**
 * Created by Abhilash on 28-01-2017.
 */
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        System.out.println(str.lastIndexOf('Z')-str.indexOf('A')+1);
    }
}


Measured memory_bytes: 14572
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
	int A, B, C, D;
	cin >>A >>B >>C >>D;

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

	else{
	  cout << "Right" << endl;
	}
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int h, m, s, i;
  scanf("%d", &i);
  for(h = 0; i > 3599; h ++)
    { i -= 3600;
	}
  for(m = 0; i > 59; m ++)
    { i -= 60;
	}
  s = i;
  printf("%d:%d:%d\n", h, m, s);
  return 0;
}
      

Measured memory_bytes: 592
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,m=0,n=0;
  cin>>a>>b;
  for(int i = 0;i < a;i++)m++;
  for(int i = 0;i < b;i++)n++;
 if(m>8||n>8)cout<<":("<<endl;
  else cout<<"Yay!"<<endl;
}

Measured memory_bytes: 256
//https://atcoder.jp/contests/dp/tasks/dp_h
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}}star;
#define DEBUG if(0)
#endif
#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}
class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }};

int R,C;
LL dp[1123][1123];
constexpr int mod = 1e9+7;
int main(){
    cin>>R>>C;
    dp[0][0]=1;
    for(int i:range(R)){
        string s;
        cin>>s;
        for(int j:range(C)){
            if(s[j]=='#')dp[i][j]=0;
            else{
                (dp[i+1][j]+=dp[i][j])%=mod;
                (dp[i][j+1]+=dp[i][j])%=mod;
            }
        }
    }
    cout<<dp[R-1][C-1]<<endl;
    return 0;
}

Measured memory_bytes: 9088
import java.util.Scanner;

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

		int ans = Integer.MAX_VALUE;
		for (int i=0; i<s.length()-2; i++){
			int num = Integer.parseInt(s.substring(i, i+3));
			if (Math.abs(753-num) < ans){
				ans = Math.abs(753-num);
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21844
def main():
    from sys import stdin
    input = stdin.readline
    n = int(input())
    ab = [list(map(int, input().split())) for _ in [0]*(n-1)]

    g = [[] for _ in [0]*n]
    for a, b in ab:
        g[a-1].append(b-1)
        g[b-1].append(a-1)

    mod = 10**9+7
    fact = [1, 1]
    inv = [pow(i, mod-2, mod) for i in range(n+1)]
    for i in range(2, n+1):
        fact.append(fact[-1]*i % mod)

    # merge:頂点aにbをマージするときのモノイド
    # adj_bu:ボトムアップ時の調整（a:値,i:頂点）
    # adj_td:トップダウン時の調整（a:値,i:頂点,p:親）
    # adj_fin:最終調整（a:値,i:頂点）
    def merge(a, b): return a * b % mod
    def adj_bu(a, i): return a * inv[size[i]] % mod
    def adj_td(a, i, p): return a * inv[n-size[i]] % mod
    def adj_fin(a, i): return a * fact[n-1] % mod

    # トポロジカルソートをする
    # T:木の隣接グラフ表現をset化
    # P:親
    # q:キュー
    # order:トポソしたもの
    T = g
    P = [-1]*n
    q = [0]
    ini = 1
    order = []
    while q:
        i = q.pop()
        order.append(i)
        for a in T[i]:
            if a != P[i]:
                P[a] = i
                T[a].remove(i)
                q.append(a)

    # サイズの処理を先に行う
    # size[i]:0を根とする根付き木における、iを根とする部分木の大きさ
    size = [1]*n
    for i in order[1:][::-1]:
        size[P[i]] += size[i]

    # ボトムアップ処理をする
    # ME:マージした値を一時保存
    # DP:DP値、MEを調整したもの
    ME = [ini]*n
    DP = [0]*n
    for i in order[1:][::-1]:
        DP[i] = adj_bu(ME[i], i)
        p = P[i]
        ME[p] = merge(ME[p], DP[i])
    DP[order[0]] = adj_fin(ME[order[0]], order[0])
    TD = [ini]*n

    # トップダウン処理をする
    for i in order:
        # 左からDP（結果はTDに入れている）
        ac = TD[i]
        for j in T[i]:
            TD[j] = ac
            ac = merge(ac, DP[j])
        # 右からDP（結果はacに入れている、一度しか使わないのでacで問題ない）
        ac = ini
        for j in T[i][::-1]:
            TD[j] = adj_td(merge(TD[j], ac), j, i)
            ac = merge(ac, DP[j])
            DP[j] = adj_fin(merge(ME[j], TD[j]), j)
    for i in DP:
        print(i)


main()


Measured memory_bytes: 122932
import sys
N=int(input())
for h in range(1,3501):
    for n in range(h,3501):
        if 4*n*h-N*h-N*n >0:
            if (N*h*n)%(4*n*h-N*h-N*n)==0:
                w=int((N*h*n)/(4*n*h-N*h-N*n))
                print(h,n,w)
                sys.exit()

Measured memory_bytes: 3060
#include <stdio.h>

int main(){
	int a[200];
	int b[200];
	int i=0;
	int I;
	int n;
	while(scanf("%d",&a[i]) != EOF)
	{
		scanf("%d", &b[i]);
		i++;
		n=i;
	}
	for(i=0;i<n;i++)
	{
		a[i]=a[i]+b[i];
		b[i]=1;
	}
	for(i=0;i<n;i++)
	{
		for(I=0;I<8;I++)
		{
			if(a[i]/10>0)
			{
				a[i]=a[i]/10;
				b[i]++;
			}
		}
	}
	for(i=0;i<n;i++)
	{
		printf("%d\n", b[i]);
	}
	return 0;
}

Measured memory_bytes: 600
// Shift-JIS（シフトジス）

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

int gcd(int a, int b)
{
    if (a < b)
    {
        a ^= b;
        b ^= a;
        a ^= b;
    }

    return b ? gcd(b, a % b) : a;
}

int lcm(int a, int b)
{
    return a * b / gcd(a, b);
}

int main()
{
    int N;
    cin >> N;
    if (N % 2 == 0)
    {
        cout << N << endl;
    }
    else
    {
        cout << N * 2 << endl;
    }
}

Measured memory_bytes: 256