akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, x, n) for(int i = x; i < n; i++)
using namespace std;
const long long INF = 1LL << 60;
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;
int main() {
    string S;
    cin >> S;
    int a = stoi(S.substr(0, 2));
    int b = stoi(S.substr(2, 2));
    if(a > 0 && a <= 12) {
        if(b > 0 && b <= 12) {
            cout << "AMBIGUOUS" << endl;
        } else {
            cout << "MMYY" << endl;
        }
    } else {
        if(b > 0 && b <= 12) {
            cout << "YYMM" << endl;
        } else {
            cout << "NA" << endl;
        }
    }
}

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


#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(int x = (l);x<=(u);x++)
#define RREP(x,l,u) for(int x = (l);x>=(u);x--)
#define mst(x,a) memset(x,a,sizeof(x))
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define se second
#define fi first
#define dbg(x) cout<<#x<<" = "<<(x)<<endl;
#define sz(x) ((int)x.size())
#define cl(x) x.clear()

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
using namespace std;

const int maxn = 100010;
const int mod = 1e9+7;
const int MAX = 1000000010;
const double eps = 1e-6;
const double PI = acos(-1);

template<typename T> inline void read(T &x){
x=0;T f=1;char ch;do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}

template<typename A,typename B> inline void read(A&x,B&y){read(x);read(y);}
template<typename A,typename B,typename C> inline void read(A&x,B&y,C&z){read(x);read(y);read(z);}
template<typename A,typename B,typename C,typename D> inline void read(A&x,B&y,C&z,D&w){read(x);read(y);read(z);read(w);}
template<typename A,typename B> inline A fexp(A x,B p){A ans=1;for(;p;p>>=1,x=1LL*x*x%mod)if(p&1)ans=1LL*ans*x%mod;return ans;}
template<typename A,typename B> inline A fexp(A x,B p,A mo){A ans=1;for(;p;p>>=1,x=1LL*x*x%mo)if(p&1)ans=1LL*ans*x%mo;return ans;}

int n;double d,x;

void Work(){
	double ans=0;
	double t=d+(2*n-1)*x/2;
	while(n){
		ans+=t;t+=t/n;n--;
	}
	printf("%.10lf\n",ans);
}

void Init(){
	scanf("%d%lf%lf",&n,&d,&x);
}

int main(){
	Init();
	Work();
	return 0;
}


Measured memory_bytes: 256
import numpy as np
from math import ceil

n,m = map(int,input().split())
a = list(map(int,input().split()))
a = [x//2 for x in a]
lcm = np.lcm.reduce(a)
ans = 0

for i in a:
    if lcm // i % 2 == 0:
        break
else:
    ans = ceil((m//lcm)/2)

print(ans)

Measured memory_bytes: 38348
wt = []
N = 5
N.times do
  wt << gets.chomp.to_i
end

ans = 0
wt.sort_by {|v| 10 - (v - 1) % 10 }.each_with_index do |v, i|
  ans += v
  ans += 10 - v % 10 if i != N - 1 && v % 10 != 0
end

puts ans


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

class Dice {
private:
	int label[6];
public:
	Dice(int* a) {
		for (int i = 0; i < 6; i++) {
			label[i] = a[i];
		}
	}

	void N() {
		int cpy[] = { label[0],label[1],label[4],label[5] };
		label[0] = cpy[1];
		label[1] = cpy[3];
		label[4] = cpy[0];
		label[5] = cpy[2];

	}
	void S() {
		int cpy[] = { label[0],label[1],label[4],label[5] };
		label[0] = cpy[2];
		label[1] = cpy[0];
		label[4] = cpy[3];
		label[5] = cpy[1];

	}
	void W() {
		int cpy[] = { label[0],label[2],label[3],label[5] };
		label[0] = cpy[1];
		label[2] = cpy[3];
		label[3] = cpy[0];
		label[5] = cpy[2];

	}
	void E() {
		int cpy[] = { label[0],label[2],label[3],label[5] };
		label[0] = cpy[2];
		label[2] = cpy[0];
		label[3] = cpy[3];
		label[5] = cpy[1];

	}
	void clock() {
		int cpy[] = { label[1],label[2],label[3],label[4] };
		label[1] = cpy[2];
		label[2] = cpy[0];
		label[3] = cpy[3];
		label[4] = cpy[1];
	}

	int getup() {
		return label[0];
	}
	int getfront() {
		return label[1];
	}
	int getright() {
		return label[2];
	}
	int getdown() {
		return label[5];
	}
	int getleft() {
		return label[3];
	}
	int getback() {
		return label[4];
	}
};

inline bool check(class Dice dice, class Dice dice2) {
	if (dice.getup() == dice2.getup() && dice.getfront() == dice2.getfront() && dice.getright() == dice2.getright() && dice.getdown() == dice2.getdown() && dice.getleft() == dice2.getleft() && dice.getback() == dice2.getback()) {
		return true;
	}
	else {
		return false;
	}
}

int main() {
	int a[6],b[6];
	for (int i = 0; i < 6; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < 6; i++) {
		cin >> b[i];
	}
	class Dice dice(a),dice2(b);
	for (int j = 0; j < 6; j++) {
		//cout << dice2.getup() << endl;
		for (int i = 0; i < 4; i++) {
			//cout <<"\t"<< dice2.getfront() << "\n";
			if (check(dice, dice2)) {
				cout << "Yes" << endl;
				return 0;
			}
			dice2.clock();
		}
		if (j < 3) {
			dice2.N();
		}
		else if (j == 3) {
			dice2.W();
		}
		else {
			dice2.W(), dice2.W();
		}
	}

	cout << "No" << endl;
}


Measured memory_bytes: 3112
D, G = map(int, input().split())
pc = [list(map(int, input().split())) for _ in range(D)]
min_solve_num = 1000
for i in range(1, 2 ** D):
    score = 0
    tmp_solve_num = 0
    for j in range(D):
        if (i >> j) & 1:
            score += pc[j][0] * (j + 1) * 100 + pc[j][1]
            tmp_solve_num += pc[j][0]
    if score >= G and tmp_solve_num < min_solve_num:
        min_solve_num = tmp_solve_num
score = 0
tmp_solve_num = 0
for i in range(D - 1, -1, -1):
    num = pc[i][0]
    for j in range(num):
        score += (i + 1) * 100
        tmp_solve_num += 1
        if j == num - 1:
            score += pc[i][1]
        if score >= G:
            break
    else:
        continue
    break
if tmp_solve_num < min_solve_num:
    min_solve_num = tmp_solve_num
print(min_solve_num)


Measured memory_bytes: 9236
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const int mod = 1000000007;
const int inf = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    int n, k;
    cin >> n >> k;
    vector<int> a(n+1,0);
    rep(i,k){
        int d;
        cin >> d;
        rep(j,d){
            int u;
            cin >> u;
            a[u]++;
        }
    }
    int ans = 0;
    srepn(i,1,n){
        if(a[i]==0) ans++;
    }
    cout << ans << endl;
}

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

#define INF 100100100
#define MOD 1000000007

using namespace std;
using ll = long long;
using ull = unsigned long long ;

int main(int argc, char const* argv[]){
   ios::sync_with_stdio(false);
   cin.tie(0);
   int N;
   string S1,S2;
   cin>>N>>S1>>S2;
   ull ans=1;
   bool yoko = false;
   bool tate = false;
   for(int i=0;i<N;i++){
      if(S1[i]==S2[i]){
         if(tate){
            ans*=2%MOD;
         }
         else if(yoko){
            tate=true;
            yoko=false;
         }
         else{
            ans*=3%MOD;
            tate=true;
         }
      }
      else if(i+1<N&&S1[i]==S1[i+1]){
         if(yoko){
            ans*=3%MOD;
         }
         else if(tate){
            ans*=2%MOD;
            tate=false;
            yoko=true;
         }
         else{
            ans*=6%MOD;
            yoko=true;
         }
      }
   }
   cout<<ans%MOD<<endl;
   return 0;
}


Measured memory_bytes: 256
import qualified Data.ByteString.Char8 as BC
import Data.Maybe
import qualified Data.IntMap as IM
import Data.List

type Map = IM.IntMap Int

readIntsLines :: IO [[Int]]
readIntsLines = map (map (fst . fromJust . BC.readInt) . BC.words) . BC.lines <$> BC.getContents

get :: Int -> Map -> Int
get key m = fromMaybe 1 $ IM.lookup key m

set :: Int -> Int -> Map -> Map
set = IM.insert

solve :: [(Int, Int, Int)] -> Map -> [(Int, String)]
solve [] _ = []
solve ((i, p, y):pys) m = (i, result) : solve pys next
  where curr = get p m
        sp = show p
        sc = show curr
        result = replicate (6 - length sp) '0' ++ sp ++ replicate (6 - length sc) '0' ++ sc
        next = set p (curr + 1) m

main :: IO ()
main = do
  getLine
  pys <- readIntsLines
  let z i l = (i, head l, last l)
  let year (_, _, y) = y
  let ds = sortOn year $ zipWith z [1..] pys
  let result = map snd . sortOn fst $ solve ds IM.empty
  mapM_ putStrLn result

Measured memory_bytes: 194684
#include <stdio.h>
#include <stdlib.h>

int compare(const void *a, const void *b){
  return *(int*)a - *(int*)b;
}

int main(void){
  int n, a[100], t;
  int i, alice, bob;

  scanf("%d", &n);

  for (i = 0; i < n; i++) {
    scanf("%d", &t);
    a[i] = -t;
  }

  qsort(a, n, sizeof(int), compare);

  for (i = 0; i < n; i++) {
    a[i] = -a[i];
  }

  alice = 0;
  bob = 0;
  for (i = 0; i < n; i++) {
    if (i % 2 == 0) {
      alice += a[i];
    }
    else {
      bob += a[i];
    }
  }

  printf("%d\n", alice-bob);

  return 0;
}


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

public class Main {

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

		String[] tmpArray = br.readLine().split(" ");

		int n = Integer.parseInt(tmpArray[0]);
		int t = Integer.parseInt(tmpArray[1]);

		int input[] = new int[n];

		tmpArray = br.readLine().split(" ");

		for(int i = 0; i < n; i++){
			input[i] = Integer.parseInt(tmpArray[i]);
		}

		//一人だけなら間違いなく答えはT
		if(n == 1){
			System.out.println(t);
			return;
		}
		int start = 0;

		long total = 0;
		for(int i = 1; i < n; i++){
			//前の人との間隔がT以上離れたならそこで清算
			if(input[i] - input[i - 1] > t){
				total += input[i - 1] + t - input[start];
				start = i;
			}

			//i == n - 1のときは未精算の区間について計算する必要がある
			if(i == n - 1) {
				total += input[i] + t - input[start];
			}

		}

		System.out.println(total);
	}

}


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

int main() {

  double d;
  while(cin>>d) {
    double t = d/9.8;
    double h = 4.9*t*t;

    for(int i=1; ;i++) {
      if(5*i-5>h) {
        cout<<i<<endl;
        break;
      }
    }
  }
}

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

int main(){
    int n, ans = 0;
    cin >> n;
    for(int i = 1; i <= n; i += 2){
        int cnt = 0;
        for(int j = 1; j <= i; j++) if(i % j == 0) cnt++;
        if(cnt == 8) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cassert>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

int vs[100000+10];

int main(void) {
  int n, hoge;
  scanf("%d%d", &n, &hoge);
  REP(i, n) {
    scanf("%d", &vs[i]);
  }
  int mini = 1000000000+10;
  int profit = -1;
  REP(i, n) {
    if(vs[i] < mini) {
      mini = vs[i];
    } else if(vs[i] > mini) {
      profit = max(profit, vs[i] - mini);
    }
  }
  assert(profit > 0);
  mini = 1000000000+10;
  int res = 0;
  REP(i, n) {
    if(vs[i] < mini) {
      mini = vs[i];
    } else if(vs[i] - mini == profit) {
      ++res;
    }
  }
  printf("%d\n", res);
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
#define FAST ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
 
#define MAXX 10005
 
#define PI   3.14159265358979323846264338327950
 
#define F first
#define S second
 
#define ll 	 long long int
 
#define mod  1000000007



int main()
{
	FAST;
	ll n;
	cin >> n;
	ll ans = 1;
	ll k = 7;
	while(ans <= n){
		if(k % n == 0){
			cout << ans ;
			return 0;
		}
		k *= 10;
		k += 7;
		k %= n;
		ans ++;
		
	}
	cout << -1;
	return 0;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <vector>

using namespace std;

int main() {
  int n;
  vector<int> x;

  cin >> n;

  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    x.push_back(tmp);
  }

  int min = *min_element(x.begin(), x.end());
  int max = *max_element(x.begin(), x.end());
  int res = 0;

  for (int i = 0; i < n; i++) {
    res += pow(x[i] - min, 2);
  }

  for (int crt = min + 1; crt <= max; crt++) {
    int sum = 0;

    for (int i = 0; i < n; i++) {
      sum += pow(x[i] - crt, 2);
    }

    if (sum < res) {
      res = sum;
    }
  }

  cout << res << endl;

  return 0;
}

Measured memory_bytes: 256
//
//  main.cpp
//  ALDS1_5_C
//
//  Created by ptyuan on 2018/10/27.
//  Copyright © 2018 Sy. All rights reserved.
//

#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;


struct Point {
    double x;
    double y;
};

void koch(int n, Point a, Point b) {
    
    if (0 == n) {
        return;
    }
    
    Point s, u, t;
    double th = M_PI * 60.0 / 180.0;
    s.x = (2 * a.x + b.x) / 3;
    s.y = (2 * a.y + b.y) / 3;
    
    t.x = (a.x + 2 * b.x) / 3;
    t.y = (a.y + 2 * b.y) / 3;
    
    u.x = s.x + (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th);
    u.y = s.y + (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th);

    koch(n - 1, a, s);
    printf("%.8f %.8f\n", s.x, s.y);
    koch(n - 1, s, u);
    printf("%.8f %.8f\n", u.x, u.y);
    koch(n - 1, u, t);
    printf("%.8f %.8f\n", t.x, t.y);
    koch(n - 1, t, b);
}

int main(int argc, const char * argv[]) {
    int n = 0;
    scanf("%d", &n);
    Point a, b;
    a.x = 0;
    a.y = 0;
    
    b.x = 100;
    b.y = 0;
    printf("%.8f %.8f\n", a.x, a.y);
    koch(n, a, b);
    printf("%.8f %.8f\n", b.x, b.y);
    return 0;
}



Measured memory_bytes: 3220
def sieve_of_eratosthenes(N):
    N += 1
    sieve = [0] * N
    for p in range(2, N):
        if sieve[p]:
            continue
        for i in range(p, N, p):
            sieve[i] = p
    return sieve

def lcm_with_sieve(numbers, N):
    sieve = sieve_of_eratosthenes(N)
    lcm = dict()
    for n in numbers:
        d = dict()
        while n > 1:
            factor = sieve[n]
            n //= factor
            d[factor] = d.get(factor, 0) + 1
        for factor, power in d.items():
            lcm[factor] = max(lcm.get(factor, 0), power)
    return lcm

def main():
    MOD = 10 ** 9 + 7
    _, *A = map(int, open(0).read().split())
    lcm = 1
    for factor, power in lcm_with_sieve(A, 10 ** 6).items():
        lcm = lcm * pow(factor, power, MOD) % MOD
    total = 0
    for a in A:
        total = (total + lcm * pow(a, MOD - 2, MOD)) % MOD
    print(total)

main()

Measured memory_bytes: 51312
#include<iostream>
using namespace std;
typedef long long int LL;
int main(){
	LL a,b,c;
	LL p,q;
	LL s=0;
	int i,j,k;
	cin>>p>>q;
	for(i=0;i<40;i++){
		a=(LL)1<<i;
		b=(q/(a<<1)-p/(a<<1))*a;
		if(p&a)b-=p%a;
		if(q&a)b+=(q%a)+1;
		if(b%2!=0)s+=a;
	}
	cout<<s<<endl;
	return 0;
}
		


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include <vector>
#include<queue>
#include<map>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<bitset>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using pii = pair<int, int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define vsort(v) sort(v.begin(), v.end())
#define rv(v) reverse(v.begin(), v.end())
#define ll long long
#define PI 3.141592653589793
using vll = vector<ll>;
using Graph = vii;
const ll MOD = 1e9 + 7;

int main() {
	string s;
	cin >> s;
	int n = s.size();
	vector<int> v(n + 1);
	ll ans = 0;

	if (s[0] == '<') v[0] = 0;
	if (s[n - 1] == '>') v[n] = 0;
	for (int i = 0; i < n - 1; i++) {
		if (s[i] == '>' && s[i + 1] == '<') v[i + 1] = 0;
	}
	for (int i = 0; i < n; i++) {
		if (s[i] == '<' && v[i] == 0) {
			do {
				i++;
				v[i] = v[i - 1] + 1;
			} while (s[i] == '<' && i < n - 1);
		}
	}
	for (int i = n - 1; i >= 0; i--) {
		if (s[i] == '>' && v[i + 1] == 0) {
			do {
				if (v[i] <= v[i + 1] + 1) v[i] = v[i + 1] + 1;
				i--;
			} while (s[i] == '>' && i > 0);
		}
	}
	if (s[0] == '>') v[0] = v[1] + 1;
	if (s[n - 1] == '<') v[n] = v[n - 1] + 1;
	rep(i, n + 1) ans += v[i];
	cout << ans << endl;
}


Measured memory_bytes: 2820
import java.util.*;

public class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	int[] d = new int[n];
	for (int i=0; i<n; i++) {
	    d[i] = sc.nextInt();
	}
	Arrays.sort(d);
	int f = d[n/2 - 1];
	int l = d[n/2];
	//f->×,l->〇
	System.out.print(l-f);
    }
}


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

int main() {
    int n,l,r;
    cin>>n;
    ll ans=0;
    rep(i,n) {
        cin>>l>>r;
        ans+=r-l+1;
    }
    cout<<ans<<endl;
}


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

int kmp(string curr){
	int n = curr.length();
	vector<int> result(n);
	int i = 0,j = 1;
	result[i] = 0;
 
	while(j<n){
		if(curr[i] == curr[j]){
			i++;
			result[j] = i;
            j++;
		}else{
			if(i>0){
				i = result[i-1];
			}else{
				i = 0;
				result[j] = 0;
				j++;
			}
		}
	}
	int res = 0;
	for(int i=0;i<n;++i){
		res = max(res,min(result[i],(i+1)/2));
	}
	return res;
}

int main(){
	int n;string s;
	cin>>n>>s;
	int result = 0;
	for(int i=0;i<n;++i){
		result = max(result,kmp(s.substr(i)));
	}
    cout<<result<<endl;
	return 0;
}

Measured memory_bytes: 384
n=int(input())
grid=[]
for i in range(2):
    grid.append(list(map(int,input().split())))
    
maxi=0
for i in range (n):
    temp=sum(grid[0][:i+1]) + sum(grid[1][i:])
    if temp >= maxi :
        maxi= temp
print(maxi)        



Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
string s; 
long long n, br, ans;
long long a[500005];
vector<int> x;
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
	cin >> s; int n=s.size(); s=s+'0'; br=1;
	x.push_back(0);
	for (int i=1; i<=n; i++){
		if (s[i]==s[i-1]) br++;
		else {x.push_back(i); br=1;}
	} 
	for (int i=1; i<x.size(); i++){
		int k=x[i]; int l=x[i-1];
		if (s[l]=='>'){
			a[l]=max(a[l], (long long)k-l);
			for (int j=l+1; j<=k; j++)
				a[j]=k-j;
		}
		else {
			for (int j=l; j<=k; j++)
				a[j]=j-l;
			
		}
	}
	for (int i=0; i<=n; i++) ans+=a[i]; cout << ans;
return 0;
}

Measured memory_bytes: 6704
#include<iostream>
#include<vector>
#include<string>
#include<math.h>
#include<algorithm>
#include<cmath>
#include<iomanip>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;
int main() {
	string s;
	cin >> s;
	string t;
	rep(i, 3) {
		t += s[i];
	}
	cout << t << endl;
	return 0;
}



Measured memory_bytes: 3604
//fast i/o functions will not work for negative values


#include<bits/stdc++.h>
using namespace std;
typedef long long lo;
typedef pair<lo,lo> ll;//pair
typedef vector<lo> vl;  //vector of long
typedef vector<ll > vll;   //vector of pair
typedef priority_queue<lo>p_q;
#define mp(a,b) make_pair((a),(b))
#define REP(a,b) for(lo i=(a);i<(b);i++)//no need to declare variable i
#define REPE(a,b,c,d) REP(a,b)for(lo j=(c);j<(d);j++)//no need to declare vaiables i,j 
#define REPV(a,b,c) for((a)=b;(a)<(c);(a)++)//a is the variable 
#define IREP(a,b) for(lo i=(a);i>=(b);i--)
#define IREPV(a,b,c) for((a)=b;(a)>=(c);(a)--)
#define all(v) (v).begin(),(v).end()
#define TRvl(c) for (vl::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvll(c) for (vll::iterator it = (c).begin(); it != (c).end(); it++)
#define INF 2000000000
#define gc getchar_unlocked
#define pc putchar_unlocked
#define pb(a) push_back((a))
#define MOD 1000000000000000007
#define PI 3.14159265



int main(){
	lo t,n,i,j,temp,flag;
	lo q,h,s,d;
	cin>>q>>h>>s>>d;
	vector <pair<lo,lo> > v;
	v.pb(mp(q*8,1));
	v.pb(mp(h*4,2));
	v.pb(mp(s*2,3));
	v.pb(mp(d,4));
	lo a[5]={0,1,2,4,8};
	lo b[5]={0,q,h,s,d};
	sort(v.begin(),v.end());
	cin>>n;
	n*=4;
	lo sum=0;
	sum+=(n/a[v[0].second])*b[v[0].second];
	n=n%a[v[0].second];
	sum+=(n/a[v[1].second]) *b[v[1].second];
	n=n%a[v[1].second];
	sum+=(n/a[v[2].second])*b[v[2].second];
	n=n%a[v[2].second];
	sum+=(n/a[v[3].second])*b[v[3].second];
	n=n%a[v[3].second];
	cout<<sum<<endl;
	

	return 0;
}	


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn cal_distance(n: usize, p: u8, x: Vec<f64>, y: Vec<f64>) -> (f64, Vec<f64>, Vec<f64>) {
    let mut distance: f64 = 0.0;

    if p == 0 {
        for number in 0..n {
            let max: f64 = (x[number] - y[number]).abs();
            if distance < max {
                distance = max;
            }
        }
    } else {
        for number in 0..n {
            distance += (x[number] - y[number]).abs().powf(p as f64);
        }
    }

    if p == 2 {
        return (distance.sqrt(), x, y);
    } else if p == 3 {
        return (distance.cbrt(), x, y);
    } else {
        return (distance, x, y);
    }
}

fn main() {
    let n: usize = read();
    let mut x: Vec<f64> = vec![];
    let mut y: Vec<f64> = vec![];

    for _ in 0..n {
        let number: f64 = read();
        x.push(number);
    }

    for _ in 0..n {
        let number: f64 = read();
        y.push(number);
    }

    let (cal_distance_1, x, y) = cal_distance(n, 1, x, y);
    let (cal_distance_2, x, y) = cal_distance(n, 2, x, y);
    let (cal_distance_3, x, y) = cal_distance(n, 3, x, y);
    let (cal_distance_infinity, x, y) = cal_distance(n, 0, x, y);

    println!("{}", cal_distance_1);
    println!("{}", cal_distance_2);
    println!("{}", cal_distance_3);
    println!("{}", cal_distance_infinity);
}



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

int main(){
    int w,h,x,y,r;
    cin >> w >> h >> x >> y >> r;
    if(x-r<0 || y-r<0 || x+r>w || y+r>h){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    
    return 0;
}



Measured memory_bytes: 3120
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;

int main(){

    string s;
    cin>>s;
    int f = 0;
    for(int l=0;l<s.size();l++){
        for(int r=l;r<s.size();r++){
            string tmp="";
            for(int i=0;i<s.size();i++){
                if(l<=i&&i<=r)continue;
                tmp+=s[i];
            }
            if(tmp=="keyence")f=1;
        }
    }
    if(s=="keyence")f=1;
    if(f)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

signed main() {
    int n;
    cin >> n;
    for (int i = 1; i < 10; i++) {
        int m = n / i;
        if (m * i == n && 1 <= m && m <= 9) {
            cout << "Yes" << "\n";
            return 0;
        }
    }
    cout << "No" << "\n";
}

Measured memory_bytes: 256
import fileinput

# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_C
__author__ = 'Kyoro'


def main():
    for a, b in read_next():
        print(area(a, b), perimeter(a, b))


def read_next():
    for line in fileinput.input():
        tokens = line.strip().split()
        yield list(map(int, tokens))


def area(a, b):
    return a * b


def perimeter(a, b):
    return 2 * (a + b)


if __name__ == '__main__':
    main()



Measured memory_bytes: 5628
def solve():
  n, k = map(int, input().split())
  p = [tuple(map(int, input().split())) for i in range(n)]
  p.sort()
  ans = 4000000000000000000
  for i in range(k, n + 1):
      for j in range(n - i + 1):
          x = p[i + j - 1][0] - p[j][0]
          s = [p[a][1] for a in range(j, i + j)]
          s.sort()
          y = 4000000000
          for a in range(i - k + 1):
            y = min(y, s[a + k - 1] - s[a])
          ans = min(ans, x * y)
  print(ans)
solve()

Measured memory_bytes: 72044
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

int dp[100010];
bool f[100010];

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    rep(i, 0, m){
        int in;
        cin >> in;
        f[in] = true;
    }
    dp[0] = 1;
    for(int i = 0; i < n; i++){
        if(!f[i + 1]) (dp[i + 1] += dp[i]) %= mod;
        if(!f[i + 2]) (dp[i + 2] += dp[i]) %= mod;
    }
    cout << dp[n] << endl;
}

Measured memory_bytes: 1152
s=input()
t=input()
if s==t:
  print("No")
  exit(0)
a=list(s)
b=list(t)
a.sort()
b.sort(reverse=True)
a="".join(a)
b="".join(b)
l=[a,b]
l.sort()
if l[0]==a:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
import java.util.PriorityQueue
import kotlin.comparisons.compareByDescending
fun main(args: Array<String>) {
    var (N, M) = listOfInt()
    val A = listOfLong()
    val Q = PriorityQueue<Long>(N, compareByDescending { it })
    for (n in 0 until N) {
        Q.add(A[n])
    }
    repeat (M) {
        val e = Q.poll()!!
        Q.add(e / 2)
    }
    var ans = 0L
    while (Q.size > 0) {
        ans += Q.poll()!!
    }
    println(ans)
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }
fun listOfLong(delta: Long = 0L) = listOfString().map { java.lang.Long.parseLong(it) + delta }


Measured memory_bytes: 71580
// May this submission get accepted!

#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(i, (q).size()) { cerr << (q)[i] << (i == i_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
#define CHOKUDAI_ const
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using cll = DANCE_ DANCE_ CHOKUDAI_;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    ll n, k; cin >> n >> k;
    string s; cin >> s;
    ll ans = n-1;
    REP(i, n-1) if (s[i] != s[i+1]) --ans;
    cout << min(n-1, ans + k * 2) << endl;
    
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define $$ long long int
#define pb push_back
#define db pop_back
#define q2(n) (n%2)==0
#define loop(i,m,p) for ($$ i = m; i < p; ++i)
#define loopn(i,m,p) for ($$ i = p-1; i >=m; --i)

using namespace std;

int main()
{
  $$ n;
  cin>>n;
  $$ a[n],b[n],sum=0,ind=0,av=0;
  loop(i,0,n) cin>>a[i];
  loop(i,0,n) cin>>b[i];
  vector<$$> v;
  loop(i,0,n)
  {
    if (a[i]>b[i])
    {
      v.pb(a[i]-b[i]);
      av+=(a[i]-b[i]);
   //   cout<<"$"<<i<<"/"<<(a[i]-b[i])<<endl;

    }
    else if(a[i]<b[i])
    {
      sum+=(b[i]-a[i]);
   //   cout<<"*"<<i<<"/"<<(b[i]-a[i])<<endl;
      ind++;
    }
  }
//  cout<<ind<<"hh"<<av<<"tt"<<sum<<endl;
//  $$ lap=0;
//  loopn(i,0,v.size())
//  {
//    lap+=v[i];
//    cout<<"&&"<<lap<<endl;
//  }
  if((av>=sum)&&(ind>0))
  {

  sort(v.begin(),v.end());
  $$ cn=0,m=v.size()-1;
  while((cn<sum)&&(m>=0))
  {
    cn+=v[m];
    m--;
    ind++;
  }
   cout<<ind<<"\n";
  }
  else if(sum==0)
    cout<<"0\n";
  else
        cout<<"-1\n";

    return 0;

}



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

int main() {
  int n, i, p = 1, cnt = 0;
  cin >> n;
  vector<int> a(n);
  for (i = 0; i < n; i++) cin >> a.at(i);

  while (p = 1) {
      for (int i = 0; i < n; i++) {
          if (a.at(i) % 2 != 0) {
            p = 0;
          }
      }
      if(p == 0) break;
      for (i = 0; i < n; i++) {
        a.at(i) /= 2;
      }
      cnt++;
  }

  cout << cnt << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int INF =  1e9 + 5 ;
int main()
{
	
	int N, K;cin>>N>>K;
	vector<int> cache(N, INF);
	vector<int> A(N);
	for(int i = 0;i < N; i++)
	{
		cin >> A[i];
	}
	cache[0] = 0;
	for(int i = 0; i < N; i++)
	{
		for(int j = i + 1; j <= i + K ; j++)
		{
			if(j < N)
			{
				cache[j] = min(cache[j], cache[i] + abs(A[i] - A[j]));
			}
		}
	}
	cout << cache[N-1];
}

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

using namespace std;
#define inputInt(a) int a; cin >> a; 
#define inputInt2(a,b) int a; int b; cin >> a >> b; 
#define inputInt3(a,b,c) int a; int b; int c; cin >> a >> b >> c;
#define inputLong(a) long a;cin >> a; 
#define inputIntArray(a,N) int a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputLongArray(a,N) long a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputIntArray2(a,b,N) int a[N]; int b[N]; for(int i=0;i<N;i++){cin >> a[i] >> b[i];}
#define output(answer) cout << answer << endl;
#define fN(i,N)    for(int i=0; i<N; i++)
#define fSE(i,s,e) for(int i=s; i<=e; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
const ll MOD2 = 998244353;
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; }

ll N, K;
vector<ll> a, f;

//二分探索ライブラリ
bool isOK(ll check){
  ll sum_k = 0;
  for(int i=0; i<N; i++){
    sum_k += max(a[i]-check/f[i],0LL);
  }
  return sum_k <= K;
}

ll binary_search(){
  //最小値を求める時
  ll ok = 1e12;//解が存在する最大値
  ll ng = -1;//解が存在しない最小値
  /*
  //最大値を求める時
  ll ok = -1;//解が存在する最小値
  ll ng = 1e18;//解が存在しない最大値
  */
  
  while(abs(ok-ng) > 1){
    ll mid = (ok+ng)/2;
    if(isOK(mid)){
      ok = mid; 
    }else{
      ng = mid;
    }
  }
  return ok;
}

int main()
{
  //input
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  cin >> N >> K;
  a.assign(N,0); f.assign(N,0);
  for(int i=0; i<N; i++){
    cin >> a[i]; 
  }
  for(int i=0; i<N; i++){
    cin >> f[i]; 
  }
  sort(a.begin(),a.end());
  sort(f.begin(),f.end(),greater<int>());
  
  //main
  ll ans = binary_search();
  
  
  // output
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3456
MODE = "stdiro"
#require 'matrix'
#include Math
line = Array.new

if(defined? MODE)
  line = STDIN.read.split("\n")
else
  tmp = '6
  2
  3
  4
  5
  6
  7'.split("\n")
  tmp.each{|s|
    line << s.strip
  }
end
def isprime?(x)
  if x==2
    return true
  elsif x<2 || x%2==0
    return false
  end

  i=3
  while i<=x**0.5
    if x%i==0
      return false
    end
    i+=2
  end
  return true
end


n = line[0].to_i
cnt=0
(1..n).each do |num|
  a = line[num].to_i
  cnt+=1 if isprime?(a)
end

puts cnt

Measured memory_bytes: 9224
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0), cin.tie(0)
#define RI(x) x = rit()
#define RII(a,b) a = rit(), b = rit()
#define RIII(a,b,c) a = rit(), b = rit(), c = rit()
#define REP(I, N) for(int I=0;I<(N);I++)
#define REPP(I, N) for(int I=1;I<=(N);I++)
#define SZ(x) (int)(x).size()
#define P pair<int, int>
#define F first
#define S second
#define PB(x) push_back(x)
#define endl "\n"
#define ll long long
//#define int long long

//===================================================//

#define N 100000
#define modn 1000000007

using namespace std;
inline int rit(){
    int f=0,key=1;
    char ch;
    do{
        ch = getchar();
        if(ch=='-') key=-1;
    }while(ch<'0'||ch>'9');
    do{
        f = f*10+ch-'0';
        ch = getchar();
    }while(ch>='0'&&ch<='9');
    return f*key;
}
int n, cnt[N+5], num, ans;
int32_t main(void){
    RI(n);
    REP(i,n){
        scanf("%d",&num);
        cnt[num]++;
    }
    REPP(i,N){
        ans = max(ans, cnt[i-1] + cnt[i] + cnt[i+1]);
    }
    printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 640
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastReader s, PrintWriter out) {
            String str = s.nextString();
            int i = 0;
            int j = str.length() - 1;
            int count = 0;
            while (i < j) {
                if (str.charAt(i) != str.charAt(j)) {
                    count++;
                }

                i++;
                j--;
            }

            out.println(count);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 22868
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int k , s;
	cin>>k>>s;
	int count=0;
	for(int i=0;i<=k;i++)
	{
		for(int j=0;j<=k;j++)
		{
			if(s-i-j<=k  && s-i-j>=0)
			  count++;
		}
	}
	cout<<count<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){

  string s,t;
  cin>>s>>t;
  REP(i,s.size()){
    if(s==t){
      cout<<"Yes"<<endl;
      return 0;
    }
    s.push_back(s[0]);
    s.erase(s.begin());
  }

  cout<<"No"<<endl;


  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <iostream>
#include <cstdlib>
#include <cmath>
int main() {
  int X;
  cin>>X;
  if(X==3){
  cout<<"YES"<<endl;
  }else if(X==5){
  cout<<"YES"<<endl;
  }else if(X==7){
  cout<<"YES"<<endl;
  }else{
  cout<<"NO"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;;
#define ll long long
#define rep(i, n) for(int i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define INF 1<<30
#define LINF 1LL<<62
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
const int MOD = 1000000007;
 
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,l;cin >> n >> l;
  ll sum = 0;
  ll mi;
  if(l>=0){
      mi = l;
  }else{
      if(l+n-1>=0)mi=0;
      else mi = l+n-1;
  }
  rep(i,n){
      sum += l+i;
  }
  cout << sum - mi << endl;
}

Measured memory_bytes: 256
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

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

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input!{
        s: chars,
    }
    let z = s
        .iter()
        .filter(|&x| x.to_string() == "0".to_string())
        .count();
    let o = s
        .iter()
        .filter(|&x| x.to_string() == "1".to_string())
        .count();

    println!("{}", if s.len() != 1 { min(z, o) * 2 } else { 0 });
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int inf=1005;
int e[100][100],h,w,x,ans;
int main()
{
	scanf("%d%d",&h,&w);
	for(int i=0;i<=9;i++)   
 		for(int j=0;j<=9;j++)   
    		if(i==j) e[i][j]=0;   
			else e[i][j]=inf; 
	for(int i=0;i<=9;i++)
	{
		for(int j=0;j<=9;j++)
		{
			scanf("%d",&e[i][j]);
		}
	}
	for(int k=0;k<=9;k++)   
  		for(int i=0;i<=9;i++)   
      		for(int j=0;j<=9;j++)   
 				if(e[i][k]<inf && e[k][j]<inf && e[i][j]>e[i][k]+e[k][j])   
     				e[i][j]=e[i][k]+e[k][j];
	for(int i=1;i<=h;i++)
	{
		for(int j=1;j<=w;j++)
		{
			scanf("%d",&x);
			if(x!=-1)
			ans+=e[x][1];
		}
	}
	printf("%d",ans);
	return 0;
}

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

public class Main {
    public static void main(String[] args) throws Exception {

        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        OutputStreamWriter osw = new OutputStreamWriter(System.out);
        PrintWriter out = new PrintWriter(osw);
    
        String s = br.readLine();
        char[] alpha = s.toCharArray();
    
        if(Character.isUpperCase(alpha[0])){
            out.println("A");
        }else{
            out.println("a");
        }
        out.close();
        
    }
}


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

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<< #str << " " str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7

int N, tmp = 0;
vector<vector<ll>> a;
vector<ll> x, dp;

ll befEval(int s)
{
	ll score = 0;
	vector<int> group;
	REP(i, N)if(((s >> i) & 1) == 1)group.push_back(i);
	REP(r, group.size())REP(l, r) score += a[group[l]][group[r]];
	return score;
}

ll three_dp(const int mask)
{
	ll res = -INFL;
	if(mask == 0){
		return 0;
	}
	if(dp[mask] != INFL){
		return dp[mask];
	}
	for(int i = mask; i > 0; i = (i - 1)&mask)
	{
		res = max(res, three_dp(mask^i) + x[i]);
	}

	return dp[mask] = res;
}

int main()
{
	// input
	cin >> N;
	a.resize(N, vector<ll>(N));
	x.resize(1 << N);
	dp.resize(1 << N, INFL);
	REP(i, N)REP(j, N)cin >> a[i][j];

	// dp
	REP(i, 1 << N)x[i] = befEval(i);
	cout << three_dp((1 << N) - 1) << endl;
	cin >> N;
	return 0;
}


Measured memory_bytes: 1280
N=int(input())
b=[]
d=[]
b=input().split()

for i in range(N):
    d.append(int(b[i]))

x=0
index=0
for i in range(N):
    x=d[0]
    d.remove(d[0])
    for k in range(N-1):
            index += x*d[k]
    N-=1

print(index)


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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

bool prime(int a)
{
    for (int i = 2; i * i <= a; i++)
        if (a % i == 0) return false;
    return true;
}

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("path.out", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    while (!prime(n)) ++n;
    cout << n;

    return 0;
}


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

int main(){
  int N; cin>>N;
  vector<int> A(N,0);
  rep(i,N)cin>>A[i];
  int check = 0;
  int chousei = 1000000000;
  rep(i,N){
    chousei = min(chousei,abs(A[i]));
    if(A[i]<0){
      check ++;
    }
  }
  ll sum = 0;
  rep(i,N){
    sum += abs(A[i]);
  }
  if(check%2 == 0){
    cout << sum << endl;
  }else{
    cout << sum - 2*chousei << endl;
  }
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define rep(i,a,n) for(int i=a;i<n;++i)
#define per(i,a,n) for(int i=n-1;i>=a;--i)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define sz(v) ((int)sizeof(v))
#define N 1005
const double inf=2e+15;
struct node{
    double x,y,r;
}f[N];
double g[N][N];
double dis[N];
inline double dist(int i,int j){
    double x1,y1,t;
    x1=f[i].x-f[j].x;
    y1=f[i].y-f[j].y;
    t=max(0.0,sqrt(x1*x1+y1*y1)-f[i].r-f[j].r);
    return t;
}
int vis[N];
double spfa(int s,int t,int n){
    double tmp=inf;
    int index;
    rep(i,0,n) {
        dis[i]=g[s][i];
        vis[i]=0;
    }
    vis[s]=1;
    while(1){
        tmp=inf;
        rep(i,0,n){
            if(!vis[i]&&tmp>dis[i]){
                tmp=dis[i];
                index=i;
            }
        }
        if(tmp==inf) break;
        vis[index]=1;
        rep(i,0,n){
            if(dis[i]>dis[index]+g[index][i]){
                dis[i]=dis[index]+g[index][i];
            }
        }
    }
    return dis[1];
}
int main()
{
    int n;
    double x,y,di;
    scanf("%lf%lf",&x,&y);
    f[0].x=x;f[0].y=y;f[0].r=0;
    scanf("%lf%lf",&x,&y);
    f[1].x=x;f[1].y=y;f[1].r=0;
    scanf("%d",&n);
    n+=2;
    rep(i,2,n) scanf("%lf%lf%lf",&f[i].x,&f[i].y,&f[i].r);
    rep(i,0,n) rep(j,0,n){
        if(i==j) g[i][j]=0;
        else{
            g[i][j]=g[j][i]=dist(i,j);
        }

    }
    double ans=spfa(0,1,n);
    printf("%.15f\n",ans);
    return 0;
}


Measured memory_bytes: 8192
#include<stdio.h>

int main(){
		long long k,a,b;
		scanf("%lld%lld%lld",&k,&a,&b);
		if(a>k-1){
				printf("%lld\n",k+1);
				return 0;		
		}
		if(b-a<=2){
				printf("%lld\n",k+1);		
				return 0;
		}
		long long kazu=(k-(a-1))/2;
		int amari=(k-(a-1))%2;
		printf("%lld\n",a+(b-a)*kazu+amari);
		return 0;
}

Measured memory_bytes: 128
N,M = map(int,input().split())
arr = []
for i in range(M):
  pi,yi = map(int,input().split())
  arr.append((pi,yi))
sorted_arr = sorted(arr, key=lambda x:x[1])
numof_i_in_p = [1]*N
id_map = dict()
for factor in sorted_arr:
  id = "{:0>6}{:0>6}".format(factor[0], numof_i_in_p[factor[0]-1])
  numof_i_in_p[factor[0]-1] += 1
  id_map[factor]=id
for factor in arr:
  print(id_map[factor])


Measured memory_bytes: 32976
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <limits.h>
#include <queue>
#include <map>
#include <ctime>

using namespace std;

#define rip(i,n,s) for (int i=(s);i<(int)(n);i++)
#define all(a) (a).begin(),(a).end()

int co[100005];
vector<vector<int>> to(100005),ot(100005);
int parent[100005];
int point[100005];

int main(){
    int n,m;
    cin >> n >> m;
    rip(i,n,0){
        co[i]=0;
        parent[i]=-1;
        point[i]=0;
    }
    rip(i,n+m-1,0){
        int a,b;
        cin >> a >> b;
        to[a-1].push_back(b-1);
        ot[b-1].push_back(a-1);
        co[a-1]++;
    }
    queue<int> q;
    rip(i,n,0){
        if(co[i]==0){
            q.push(i);
        }
    }
    while(!q.empty()){
        int no=q.front();
        q.pop();
        rip(i,ot[no].size(),0){
            int y=ot[no][i];
            co[y]--;
            if(co[y]==0){
                q.push(y);
                point[y]=point[no]+1;
            }
        }
    }
    rip(i,n,0){
        int mi=INT_MAX;
        rip(j,ot[i].size(),0){
            if(mi>point[ot[i][j]]){
                mi=point[ot[i][j]];
                parent[i]=ot[i][j];
            }
        }
    }
    rip(i,n,0){
        printf("%d\n",parent[i]+1);
    }
}

Measured memory_bytes: 12928