akhauriyash/Code-Regression huggingface dataset:
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	const initialBufSize = 4096
	const maxBufSize = 1000000
	scanner.Buffer(make([]byte, initialBufSize), maxBufSize)
	scanner.Split(bufio.ScanWords)
	var X int64
	scanner.Scan()
	X, _ = strconv.ParseInt(scanner.Text(), 10, 64)
	fmt.Println(solve(X))
}
func solve(X int64) int {
	money := int64(100)
	year := 0
	for {
		if money >= X {
			return year
		}
		money += int64(float64(money) * 0.01)
		year++
	}
}


Measured memory_bytes: 1756
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <string>
#include <set>
#include <algorithm>
#include <utility>
#include <cstring>
#include <cmath>
using namespace std;


int main() {
    string s;
    cin>>s;
    int ans=0,cnt=1,k=0;
    for(int i=1;i<s.size();++i){
        if(s[i]==s[k])++cnt;
        else if(cnt)--cnt,ans+=2;
        else k=i,cnt++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 512
n = int(input())
a = list(map(int, input().split()))
_a = list(a)
b = list(map(int, input().split()))

for i in range(len(b)) :
	if a[i] > b[i] : 
		a[i] = a[i] - b[i]
	else :
		b[i] = b[i] - a[i]
		a[i] = 0
		a[i+1] = a[i+1] - b[i]
		if a[i+1] < 0 : a[i+1] = 0

count = 0
for i in range(len(a)) : 
	count += _a[i] - a[i]
print(count)

Measured memory_bytes: 19168
/*
	JAI JAGANNATH!
*/
//@Author : zanj0

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

typedef long long int lli;

#define ff              first
#define ss              second
#define pb              push_back
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            lli x; cin>>x; while(x--)

void zanj0()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

}
lli calc(string &s, string& t, lli idx) {
	lli ret = 0;
	lli n = t.size();
	lli j = 0;
	for (lli i = idx; j < n; i++, j++) {
		ret += s[i] != t[j];
	}
	return ret;
}
void solve() {
	string s;
	string t;
	cin >> s >> t;
	lli ret = t.size();
	for (lli i = 0; i <= s.size() - t.size(); i++) {
		ret = min(ret, calc(s, t, i));
	}
	cout << ret << endl;
}
int main()
{
	zanj0();
	solve();
	return 0;
}

Measured memory_bytes: 3620
#include <cstdio>
#include <iostream>
#include <queue>
#define ROP(i,n) for(int i=0;i<n;i++)
#define ROPP(i,n) for(int i=1;i<=n;i++)
#define NIL -1
using namespace std;
typedef pair<int,int> P;
int N,M,G,gx[10],gy[10];
char MAP[1005][1005];
int DX[4]={1,0,-1,0},DY[4]={0,1,0,-1},FAR[1005][1005];
int BFS(int u){
  queue<P> que;
  ROPP(i,N){ROPP(j,M) FAR[j][i]=NIL;}
  que.push(P(gx[u],gy[u]));
  FAR[gx[u]][gy[u]]=0;
  while(que.size()){
    P p=que.front();que.pop();
    if(p.first==gx[u+1]&&p.second==gy[u+1]) break;
    ROP(i,4){
      int nx=p.first+DX[i],ny=p.second+DY[i];
      if(1<=nx&&nx<=M&&1<=ny&&ny<=N
        &&MAP[nx][ny]!='X'&&FAR[nx][ny]==NIL){
        que.push(P(nx,ny));
        FAR[nx][ny]=FAR[p.first][p.second]+1;
      }
    }
  }
  return FAR[gx[u+1]][gy[u+1]];
}
int main(){
  scanf("%d %d %d",&N,&M,&G);
  ROPP(i,N){
    ROP(j,M+1){
      scanf("%c",&MAP[j][i]);
      if(MAP[j][i]=='S') gx[0]=j,gy[0]=i;
      if(MAP[j][i]=='1') gx[1]=j,gy[1]=i;
      if(MAP[j][i]=='2') gx[2]=j,gy[2]=i;
      if(MAP[j][i]=='3') gx[3]=j,gy[3]=i;
      if(MAP[j][i]=='4') gx[4]=j,gy[4]=i;
      if(MAP[j][i]=='5') gx[5]=j,gy[5]=i;
      if(MAP[j][i]=='6') gx[6]=j,gy[6]=i;
      if(MAP[j][i]=='7') gx[7]=j,gy[7]=i;
      if(MAP[j][i]=='8') gx[8]=j,gy[8]=i;
      if(MAP[j][i]=='9') gx[9]=j,gy[9]=i;
    }
  }
  int res=0;
  ROP(i,G) res+=BFS(i);
  printf("%d\n",res);
  return 0;
}

Measured memory_bytes: 8088
#include <iostream>
#include <stack>
#include <cmath>
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;

int main()
{
  while(1){
    string s;
    cin >> s;
    if(s == "#") break;
    stack<char> d;
    REP(i,(int)s.size()){
      if(s[i] == 'w'){
        d.push('w');
        i += 3;
      }else if(s[i] == 'n'){
        d.push('n');
        i += 4;
     }
    }
    int n = pow(2,d.size()-1);
    int m = 0;
    int ans = 0;
    while(!d.empty()){
      char c;
      c = d.top();
      d.pop();
      if(c == 'w'){
        ans += 90 * (n / pow(2,m));
      }else if(c == 'n'){
        ans -= 90 * (n / pow(2,m));
        if(ans < 0)
          ans = 0;
      }
      m++;
    }
    if(!(ans & 1) && !(n & 1)){
      ans /= 2;
      n /= 2;
    }
    cout << ans;
    if(!(n & 1))
      cout << "/" << n;
    cout << endl;
  }
}

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

int index(int x);

int c, n;

int main() {
  cin >> c >> n;
  vector<vector<char>> p_c(n, vector<char>(n));
  vector<vector<int>> p(n, vector<int>(n));
  vector<vector<int>> sum((n + 1) / 2, vector<int>((n + 1) / 2, 0));
  int i, j;
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      cin >> p_c[i][j];
      p[i][j] = (p_c[i][j] - '0');
    }
  }
  int diff = 0;
  for (i = 0; i < n / 2; i++) {
    for (j = 0; j < n / 2; j++) {
      sum[i][j] += p[i][j];
      sum[i][j] += p[i][n - j - 1];
      sum[i][j] += p[n - i - 1][j];
      sum[i][j] += p[n - i - 1][n - j - 1];
      if (!(sum[i][j] == 0 || sum[i][j] == 4)) {
        diff++;
      }
    }
  }
  // for (j = 0; j < sum.size(); j++) {
  //   for (int k = 0; k < sum[j].size(); k++) {
  //     cout << sum[j][k] << ' ';
  //   }
  //   cout << endl;
  // }
  // cout << endl;
  int result = (diff == 0 ? 1 : 0);
  int d, x, y;
  bool was_diff;
  for (i = 0; i < c - 1; i++) {
    cin >> d;
    for (j = 0; j < d; j++) {
      was_diff = false;
      cin >> y >> x;
      if (!(sum[index(y)][index(x)] == 0 || sum[index(y)][index(x)] == 4)) {
        was_diff = true;
      }
      if (n % 2 == 0) {
        sum[index(y)][index(x)] += (p[y - 1][x - 1] == 1 ? -1 : 1);
      } else {
        if (index(y) == n / 2 && index(x) == n / 2) {
          sum[index(y)][index(x)] += (p[y - 1][x - 1] == 1 ? -1 : 1) * 4;
        } else if (index(y) == n / 2 || index(x) == n / 2) {
          sum[index(y)][index(x)] += (p[y - 1][x - 1] == 1 ? -1 : 1) * 2;
        } else {
          sum[index(y)][index(x)] += (p[y - 1][x - 1] == 1 ? -1 : 1);
        }
      }
      p[y - 1][x - 1] ^= 1;
      if (was_diff) {
        if (sum[index(y)][index(x)] == 0 || sum[index(y)][index(x)] == 4) {
          diff--;
        }
      } else {
        if (!(sum[index(y)][index(x)] == 0 || sum[index(y)][index(x)] == 4)) {
          diff++;
        }
      }
    }
    // cout << "diff " << diff << endl;
    if (diff == 0) {
      result++;
    }
    // for (j = 0; j < sum.size(); j++) {
    //   for (int k = 0; k < sum[j].size(); k++) {
    //     cout << sum[j][k] << ' ';
    //   }
    //   cout << endl;
    // }
    // cout << endl;
  }
  cout << result << endl;
  return 0;
}

int index(int x) {
  if (x > n / 2) {
    return n - x;
  } else {
    return x - 1;
  }
}



Measured memory_bytes: 8976
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int x,y;
  while(true){
    cin>>x>>y;
    if(x==0 && y==0) break;
    else cout<<min(x,y)<<" "<<max(x,y)<<'\n';
  }
  return(0);
}



Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(v) v.begin(), v.end()

int clc(int r, int d, int x) {
  int y = r*x - d;
  return y;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll r, d, x;
  cin >> r >> d >> x;
  
  rep (i, 0, 10) {
    int x1 = clc(r, d, x);
    cout << x1 << "\n";
    x = x1;
  }

}


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

int main() {
  int N; cin >> N;
  vector<int> A(N);
  for (int i=0; i<N; ++i) cin >> A[i];

  int min_idx;
  int dead_num = 0;
  do {
    int min_val = 1 << 30;
    for (int i=0; i<N; i++) {
      if (A[i] > 0 && A[i] < min_val) {
	min_val = A[i];
	min_idx = i;
      }
    }

    dead_num = 0;
    for (int i=0; i<N; ++i) {
      A[i] = (i != min_idx) ? A[i] % A[min_idx] : A[i];
      if (A[i] == 0) dead_num++;
    }
  } while (dead_num < N-1);
  
  cout << A[min_idx] << endl;
}


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

int main(){
    string s;
    cin>>s;
    string untstr;
    for(string::size_type i=0;i<s.length();i+=2){
        untstr.push_back(s.at(i));
    }
    cout<<untstr<<endl;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <set>
#include <vector>

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

int main() {
  int h, w, m;
  cin >> h >> w >> m;
  struct P {
    int x;
    int y;
    P(int x, int y): x(x), y(y) {}
  };
  vector<P> pts;
  rep(i, m) {
    int y, x;
    cin >> y >> x;
    pts.emplace_back(x, y);
  }
  vector<vector<P>> row(h + 1);
  vector<vector<P>> col(w + 1);
  multiset<int> set;
  for (P p: pts) {
    row[p.y].emplace_back(p);
    col[p.x].emplace_back(p);
  }
  for (int x = 0; x <= w; x++) {
    set.insert(col[x].size());
  }
  int ans = 0;
  for (int y = 0; y <= h; y++) {
    int s = 0;
    for (auto p: row[y]) {
      int size = col[p.x].size();
      s = max(s, size - 1);
      auto itr = set.find(size);
      set.erase(itr);
    }
    s = max(s, *set.rbegin());
    ans = max<int>(ans, s + row[y].size());
    for (auto p: row[y]) {
      set.insert(col[p.x].size());
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 52476
using System;
using System.Collections.Generic;

class Program {
    static void Main(string[] arg) {

        string[] tmp = Console.ReadLine().Split(' ');
        int a = int.Parse(tmp[0]);
        int b = int.Parse(tmp[1]);

        int i = 0;
        int price = -1;
        
        while (true)
        {
            if ((int)(i * 0.08) == a && (int)(i * 0.1) == b)
            {
                price = i;
                break;
            }
            else if (i >= 1010)
            {
                break;
            }
            i++;
        }
        
        Console.WriteLine(price);
    }
}


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

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

template<typename T,typename U>bool chmin(T& a,const U& b){return a>b?(a=b,1):0;}
template<typename T,typename U>bool chmax(T& a,const U& b){return a<b?(a=b,1):0;}

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	#ifndef _GLIBCXX_DEBUG
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	constexpr char endl='\n';
	#endif

	for(ll n,p;cin>>n>>p&&n|p;){
		map<ll,int> fs;
		for(ll i=2;i*i<=p;i++){
			while(p%i==0){
				fs[i]++;
				p/=i;
			}
		}
		if(p!=1)
			fs[p]++;
		ll res=1;
		for(auto kv:fs)
			rep(i,kv.second/n)
				res*=kv.first;
		cout<<res<<endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define MOD 1000000007

int main(){
  string s;
  cin>>s;
  int ans=0;
  char prev=s[0];
  for(int i=1;i<s.length();i++){
    if(s[i]!=prev){
      ans++;
      prev=s[i];
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<string>//class string???????????????
using namespace std;

int main(){
	int n,i,t=0,h=0;
	string tstr,hstr;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> tstr >> hstr;

		if(tstr==hstr){
			t++;h++;
		}
		else if(tstr>hstr)t+=3;
		else h+=3;


	}

	cout <<t<<' '<<h<<endl;
	return 0;
}

Measured memory_bytes: 3208
S = input()
T = input()
ls = len(S)
lt = len(T)

DP = [[0] * (lt + 1) for _ in range(ls + 1)]
Ans = []
for i, s in enumerate(S, 1):
    for j, t in enumerate(T, 1):
        if s == t:
            DP[i][j] = DP[i - 1][j - 1] + 1
        else:
            DP[i][j] = max(DP[i - 1][j], DP[i][j - 1])
cnts = ls
cntt = lt

while DP[cnts][cntt]:
    while DP[cnts][cntt] == DP[cnts][cntt - 1]:
        cntt -= 1
    while DP[cnts][cntt] == DP[cnts - 1][cntt]:
        cnts -= 1
    cnts -= 1
    cntt -= 1
    Ans.append(S[cnts])
print(''.join(Ans[::-1]))


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

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

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  int N; cin >> N;
  vector<ll> A(N);

  map<ll,int> m;
  for(int i =0; i < N; i++){
    cin >> A[i];
    m[A[i]]++;
  }
  sort(A.begin(), A.end());


  ll A_max = A[A.size()-1];
  vector<bool> B(A_max + 1, true);

  for(int i = 0; i < N; i++){
    if(!A[i]) continue;
    for(int j = 2; A[i]*j <= A_max; j++){
      B[A[i]*j] = false;
    }
  }

  for(auto x: m){
    if(x.second >= 2){
      B[x.first] = false;
    }
  }

  int ans = 0;
  for(int i = 0; i < N; i++){
    if(B[A[i]]) ans++;
  }

  cout << ans << endl;


}


Measured memory_bytes: 17284
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;

int main() {
    int n, x, t;
    cin >> n >> x >> t;
    if (n % x == 0) {
        cout << (n / x) * t << endl; 
    }
    else {
        cout << (n / x) * t + t << endl;
    }
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  int N = nextLong();


  ll ans = N + N*N + N*N*N;
  cout << ans << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 3760
H, W = map(int, input().split())

while H != 0 or W != 0:
    for i in range(H):
        for j in range(W):
            if (i + j) % 2 == 0:
                print("#", end="")
            else:
                print(".", end="")
        print()
    print()
    H, W = map(int, input().split())


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

int main()
{
	using ll = long long;
	ll L, R, x;
	cin >> L >> R >> x;
	ll first = L - L%x + (L%x==0 ? 0 : x);
	ll last = R - R%x;
	cout << last/x - first/x + 1;
}


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

int main() {
  long long n;
  cin >> n;
  
  vector<long long int> accum(n+1);
  accum[0] = 0;
  
  for (long long int i = 0; i < n; i++) {
    long long int p;
    cin >> p;
    accum[i+1] = accum[i] + p;
  }
  
  long long int buf;
  buf = abs(accum[1] - (accum[n]-accum[1]));
  for (long long int i = 1; i < n; i++) {
    buf = buf < abs(accum[i] - (accum[n] - accum[i])) ? buf : abs(accum[i] - (accum[n] - accum[i]));
  }
  cout << buf << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <math.h>


using namespace std;



int main(){
  int r0,r1,i=0,coin=0;
  int n[200001];
  
  while (cin>>n[i]){
    i++;
  }
  
  r0= n[1];
   coin = n[3]-n[2];
   if(i==3){
   coin = n[2]-n[1];
   }
  for(int t=2;t<i;t++){
    
    if(n[t]<r0){
      r0=n[t];
      }
    if(t==i-1){
    }else{
    r1=n[t+1];
    }

    if(t==i-1){
    }else{
    if(r1-r0>coin){
    coin=r1-r0;

    }
    }

  }


  cout << coin<<endl;

  

  return 0;
}

Measured memory_bytes: 3884
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * 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;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        MonstersBattleRoyale solver = new MonstersBattleRoyale();
        solver.solve(1, in, out);
        out.close();
    }

    static class MonstersBattleRoyale {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();

            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
            }

            long result = a[0];
            for (int i = 1; i < a.length; i++) {
                result = gcd(result, a[i]);
            }
            out.println(result);

        }

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

    }
}



Measured memory_bytes: 58496
//abc176_c.cpp
//Sat Aug 22 20:51:45 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007
#define rep(i,n) for (int i=0;i<(n);++i)

using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	ll a[n];
	rep(i,n) cin >> a[i];

	ll cur = a[0];
	ll ans = 0;
	for (int i=1;i<n;i++){
		if (cur > a[i]){
			ans += cur-a[i];
		}else {
			cur = max(cur,a[i]);
		}
	}
	cout << ans << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 5192
// 2014/01/28 Tazoe

#include <iostream>
using namespace std;

int main()
{
	int sum = 0;

	for(int i=0; i<5; i++){
		int s;
		cin >> s;

		if(s>=40){
			sum += s;
		}
		else{
			sum += 40;
		}
	}

	cout << sum/5 << endl;

	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
 
using namespace std;
 
int main() {
	// 入力
    int X;
    cin >> X;
 
    int ans = 1;
    for (int i = 2; i <= X; ++i) {
    	// cout <<"i " << i << endl;
    	int k = i*i;
    	if (k>X) break;
    	while (k<=X){
    	    if (k*i>X)break;
    	    else {
    	    	k *= i; 
    	    	// cout << k << endl;
    	    }
    	}
    	if (k>ans) ans = k;
    	
    
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define Rep(i,n) for(ll i=1;i<=n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
#define prique priority_queue<ll>
const int mod = 1000000007;
const int mod2 = 998244353;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod;
		}
		x = x * x % mod;
		y >>= 1;
	}
	return res;
}
long nCr(int n, int r) {
	int ans = 1;
	for (ll i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};
int a[100010];
signed main() {
	int n;
	cin >> n;
	bool b = false;
	rep(i, n) {
		cin >> a[i];
		if (a[i] % 2 != 0)b = true;
	}
	if (b)cout << "first" << endl;
	else cout << "second" << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    string s; cin>>s;
    if (s == "RRS" || s == "SRR") {
        cout << 2 << '\n';
    }
    else if (s == "RRR") {
        cout << 3 << '\n';
    }
    else if (s == "SSS") {
        cout << 0 << '\n';
    }
    else {
        cout << 1 << '\n';
    }
    return 0;
}

Measured memory_bytes: 3584
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<climits>
#include<set>
#include<map>
#define ll long long
using namespace std;

int main() {
	string a, b, c;
	char ima;
	cin >> a >> b >> c;
	bool flag = true;
	while (true) {
		if (flag==true||ima == 'a') {
			flag = false;
			if (a.size() == 0) {
				cout << 'A' << endl;
				exit(0);
			}
			ima = *(a.begin());
			a.erase(a.begin());
		}
		else if (ima == 'b') {
			if (b.size() == 0) {
				cout << 'B' << endl;
				exit(0);
			}
			ima = *(b.begin());
			b.erase(b.begin());
		}
		else {
			if (c.size() == 0) {
				cout << 'C' << endl;
				exit(0);
			}
			ima = *(c.begin());
			c.erase(c.begin());
		}
	}
}


Measured memory_bytes: 256
package main

import "fmt"

var di []int = []int{
	-1, 0, 1, 0,
}
var dj []int = []int{
	0, 1, 0, -1,
}

const INF = 1001001001

type P struct {
	x, y int
}

func fill(s []int, val int) {
	for i := range s {
		s[i] = val
	}
}

func max(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}

func disp(s [][]int) {
	for j := range s {
		for i := range s[j] {
			v := s[j][i]
			if v == INF {
				fmt.Printf("%3s", "#")
			} else {
				fmt.Printf("%3d", v)
			}
		}
		fmt.Println()
	}
	fmt.Println()
}

func main() {
	var H, W int
	fmt.Scan(&H, &W)
	S := make([]string, H)
	for i := range S {
		fmt.Scan(&S[i])
	}
	m := make([][]int, H)
	for i := range m {
		m[i] = make([]int, W)
		fill(m[i], INF)
	}
	res := 0
	for j := 0; j < H; j++ {
		for i := 0; i < W; i++ {
			if S[j][i] == '#' {
				continue
			}
			q := make(chan P, H*W)
			q <- P{i, j}
			for i := range m {
				fill(m[i], INF)
			}
			m[j][i] = 0
			for len(q) != 0 {
				p := <-q
				for k := range di {
					x, y := p.x+di[k], p.y+dj[k]
					if x < 0 || x > W-1 {
						continue
					}
					if y < 0 || y > H-1 {
						continue
					}
					if m[y][x] != INF || S[y][x] == '#' {
						continue
					}
					m[y][x] = m[p.y][p.x] + 1
					res = max(res, m[y][x])
					q <- P{x, y}
				}
			}
			//disp(m)
		}
	}
	fmt.Println(res)
}


Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>
#define INF 1000000000
#define LINF 9000000000000000000
#define mod  1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  string s, akb = "AKIHABARA";
  cin >> s;

  if(s.size() > akb.size()){
    cout << "NO" << endl;
    return 0;
  }

  int cnt = 0;
  for(int i = 0; i < akb.size(); i++){
    if(s[cnt] == akb[i]){ cnt++; continue;}
    else if(akb[i] == 'A') continue;
    else {
      cout << "NO" << endl;
      return 0;
    }
  }
  
  if(cnt == s.size())cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int main(){
    int n;cin>>n;
    int w[n];
    for(int i=0;i<n;i++) cin>>w[i];
    int m=10005;
    for(int t=0;t<n-1;t++){
        int sl=0,sr=0;
        for(int i=0;i<=t;i++) sl+=w[i];
        for(int i=t+1;i<n;i++) sr+=w[i];
        m=min(m,abs(sl-sr));
    }
    cout<<m<<endl;
}

Measured memory_bytes: 504
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

def prime_factorize(n, unique=False):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    if unique:
        return set(fct)
    else:
        return fct

x = int(input())
for i in range(x, x+100):
    ret = prime_factorize(i)
    if len(ret) == 1:
        print(ret[0])
        exit()

Measured memory_bytes: 3064
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
x = 1000
ans = 0
for i in range(n):
    if x >=  abs(a-(t-h[i]*0.006)):
        x = abs(a-(t-h[i]*0.006))
        ans = i+1
print(ans)

Measured memory_bytes: 9176
#include <stdio.h>
int main(){
    int H,N,a;
    scanf("%d %d",&H,&N);
    int i,sum;
    sum =0;
    for(i=0;i<N;i++){
        scanf("%d",&a);
        sum = sum + a;
    }
    if(sum>=H){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define all(a) (a).begin(),(a).end()

using namespace std;
void nuri(int&,int);

int main(int argc, char const *argv[]) {
  int H,W,N;
  scanf("%d%d%d",&H,&W,&N);
  std::vector<int> A(N);
  int c[H][W];
  for (int i = 0; i < N; i++) {
    std::cin >> A[i];
  }
  int current=1,i=0,j=0;

  //塗りますよ～～
  while (1) {
    for (; j < W; ++j) { //右行き
      nuri(c[i][j],current);
      --A[current-1];
      if(A[current-1]==0){
        ++current;
      }
    }
    //printf("残り%d_現在%d\n",A[current-1],current);
    if(H==i+1){ //終わり判定
      break;
    }else{
      ++i;
    }

    for (; j > 0; --j) { //左行き
      nuri(c[i][j-1],current);
      --A[current-1];
      if(A[current-1]==0){
        ++current;
      }
    }
    if(H==i+1){ //終わり判定
      break;
    }else{
      ++i;
    }
  }

  //出力
  for (size_t i = 0; i < H; i++) {
    for (size_t j = 0; j < W-1; j++) {
      printf("%d ",c[i][j]);
    }
    printf("%d\n",c[i][W-1]);
  }

  return 0;
}


void nuri(int& point,int color){
  point=color;
  //printf("現在のポイント色%d\n",point);
}


Measured memory_bytes: 384
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a == b)
	{
		cout << c << endl;
	}
	else if (b == c)
	{
		cout << a << endl;
	}
	else if (a == c)
	{
		cout << b << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for(ll i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(ll i=(begin)-1;i>=(end);i--)
#define IREP(i, n) IFOR(i,n,0)
#define SORT(a) sort(a.begin(), a.end())
#define ISORT(a) sort(a.begin(), a.end(),greater<ll>())
#define REVERSE(a) reverse(a.begin(), a.end())
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=(" <<; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << ")" << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)

#define ll long long
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define INF 1000000000000000000

using vec = vector<ll>;
using mat = vector<vec>;
using Pii = pair<ll, ll>;
using PiP = pair<ll, Pii>;
using PPi = pair<Pii, ll>;
using bvec = vector<bool>;
using Pvec = vector<Pii>;


template<typename T> void readv(vector<T> &a) { REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a) { REP(i, a.size()) {cin >> a[i]; a[i]--;} }

ll mod = 1000000007;

int main()
{
	// 入力
	ll N, M;
	cin >> N >> M;

	vec K(N);
	vec A(N, 0);

	REP(i, N) {
		cin >> K[i];
		REP(j, K[i]) {
			ll At = 0;
			cin >> At;
			A[i] += (1 << At);
		}
	}

	ll Atot = A[0];
	FOR(i, 1, N) {
		Atot &= A[i];
	}

	ll ans = 0;
	while (Atot > 0) {
		ans += Atot % 2;
		Atot /= 2;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <functional>
using namespace std;
int N, p[10], sum;
int main() {
  scanf("%d", &N);
  for(int i = 0; i < N; ++i) scanf("%d", &p[i]);
  sort(p, p+N, greater<>());
  p[0] = p[0]/2;
  for(int i = 0; i < N; ++i) sum += p[i];
  printf("%d\n", sum);
}

Measured memory_bytes: 128
import java.util.*;
import java.util.Map.Entry;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.rmi.server.UnicastRemoteObject;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

//        int n=sc.nextInt();
        char c[]=sc.nextString().toCharArray();
        int a=1;
        int pr=c[0], t=0;
        
        for (int i = 1; i < c.length; i++) {
			if(c[i]==pr) {
				if(i==c.length-1) {
					if(t==1)a++;
					break;
				}
				if(t==0)i++;
				t++; t%=2;
				pr=c[i];
			} else {
				pr=c[i];
				t=0;
			}
			a++;
		}

        out.println(a);
        out.flush();
    }



    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
}

//class P {
//	int x, y;
//	P(int  x, int y) {
//	  this.x=x;
//	  this.y=y;
//	}
//}


//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

class P implements Comparable<P>{
    int a,b;
    P(int a, int b) {
    	this.b=b;
    	this.a=a;
    }

    public int compareTo(P p){
    	if(a==p.a) return b-p.b;
        return -p.a+a;
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
        int r[] = new int[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextInt(); 
        }
        return r;
    }
    public long[] nextLongArray(int size) throws IOException{
        long r[] = new long[size];
        for (int i = 0; i < size; i++) {
            r[i] = this.nextLong(); 
        }
        return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 25812
import sys
line=sys.stdin.readlines()
for A,B in zip(line[0::2],line[1::2]):
    a=map(int,A.strip().split())
    b=map(int,B.strip().split())
    hit,blow=0,0
    for i in xrange(4):
        if a[i]==b[i]:hit+=1
        elif a[i] in b : blow+=1
    print hit,blow

Measured memory_bytes: 5424
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if((a==b&&b!=c)||(b==c&&a!=b)||(c==a&&a!=b))cout<<"Yes"<<endl;
  else cout<<"No"<<endl;


}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <vector>
#include <string>
#include <deque>
#include <queue>
#include <map>
#include <set>
using namespace std;
#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 pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define It iterator
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

int n;
string s,t;
bool isSame(string x, string y, int k){
    rep(i,0,k) if(y[i]!=x[n-k+i]) return false;
    return true;
}

int main(){
    //freopen("test.in","r",stdin);
    cin>>n>>s>>t;
    per(i,1,n+1){
        if(isSame(s,t,i)) {cout<<2*n-i; return 0;}
    }
    cout<<n*2;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<functional>
#include<algorithm>
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int z = 0; z < n; z++) {
		string a, b;
		cin >> a >> b;
		for (int i = a.length() - 1; i >= 0; i--) {
			string c = "";
			if (a[i] == 'C') {
				for (int i = 1; i < b.length(); i++) c += b[i];
				c += b[0];
				b = c;
			}
			if (a[i] == 'J') {
				c += b[b.length() - 1];
				for (int i = 0; i < b.length() - 1; i++) c += b[i];
				b = c;
			}
			if (a[i] == 'E') {
				int d = floor(b.length() / 2.0);
				string e = "", f = "", g = "";
				int h;
				if (b.length() % 2 == 0) h = b.length()/ 2;
				else h = d+1;
				for (int i = 0; i < d; i++) {
					e += b[i];
				}
				if(b.length()%2!=0)f = b[d];
				for (int i = h; i < b.length(); i++) {
					g += b[i];
				}
				c += g += f += e;
				b = c;
			}
			if (a[i] == 'A') {
				for (int i = b.length() - 1; i >= 0; i--) c += b[i];
				b = c;
			}
			if (a[i] == 'M') {
				for (int i = 0; i < b.length(); i++) {
					if (b[i] >= '0'&&b[i] <= '8') {
						int e = (int)b[i] - '0';
						e++;
						b[i] = (char)e + '0';
					}
					else if (b[i] == '9') {
						b[i] = '0';
					}
				}
			}
			if (a[i] == 'P') {
				for (int i = 0; i < b.length(); i++) {
					if (b[i] >= '1'&&b[i] <= '9') {
						int e = (int)b[i] - '0';
						e--;
						b[i] = (char)e + '0';
					}
					else if (b[i] == '0') {
						b[i] = '9';
					}
				}
			}
		}
		cout << b << endl;
	}
}

Measured memory_bytes: 3164
fun main(args: Array<String>) {
    val (a, b, x) = readLine()?.split(" ")?.map(String::toDouble) ?: return
    val h = x / (a * a)
    if (h > b / 2) {
        val r = (b - h) * a * a
        val c = 2 * r / (a * a)
        val d = Math.atan(c / a) * 180 / Math.PI
        println(String.format("%.10f", d))
    } else {
        val c = 2 * x / (a * b)
        val d = Math.atan(b / c) * 180 / Math.PI
        println(String.format("%.10f", d))
    }
}


Measured memory_bytes: 36032
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

# ((Aの数)-(Bの数))%3 が同じときだけ可能

S = list(input())
T = list(input())
q = I()
a,b,c,d = LIR(q,4)

n = len(S)
Sab = [0]*(n+1)
for i in range(n):
    if S[i] == 'A':
        Sab[i+1] = Sab[i]+1
    else:
        Sab[i+1] = Sab[i]-1

m = len(T)
Tab = [0]*(m+1)
for i in range(m):
    if T[i] == 'A':
        Tab[i+1] = Tab[i]+1
    else:
        Tab[i+1] = Tab[i]-1

for i in range(q):
    diff = (Sab[b[i]]-Sab[a[i]-1]) - (Tab[d[i]]-Tab[c[i]-1])
    if diff%3 == 0:
        print('YES')
    else:
        print('NO')

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

int main(){
    vector<int> num(3);
    cin>>num.at(0)>>num.at(1)>>num.at(2);
    sort(num.begin(),num.end());
    reverse(num.begin(),num.end());
    int sum = (10*num.at(0)+num.at(1))+num.at(2);
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int w[13]={0,1,2,1,3,1,3,1,1,3,1,3,1};
int main()
{
	int a,b;
	cin>>a>>b;
	if(w[a]==w[b])
	{
		cout<<"Yes";
		return 0;
	}
	cout<<"No"; 
}


Measured memory_bytes: 256
package main
 
import (
  "fmt"
)
 
func main() {
  var N, M int
  var a, b, c, d int
  fmt.Scan(&N)
  fmt.Scan(&M)
  
  student := make([][]int, N)
  for i := 0; i < N; i++ {
    student[i] = make([]int, 2)
    fmt.Scan(&a)
    fmt.Scan(&b)
    student[i][0] = a
    student[i][1] = b
  }
  checkpoint := make([][]int, M)
  for i := 0; i < M; i++ {
    checkpoint[i] = make([]int, 2)
    fmt.Scan(&c)
    fmt.Scan(&d)
    checkpoint[i][0] = c
    checkpoint[i][1] = d
  }
  
  for i := 0; i < N; i++ {
    min := 1000000000
    ans := 0
    for j := 0; j < M; j++ {
      dx := student[i][0] - checkpoint[j][0]
      dy := student[i][1] - checkpoint[j][1]
      d := abs(dx) + abs(dy)
      
      if d < min {
        min = d
        ans = j+1
      }
    }
    fmt.Printf("%d\n", ans)
  }  
}

func abs(a int) int {
  if a < 0 {
    a *= -1
  }
  return a
}

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

using namespace std;

#define mod 1000000007LL
#define pi 3.141592653589793238462643383279;
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define f first
#define s second
char a1[50][50],a2[50][50];

int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
            cin>>a1[i][j];
    }
    for(int i=0;i<m;i++)
    {
        for(int j=0;j<m;j++)
            cin>>a2[i][j];
    }
    for(int ii=0;ii<=n-m;ii++)
    {
        for(int jj=0;jj<=n-m;jj++)
        {
            //int i=ii;
            //int j=jj;
            bool temp=true;
            for(int i=0;i<m;i++)
            {
                for(int j=0;j<m;j++)
                {
                    if(a1[i+ii][j+jj]!=a2[i][j])
                    {
                        temp=false;
                        break;
                    }
                }
                if(!temp)
                    break;
            }
            if(temp)
            {
                cout<<"Yes";
                return 0;
            }
        }
    }
    cout<<"No";
    //int acc;cin>>acc;
    return 0;
}


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

const int mod=1e9+7;
const int SIZE=100010;
vector<int> G[SIZE];

int N,K;

int dfs(int v,int p,int cnt)
{
    int res=cnt;
    int used=1;
    if(v>0) used++;
    for(int u:G[v]) if(u!=p){
        res=res*dfs(u,v,K-used)%mod;
        used++;
    }
    return res;
}

signed main(){   
    cin>>N>>K;
    for(int i=0;i<N-1;i++){
        int a,b; cin>>a>>b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    } 
    cout<<dfs(0,-1,K)<<endl;
    return 0;    
}

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

tasks = [[] for i in range(N)]
for i in range(N):
    tasks[i] = list(map(int, input().split()))

sorted_task = sorted(tasks, key=lambda x: x[1])  # 1番目の要素でソート
# print(sorted_task)

now = 0
for task in sorted_task:
    now += task[0]
    if now > task[1]:
        print("No")
        break
else:
    print("Yes")


Measured memory_bytes: 55228
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

int main() {
	ll N; cin >> N;
	vector<ll> l(N), r(N);
	rep(i, N) cin >> l[i] >> r[i];

	ll ans = 0;
	rep(i, N) {
		ans += (r[i] - l[i] + 1);
	}

	cout << ans << endl;
}

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

#define pb(a) push_back(a)
#define vi vector<int>
#define loop(i, n) for(int i=1;i<=n;i++)
#define loop0(i, n) for(int i=0;i<n;i++)
#define in(i) scanf("%d", &i);
#define out(i) printf("%d", i)

int n, k, a[101];
bool dp[100001];
// dp[i] current player can win from here.
// return true if there is a dp[i-a[x]] such
// that it is false that is the current player
// after this turn ie the next player loses.

int main()
{
  in(n);
  in(k);
  loop(i, n)
  {
    in(a[i]);
    dp[a[i]]=1;
  }

  loop(i, k)
  {
    loop(j, n)
    {
      if(i>=a[j] && dp[i-a[j]]==0)
      {
        dp[i]=true;
        break;
      }
    }
  }

  if(dp[k])
    cout<<"First\n";
  else
    cout<<"Second\n";

}



Measured memory_bytes: 3752
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
    unsigned int n, t;
    cin >> n >> t;
    unsigned int result=static_cast<unsigned int>(-1);
    for(int i=0; i<n; ++i){
        unsigned int ci, ti;
        cin >> ci >> ti;
        if(ti<=t) result=min(result, ci);
    }
    if(result==static_cast<unsigned int>(-1)){
        cout << "TLE" << endl;
    } else{
        cout << result << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1e9;
const long long LINF = 1LL << 50;
#define int long long
int n;
char c[2][52];
int grid[2][52];
VE vec[52];
int ans[52];
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	rep(i, 2)rep(j, n) {
		cin >> c[i][j];
	}
	int ans = 1;
	rep(i, n) {
		if (c[0][i] == c[1][i]) {
			if (!i)ans *= 3;
			else if (c[0][i - 1] == c[1][i - 1])ans *= 2;
		}
		else {
			if (!i)ans *= 6;
			else if (c[0][i - 1] == c[1][i - 1])ans *= 2;
			else ans *= 3;
			i++;
		}
		ans %= MOD;
	}
	COUT(ans);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N,K;
    cin >> N >> K;
    double res=0;

    for(int i=1; i<=N; i++){
        double p = 1.0/N;
        int point = i;
        while(point < K){
            point*=2;
            p/=2;
        }
        res += p;
    }
    printf("%0.12f\n",res);

    return 0;
}


Measured memory_bytes: 384