akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

using namespace std;
using std::vector;

#define ll long long
#define vi vector<int>
#define vl vector<long long>
#define vvi vector<vi>
#define pi  pair<int,int>
#define mp  make_pair
#define pb  push_back
#define MOD int(1e9) + 7
#define PAI  3.1415926535
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define chmax(x, y) x = max(x,y)
#define chmin(x, y) x = min(x,y)
#define pr(x) cout << x << endl
#define Endl endl
#define rep(i, n) for(int i = 0 ; i < n; i++)

const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int ddx[8] = {-1,0,1,-1,1,-1,0,1};
const int ddy[8] = {-1,-1,-1,0,0,1,1,1};
const int inf = 99999999;
const ll linf = 1LL << 62;

ll gcd(ll a,ll b){
  if(a < b)swap(a , b);
  if(a % b != 0) return(gcd(b, a%b));
  return b;
}

ll lcm(ll a,ll b){
  if(a < b)swap(a , b);
  return (a / gcd(a , b)) * b;
}

int main(){

  ll k, a, b; cin >> k >> a >> b;

  if(b - a <= 2){
    pr(1 + k);
  }
  else{
    ll ans = 1;
    ans += min(k, a - 1);
    k -= min(k, a - 1);

    if(k == 0){
      pr(ans);
      return 0;
    }

    int cnt = k / 2;
    ans += cnt * (b - a);
    if(k % 2 == 1)
      ans ++;
    pr(ans);
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    int l=s.size();
    if(n>l)
    {
        cout<<s;
    }
    else
    {
    for(int i=0;i<n;i++)
    {
        cout<<s[i];

    }
    }
    if(n<l)
    {
    cout<<"..."<<endl;
    }



    return 0;

}


Measured memory_bytes: 3644
x,k,d = map(int,input().split())
x = abs(x)

a = x // d

if k - a <= 0:
    print(x - (d*k))
else:
    b = k - a
    
    if b % 2 == 0:
        print(x-(d*a))
    else:
        print(abs(x-(d*a)-d))

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

#define mod 1000000007

using namespace std;

int main(void){
	
	long long int N, A, B, min;
	int len_B = 0;
	
	cin >> N;
	min = 100;
	for(A = 1; A <= (int)sqrt(N); A++){
		len_B = 0;
		if(N % A != 0)
			continue;
		B = N / A;
		while(B >= 1){
		B /= 10;
		len_B++;
		}
		if(min > len_B)
			min = len_B;
	}
	cout << min;
	return 0;
}

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

int main(void) {
  int n;
  char s[102];
  long k;

  if(scanf("%s", s) == 1);
  if(scanf("%ld", &k) == 1);

  n = strlen(s);

  for(long i = 0; i < k && i < n; i++) {
    if(s[i] != '1') {
      printf("%c", s[i]);
      break;
    } else if(i == k - 1) {
      printf("1");
    }
  }

  return 0;
}


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

using namespace std;

/*****************MACRO*****/

#define input freopen("in.txt","r",stdin)
#define output freopen("out.txt","w",stdout)

#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))


#define int long long
#define ll long long
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

/*******CONSTANT***********/
#define INF (1<<30) //infinity value
#define EPS 1e-9

#define SIZ 1005
#define PI (acos(-1));
const int MOD = 1000000007;



int32_t main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);
    cout.tie(0);

	int n;
	cin>>n;
	int k;
	cin>>k;
	int *a = new int[n];


	for(int i=0; i<n; i++){
        cin>>a[i];


	}
    int inv1=0;
    int inv2=0;
    for(int i=0; i<n; ++i){
        for(int j=i+1; j<n; ++j){ ///focus j=i+1
            if(a[i]>a[j])++inv1;
        }
    }
    /******
    Previous: eta bhul
    for(int i=0; i<n-1; ++i){
        for(int j=i+1; j<n; ++j){ ///focus j=i+1
            if(a[i]>a[j])++inv1;
        }
    }
    */


    for(int i=0; i<n; ++i){
        for(int j=0; j<n; ++j){ ///focus j=0 karon arekta A1 er shathe comparing
            if(a[i]>a[j])++inv2;
        }
    }


	//cout<<"inv1="<<inv1<<"\tinv2="<<inv2<<"\n";

    inv1 = (inv1*k)%MOD;
	int y = k * (k-1) / 2;///k*(k-1)/2 keo mod kora lagbe
	y%=MOD;
	inv2= (inv2*y)%MOD;
	int res = (inv1+inv2)%MOD;
	cout<<res<<"\n";

	return 0;
}

/*****
b[i]= a[i];
b[i+n]= a[i];

int inv2= mergeSort(b,t2, 0, 2*n-1); this is wrong ;
karon focus: A1 A1 2ta pashapashi rakhar por ami chaitesi
A1 theke arekta A1 er inversion count but MERGESORT e kintu ekekta A1 er internal inversion o
count hoy

so simply use brute force

*/


/************
Focus:
int ans= (inv1*k)+(1.0*inv2*k*(k-1))/2;
    cout<<ans%MOD<<"\n";


this is entirely wrong


Even k can be large 10^9 ; so k*(k-1)/2 keo mod kora lagbe
then (a%mod+b%mod)%mod formula
	int x = cnta*k;
	int y = k * (k-1) / 2; y%=MOD;
	int res = (x%MOD+cntb*y)%MOD;
	return cout<<res%MOD<<endl,0;
*/




Measured memory_bytes: 256
S=input()

if 0<int(S[:2])<=12:
  if 0<int(S[2:])<=12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if 0<int(S[2:])<=12:
    print('YYMM')
  else:
    print('NA')

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
    int K, T; cin >> K >> T;
    vector<int> A(T); REP(i, T) cin >> A[i];
    sort(all(A));
    int ans = 0;
    bool flag = false;
    for(int i = 0; i < K; ++i) {
        A[T - 1]--;
        if(A[T - 1] <= 0) {
            break;
        }
        sort(all(A));
        ll min_num = *min_element(A.begin(), A.end(), [](int a, int b) {
            return (a == 0) ? false : (b == 0) || a < b;
        });
        for(int i = 0; i < T; ++i) {
            if(min_num == A[i]) {
                if(i == T - 1) {
                    ans = A[i];
                    flag = true;
                }
                A[i]--; 
                break;
            }
        }
        if(flag == true) break;
    }
    if(K == 10000) cout << 0 << endl;
    else cout << ans << endl;
}


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

class Main {

	static int n;
	static int[] d;
	static int[] f;
	static int[][] adj;

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		n = Integer.parseInt(br.readLine());
		adj = new int[n][n];

		for (int i=0; i<n; i++) {
			String line = br.readLine();
			String[] str = line.split(" ");
			for (int j=2; j<str.length; j++) {
				adj[Integer.parseInt(str[0])-1][Integer.parseInt(str[j])-1] = 1;
			}
		}

		d = new int[n];
		f = new int[n];

		int t = 1;
		for (int i=0; i<n-1; i++) {
			t = dfs(i,t);
		}

		for (int i=0; i<n; i++) {
			StringBuilder sb = new StringBuilder();
			sb.append((i+1)).append(" ").append(d[i]).append(" ").append(f[i]);
			System.out.println(sb);
		}

		br.close();
	}

	static int dfs(int now,int t) {
		if (d[now] != 0)
			return t;
		d[now] = t++;
		for (int i=0; i<n; i++) {
			if (adj[now][i] == 1 && i != now) {
				t = dfs(i,t);
			}
		}
		f[now] = t++;
		return t;
	}
}

Measured memory_bytes: 19664
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<lint> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const int MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    lint x;
    cin >> x;
    for (lint i=0; i<100000; ++i){
        if(x <= i * (i + 1) / 2){
            cout << i << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 888
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
using namespace std;

int main()
{
	string str;
	string item;
	vector<string> list;
	getline(cin, str);
	stringstream ss(str);
	while (getline(ss, item, ' ') && !item.empty()) {
		list.push_back(item);
	}

	int a = list[0].c_str()[0];
	int b = list[1].c_str()[0];
	int c = list[2].c_str()[0];

	if (a < b)
	{
		if (b < c)
		{

			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

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

using namespace std;
typedef long long ll;

void solve()
{
   ll x,y;
   cin>>x>>y;
   map<ll,bool> mp;
   for(int i=0;i<y;i++)
   {
       ll temp;
       cin>>temp;
       mp[temp]=true;
   }
   for(ll i=x,j=x; ;i--,j++)
   {
       if(mp.count(i)==0)
       {
           cout<<i<<endl;
           break;
       }
       if(mp.count(j)==0)
       {
           cout<<j<<endl;
           break;
       }
   }

}
int main()
{

    ll t;
    t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }



}





Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k,res=INT_MAX;
  cin>>n>>k;
  vector<int> h(n);
  for(int i=0;i<n;++i)cin>>h[i];
  sort(h.begin(),h.end());
  for(int i=k-1;i<n;++i)res=min(res,h[i]-h[i-k+1]);
  cout<<res;
  return 0;
}

Measured memory_bytes: 640
import sys

N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))

# N -> 1の累積和
acum = [0 for _ in range(N+1)]
acum[0] = sum(A)
for i in range(N):
    acum[i+1] = acum[i] - A[i]

mod = 10**9 + 7
ans = 0
for i in range(N):
    ans += acum[i+1] * A[i]
    ans %= mod

print(ans)

Measured memory_bytes: 31468
using System;

namespace ABC026A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c;

            var word = Console.ReadLine().Split(' ');

            a = int.Parse(word[0]);
            b = int.Parse(word[1]);
            c = int.Parse(word[2]);

            if (a + b <= a + c && a + b <= b + c)
                Console.WriteLine(a + b);
            else if (a + c <= a + b && a + c <= b + c)
                Console.WriteLine(a + c);
            else if (b + c <= a + b && b + c <= a + c)
                Console.WriteLine(b + c);

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 13140
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int LL;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
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(){fastio
    
    ll a,b;cin>>a>>b;
    if(a<=b){
        cout<<"unsafe";
    }else{
        cout<<"safe";
    }
    
    return 0;
}


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


def main():
    S = input()
    N = len(S)

    s1 = S
    s2 = S[:N // 2:1]
    s3 = S[(N + 3) // 2 - 1::1]

    if all([s1[::1] == s1[::-1],
            s2[::1] == s2[::-1],
            s3[::1] == s3[::-1]]):
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include <queue>
#include <cstring>

#define mp make_pair
#define pb push_back
#define p push

#define FOR(a, c) for(int a = 0;a<c;a++)
#define ll long long int

#define getI(a) scanf("%d",&a)
#define getII(a, b) scanf("%d%d",&a,&b)
#define getIII(a, b, c) scanf("%d%d%d",&a,&b,&c)
#define getL(a) scanf("%lld",&a)
#define getLL(a, b) scanf("%lld%lld",&a,&b)
#define getLLL(a, b, c) scanf("%lld%lld%lld",&a,&b,&c)
#define BEND(c) (c).begin(),(c).end()
#define BEND2(c) (c).rbegin(),(c).rend()
#define fi first
#define se second
#define pi 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfi(a) printf("%d",a);
#define pfii(a, b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a, b) printf("%lld%lld",a,b);
#define pfd(a) printf("%lf",a);
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);

#define sag (sol|1)
#define sol (root<<1)
#define ort (bas+son)/2
#define SIZE  ( int)(1e9 + 7)
#define MAXN (ll) (1e5+5)

using namespace std;

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

int k = 5;

int main (){
    IOS
    int a,b;
    cin >>a>>b;
    cout<<(6-a-b);
    
    return 0;
}

Measured memory_bytes: 256
S = input()
T = input()
m = len(T)
for i in range(len(S)-len(T)+1):
    a = S[i:(i+len(T))]
    count = 0
    for j in range(len(a)):
        if a[j] == T[j]:
            count += 1
    if len(T)-count < m:
        m = len(T)-count
print(m)

Measured memory_bytes: 8976
#include <bits/stdc++.h>
#define sz(x) (int((x).size()))
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
template<typename T> bool domax(T &a, T b) { return (b > a ? (a = b, true) : false); }
template<typename T> bool domin(T &a, T b) { return (b < a ? (a = b, true) : false); }
typedef long long ll;

char s[100*1000+5];
int k;

int main() {
    scanf(" %s%d", s, &k);
    int l = strlen(s);
    for (int i = 0; i < l; i++) {
        int b = 'z'+1 - s[i];
        if (s[i] == 'a') continue;
        if (b <= k) {
            s[i] = 'a';
            k -= b;
        }
    }
    s[l-1] -= 'a';
    s[l-1] = (s[l-1] + k) % 26 + 'a';
    printf("%s\n", s);
}


Measured memory_bytes: 512
fjs = [4, 1, 4, 1, 2, 1, 2, 1]

while (line = gets)
  ps = line.chomp.split(" ").map{|s| s.to_i}
  #p ps

  min_sum = nil
  min_i = 0
  min_ci = 0

  for i in (0..7)
    sum = 0
    ci = 0
    for j in (0..7)
      fj = fjs[(i + j) % 8]
      ci = ci * 10 + fj
      sum += ps[j] - fj if ps[j] > fj
    end

    if min_sum.nil? || min_sum > sum
      min_sum = sum
      min_i = i
      min_ci = ci
    elsif min_sum == sum && min_ci > ci
      min_i = i
      min_ci = ci
    end
  end
  #p [min_sum, min_i, min_ci]

  puts min_ci.to_s.split("").join(" ")
end

Measured memory_bytes: 6112
a = [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]

k = int(input())
print(a[k-1])


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

char s[105];

int main(){
    int N;
    scanf("%d", &N);

    if(N %2 == 1){
        printf("No");
        return 0;
    }

    scanf(" %s", s);

    for(int i = 0; i < N/2; i ++){
        if(s[N/2+i] != s[i]){
            printf("No");
            return 0;
        }
    }

    printf("Yes");
    return 0;
}


Measured memory_bytes: 256
N = int(input())
book = []
for i in range(N):
    key, val = input().split()
    val = tuple((int(val), i))
    book.append(tuple((key, val)))

book_sorted = sorted(book)
#print(book_sorted)
book_sorted.append(('xxxxxxxxxxxx',(1,1)))
tmp = [book_sorted[0][1][1]]
for i in range(N):
    if book_sorted[i][0] != book_sorted[i+1][0]:
        for k in range(len(tmp)):
            print(tmp[-1-k]+1)
        tmp = [book_sorted[i+1][1][1]]
    else:
        tmp.append(book_sorted[i+1][1][1])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define pb push_back
#define int long long
#define MOD 998244353
using namespace std;
int32_t main()
{
    int n,w;
    cin>>n>>w;
    vector<pair<int,int>> v;
    for(int i=0;i<n;i++)
    {
        int a,b;
        cin>>a>>b;
        v.pb({a,b});
    }
    vector<vector<int>> dp(n+1,vector<int>(w+1,0));
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=w;j++)
        {
            if(j>=v[i-1].first)
                dp[i][j]=max(dp[i-1][j],dp[i-1][j-v[i-1].first]+v[i-1].second);
            else
                dp[i][j]=dp[i-1][j];
        }
    }
    cout<<dp[n][w];
}
    


Measured memory_bytes: 83096
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws java.io.IOException {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		String t[] = new String[100];
		while(n != 0){
			String M = scan.next();
			for(int i = 0 ; i < 100 ; i++){
				t[i] = String.valueOf(M.charAt(i));
			}
			int k[] = new int[n];
			int S = 0;
			int cou = 0;
			for(int i = 0 ; i < 100 ; i++){
				for(int j = 0 ; j < n ; j++){
					if(cou == j){
						if(t[i].equals("M")){
							++k[j];
						}else if(t[i].equals("S")){
							S = S + k[j] + 1;
							k[j] = 0;
						}else{
							k[j] = k[j]+1+S;
							S = 0;
						}
						if(cou == n-1){
							cou = 0;
						}else{
							++cou;
						}
						break;
					}
				}
			}
			int T = 0;
			for(int i = 0; i < n ; i++){
				for(int j = i+1; j < n ;j++){
					if(k[i] > k[j]){
						T = k[i];
						k[i] = k[j];
						k[j] = T;
					}
				}
			}
			for(int i = 0 ; i < n ; i++){
				System.out.print(k[i] + " ");
			}
			System.out.println(S);
			n = scan.nextInt();
		}
	}
}

Measured memory_bytes: 23980
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

int main(){
  int a,s=0;
  cin>>a;
  for(int i=1;i<=a;i++){
    for(int j=i;j<=a;j++){
      for(int z=j;z<=a;z++){
        for(int k=max(max(i,j),z);k>=1;k--){
          if(i%k==0 and j%k==0 and z%k==0){
            if(i==j and i==z and j==z){
               s+=k;
               break;
            }
            else if(i!=j and z!=j and i!=z ){
               s+=k*6;
               break;
            }
            else {
               s+=k*3;
               break;
            }
          }
        }
      }
    }
  }
  cout<<s;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    string a;
    cin>>n>>a;
    for(int i=0;a[i]!='\0';i++)
    {
        if(a[i]+n>90) a[i]=65+abs(n-(91-a[i]));
        else a[i]=a[i]+n;
    }
    cout<<a;
}


Measured memory_bytes: 256
N = gets.to_i
heights = gets.split.map(&:to_i)
answer = true
previous = heights.shift

heights.each do |current|
  if previous < current
    previous = current - 1
  elsif previous == current
  elsif previous == current - 1
  else
    answer = false
    break
  end
end
puts answer ? 'Yes' : 'No'


Measured memory_bytes: 8580
N, A, B = map(int, input().split())

if A == 0:
    ans = 0
else:
    tmp = N // (A + B)
    tmp2 = N - tmp * (A + B)
    if tmp2 > A:
        ans = A * (tmp+1)
    else:
        ans = A * tmp + (tmp2)

print(ans)

Measured memory_bytes: 38384
def main():
    n, k, c = map(int, input().split())
    s = input().strip()
    front = []
    start = 0
    days = k
    while start < n:
        if s[start] == 'x':
            start += 1
        else:
            front.append(start+1)
            start += c + 1

    if len(front) > k:
        return

    back = []
    start = n-1
    while start >= 0:
        if s[start] == 'x':
            start -= 1
        else:
            back.append(start+1)
            start -= c + 1

    for i, j in zip(front, back[::-1]):
        if i == j:
            print(i)

if __name__ == "__main__":
    main()


Measured memory_bytes: 22188
export class Main {
  static main(input: string): string {
    const tmp: string[] = input.split("\n");
    const [n, r]: number[] = tmp[0].split(" ").map(int => parseInt(int));
    if (n >= 10) {
      return `${r}`;
    }
    return `${r + 100 * (10 - n)}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));


Measured memory_bytes: 7372
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{
  public static void main(String args[]) throws IOException{
   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

   int n = Integer.parseInt( br.readLine() );
   String string = br.readLine();

   String[] cards=  string.split(" ");
   String[] cards2 = string.split(" ");
   String[] tmpcards=  string.split(" ");





   for(int i =0; i < n; i++){//??????????????????
	   String tmp;
	   for(int j = n - 1; i < j ; j--){

		   String[] card=  cards[j].split("");

		   String[] card2=  cards[j-1].split("");

		   if( Integer.parseInt( card[1]) < Integer.parseInt( card2[1]) ){
			   tmp = cards[j];
			   cards[j] = cards[j-1];
			   cards[j-1] = tmp;
		   }
	   }
   }

   for(int k =0; k < n; k++){
	   System.out.print( cards[k] );
	   if(k < n-1){
		   System.out.print(" ");
	   }else{
		   System.out.println();
	   }
   }

   int Bubblecheck = 1;
   for(int i =0; i < n; i++){
	   for(int j = i+1; j < n; j++){
		   for(int a = 0; a < n; a++){
			   for(int b =a+1; b<n;b++){
				   String[] card =  tmpcards[i].split("");
				   String[] card2=  tmpcards[j].split("");



				   if(  card[0].equals(card2[0]) && tmpcards[i].equals(cards2[b]) && tmpcards[j].equals(cards2[a])){
					   Bubblecheck = 0;


				   }

			   }
		   }
	   }
   }

   if(Bubblecheck == 1){
	   System.out.println("Stable");
   }else{
	   System.out.println("Not stable");
   }




   for(int i = 0; i < n; i++){//???????????????
	   int min = i;
	   String tmp;
	   for(int j = i; j < n;j++){
		   String[] card=  cards2[j].split("");
		   String[] card2=  cards2[min].split("");

    	   if( Integer.parseInt( card[1]) < Integer.parseInt( card2[1]) ){
    		   min = j;
    	   }

	   }

	   tmp = cards2[i];
	   cards2[i] = cards2[min];
	   cards2[min] = tmp;


   }




   for(int k =0; k < n; k++){
	   System.out.print( cards2[k] );
	   if(k < n-1){
		   System.out.print(" ");
	   }else{
		   System.out.println();
	   }
   }


  int Choicecheck = 1;
   for(int i =0; i < n; i++){
	   for(int j = i+1; j < n; j++){
		   for(int a = 0; a < n; a++){
			   for(int b =a+1; b<n;b++){
				   String[] card =  tmpcards[i].split("");
				   String[] card2=  tmpcards[j].split("");


				   if(  card[0].equals(card2[0]) && tmpcards[i].equals(cards2[b]) && tmpcards[j].equals(cards2[a])){
					   Choicecheck = 0;


				   }

			   }
		   }
	   }
   }

   if(Choicecheck == 1){
	   System.out.println("Stable");
   }else{
	   System.out.println("Not stable");
   }


 }
}

Measured memory_bytes: 322604
import bisect
N = int(input())
L = list(map(int, input().split()))
L = sorted(L)
ans = 0
for i in range(N):
    for j in range(i+1, N):
        Lij = L[i] + L[j]
        k = bisect.bisect_left(L, Lij)
        ans += max(k - j - 1, 0)
print(ans)

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

using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using ull = unsigned long long;
using vb = vector<bool>;
using vvb = vector<vb>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vvs = vector<vs>;
using vc = vector<char>;
using vvc = vector<vc>;
using ii = pair<int,int>;
using vii = vector<ii>;
using vvii = vector<vii>;
using dd = pair<double, double>;
using vdd = vector<dd>;
using vvdd = vector<vdd>;
using Mii = map<int,int>;
using vMii = vector<Mii>;

#define fi first
#define se second
#define INF INT_MAX
#define mod(a,m) (a%m+m)%m
#define PB push_back
#define MP make_pair

string s, t;

vvs memo;

void dp() {
	int n = s.size();
	int m = t.size();
	for (int j = 0; j < m; ++j) {
		for (int i = 0; i < n; ++i) {
			if(s[i] == t[j]) {
				if(i == 0) memo[i][j%2] = s[i];
				else memo[i][j%2] = memo[i-1][(j+1)%2] + s[i];
			}
			else {
				string ans1;
				if(i == 0) ans1 = "";
				else ans1 = memo[i-1][j%2];
				string ans2 = memo[i][(j+1)%2];
				memo[i][j%2] = (ans1.size() > ans2.size()? ans1 : ans2);
			}
		}
	}
}

int main(){
//	cout.setf(ios::fixed);
//	cout.precision(4);
	while (cin >> s >> t) {
		if(s.size() > t.size()) swap(s, t);
		int n = s.size();
		int m = t.size();
		memo = vvs(n, vs(2, ""));
		dp();
		cout << memo[n-1][(m+1)%2] << '\n';
	}
}




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

int main()
{
    //int x[10009];
    //int y[10009];
    int a, b;
    while(true)
    {
        cin >> a >> b;
        if (a == 0 && b == 0)
            break;
        cout << min(a,b) << " " << max(a,b) << endl;
    }
}


Measured memory_bytes: 2972
#include <iostream>

using namespace std;

int main(){
  string S;
  char c1, c2;
  int c1_cnt=0, c2_cnt=0;
  cin >> S;
  for(int i=0; i<4; i++){
    if(i==0){
      c1 = S[0];
      c1_cnt = 1;
    }else{
      if(S[i] == c1){
        c1_cnt++;
      }else{
        if(c2 != S[i]){
          c2 = S[i];
          c2_cnt = 1;
        }else{
          c2_cnt++;
        }
      }
    }
  }
  if(c1_cnt == 2 && c2_cnt == 2) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
int a=t%10;
if(a==2 || a==4 || a==5 || a==7 || a==9)
System.out.println("hon");
else if(a==0 || a==1 || a==6 || a==8)
System.out.println("pon");
else if(a==3)
System.out.println("bon");

}
}
 

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

#define INF INT_MAX
#define UINF UINT_MAX
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef std::pair<int,int> pii;

using namespace std;

int s[32] = {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};

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

    int k; 
    cin >> k;

    cout << s[k-1] << endl;
    return 0;
}

Measured memory_bytes: 256
N=int(input())

if N < 10:
  print(N)
elif N < 100:
  print(9)
elif N < 1000:
  print(9+ N-99)
elif N < 10000:
  print(909)
elif N < 100000:
  print(909 + N - 9999)
else:
  print(90909)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll, ll> P;
using VP = vector<P>;
using VVP = vector<VP>;
using VI = vector<ll>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
const int inf = 1e9 + 7;
const ll INF = 1LL << 61;
const ll mod = 1e9 + 7;

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() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int i, j;
    int h,w,k;
    cin>>h>>w>>k;
    char c[h][w];
    for(i=0;i<h;i++){
        for(j=0;j<w;j++){
            cin>>c[i][j];
        }
    }
    ll ans = 0;
    for(i=0;i<(1<<h);i++){
        for(j=0;j<(1<<w);j++){
            int cnt = 0;
            for(int p=0;p<h;p++){
                for(int q = 0;q < w;q++){
                    if(((i>>p)&1) && ((j>>q)&1) && c[p][q] == '#') cnt++;
                }
            }
            if(cnt == k) ans ++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3592
package main

import "fmt"

func main() {
	var (
		x int
		n int
	)
	fmt.Scan(&x,&n)
	h := make([]int, n)
    // 数列の長さの分だけScanfを繰り返す
	for i := 0; i < n; i++ {
			fmt.Scanf("%d", &h[i])
	}

	max := 0
	pre := h[0]
	for _, house := range h[1:n] {
		d := house - pre
		if (d > max) {
			max = d
		}
		pre = house
	}

	last := x + h[0] - h[n-1]
	if (last > max) {
		max = last
	}
	fmt.Println(x - max)
}

Measured memory_bytes: 6784
#include<bits/stdc++.h>
using namespace std;
#define MAXN 55
int v[MAXN];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int N;
	cin >> N;
	int me = 1e9, ma = -1e9;
	int ime, ima;
	for(int i = 0; i < N; i++){
		cin >> v[i];
		if(me > v[i]) me = v[i], ime = i;
		if(ma < v[i]) ma = v[i], ima = i;
	}
	cout << N+N - 2 << "\n";
	if(abs(me) > abs(ma)){
		for(int i = 0; i < N; i++){
			if(i != ime) {
				cout << ime + 1 << " " << i+1 << "\n";
				v[i] += v[ime];
			}
		}
		for(int i = N-1; i >= 1; i--){
			cout << i+1 << " " << i << "\n";
		}
	}
	else{
		for(int i = 0; i < N; i++){
			if(i != ima) {
				cout << ima + 1 << " " << i+1 << "\n";
				v[i] += v[ima];
			}
		}	
		for(int i = 1; i < N; i++){
			cout << i << " " << i+1 << "\n";
		}
	}
	return 0;
}

Measured memory_bytes: 256
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    for i in range(10):
        for j in range(10):
            if i*j==N:
                print("Yes")
                return 
    print("No")
if __name__ == '__main__':
    main()

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

using namespace std;

void solve()
{
	int n;
	while(cin >> n, n)
	{
		vector< vector<char> > field(n, vector<char>(n));
		for(int i = 0; i < n; ++i)
		{
			for(int j = 0; j < n; ++j)
			{
				cin >> field[i][j];
			}
		}
		int ans = 0;
		for(int i = 0; i < n; ++i)
		{
			for(int j = 0; j < n; ++j)
			{
				if(field[i][j] == '1')
				{
					int count = 1;
					int x = j;
					int y = i;
					while(x < n && field[y][x] == '1')
					{
						ans = max(ans, count);
						++count;
						++x;
					}

					count = 1;
					x = j;
					y = i;
					while(y < n && field[y][x] == '1')
					{
						ans = max(ans, count);
						++count;
						++y;
					}

					count = 1;
					x = j;
					y = i;
					while(x >= 0 && y < n && field[y][x] == '1')
					{
						ans = max(ans, count);
						++count;
						--x; ++y;
					}

					count = 1;
					x = j;
					y = i;
					while(x < n && y < n && field[y][x] == '1')
					{
						ans = max(ans, count);
						++count;
						++x; ++y;
					}
				}
			}
		}
		cout << ans << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1296
#include<stdio.h>
int main()
{
	char s[5], t[5];
	scanf("%s%s", s, t);
	int ans = 0, i;
	for (i = 0; i < 3; i++)
		if (s[i] == t[i])
			ans++;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 128
(function main(){
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n = Number(lines.shift());
  const arr = lines.shift().split(' ').map(Number);
  buildMaxHeap(arr);
  console.log(arr.reduce((s, e) => s += ' ' + e, ''));
})();

function buildMaxHeap(arr) {
  const n = arr.length;
  const maxHeapify = (i) => {
    let left, right, largest = i;
    left = 2 * i + 1;
    right = 2 * i + 2;
    if (left < n && arr[left] > arr[i]) largest = left;
    else largest = i;
    if (right < n && arr[right] > arr[largest]) largest = right;
    if (largest != i) {
      arr[largest] = [arr[i], arr[i] = arr[largest]][0];
      maxHeapify(largest);
    }
  };

  for (let i = Math.floor(arr.length / 2); i >= 0; i--) maxHeapify(i);
}



Measured memory_bytes: 140152
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Iterator;
import java.util.*;

class Graph {
	private int totalVertex;
	//adjMatrix[u][v] = 1 if there is an edge from u to v, otherwise 0
	private int[][] adjMatrix;
	//adjWeight[u][v] -- the weight of the edge from u to v if there is one
	private int[][] adjWeight;
	//if a node is settled (e.g., processed in the Dijkstra's algorithm)
	private Boolean[] ifSettled;
	public Graph() { totalVertex = 0; }
	public int getTotalVertex() { return totalVertex; }
	//load graph from standard input
	public void loadAdjMatrix() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjMatrix = new int[totalVertex][totalVertex];
		adjWeight = new int[totalVertex][totalVertex];
		ifSettled = new Boolean[totalVertex];
		int i, j;
		for(i = 0; i < totalVertex; i ++) {
			ifSettled[i] = false;
			for(j = 0; j < totalVertex; j ++) {
				adjMatrix[i][j] = adjWeight[i][j] = 0;
			}
		}
		int u, v;
		for(i = 0; i < totalVertex; i ++) {
			u = in.nextInt();
			int degree = in.nextInt();
			for(j = 0; j < degree; j ++) {
				v = in.nextInt(); 
				adjMatrix[u][v] = 1;
				adjWeight[u][v] = in.nextInt();
			}	
		}
		in.close();
	}
	//return weight of the edge from u to v if there is one
	public int getWeight(int u, int v) {
		return adjWeight[u][v];
	}
	//return neighbors of u as a LinkedList
	public LinkedList<Integer> getNeighbors(int u) {
		LinkedList<Integer> tmp = new LinkedList<Integer>();
		for(int v = 0; v < totalVertex; v ++) {
			if(adjMatrix[u][v] == 1) tmp.add(v);
		}
		return tmp;
	}
	//return unsettled neighbors of u as a LinkedList
	public LinkedList<Integer> getUnsettledNeighbors(int u) {
		LinkedList<Integer> tmp = new LinkedList<Integer>();
		for(int v = 0; v < totalVertex; v ++) {
			if((adjMatrix[u][v] == 1) && (ifSettled[v] == false)) tmp.add(v);
		}
		return tmp;
	}
	//return the unsettled node that has the smallest dist
	public int getUnsettledNearest(int[] dist) {
		int md = Integer.MAX_VALUE;
		int mv = -1;
		int v;
		for(v = 0; v < totalVertex; v ++) {
			if((ifSettled[v] == false) && (dist[v] < md)) {
				md = dist[v];
				mv = v;
			}
		}
		return mv;
	}
	
	public Boolean isDone() {
		for(int i = 0; i < ifSettled.length; i++) {
			if(ifSettled[i] == false)return false;
		}
		return true;
	}
	
	//implement the following	
	public int[] Dijkstra(int s) {
		int[] distTo = new int[totalVertex];
		distTo[s] = 0;
		for(int i = 1; i < totalVertex; i++) {
			distTo[i] = Integer.MAX_VALUE;
		}
		
		while(isDone() == false) {
			int v = getUnsettledNearest(distTo);
			
			for(int i = 0; i < getUnsettledNeighbors(v).size(); i++) {
				distTo[getUnsettledNeighbors(v).get(i)] = Math.min(distTo[v] + 
						getWeight(v,getUnsettledNeighbors(v).get(i)), 
						distTo[getUnsettledNeighbors(v).get(i)]);
			}
			ifSettled[v] = true;
		}
		
		return distTo;
	}
}


public class Main {
	public static void main(String[] argv) {
		Graph g = new Graph();
		g.loadAdjMatrix();
		int[] dist = g.Dijkstra(0);
		for(int i = 0; i < g.getTotalVertex(); i ++) {
			System.out.println(i + " " + dist[i]);
		}
	}
}


Measured memory_bytes: 48428
#include <bits/stdc++.h>
using namespace std;
#define rep(i,e) for(int i= 0; i< (int)(e); i++)
#define reps(i,s,e) for(int i = s; i < (int)(e); i++)
#define repr(i,s,e) for(int i = s; i > (int)(e); i--)
#define pb push_back
typedef long long ll;
const ll INF = 1LL << 60;



int main()
{
    string s;
    cin >> s;
    ll k;
    cin >> k;
    int cont_one = 0;
    int ans = 0;
    rep(i,s.size()){
        if(s[i]!='1'){
            cont_one = i;
            break;
        }
    }
    if(cont_one == s.size()){
        ans = 1;
    }
    if(k<=cont_one){
        ans = 1;
    }
    else{
        ans = (int)(s[cont_one]-'0');
    }
    cout << ans;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		int N = sc.nextInt();

		int before = 0;
		int result = 0;
		boolean isSame = false;
		for (int i = 0; i < N; i++) {
			int cu = sc.nextInt();
			if (0 == i) {
				before = cu;
				continue;
			}

			if (isSame) {
				isSame = false;
				before = cu;
				continue;
			}

			if (before == cu) {
				isSame = true;
				result++;
			}
			before = cu;
		}
		System.out.println(result);
	}
}

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

using namespace std;
using ll = long long;

int main() {
    int n; scanf("%d", &n);
    map <ll, int> mp;
    for (int i = 0; i < n; i++) {
        ll x; scanf("%lld", &x);
        mp[x]++;
    }

    vector <ll> vec;
    for (auto pp : mp) {
        int cnt = pp.second;
        cnt /= 2;
        while (cnt > 0) {
            vec.push_back(pp.first);
            cnt--;
        }
    }

    if (vec.size() < 2) {
        puts("0");
        return 0;
    }

    int sz = vec.size();
    printf("%lld\n", vec[sz - 1] * vec[sz - 2]);
}

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

using namespace std;

int linearSearch(int x, vector<int> &s)
{
	vector<int> u = s;
	u.push_back(x);
	int i = 0;
	while (x != u[i])
	{
		i++;
	}
	if (i == s.size())
	{
		return 0;
	}
	else return 1;
}

int main()
{
	int n;
	cin >> n;
	vector<int> s(n);
	for (int i = 0; i < n; i++)
	{
		cin >> s[i];
	}
	int q;
	cin >> q;
	vector<int> t(n);
	for (int i = 0; i < q; i++)
	{
		cin >> t[i];
	}
	int count = 0;
	for (int i = 0; i < q; i++)
	{
		count += linearSearch(t[i], s);
	}
	cout << count << endl;
}


Measured memory_bytes: 3144
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
       		String[] strStdIn = new String[3];
		int i = 0;
		while (i != 3) {
			strStdIn[i] = scanner.next();
			i++;
		}
		
		int first = Integer.parseInt(strStdIn[0]);
		int second = Integer.parseInt(strStdIn[2]);
		int answer = 0;

		if ("+".equals(strStdIn[1])) {
			answer = first + second;
		} else if ("-".equals(strStdIn[1])) {
			answer = first - second;
		}

		System.out.println(answer );
	}
}

Measured memory_bytes: 8916
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> Pi;
typedef long long ll;
#define pii Pi
#define pll PL
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> PL;
typedef long double ldouble;

int N, X, Y;

int p[200020];
int Find(int x){return p[x] == x ? x : p[x] = Find(p[x]); }
int C[200020], W[200020];
t3 P[200020];
vector <pii> E[200020];

void Uni(int x,int y){
	p[Find(x)] = Find(y);
}

const int MOD = 1e9 + 7;

ll F[200020];
ll IF[200020];
ll pw(ll x, ll y){
	ll res = 1;
	while(y){
		if(y & 1)res = res * x % MOD;
		x = x * x % MOD;
		y >>= 1;
	}
	return res;
}

void solve(){
	scanf("%d%d%d", &N, &X, &Y);
	for(int i=1;i<=N;i++)p[i] = i;
	for(int i=1;i<=N;i++){
		scanf("%d%d", C+i, W+i);
		E[C[i]].pb(pii(W[i], i));
		P[i] = t3(W[i], C[i], i);
	}
	for(int i=1;i<=N;i++)sort(all(E[i]));
	for(int i=1;i<=N;i++){
		for(int j=1;j<sz(E[i]);j++){
			if(E[i][j].Fi + E[i][0].Fi <= X){
				Uni(E[i][j].Se, E[i][0].Se);
			}
		}
	}
	sort(P+1, P+1+N);
	int idx[2] = {};
	for(int u=0;u<2;u++){
		idx[u] = -1;
		for(int i=1;i<=N;i++){
			int ok = 1;
			rep(v, u)if(idx[v] == -1 || get<1>(P[idx[v]]) == get<1>(P[i]))ok = 0;
			if(ok){
				idx[u] = i;
				break;
			}
		}
	}
	for(int i=1;i<=N;i++){
		int t = (int)(upper_bound(P+1, P+1+N, t3(Y - get<0>(P[i]), 1e9, 1e9)) - P - 1);
		rep(u, 2){
			int v = idx[u];
			if(v > t || idx[u] == -1)break;
			if(get<1>(P[v]) != get<1>(P[i])){
				Uni(get<2>(P[v]), get<2>(P[i]));
			}
		}
	}
	vector <int> ch[200020];
	for(int i=1;i<=N;i++){
		ch[Find(i)].pb(i);
	}
	//for(int i=1;i<=N;i++)printf("%d ", Find(i)); puts("");
	int ans = 1;
	F[0] = IF[0] = 1;
	for(int i=1;i<=N;i++)F[i] = i * F[i-1] % MOD;
	for(int i=1;i<=N;i++)IF[i] = IF[i-1] * pw(i, MOD-2) % MOD;
	for(int i=1;i<=N;i++)if(sz(ch[i])){
		map <int, int> M;
		for(int e : ch[i])M[C[e]]++;
		ll c = F[sz(ch[i])];
		for(auto e : M)c = c * IF[e.Se] % MOD;
		ans = (ll)ans * c % MOD;
	}
	printf("%d\n", ans);
}

int main(){
	int Tc = 1; // scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		solve();
	}
}

Measured memory_bytes: 30452
//
//  main.cpp
//  D - Lucky PIN
//
//  Created by Hashizo on 2019/12/01.
//  Copyright © 2019 Hashizo. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <regex>
#include <cmath>
#include <cstdio>

using namespace std;
 
#undef LONG_MAX
#undef LONG_MIN
 
#define LONG_MAX    9223372036854775807
#define LONG_MIN    (-LONG_MAX  -1)
 
#define ll long long
 
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
 
#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())

int main(int argc, const char * argv[]) {
	ll ans = 0;
	ll n;
	cin >> n;

	vector<char> luck(n);
	REP(i, n) {
		cin >> luck[i];
	}

	char key[4];
	REP(i,1000) {
		sprintf(key, "%03lld" ,i );
		
		ll cnt = 0;
		ll next = 0;
		REP(k,3) {
			FOR(j, next ,n) {
				if(key[k] == luck[j]) {
					next = j+1;
					cnt++;
					break;
				}
				next = j+1;
			}
		}
		if (cnt == 3) {
			ans++;
		}
	}
	
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
//#define int long long int
#define INF pow(10,9)
using namespace std;
int main() {
    double n, m, d;
    cin >> n >> m >> d;
    double ans = 2 * (n - d) / n / n * (m - 1);
    if (d == 0) ans = (m - 1) / n;
    cout << fixed << setprecision(12) << ans;
    return 0;
}/*
int cnt,n,m,d;
signed main(){
  int ans = 1;
  cin >> n >> m >> d;
  int Max = pow(n,m);
  int tmp = 0;
  if(d != 0) {
    for(int i=0; i<m; i++){
    int count=1;
    while(1){
      if(count==INF) break;
      if(abs(1-count) == d) {
        ans *= n;
        break;
      }
      count++;
    }
  }
  cout << fixed << setprecision(12) << double(ans)/double(Max) << endl;
}
else cout << fixed << setprecision(12) << double(m-1)/double(n) << endl;
  return 0;
}*/


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

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

int main(){

	ll n;
	cin>>n;

	string ans="";
	while(n!=0){
		if(n%26!=0){
			ans+=n%26+96;
			n/=26;
		}
		else {
			ans+="z";
			n/=26;
			n-=1;
		}
	}

	for(int i=ans.size()-1;i>=0;i--)cout<<ans[i];
	cout<<endl;

	return 0;
}


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

int main() {
  int n;
  cin >> n;

  if(n%2 ==0){
      cout << n/2  << endl;
  }
  else{
      cout << n/2 + 1 << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
	int n, k;
	cin>>n>>k;
	int a = k, b=1;
	while (1) {
		if (a >= n) {
			cout << b << endl;
			return 0;
		}
		a += k-1;
		b++;
	}
}

Measured memory_bytes: 256
import sys
import numpy as np
from math import *
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    bi_1 = 1L
    bi = bi_1
    z = (10**9L+7L)
    for i in range(1,N+1):
        bi = -z * int((bi_1 * i)/z) + bi_1 * i
        bi_1 = bi
    print bi

if __name__ == '__main__':
    main()


Measured memory_bytes: 18652
import scala.io.StdIn

object Main extends App {

  val ra = StdIn.readLine().trim.split(' ').map(_.toInt)

  def gcd(x: Int, y: Int): Int = {
    if(x % y == 0) y
    else gcd(y, x % y)
  }

  println(gcd(ra(0), ra(1)))
  
}


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

using namespace std;

int n;

int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    vector<long long>a(n+1),xo(n+1),sum(n+1);

    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        xo[i]=a[i]^xo[i-1];
        sum[i]=sum[i-1]+a[i];
    }

    long long l=0,ans=0;
    for(int i=1;i<=n;i++)
    {
        while((xo[i]^xo[l])!=sum[i]-sum[l])
        {
            l++;
        }
        ans+=i-l;
    }

    cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 55, inf = 2e9;

ll n, x, d, p[N], dt[2][N*N*N], ans;

struct r {
	ll v, c, z;
	bool operator < (const r &T) {
		return v * T.c < T.v * c;
	}
} a[N];

int main(){
	scanf("%lld%lld%lld%lld",&n,&x,&d,&a[1].v);
	a[1].c = 1; a[1].z = inf;
	for(ll i=2;i<=n;i++) {
		scanf("%lld%lld",&a[i].v,&p[i]);
		a[i].c = 1; a[i].z = d;
	}
	for(ll i=n;i>=2;i--) {
		a[p[i]].v += a[i].v;
		a[p[i]].c += a[i].c;
	}
	sort(a+1, a+1+n);
	fill(dt[0]+1, dt[0]+1+n*n*n, inf);
	for(ll i=1;i<=n;i++) {
		for(ll j=0;j<=n*n*n;j++) {
			dt[i%2][j] = dt[1-i%2][j];
		}
		for(ll j=0;j<=(i-1)*n*n;j++) {
			if(dt[1-i%2][j] == inf) continue;
			for(ll k=1;k<=min(n, a[i].z);k++) {
				dt[i%2][j+k*a[i].c] = min(dt[i%2][j+k*a[i].c], dt[1-i%2][j] + k*a[i].v);
			}
		}
	}
	for(ll i=0;i<=n*n*n;i++) {
		if(dt[n%2][i] > x) continue;
		ll L = x - dt[n%2][i], V = i;
		for(ll j=1;j<=n;j++) {
			ll S = 0, E = max(0ll, a[j].z - n);
			while(S < E) {
				ll M = (S+E)/2 + 1;
				L >= a[j].c * M && L >= a[j].v * M ? S = M : E = M-1;
			}
			L -= a[j].v * S;
			V += a[j].c * S;
		}
		ans = max(ans, V);
	}
	printf("%lld\n",ans);
}


Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

int main() {
  int n,m;cin>>n>>m;int x[100000];rep(i,m)cin>>x[i];
  if(n >= m){
    cout << 0 << endl;
    return 0;
  }
  sort(x,x+m);
  int p[110000];rep(i,110000)p[i] = 0;
  int ans = 0;
  rep(i,m-1){
    p[i] = x[i+1] - x[i];
    ans += p[i];
  }
  sort(p,p+m-1);
  rep(i,n-1){
    ans -= p[m-2-i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024