akhauriyash/Code-Regression huggingface dataset:
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

ll n;
deque<ll> A;
deque<ll> B;
vector<ll> K;
vector<pll> L;
ll sum1=0;

ll culL(ll l){
    ll ret=l;
    vector<pll> X;
    for(int i=0;i<n;i++){
        if(A[i]==B[i]){continue;}
        ret++;
        if(K[i+l]-(i==0?0LL:K[i-1])>0){continue;}
        X.push_back({L[i].F,L[i+l].S});
    }
    if(X.size()==0 || l==n){return ret;}
    else if(X.size()==1){return ret+min(X[0].F,X[0].S)*2;}
    sort(X.begin(),X.end());
    vector<ll> sum(X.size()+1,0);
    ll s=0;
    for(ll i=X.size()-1;i>=0;i--){s=max(s,X[i].S); sum[i]=s;}
    ll mi=s;
    s=0;
    for(int i=0;i<X.size();i++){s=max(s,X[i].F); mi=min(mi,s+sum[i+1]);}
    return ret+mi*2;
}

ll culR(ll l){
    ll ret=n-l;
    vector<pll> X;
    for(int i=0;i<n;i++){
        if(A[i]==B[i]){continue;}
        ret++;
        if(K[i+l]-K[i]<sum1){continue;}
        X.push_back({L[i].S,L[i+l].F});
    }
    if(X.size()==0 || l==0){return ret;}
    else if(X.size()==1){return ret+min(X[0].F,X[0].S)*2;}
    sort(X.begin(),X.end());
    vector<ll> sum(X.size()+1,0);
    ll s=0;
    for(ll i=X.size()-1;i>=0;i--){s=max(s,X[i].S); sum[i]=s;}
    ll mi=s;
    s=0;
    for(int i=0;i<X.size();i++){s=max(s,X[i].F); mi=min(mi,s+sum[i+1]);}
    return ret+mi*2;
}


int main(){
    string a,b;
    cin>>a>>b;
    n=a.size();
    A.resize(n,0);
    B.resize(n,0);
    K.resize(2*n,0);
    L.resize(2*n,{E,E});
    for(int i=0;i<n;i++){
        if(a[i]=='1'){A[i]=1;}
        if(b[i]=='1'){sum1++; B[i]=1; K[i]++; K[i+n]++;}
    }
    if(sum1==0){cout<<(A==B?0:-1)<<endl; return 0;}
    for(int i=1;i<K.size();i++){K[i]+=K[i-1];}
    ll l=-E;
    for(int i=0;i<n;i++){
        if(B[i]==1){l=i;}
        L[i].F=i-l;
    }
    for(int i=0;i<n;i++){
        if(B[i]==1){l=i+n;}
        L[i].F=i+n-l;
    }
    l=E;
    for(ll i=n-1;i>=0;i--){
        if(B[i]==1){l=i+n;}
        L[i].S=l-i-n;
    }
    for(ll i=n-1;i>=0;i--){
        if(B[i]==1){l=i;}
        L[i].S=l-i;
    }
    ll ans=E;
    for(int i=0;i<n;i++){L[i+n]=L[i];}
    for(ll i=0;i<=n;i++){
        //cout<<i<<" "<<culL(i)<<" "<<culR(i)<<endl;
        ans=min(ans,culL(i));
        ans=min(ans,culR(i));
        A.push_back(A[0]);
        A.pop_front();
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 384
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int main(){
  int M;
  int D;
  int i;
  int j;
  int k;
  int res = 0;
  rd(M);
  rd(D);
  for(i=(1);i<(D+1);i++){
    j = i / 10;
    k = i % 10;
    if(j >= 2 && k >= 2 && j*k <= M){
      res++;
    }
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190921-1

// --- original code ---
// {
//   int M, D;
//   int i, j, k, res = 0;
//   rd(M, D);
//   rep(i,1,D+1){
//     j = i / 10;
//     k = i % 10;
//     if(j >= 2 && k >= 2 && j*k <= M) res++;
//   }
//   wt(res);
// }


Measured memory_bytes: 256
h, n = map(int, input().split())
A, B = [], []
for i in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
F = [0]
for i in range(1, h+1):
    f = 1 << 30
    for a, b in zip(A, B):
        if i < a:
            f = min(f, b)
        else:
            f = min(f, F[i-a]+b)
    F.append(f)
print(f)


Measured memory_bytes: 42332
T_MAX = 10 ** 5
N, C = map(int, input().split())
programs = []
for _ in range(N):
    s, t, c = map(int, input().split())
    programs.append((c - 1, s - 1, t))

programs.sort()
for i in range(N - 2, -1, -1):
    c0, s0, t0 = programs[i]
    c1, s1, t1 = programs[i + 1]
    if c0 == c1 and t0 == s1 + 1:
        programs[i] = (c0, s0, t1) # merge
        programs[i + 1] = (-1, 0, 0) # delete

acc = [0] * (T_MAX + 1)
for i in range(N):
    _c, s, t = programs[i]
    acc[s] += 1
    acc[t] -= 1
for i in range(T_MAX):
    acc[i + 1] += acc[i]

result = max(acc)
print(result)

Measured memory_bytes: 18188
import itertools

n = int(input())
xy_inputs = [[int(j) for j in input().split()]for i in range(n)]

dist_map = [[0 for i in range(n)] for i in range(n)]
for i in range(n):
    for j in range(n):
        x1,y1 = map(int,xy_inputs[i])
        x2,y2 = map(int,xy_inputs[j])
        dist = ((x1-x2)**2+(y1-y2)**2)**0.5
        dist_map[i][j]=dist
        dist_map[j][i]=dist

ans=0
li = list(itertools.permutations([i for i in range(n)],n))
for l in li:
    for i in range(len(l)-1):
        ans+=dist_map[l[i]][l[i+1]]

print(ans/len(li))
        

Measured memory_bytes: 8052
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W;
    cin >> H >> W;
    string S;
    for(int i = 0; i < H; i++) {
        string in;
        cin >> in;
        S += in;
    }
    vector<int> v(26);
    for(int i = 0; i < S.size(); i++) {
        v[S[i] - 'a']++;
    }
    int four = (H / 2) * (W / 2);
    int one = 0;
    if(H % 2 == 1 && W % 2 == 1) one = 1;
    int two = ((H * W - four * 4 - one)) / 2;
    cerr << four << " " << two << " " << one << endl;
    while(four--) {
        bool ok = false;
        for(int i = 0; i < 26; i++) {
            if(v[i] >= 4) {
                v[i] -= 4;
                ok = true;
                break;
            }
        }
        if(!ok) {
            cout << "No" << endl;
            return 0;
        }
    }
    while(two--) {
        bool ok = false;
        for(int i = 0; i < 26; i++) {
            if(v[i] >= 2) {
                v[i] -= 2;
                ok = true;
                break;
            }
        }
        if(!ok) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;
#define FIX cout << fixed << setprecision(15)

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

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

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN3(a,b,x);
  if(a!=0) OUT(b/x+1 - (a-1)/x-1);
  else OUT(b/x+1);
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll, int> plli;
typedef pair<int, pii> pipii;
typedef vector<vector<int> > mati;
typedef vector<vector<double> > matd;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef vector<pll> vpll;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back

inline void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

inline void OUT(void){
  cout << "\n";
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  ll r;
  IN(r);
  OUT(3*r*r);

  return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 問題：https://atcoder.jp/contests/abc126/tasks/abc132_c

n = int(input())
d = list(map(int, input().strip().split()))

d = sorted(d)
res = d[n//2] - d[n//2-1]
print(res)



Measured memory_bytes: 20844
import java.math.BigInteger;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int K = in.nextInt();
        int sum = 0;
        for (int i = 1; i <= K; i++) {
            for (int j = 1; j <= K; j++) {
                for (int k = 1; k <= K; k++) {
                    sum += BigInteger.valueOf(i).gcd(BigInteger.valueOf(j)).gcd(BigInteger.valueOf(k)).intValue();
                }
            }
        }
        System.out.println(sum);
    }
}

Measured memory_bytes: 63100
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define all(f) (f).begin(),(f).end()
#define allr(f) (f).rbegin(),(f).rend()
const int mod = 1e9+7, A = 1e5+5;
int main()
{
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int n, m;
	cin >> n >> m;
	if (n > m)
	{
		while (n--)
			cout << m;
	}
	else
	{
		while (m--)
			cout << n;
	}
	return 0;
}


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

int main() {
  vector<char>C(6);
  for(int i=0;i<6;i++){
    cin >> C.at(i);
  }
  if(C.at(0)==C.at(5)&&C.at(1)==C.at(4)&&C.at(2)==C.at(3)){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
}

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

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)

#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

#define INF 1000000000000
#define MOD 1000000007
#define MAXR 100000

using namespace std;
typedef long long ll;

int main() {
    int K;
    string S;
    cin >> K >> S;
    if (S.size() <= K){
        cout << S;
    }else{
        cout << S.substr(0, K) << "...";
    }
}

Measured memory_bytes: 3628
/* ＵＴＦ－８ */
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	std::string s;
	std::cin >> s;
	s[5] = ' ';
	s[13] = ' ';
	std::cout << s << "\n";
}


Measured memory_bytes: 256
'''
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)
#'''
N = int(input())
h = list(map(int, input().split()))
h.append(0)
m = 0

while True:
	l = -1
	r = N
	for i in range(N):
		if h[i] > 0:
			l = i
			break
			
	for i in range(l, N):
		if h[i] == 0:
			r = i
			break
			
	if l == -1:
		break
			
	for i in range(l, r):
		h[i] -= 1
		
	m += 1
	
print(m)

Measured memory_bytes: 40304
a, b = map(int, input().split())

group1 = {1,3,5,7,8,10,12}
group2 = {4,6,9,11}
group3 = {2}

groups = [group1, group2, group3]

def check():
    for i in range(3):
        if a in groups[i] and b in groups[i]:
            print('Yes')
            return
    print('No')

check()



Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

#define ll long long
#define ull unsigned long long
#define REP(i, n) for(int i=0; i<n; i++)

ll cnt[5];
ll dp[6][4];
int main(){
    int N;
    cin >> N;
    string str;
    REP(i,N){
      cin >> str;
      switch(str[0]){
          case 'M':
              cnt[0]++;
              break;
          case 'A':
              cnt[1]++;
              break;
          case 'R':
              cnt[2]++;
              break;
          case 'C':
              cnt[3]++;
              break;
          case 'H':
              cnt[4]++;
              break;
      } 
    }

    for(int i = 1; i < 6; i++){
        dp[i][1] = cnt[i-1] + dp[i-1][1];
    }

    for(int i = 1; i < 6; i++){
        for(int k = 2; k < 4; k++){
            //dp[i][k] = dp[i-1][k-1] * dp[i][1] + dp[i-1][k];
            dp[i][k] = dp[i-1][k] + dp[i-1][k-1] * cnt[i-1];
        }
    }

    //REP(i,6){
    //    REP(k,4){
    //        cout << dp[i][k] << " ";
    //    }
    //    cout << endl;
    //}
    cout << dp[5][3] << endl;
    return 0;
}


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

using namespace std;

int main(){
    string s;

    cin >> s;

    int cnt = 0;
    for(int i = 0; i < 3; i++){
        if(s[i] == '1')
            cnt++;
    }

    cout  << cnt << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <set>
#include <math.h>
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
typedef long long ll;
using namespace std;

int main() {
    ll x, y=100;
    cin >> x;
    int cnt=0;
    while (y<x) {
        y+=y/100;
        cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3188
#include <limits>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>

using namespace std;

int main()
{
    size_t n;
    cin >> n;
    
    vector<int> xs(n);
    for(int& x : xs) cin >> x;
    
    vector<int> xs_sorted = xs;
    sort(begin(xs_sorted), end(xs_sorted));
    
    size_t mid = n / 2;
    
    for(int& x : xs)
    {
        auto i = lower_bound(begin(xs_sorted), end(xs_sorted), x);
        int median = ((size_t)distance(begin(xs_sorted), i)) < mid ? xs_sorted[mid] : xs_sorted[mid - 1];
        cout << median << '\n';
    }

    return 0;
}


Measured memory_bytes: 3712
using System;
using System.Collections.Generic;
using System.Linq;

public static class Common
{
    // ユークリッドの互除法により最大公約数を得る
    public static long GCD(long m, long n)
    {
        if (m < n)
        {
            return GCD(n, m);
        }

        while (n != 0)
        {
            var t = n;
            n = m % n;
            m = t;
        }
        return m;
    }

    public static long LCM(long m, long n)
    {
        return m * n / (GCD(m, n));
    }
}

public class Solution
{
    // [start, end]
    static long GetCount(long start, long end, long div)
    {
        start = (start + div - 1) / div * div;
        if (start > end)
        {
            return 0;
        }

        return 1 + (end - start) / div;
    }

    public static void Main()
    {
        var vals = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        var A = vals[0];
        var B = vals[1];
        var C = vals[2];
        var D = vals[3];

        long c = GetCount(A, B, C);
        long d = GetCount(A, B, D);
        var lcm = Common.LCM(C, D);
        long cd = GetCount(A, B, lcm);

        long count = B - A + 1 - c - d + cd;

        Console.WriteLine(count);
    }
}

Measured memory_bytes: 13396
#include<cstdio>
#include<string.h>
using namespace std;

char s[4];
int main(){
	scanf("%s",s);
	int len = strlen(s);
	if (len == 2){
		printf("%s",s);
		}
	else if(len == 3){
		s[3] = s[2];
		s[2] = s[0];
		s[0] = s[3];
		for(int i = 0;i <= 2;i++){
			printf("%c",s[i]);
			}
		}
	printf("\n");
	
	}

Measured memory_bytes: 128
//fifer a tak luboin
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

#define ll long long
#define mp make_pair
#define pb push_back
#define s second
#define f first
#define endl "\n"

// using namespace __gnu_pbds;
using namespace std;
// template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 

const double eps = 1e-10;                                     
const double pi = acos(-1.0);

ll pw(ll p) {
    ll sum = 1;
    for (int i = 0; i < p; i++) sum *= 26;

    return sum;
}
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); 
    // freopen("input.in.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ll n;
    cin >> n;
    ll sum = 0;
    ll cnt;
    for (int i = 0; i < 15; i++) {
        sum += pw(i + 1);
        if (sum >= n) {
            cnt = i + 1;
            break;
        }
    }
    
    map <int, char> m;
    char cur = 'a';
    for (int c = 0; c < 26; c++) {
        m[c] = cur;
        cur++;
    }
    string ans = "";
    while (cnt > 0) {
        n--;
        ans += m[n % 26];
        n /= 26;
        cnt--;
    }

    reverse(ans.begin(), ans.end());
    cout << ans << endl;
    return 0;  
}


Measured memory_bytes: 3656
from collections import OrderedDict

class Stack():
    def __init__(self):
        self.el = []
    def add(self, el):
        self.el.append(el)
    def pop(self):
        return self.el.pop()
    def top(self):
        return self.el[-1]
    def isEmpty(self):
        if self.el:
            return False
        return True

class Node():
    def __init__(self, id, edge=[], flag=0, discover=0, finish=0):
        self.id = id
        self.edge = edge
        self.flag = flag
        self.discover = discover
        self.finish = finish
    def show(self):
        print self.id, self.discover, self.finish
        
def notVisited(dic):
    for i in dic.keys():
        if dic[i].flag != 2:
            return i
    return None
        
n = int(raw_input())
dic = {}
for i in range(n):
    tmp = map(int, raw_input().split())
    if tmp[1] > 0:
        dic[tmp[0]] = Node(tmp[0], tmp[2:])
    else:
        dic[tmp[0]] = Node(tmp[0])
dic = OrderedDict(dic)

start = 1
time = 1
st = Stack()
dic[start].flag = 1
dic[start].discover = time
st.add(dic[start])

while not st.isEmpty():
    time += 1
    u = st.top()
    v = u.edge
    if v:
        for i in range(len(v)):
            if dic[v[i]].flag == 0:
                dic[v[i]].flag = 1
                dic[v[i]].discover = time
                if i != len(v)-1:
                    dic[u.id].edge = u.edge[i+1:]
                else:
                    dic[u.id].edge = []
                st.add(dic[v[i]])
                break
        else:
            st.pop()
            dic[u.id].flag = 2
            dic[u.id].finish = time
    else:
        st.pop()    
        dic[u.id].flag = 2
        dic[u.id].finish = time
    if st.isEmpty() and notVisited(dic):
        new = notVisited(dic)
        dic[new].flag = 1
        time += 1
        dic[new].discover = time
        st.add(dic[new])
for i in dic.keys():
    dic[i].show()

Measured memory_bytes: 6900
s = [input() for i in range(3)]
cnt = [0] * 3
player = 0
while True:
    if cnt[player] == len(s[player]):
        print("ABC" [player])
        break
    else:
        cnt[player] += 1
        player = ord(s[player][cnt[player] - 1]) - ord("a")

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

using namespace std;

int main()
{
    int n;
    cin >> n;
    int a[n];
    int b[n];
    int c[n-1];
    for(int i=0;i<n;i++)
        cin >> a[i];
    for(int i=0;i<n;i++)
        cin >> b[i];
    for(int i=0;i<n-1;i++)
        cin >> c[i];
    int f=0;
    int sum=0;
    for(int i=0;i<n;i++){
        if(a[i]==f+1) sum+=c[f-1];
        sum+=b[a[i]-1];
        f=a[i];
    }
    cout << sum << endl;
    return 0;
}



Measured memory_bytes: 256
#[allow(unused_imports)]
use std::{cmp::Reverse, collections::*};

#[allow(unused_imports)]
use proconio::{fastout, input, marker::Chars};

#[allow(unused_imports)]
use itertools::Itertools;

#[allow(unused_imports)]
use num::Integer;

#[fastout]
pub fn main() {
    input! {
        x: i32,
        y: i32,
    }

    if y % 2 == 1 {
        println!("No");
        return;
    }
    if x * 2 <= y && y <= x * 4 {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2164
#include <bits/stdc++.h>
using namespace std;
int main () {
  long N, MA, MB;
  cin >> N >> MA >> MB;
  vector<vector<long>> data(401, vector<long> (401, INT_MAX));
  data.at(0).at(0) = 0;
  long a, b, c;
  for(int i = 0; i < N; i++){
    cin >> a >> b >> c;
    for(int j = 390; j >= 0; j--){
      for(int k = 390; k >= 0; k--){
        if(data.at(j).at(k) != INT_MAX){
          data.at(j + a).at(k + b) = min(data.at(j + a).at(k + b), data.at(j).at(k) + c);
        }
      }
    }
  }
  long sub = 1, ans = INT_MAX;
  while(sub * MA <= 400 && sub * MB <= 400){
    ans = min(ans, data.at(sub * MA).at(sub * MB));
    sub++;
  }
  cout << (ans == INT_MAX?-1:ans) << endl;
  return 0;
}

Measured memory_bytes: 1536
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define ALL(v) v.begin(),v.end()

int main(int argc, char const *argv[])
{
    ll k, a, b;
    cin >> k >> a >> b;
    if (b - a <= 2)
    {
        cout << k + 1 << endl;
    }
    else
    {
        if (k <= a - 1)
        {
            cout << k + 1 << endl;
        }
        else
        {
            k -= a - 1;
            if (k % 2 == 0)
            {
                cout << b + (b - a) * (k / 2 - 1) << endl;
            }
            else
            {
                cout << b + (b - a) * (k / 2 - 1) + 1 << endl;
            }
        }
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

typedef pair<ll,ll> P;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    vector<P> a(n);
    rep(i,n){
      cin>>a[i].second>>a[i].first;
    }
    sort(begin(a),end(a));
    cout<<a[0].second+a[0].first<<endl;
}

Measured memory_bytes: 1916
#include <stdio.h>

int main(void)
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	
	
	if( (a == b && a == c)||(a != b && b != c && a != c) )
	{
		printf("No");
	}
	else
	{
		printf("Yes");
	}
	
	
	
	
	
	
	
	
	
	return 0;
}
	

Measured memory_bytes: 1712
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define UNIQNUM(a) UNIQ(a)-a.begin()
#define UNIQIT(a) a.erase(UNIQ(a), a.end());
#define VOUT(v,i) rep(i,v.size())cout<<v[i]<<(i==v.size()-1?"\n":" ");
#define vout(v) VOUT(v,z);
#define vdbg(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL)
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define out(a) debg(a);
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
// template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
// template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
// template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
bool is_palindrome(string s){return s == string(s.rbegin(),s.rend());}
#define popcount __builtin_popcount
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
typedef vector<vector<ll>> VV;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
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;
}



int main(){
    long long x;
    scanf("%lld",&x);
    cout << !x << endl;
    // if(x==1){
    //     cout << 0 << endl;
    // }else{
    //     cout << 1 << endl;
    // }
    return 0;
}


Measured memory_bytes: 3756
while True:                                  
  m, f, r = [int(_) for _ in input().split()]
  if m == -1 and f == -1 and r == -1:        
    break                                    
  sum = m+f                                  
  if m == -1 or f == -1 or sum < 30:         
    print("F")                               
  else:                                      
    if sum >= 80:                            
      print("A")                             
    elif sum >= 65:                          
      print("B")                             
    elif sum >= 50:                          
      print("C")                             
    else:                                    
      if r >= 50:                            
        print("C")                           
      else:                                  
        print("D")                           

Measured memory_bytes: 7648
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  int n, k;
  scanf("%d%d", &n, &k);
  if (n <= 5)
    printf("%d\n", 0);
  else if (6 <= n && n <= 12)
    printf("%d\n", k / 2);
  else
    printf("%d\n", k);
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
typedef long long ll;
#define PB	push_back
#define FOR(n)			for(int i = 0; i < n; ++i)
#define RFOR(n)			for(int i = n; i >= 0; --i)
#define FORR(start,end) for(int i = start; i < end; ++i)
#define COUT(n)			cout << n << " " << flush
#define vi(v)			vector<int> v
#define vii(v)			vector<pair<int,int>> v
#define mkp(a,b)		make_pair(a,b)
#define ALL(obj)		obj.begin(), obj.end()
using namespace std;

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

	int res = 2 * b;
	if (a <= res)
		cout << 0 << endl;
	else if (a > res)
		cout << a - res << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i = 1; i <= (n); ++i)
#define drep(i,n) for(ll i = (n)-1; i >= 0; --i)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (ll)(x).size()
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
ll gcd(ll a,ll b){if(a%b==0){return b;}else{return(gcd(b,a%b));}}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const int INF=1e9;
const ll MX = 1e18;
const ll MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
const double PI=acos(-1);
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define YN {puts("YES");}else{puts("NO");}
const ll MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {fac[0] = fac[1] = 1;finv[0] = finv[1] = 1;inv[1] = 1;for (ll i = 2; i < MAX; i++){fac[i] = fac[i - 1] * i % MOD;inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;finv[i] = finv[i - 1] * inv[i] % MOD;}}
long long COM(ll n, ll k){if (n < k) return 0;if (n < 0 || k < 0) return 0;return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;}

int main() {
  COMinit();
  ll n,m;
  cin>>n>>m;
  v(ll) a(m);
  rep(i,m) cin>>a[i];
  bool jat=false;
  rrep(i,m-1){
    if(a[i]-a[i-1]==1) jat=true;
  }
  if(jat){
    cout<<0<<endl;
    return 0;
  }
  ll cnt=0;
  ll ans=1;
  ll state=0;
  ll ja=0;
  ll ja1=0;
  ll ja2=0;
  rep(i,m){
    cnt=0;
    ja=a[i]-state-1;
    ja1=ja/2+ja%2;
    ja2=ja/2;
    while(ja2>0){
      cnt+=COM(ja1,ja2);
      cnt%=MOD;
      ja1++;
      ja2--;
    }
    cnt++;
    cnt%=MOD;
    ans*=cnt;
    ans%=MOD;
    state=a[i]+1;
  }
  cnt=0;
  ja=n-state;
    ja1=ja/2+ja%2;
    ja2=ja/2;
    while(ja2>0){
      cnt+=COM(ja1,ja2);
      cnt%=MOD;
      ja1++;
      ja2--;
    }
    cnt++;
    cnt%=MOD;
    ans*=cnt;
    ans%=MOD;
    cout<<ans<<endl;
}


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

int main() {
  int N,xi,K,x=0,A,B;
  cin >>N>>K;
  for(int i=0;i<N;i++){
    cin>>xi;
    A=xi;
    B=K-xi;
    if (A<B)
      x=x+2*A;
      else
        x=x+2*B;
}
  cout<< x<<endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int A[]=new int[N];
		
		for(int i=0;i<A.length;i++) {
			 A[i]=sc.nextInt();

		}
		Arrays.sort(A);
		int ans=A[A.length-1] - A[0];
		
		System.out.println(ans);
	}
}

Measured memory_bytes: 23892
import sys
import bisect
input = sys.stdin.readline

N = int(input())
L = [int(input()) for _ in range(N)]

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

t = L[0]
for i in range(1, N):
    p = gcd(t, L[i])
    t = t * L[i] // p
    
print(t)

Measured memory_bytes: 3060
from collections import deque
 
N = int(input())
numbers = input().split()
 
d = deque()
 
for i in range(N):
    if i % 2 == 0:
        d.append(numbers[i])
    else :
        d.appendleft(numbers[i])
        
if N % 2 == 1:
    d.reverse()
    
output = ' '.join(d)
 
print(output)

Measured memory_bytes: 26564
n, m = map(int, input().split())
q = [input().split() for _ in range(m)]
ac = [False for _ in range(n+1)]
wa = [0 for _ in range(n+1)]
for p, s in q:
	p = int(p)
	if s == "WA" and not ac[p]:
		wa[p] += 1
	if s == "AC":
		ac[p] = True
print(sum(ac), sum([wa[i] for i in range(n+1) if ac[i]]))

Measured memory_bytes: 34676
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define sz(x) int(x.size())

using namespace std;

int main(int argc, const char * argv[]) {
    // input from txt
    
    /////////
    //write//
    /////////
    
    int n;
    int res = 1;
    cin >> n;
    for(int i=0; i<3; i++){
        res *= n;
    }
    
    cout << res << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int main() {
	int n; cin >> n;
	string s, t; cin >> s >> t;
	for(int i = 0; i < n; ++i) {
		cout << s[i] << t[i];
	}
	cout << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int phi(int n) {
  int ret = n;
  for (int i = 2; i * i <= n; i++)
    if (n % i == 0) {
      ret = ret / i * (i - 1);  //先进行除法防止溢出(ret=ret*(1-1/p(i)))
      while (n % i == 0) n /= i;
    }
  if (n > 1) ret = ret / n * (n - 1);
  return ret;
}
int main() {
  int n;
  cin >> n;
  cout << phi(n) << endl;

  return 0;
}


Measured memory_bytes: 3112
#include <stdio.h>

int GCD(int a, int b){
	int n;
	
	while(a % b != 0){
		
		n = b;
		b = a % b;
		a = n;
	}
	
	return (b);
}
	
int main (void){
	int a, b;
	int gcd, lcm;
	
	while (scanf("%d %d", &a, &b) != EOF){
		
		gcd = GCD(a, b);
		lcm = a * (b / gcd);
		
		printf("%d %d\n", gcd, lcm);
	}
	return (0);
}

Measured memory_bytes: 596
import math

D, G = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(D)]

ret = 1000 ** 10
for i in range(2 ** D):
    total = 0
    cnt = 0
    digit = 1
    for p in range(D):
        if (digit << p) & i:
            cnt += lst[p][0]
            total += lst[p][0] * (p + 1) * 100 + lst[p][1]

    for p in range(D)[::-1]:
        if not ((digit << p) & i):
            delta = max(0, G - total)
            n = min(math.ceil(delta / ((p + 1) * 100)), lst[p][0])
            cnt += n
            total += n * (p + 1) * 100
    ret = min(ret, cnt)
print(ret)


Measured memory_bytes: 3064
S = str(input())
result=[0 for x in S]
RLs = []
LRs = []
for i in range(len(S) - 1):
    if S[i]=="R" and S[i+1]=="L":
        RLs.append(i)
    if S[i]=="L" and S[i+1]=="R":
        LRs.append(i)
LRs.append(len(S)-1)
pred = -1
for i,x in enumerate(LRs):
    leng = x-pred
    if leng%2==0:
        result[RLs[i]] = leng//2
        result[RLs[i]+1] = leng//2
    elif (RLs[i]-pred) % 2 == 0 :
        result[RLs[i]] = leng//2
        result[RLs[i]+1] = leng//2 + 1
    else:
        result[RLs[i]] = leng//2 + 1
        result[RLs[i]+1] = leng//2
    pred = x
        
print(" ".join(map(str,result)))

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

public class Main {
	static final int mod = (int) 1e9 + 7;
	static final int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };
	static final int[] DX8 = { -1, -1, -1, 0, 0, 1, 1, 1 }, DY8 = { -1, 0, 1, -1, 1, -1, 0, 1 };
	static final int INF = Integer.MAX_VALUE / 3;
	static final long LINF = Long.MAX_VALUE / 3;
	static final String nextLine = "\n";

	static List<Integer> graph[];
	static int dist[], ans[];
	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		int n = fs.nextInt(), x = fs.nextInt()-1, y = fs.nextInt()-1;
		graph = new ArrayList[n];
		for(int i=0;i<n;i++)graph[i] = new ArrayList<>();
		for(int i=0;i<n-1;i++) {
			graph[i].add(i+1);
			graph[i+1].add(i);
		}
		graph[x].add(y);
		graph[y].add(x);
		
		ans = new int[n];
		dist = new int[n];
		for(int i=0;i<n;i++) {
			ArrayDeque<Integer> q = new ArrayDeque<>();
			q.add(i);
			Arrays.fill(dist, INF);
			dist[i] = 0;
			while(!q.isEmpty()) {
				int now = q.poll();
				for(int to:graph[now]) {
					if(dist[to]!=INF)continue;
					dist[to] = dist[now] + 1;
					ans[dist[to]]++;
					q.add(to);
				}
			}
		}
		for(int i=1;i<n;i++) {
			System.out.println(ans[i]/2);
		}
	}
	

	//MOD culculations
	static long plus(long x, long y) {
		long res = (x + y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long sub(long x, long y) {
		long res = (x - y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long mul(long x, long y) {
		long res = (x * y) % mod;
		return res < 0 ? res + mod : res;
	}

	static long div(long x, long y) {
		long res = x * pow(y, mod - 2) % mod;
		return res < 0 ? res + mod : res;
	}

	static long pow(long x, long y) {
		if (y < 0)
			return 0;
		if (y == 0)
			return 1;
		if (y % 2 == 1)
			return (x * pow(x, y - 1)) % mod;
		long root = pow(x, y / 2);
		return root * root % mod;
	}
}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScanner(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

	public String next() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}

Measured memory_bytes: 86088
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <sstream>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <numeric>
#include <bitset>
#include <ext/algorithm>
#include <ext/numeric>
#define ffor(_a,_f,_t) for(int _a=(_f),__t=(_t);_a<__t;_a++)
#define all(_v) (_v).begin() , (_v).end()
#define sz size()
#define pb push_back
#define SET(__set, val) memset(__set, val, sizeof(__set))
#define FOR(__i, __n) ffor (__i, 0, __n)
typedef long long LL; using namespace std;

const int MAXN = 100005;

vector<int> g[100005];

bool inPath[MAXN], endPoint[MAXN];

vector<int> ret;
bool first;

void dfs(int v) {
	FOR (i, g[v].sz) {
		int w = g[v][i];
		if (inPath[w])
			continue;
		if (first)
			ret.pb(w);
		inPath[w] = true;
		dfs(w);
		if (!first)
			ret.pb(w);
		break;
	}
}

int main() {
	int n, m;
	scanf("%d %d", &n, &m);
	FOR (i, n)
		g[i].clear();
	int a, b;
	FOR (i, m) {
		scanf("%d %d", &a, &b);
		a--;
		b--;
		g[a].pb(b);
		g[b].pb(a);
	}
	SET(inPath, 0);
	SET(endPoint, 0);
	int u = g[0][0];
	inPath[0] = inPath[u] = true;
	ret.clear();
	first = false;
	dfs(0);
	ret.pb(0);
	ret.pb(u);
	first = true;
	dfs(u);
	printf("%d\n", ret.size());
	FOR (i, ret.size())
		printf("%d ", ret[i] + 1);
	printf("\n");
	return 0;
}

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

fn main() {
    input! {
        n: i64, a: i64, b: i64,
    }
    println!("{} {}", std::cmp::min(a, b), std::cmp::max(b - (n - a), 0));
}


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


int main() {
    int n;
    string s_i;
    cin >> n;
    map <string, int> s;
    s["AC"]=0;
    s["WA"]=0;
    s["TLE"]=0;
    s["RE"]=0;
    for (int i=0; i<n; i++) {
        cin >> s_i;
        s[s_i] ++;
    }
    cout << "AC x " <<s["AC"]<< endl;
    cout << "WA x " <<s["WA"]<< endl;
    cout << "TLE x " <<s["TLE"]<< endl;
    cout << "RE x " <<s["RE"]<< endl;
    return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top, S[1000];

void push(int x)
{
	S[++top] = x;
}
int pop()
{
	top--;
	return S[top+1];
}
int main()
{
	int a, b;
	top = 0;
	char s[100];
	while(scanf("%s", s) != EOF)
	{
		if(s[0] == '+')
		{
			b = pop();
			a = pop();
			push(a + b);
		}
		else if(s[0] == '-')
		{
			b = pop();
			a = pop();
			push(a - b);
		}
		else if(s[0] == '*')
		{
			b = pop();
			a = pop();
			push(a * b);
		}
		else
			push(atoi(s));
	 } 
	 printf("%d\n", pop());
	 return 0;
}



Measured memory_bytes: 2692
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#include<iomanip>
#include<map>
#include<queue>
#include<set>
#define int long long
using namespace std;
const int INF = 1e10;
const int ZERO = 0;

signed main() {
	vector<int> graph[4];
	for(int i = 0;i < 3;i++) {
		int A,B;
		cin >> A >> B;
		graph[A - 1].push_back(B - 1);
		graph[B - 1].push_back(A - 1);
	}
	int A = graph[0].size() % 2;
	int B = graph[1].size() % 2;
	int C = graph[2].size() % 2;
	int D = graph[3].size() % 2;
	if(A == 0 && B == 0 && C == 0 && D == 0) {
		cout << "YES" << endl;
	}
	else if(A + B + C + D == 2) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 256
object Main extends App {

  val n = scala.io.StdIn.readLine.toInt
  val p: Array[Int] = scala.io.StdIn.readLine.split(" ").map(_.toInt)

  def solve(): String = {
    var cnt = 0
    for(i <- 0 until n) {
      if(i+1 != p(i)) cnt += 1
    }
    if(cnt <= 2) "YES" else "NO"
  }
  println(solve)
}


Measured memory_bytes: 27204
#include<iostream>

using namespace std;

int n;

int main()
{
  int len, ans;
  while(true)
  {
    ans = -1;
    len = 0;
    cin >> n;
    if(!n)
      break;
    for(int i = 0; i < n; i++)
    {
      int a, b, c;
      cin >> a >> b >> c;
      if(c + b > len)
      {
        len = c + b;
        ans = a;
      }
    }
    cout << ans << " " << len << endl;
  }
}

Measured memory_bytes: 1160
#include <iostream>
using namespace std;
int main(void){
    int n,a=1;
    cin>>n;
    for(int i=0;i<n;i++){
        int b;
        bool hoge = true;
        while(hoge){
            b=10*a+1;
            int c=b;
            hoge = false;
            for(int j=3;j<c;j++){
                if(b%j==0){
                    hoge = true;
                    j=c;
                }
                c=b/j;
            }
            
            a++;
            
        }
        cout<<b;
        if(i<n-1){
            cout<<" ";
        }else{
            cout<<endl;
        }
    }
}


Measured memory_bytes: 256
program ABC067A
    implicit none
    integer(8)::A,B
    read(5,*)A,B
    if(mod(A,3)==0.or.mod(B,3)==0.or.mod(A+B,3)==0)then
        print'(A)',"Possible"
    else
        print'(A)',"Impossible"
    end if
end program ABC067A

Measured memory_bytes: 256
import sys
def area_of_triangle(x, y, z):
    return ((y[0]-x[0])*(z[1]-x[1]) - (z[0]-x[0])*(y[1]-x[1])) / 2
p = [list(map(float, line.split(','))) for line in sys.stdin]
print(sum([area_of_triangle(p[0], p[i], p[i+1]) for i in range(1, len(p) - 1)]))




Measured memory_bytes: 5596
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>

#define int long long
#define REP(i,a,n) for(int i=a;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define REV(i,a,n) for(int i=n;i>=a;--i)
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define show(n) cerr<<#n<<" = "<<n<<endl
#define showp(n) cerr<<n.fs<<", "<<n.sc<<endl
#define shows(n) for(auto z:n){cerr<<z<<", ";}cerr<<endl
#define showsp(n) for(auto z:n){cerr<<z.fs<<" "<<z.sc<<", "}cerr<<endl

#define yes puts("Yes")
#define no puts("No")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

inline void io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}
inline int  in(){int n;scanf("%lld",&n);return n;}
inline void out(int n){printf("%lld\n",n);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;

int a,b;

signed main(){
    io();

    cin >> a >> b;
    if(a + b == 15){
        cout<<"+"<<endl;
    }else if(a * b == 15){
        cout<<"*"<<endl;
    }else{
        cout<<"x"<<endl;
    }

    return 0;
}


Measured memory_bytes: 888
import java.io.*;
class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader r =
            new BufferedReader(new InputStreamReader(System.in), 1);
        String is = r.readLine();
        String[] sp = is.split(" ");
        if(sp.length > 3)
            return;
        int a = Integer.parseInt(sp[0]);
        int b = Integer.parseInt(sp[1]);
        int c = Integer.parseInt(sp[2]);
        if(a<b){
            if(b<c){
                System.out.println("Yes");
            }else
                System.out.println("No");
        }else
            System.out.println("No");
      }
}

Measured memory_bytes: 24408