akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
signed main(){
  string s;cin>>s;
  int n=s.size();
  int res=0;
  s[n-1]='.';
  rep(i,300)s+='.';
  rep1(i,n){
    string buf=s.substr(0,i);
    string rear=s.substr(i,i);
    if(buf==rear){
      res=i*2;
    }
  }
  cout<<res<<"\n";
  return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    string abc = "abcdefghijklmnopqrxtuvwxyz";
    string s;
    map<char,bool>found;
    cin >> s;

    string ans;
    for (int i=0; i<s.size(); i++){
        found[s[i]] = true;
    }

    for (int i=0; i<abc.size(); i++){
        if (not found[abc[i]])ans += abc[i];
    }
    sort(all(ans));
    if (ans.size() == 0)cout << "None" << endl;
 
    else cout << ans[0] << endl;
}

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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int n,k;
int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cin>>n>>k;
  int ans=0;
  while (n) {
    ans++;
    n=n/k;
  }

  cout<<ans<<endl;
  return 0;
}
// don't forget to read in the input :^)


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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; }

vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}

int main() {
  int N;
  cin>>N;
  vector<int>v(N);
  map<int,int>odd;
  map<int,int>even;
  for(int i=0;i<N;i++){
    cin>>v[i];
    if(i%2==0){even[v[i]]++;}
    else{odd[v[i]]++;}
  }

  int MO=0,MCO=0;
  for(auto c:odd){
    if(c.second>MCO){MO=c.first;MCO=c.second;}
  }
  int SO=0;
  for(auto c:odd){
    if(c.first!=MO&&c.second>SO){SO=c.second;}
  }

  int ME=0,MCE=0;
  for(auto c:even){
    if(c.second>MCE){ME=c.first;MCE=c.second;}
  }
  int SE=0;
  for(auto c:even){
    if(c.first!=ME&&c.second>SE){SE=c.second;}
  }

  if(MO!=ME){
    cout<<(N/2-MCO)+(N/2-MCE)<<endl;
  }
  else{
    if((N/2-MCO)+(N/2-SE)<(N/2-MCE)+(N/2-SO)){
      cout<<(N/2-MCO)+(N/2-SE)<<endl;
    }
    else{
      cout<<(N/2-MCE)+(N/2-SO)<<endl;
    }
  }
  
  return 0;
}

Measured memory_bytes: 8284
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static long LINF = 1L << 55;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			Deque<Integer> stack = new ArrayDeque<Integer>();

			char[] s = in.nextString().toCharArray();
			for (char c : s) {
				if (c == '0') {
					stack.push(0);
				} else if (c == '1') {
					stack.push(1);
				} else if (c == 'B') {
					if (stack.isEmpty()) continue;
					stack.pop();
				}
			}

			StringBuilder sb = new StringBuilder();
			while (!stack.isEmpty()) {
				sb.append(stack.pop());
			}
			out.println(sb.reverse().toString());
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

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

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

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

		public int[] nextIntArrayDec(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt() - 1;
			}
			return res;
		}

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

		public long[] nextLongArrayDec(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong() - 1;
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}


Measured memory_bytes: 21460
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = b[a[0] - 1]
for i in range(1, n):
    ans += b[a[i] - 1]
    if a[i] == a[i-1] + 1:
        ans += c[a[i]-2]
print(ans)


Measured memory_bytes: 9056
import fractions

a, b = map(int, input().split())

import math
def prime_number(n):
    prime_list = []
    p = 2
    last = n

    while p <= math.sqrt(last)+1:
        cnt = 0
        if n % p != 0: pass
        else:
            while n % p == 0:
                n //= p
                cnt += 1

            prime_list.append((p, cnt))

        p += 1
    
    if n != 1: prime_list.append((p, cnt))
    return len(prime_list)

n = fractions.gcd(a, b)
print(prime_number(n) + 1)

Measured memory_bytes: 5432
#include<bits/stdc++.h>
using namespace std;
const int maxn=500+10;
int n;
bool has[maxn];
char s[maxn][maxn];
int main()
{
    cin>>n;int i,j,x;
    for(i=0;i<n;i++)
        scanf("%s",s[i]);
    bool a1=0,a2=0;
    for(i=0;i<n;i++)
        for(j=0;j<n;j++)
            a1|=s[i][j]=='.',
            a2|=s[i][j]=='#';
    if(!a1){puts("0");return 0;}
    if(!a2){puts("-1");return 0;}
    a1=false;
    for(i=0;!a1&&i<n;i++){
        a2=false;
        for(j=0;j<n;j++)
            a2|=s[i][j]=='.',
            has[j]|=s[i][j]=='#';
        a1|=!a2;
    }
    x=n;
    for(j=0;j<n;j++){
        a2=false;
        for(i=0;!a2&&i<n;i++)
            a2|=s[i][j]=='.';
        x-=!a2;
    }
    if(a1){
        cout<<x;
        return 0;
    }
    int hwq=x,ans=2e9;
    for(i=0;i<n;i++){
        x=0;
        for(j=0;j<n;j++)
            x+=s[i][j]=='.';
        if(!has[i]) ++x;
        ans=min(x,ans);
    }
    cout<<hwq+ans;
    return 0;
}

Measured memory_bytes: 512
# -*- coding: utf-8 -*-
N,Y = map(int, input().split())

for n_10000 in range(int(Y/10000)+1):
    y_10000 = n_10000*10000
    for n_5000 in range(int((Y-y_10000)/5000)+1):
        y_5000 = n_5000*5000
        
        n_1000 = N-n_10000-n_5000
        if n_1000 >= 0 and Y-y_10000-y_5000 == 1000*n_1000:
            print('{} {} {}'.format(n_10000, n_5000, n_1000))
            exit(0)

print('-1 -1 -1')

Measured memory_bytes: 3060
while True:
    a=input();t={};s=""
    if a==0:break
    for i in range(a):
        q=raw_input().split()
        t[q[0]]=q[1]
    for j in range(input()):
        q=raw_input().strip()
        s=s+t[q] if q in t else s+q
    print s

Measured memory_bytes: 7604
def main():
    n, k = map(int, input().split())
    p = list(map(int, input().split()))
    e = [(p[j-1]+1)/2.for j in range(1, n+1)]
    s = [sum(e[:k])]
    for i in range(1, n-k+1):
        s.append(s[-1]-e[i-1]+e[k+i-1])
    ans = max(s)
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 24804
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    int t = sc.nextInt();
    if (X < t) {
      System.out.println(0);
    } else {
      System.out.println(X-t);
    }
  }
}

Measured memory_bytes: 20820
x,y=map(int, raw_input().split())
if 0<=x and 0<=y:
    if x<=y:
        print abs(x-y)
    else:
        print min(1+abs(x*-1-y),2+abs(x-y))
elif x<0 and y<0:
    if x<=y:
        print abs(x-y)
    else:
        print min(2+abs(x-y), 1+abs(x-y*-1))
elif x<0 and y==0:
    print abs(x-y)
elif x<0 and 0<y:
    if x*-1<=y:
        print 1+abs(y-x*-1)
    else:
        print 1+abs(x*-1-y)
elif y<0 and x==0:
    print 1+abs(x-y)
elif y<0 and 0<x:
        print 1+abs(x*-1-y)


Measured memory_bytes: 28396
N,W=map(int,input().split())
DP= [[0 for j in range(W+1)] for i in range(N+1)]
v=[0]*(N+1)
w=[0]*(N+1)
for i in range(1,N+1):
    v[i],w[i]=map(int,input().split())
for i in range(1,N+1):
    for j in range(1,W+1):
        if j-w[i]<0:
            DP[i][j]=DP[i-1][j]
        else:
            if v[i]+DP[i-1][j-w[i]]>DP[i-1][j]:
                DP[i][j]=v[i]+DP[i-1][j-w[i]]
            else:
                DP[i][j]=DP[i-1][j]
print(DP[N][W])


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

typedef long long ll;
 
int main(){
  string a, b, c;
  cin >> a >> b >> c;
  cout << char(a[0]-32) << char(b[0]-32) << char(c[0]-32);
  cout << endl;
  return 0;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge
{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
// using Graph = vector<vector<Edge>>;
using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

bool check(ll x, ll N, ll K, vector<ll> &A)
{
  ll cnt = 0;
  for (int i = 0; i < N; i++)
  {
    if (A[i] > x)
    {
      cnt++;
      cnt += (A[i] - x + (x - 1)) / x - 1;
    }
  }
  if (cnt <= K)
    return true;
  else
    return false;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, K;
  cin >> N >> K;
  vector<ll> A(N);
  for (auto &it : A)
    cin >> it;
  ll left = 0, right = INF;
  while (left + 1 < right)
  {
    ll mid = (left + right) / 2;
    if (check(mid, N, K, A))
      right = mid;
    else
      left = mid;
  }
  cout << right << endl;
  return 0;
}

// 二分探索？最小の長さを決め打ちしてそれを超える丸太を全て切っていく


Measured memory_bytes: 4692
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
typedef long long int64;
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;

int gcd(int a, int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//逆元を求める関数
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
      fac[i] = fac[i-1] * i % MOD;
      inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD;
      finv[i] = finv[i-1] * inv[i] % MOD;
    }
}
//組み合わせ
long long COM (int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD;
}

void solve() {
		int n; cin >> n;
		vector<int> a(n), s(n);
		rep(i, n) {
			cin >> a[i];
			s[i] = a[i];
		}
		sort(all(s), greater<>());
		rep(i, n) {
			cout << (a[i] == s[0] ? s[1] : s[0]) << endl;
		}
    return;
}

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



Measured memory_bytes: 3200
/*
 *  Author :: Kattu37
 */

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

#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define sortallr(x) sort(allr(x))
#define PI 3.1415926535897932384626
#define mod 1000000007

typedef pair<int, int>  pii;
typedef pair<ll, ll>  pll;
typedef vector<int>   vi;
typedef vector<ll>    vl;
typedef vector<pii>   vpii;
typedef vector<pll>   vpl;
typedef vector<vi>    vvi;
typedef vector<vl>    vvl;

void solve()
{
	int k;
	cin >> k;

	int count = 1;
	ll no = 7;
	no = no % k;

	while (no != 0 && count < 1e6)
	{
		no = no * 10 + 7;
		no = no % k;
		count++;
	}

	if (no == 0)
		cout << count << "\n";
	else cout << -1 << "\n";
}

int main(void)
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

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

	return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;
const int inf = 1001001000;
const long long int Inf = 1001001001001001000;

void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

int main()
{
	long long int n;
	cin >> n;
	long long int ans = 0;
	vector<long long int> a(1,10);
	while(n >= a.back() * 5){
		a.push_back(a.back() * 5);
	}
	if (n % 2 == 1)
	{
		cout << 0 << endl;
	}
	else
	{
		rep(i,a.size()){
			ans += n / a[i];
		}
		cout << ans << endl;
	}
	

	return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/arc094/tasks/arc094_b

#include "algorithm"
#include "iostream"
#include "set"
#include "vector"
#define rep(i, from, to) for (ll i = from; i < (to); ++i)
using namespace std;
typedef long long ll;
template <typename T>
using V = vector<T>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

ll partial(ll a, ll b) {
  if (a == b) {
    // 1, 2 回目のコンテストのどちらか一方で a 以下を取る必要がある。
    // よって最大値は 2*(a-1)
    // (a-i)(a+i) = a^2 - i^2 < a^2 より、
    // (a-i) と (a+i) でペアを作っていけば最大値を実現できる
    return 2 * (a - 1);
  }

  if (a > b) {
    swap(a, b);
  }

  // a 側については、 a-1 と b+1 以上のペアは (a-i)(b+i) - ab = (a-b)i-i^2 < 0
  // より条件を満たす。
  // b 側が最大で a 側の a+1 以上といくつペアを作れるかを二分探索。
  ll ok = 0, ng = 1LL << 31;

  while (ng - ok > 1) {
    ll mid = (ok + ng) / 2;
    // mid ペア作れるとき、それぞれ (a+mid-i+1) と i (i = 1, 2, .., mid)
    // と表せ、その最大ペアは arg = (a+mid+1)/2 とすると a+mid+1 - arg
    // なおこれが偶数であれば軸は整数となり問題がなく、奇数であれば軸は二整数の中間だから
    // 切り捨て切り上げを気にする必要はない
    ll arg = (a + mid + 1) / 2;
    ll mul = arg * (a + mid + 1 - arg);

    if (mul < a * b) {
      ok = mid;
    } else {
      ng = mid;
    }
  }

  return ok + a - 1;
}

void solve() {
  ll Q;
  cin >> Q;

  rep(i, 0, Q) {
    ll A, B;
    cin >> A >> B;

    cout << partial(A, B) << endl;
  }
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

#ifndef TEST
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}
#endif

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

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

void print_ints(vector<ll> v) {
  rep(i, 0, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
using namespace std;
int main()
  
{	string s,t;int c=0;
 cin>>s>>t;int n=s.size();
 for(int i=0;i<n;i++)
 {if(s[i]!=t[i])
   { c++;
      break;}}

if(c==0)
 cout<<"Yes";
else
   cout<<"No";}
     
     

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
using LL=long long;
    
struct item{
    int w,s,v;
}a[3005];
    
int n;  LL dp[20005];
    
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d%d%d",&a[i].w,&a[i].s,&a[i].v);
    
    sort(a+1,a+n+1,[&](item &x, item &y){return x.s+x.w<y.s+y.w;});

    for(int i=1;i<=n;i++)
        for(int j=min(20000,a[i].w+a[i].s);j>=a[i].w;j--)
            dp[j]=max(dp[j],dp[j-a[i].w]+a[i].v);
            
    printf("%lld",*max_element(dp+1,dp+20001));
    return 0;
}

Measured memory_bytes: 384
X, Y = map(int, input().split())
MOD = 10**9+7

def mod_pow(n, m):
  res = 1
  while m > 0:
    if m & 1:
      res = (res*n)%MOD
    n = (n*n)%MOD
    m >>= 1
  return res
  
if (2*Y-X)%3 != 0 or (2*X-Y)%3 != 0 or 2*Y < X or 2*X < Y:
  print(0)
else:
  A = (2*X-Y)//3
  B = (2*Y-X)//3
  m = 1
  n = 1
  for i in range(A):
    m = (m*(A+B-i))%MOD
    n = (n*(A-i))%MOD
  inverse_n = mod_pow(n, MOD-2)
  print((m*inverse_n)%MOD)

Measured memory_bytes: 63000
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
  int n;
  double v[50];
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  sort(v, v+n);
  for (int i = 0; i < n - 1; ++i) {
    v[i + 1] = (v[i] + v[i + 1]) / 2.0;
  }
  cout << v[n - 1] << endl;
  return 0;
}

Measured memory_bytes: 256
while True:
    h,w = map(int,input().split())
    
    if h == 0 and w == 0:
        break
    
    for i in range(h):
        for k in range(w):
            if (i+k)%2 == 0:
                print('#', end="")
            else:
                print('.', end="")
        print() 
    print()


Measured memory_bytes: 7004
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  ll n, m;
  while (cin >> n >> m) {
    if (n==0 && m==0) {
      break;
    } else {
      vector <ll> v(n, 0);
      rep(i, m) {
        rep(j, n) {
          ll a;
          cin >> a;
          v.at(j) += a;
        }
      }
      ll res = 0;
      rep(i, n) {
        res = max(res, v.at(i));
      }
      cout << res << endl;
    }
  }
}


Measured memory_bytes: 3012
#include <bits/stdc++.h>
            #include <ext/pb_ds/assoc_container.hpp>
            #include <ext/pb_ds/tree_policy.hpp>
            using namespace std;
            using namespace __gnu_pbds;
            #define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
            #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
            #define endl "\n"
            #define pb push_back
            #define F first
            #define S second
            #define print(a)       for(auto x : a) cout << x << " "; cout << endl
            #define print1(a)      for(auto x : a) cout << x.F << " " << x.S << endl
            #define print2(a,x,y)  for(int i = x; i < y; i++) cout<< a[i]<< " "; cout << endl
            #define mk(x,y)  make_pair(x,y)
            typedef long long int ll;
            const ll N =  1e6+5;
            const ll mod = 1e9+7;
            const ll inf = 1e18;
            ll   n , a[N] , b[N]   , k  , m  , l , r  , x , y  , q , u , z  ;
    ll pow_mod_m(ll a , ll n)
    {
        if(!n)
            return 1;
        ll pt =  pow_mod_m(a,n/2);
        pt *= pt ;
        if(n&1)
            pt *= a ;
        return pt;
    }


    int main()
    {
         IOS;
         int ts =1;
        /// cin >> ts ;
         while(ts--)
         {
            cin >> n;
            rep(i,0,n) cin >> a[i];
            ll left = 1000;
            rep(i,0,n)
            {
                ll j = i;
                while(j+1 < n and a[j] <= a[j+1]) j++;
                ///cout << " current i and j are : " << i << " " << j << endl;
                if(j < n)
                {
                    ll bought = left/a[i];
                   /// cout << " bought : " << bought << endl;
                    left -= bought*a[i];
                    left += a[j]*bought;
                    i = j;
                }
                ///cout << " left is : " << left << endl;
            }
            cout << left << endl;
         }
    }


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define FOR(i,n) for(size_t i=0;i<(n);i++)
#define REP(n) FOR(i,n)
#define cinv(v,n) for(size_t i=0;i<(n);i++){cin>>(v)[i];}
#define nvec(type,v,n) vector<type> v(n);cinv(v,n)
#define npairs(type1,type2,v,n) vector<pair<type1,type2>> v(n);for(size_t i=0;i<(n);i++){cin>>v[i].first>>v[i].second;}
#define npairs(type1,type2,v,n) vector<pair<type1,type2>> v(n);for(size_t i=0;i<(n);i++){cin>>v[i].first>>v[i].second;}
#define ntuples(type1,type2,type3,v,n) vector<tuple<type1,type2,type3>> v(n);for(size_t i=0;i<(n);i++){cin>>get<0>(v[i])>>get<1>(v[i])>>get<2>(v[i]);}

#define min_index(v) size_t(min_element(all(v))-(v).begin())
#define max_index(v) size_t(max_element(all(v))-(v).begin())
#define min_e(v) *min_element(all(v))
#define max_e(v) *max_element(all(v))

#define count_le(v,a) size_t(upper_bound(all(v),a)-(v).begin())
#define count_lt(v,a) size_t(lower_bound(all(v),a)-(v).begin())
#define count_ge(v,a) size_t((v).end()-lower_bound(all(v),a))
#define count_gt(v,a) size_t((v).end()-upper_bound(all(v),a))

#define order(neq_sl) [](const &auto s, const &auto l){return neq_sl;}
#define make_lr(v,type,l,r) vector<type> l(n+1),r(n+1);FOR(i,n){l[i+1]=l[i]+v[i];r[i+1]=r[i]+v[n-1-i];}

#define acm accumulate
#define SUM(v) accumulate(all(v),0l)

int main() {
  int n;string s;
  cin>>n>>s;
  if(n%2==1){
    cout<<"No";
    return 0;
  }
  n/=2;
  for (size_t i = 0; i < n; i++) {
    if(s[i]!=s[n+i]){
      cout<<"No";
      return 0;
    }
  }
  cout<<"Yes";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define ll long long
#define pb push_back
#define f first
#define s second
//#define mp make_pair
#define gg return 0;
#define pii pair < int, int>
 
using namespace std;
 
const int maxn = 132675;
const int INF = (int)1e9;
 
ll a,b[maxn],c,d,cnt,e[(int)2e3 + 1][(int)2e3 + 1],cost[maxn],tout[maxn],mn = INF,mx = -INF,l,r;
 
ll x[maxn],y[maxn],x2[maxn],y2[maxn];
 
bool u[maxn], m;
 
vector <int> v;
 /*
void forn( int s, int f, int inter){
	for(int i = s; i <= f; i += inter){
		b[i] = i;
	}
}
*/ 
string s, ans;
 
ll pref;
 
//vector <int> g[maxn],d[maxn];
 
ll lvlc,lvl[maxn];
/*
void dfs(int v){
	lvlc++;
	lvl[v] = lvlc;
	d[lvl[v]].pb(v);
	u[v] = 1;
	for(int i = 0; i < g[v].size(); ++i){
		int to = g[v][i];
		if(!u[to]){
			dfs(to);
		}
	}
	lvlc--;
}*/
 
map <char, bool> mp;
 
char ch;
 
int main()
{
	cin >> a >> c;
	for(int i = 1; i <= c; ++i){
		cin >> b[i];
		u[b[i]] = 1;
	}
	l = a;
		m = 0;
		while(l > 0){
			if(u[l % 10]){
				m = 1;
				break;
			}
			l /= 10;
		}
	if(!m){
		cout << a;
		gg
	}
	while(a++){
		l = a;
		m = 0;
		while(l > 0){
			if(u[l % 10]){
				m = 1;
				break;
			}
			l /= 10;
		}
		if(!m){
			cout << a;
			gg
		}
	}
	gg
}

Measured memory_bytes: 4352
#include <cstdio>
#include <iostream>
#define debug(...) fprintf(stderr, __VA_ARGS__)
using namespace std;
inline char nc()
{
    return getchar();
	static char buf[100000], *l = buf, *r = buf;
	return l==r&&(r=(l=buf)+fread(buf,1,100000,stdin),l==r)?EOF:*l++;
}
template<class T> void read(T &x)
{
	x = 0; int f = 1, ch = nc();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=nc();}
	while(ch>='0'&&ch<='9'){x=x*10-'0'+ch;ch=nc();}
	x *= f;
}
typedef long long ll;
const int maxn = 500 + 5;
ll f[maxn][maxn];
ll sum[2][maxn][maxn];
int n;
int a[maxn][maxn];
ll cal0(int a, int b)
{
    return sum[0][b][b] - sum[0][a][b] - sum[0][b][a] + sum[0][a][a];
}
ll cal1(int a, int b, int c)
{
    return sum[1][n][b] - sum[1][n][a] - sum[1][c][b] + sum[1][c][a];
}
void init()
{
    for(int i = 1; i <= n; ++i)
    {
        for(int j = 1; j <= n; ++j)
        {
            sum[i > j][i][j] = a[i][j];
        }
    }
    for(int k = 0; k < 2; ++k)
    {
        for(int i = 1; i <= n; ++i)
        {
            for(int j = 1; j <= n; ++j)
            {
                sum[k][i][j] += sum[k][i - 1][j] + sum[k][i][j - 1] - sum[k][i - 1][j - 1];
            }
        }
    }
}
ll solve()
{
    init();
    for(int i = 1; i <= n; ++i)
    {
        for(int j = i + 1; j <= n; ++j)
        {
            f[j][i] = cal0(0, i) + cal0(i, j) + cal1(0, i, j);
        }
    }
    for(int i = 1; i <= n; ++i)
    {
        for(int j = 1; j < i; ++j)
        {
            for(int x = i + 1; x <= n; ++x)
            {
                f[x][i] = min(f[x][i], f[i][j] + cal0(i, x) + cal1(j, i, x));
            }
        }
    }
    ll an = cal0(0, n);
    for(int i = 1; i <= n; ++i)
    {
        ll r = cal0(i, n);
        an = min(an, cal0(0, i) + r);
        for(int j = 1; j < i; ++j)
        {
            an = min(an, f[i][j] + r);
        }
    }
    return an;
}
int main()
{
    read(n);
    for(int i = 1; i <= n; ++i)
    {
        for(int j = 1; j <= n; ++j) if(i != j)
        {
            read(a[i][j]);
        }
    }
    printf("%lld\n", solve());
    return 0;
}


Measured memory_bytes: 7168
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9+7;
//const long long MOD = 998244353;
const long long INF_LL = 1e18+11; const int INF_int = 1e9+11;
#define ll long long
#define mp std::make_pair
#define rep(i,n) for(int i = 0;i<n;i++)
#define lrep(i,n) for(long long i = 0;i<n;i++)
#define All(a) a.begin(),a.end()
#define Debug_Output_ALL(a) for(auto x:a) cout << x << " ";cout << endl;
int main(){
    string s,t;
    cin >> s >> t;
    int a = s.size();
    int b = t.size();
    int ans = 0;
    rep(i,a-b+1){
        int tmpans = 0;
        rep(j,b){
            if(s[i+j]==t[j]) tmpans++;
        }
        ans = max(ans,tmpans);
    }
    cout << b -ans << endl;
}

Measured memory_bytes: 3592
import java.util.Scanner;

public class Main{
    void euc(int n, int m){
	int x, y, z, t = 0;
	if(n < m){
	    x = m;
	    y = n;
	} else {
	    x = n;
	    y = m;
	}

	while(y > 0){
	    x %= y;
	    z = y;
	    y = x;
	    x = z;
	    t++;
	}
	System.out.println(String.valueOf(x)+ " " + String.valueOf(t));

	return ;
    }

    Main(){
	Scanner sc = new Scanner(System.in);

	while(sc.hasNext()){
	    int n = sc.nextInt(), m = sc.nextInt();
	    if(n+m == 0) break;

	    euc(n, m);
	}
    }

    public static void main(String[] args){
	new Main();
    }
}

Measured memory_bytes: 13000
/*
 * WelcomeToAtCoder.cpp
 *
 *  Created on: 2020/02/19
 *      Author: black
 */
#include <iostream>
#include <algorithm>
using namespace std;


int main(){
	int num;
	int A, B, C, D;
	cin >> num;
	A = num/1000;
	num %= 1000;
	B = num/100;
	num %= 100;
	C = num/10;
	D = num%10;

	if (A+B+C+D == 7){
		cout << A << '+' << B << '+' << C << '+' << D << "=7";
	}
	else if (A-B+C+D == 7){
		cout << A << '-' << B << '+' << C << '+' << D << "=7";
	}
	else if (A+B-C+D == 7){
		cout << A << '+' << B << '-' << C << '+' << D << "=7";
	}
	else if (A+B+C-D == 7){
		cout << A << '+' << B << '+' << C << '-' << D << "=7";
	}
	else if (A-B-C+D == 7){
		cout << A << '-' << B << '-' << C << '+' << D << "=7";
	}
	else if (A-B+C-D == 7){
		cout << A << '-' << B << '+' << C << '-' << D << "=7";
	}
	else if (A+B-C-D == 7){
		cout << A << '+' << B << '-' << C << '-' << D << "=7";
	}
	else if (A-B-C-D == 7){
		cout << A << '-' << B << '-' << C << '-' << D << "=7";
	}

	return 0;
}


Measured memory_bytes: 256
import bisect
from operator import itemgetter
import math
import copy
import collections
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

L,R = IL()


if R-L >= 2019:
  print(0)
else:
  data = []
  ans = MAX_INT
  for i in range(L,R+1):
    data.append(i%2019)
  for i in itertools.combinations(data,2):
    ans = min(ans,i[0]*i[1]%2019)
  print(ans)

Measured memory_bytes: 14112
#include <iostream>
#include<cstdio>
#include<iomanip>
#include <cmath>
using namespace std;

int stair(int a){
  	int ret = 1;
	for(int i=1;i<a;i++){
    	ret *= i;
    }
  	return ret;
}

int main(){
  	cout<<fixed<<setprecision(10);
    double n;
    cin >> n;
    double x[(int)n];
    double y[(int)n];
    for(int i=0;i<n;i++){
        cin >> x[i];
        cin >> y[i];
    }
    double result = 0.00000000;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            result += sqrt((x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]));
        }
    }
    cout << result * (double)2 / n << endl;
}

Measured memory_bytes: 256
import copy

n, x = map(int, input().split())
a = list(map(int, input().split()))
b = copy.deepcopy(a)

for i in range(n - 1):
    if a[i] + a[i + 1] > x:
        a[i + 1] -= min(a[i + 1], a[i] + a[i + 1] - x)
        if a[i] > x:
            a[i] -= a[i] - x

ans = sum(abs(x - y) for x, y in zip(a, b))
print(ans)

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

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

  //1を探す
  int cnt;
  for(int i=0;i<n;i++)
  {
    if(a.at(i)==1)
    {
      cnt=i+1;
      break;
    }
  }

  //1がもっとも端のブロックにある場合
  if(cnt<=k || (n-cnt+1)<=k)
  {
    if(n==k) ans=1;
    else if(n%(k-1)==1) ans=(n-1)/(k-1);
    else if(n%(k-1)==0) ans=n/(k-1);
    else ans=n/(k-1)+1;
  }

  //1が端のブロックにない場合
  else
  {
    //前半がちょうど
    if((cnt-1)%(k-1)==0)
      //後半がちょうど
      if((n-cnt+1)%(k-1)==0)
        ans=(cnt-1)/(k-1)+(n-cnt+1-1)/(k-1);

      else
        ans=(cnt-1)/(k-1)+(n-cnt+1-k)/(k-1);

    //前半がちょうどじゃない
    else
      if(n%(k-1)==1)
        ans=n/(k-1);

      else
        ans=n/(k-1)+1;



  }
  cout<<ans<<endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
 
int main()
{
    int a,b,c,d;
  cin>>a>>b>>c>>d;
 
  if(ceil((double)a/(double)d)>=ceil((double)c/(double)b))cout<<"Yes";
    else cout<<"No";
  cout<<endl;
}

Measured memory_bytes: 3648
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();

        // 主処理
        int c = s.indexOf("C");
        int f = s.lastIndexOf("F");
        boolean judge = 0 <= c && 0 <= f && c < f;
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 23124
#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    if (A == 1 and B == 2) or (A == 2 and B == 1):
        print(3)
    elif (A == 1 and B == 3) or (A == 3 and B == 1):
        print(2)
    else:
        print(1)


    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()


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


int A[1000];
int main(){
	int n,a,ans=1;
	cin >> n;
	for(int i=0;i<n;i++) cin >> A[i];
	
	for(int i=1;i<n;i++){
		for(int j=i-1;j>=0;j--){
			if(A[j]>A[i]) goto aa;
		}
		ans++;
		aa:;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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

ll N;
ll w[2][3];
ll solve(ll n,ll from, ll to){
    ll dp[n+1];
    rep(i,n+1)dp[i]=i;
    // out(dp[n]);
    rep(i,n+1){
        rep(j,3){
            if(i>=w[from][j])dp[i]=max(dp[i],dp[i-w[from][j]]+w[to][j]);
        }
    }
    return dp[n];
}

int main(){
    cin>>N;
    rep(i,2)rep(j,3)cin>>w[i][j];
    out(solve(solve(N,0,1),1,0));
}


Measured memory_bytes: 195584
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >>n;
    vector<int>l(n);
    for(int i=0;i<n;i++)cin >>l[i];
    sort(l.begin(),l.end());
    reverse(l.begin(),l.end());
    int ans=0;
    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
            for(int k=j+1;k<n;k++){
            if(l[i] < l[j] + l[k])ans++;
            }
        }
    }
    cout <<ans<<endl;
}

Measured memory_bytes: 256
'use strict'

function main(s) {

  s = s.split('\n')[0].split(' ').map(n => Number(n));

  const a = s[0];
  const b = s[1];

  const strength = [0, 13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];

  let ans = '';

  if (strength[a] > strength[b])   ans = 'Alice';
  if (strength[a] < strength[b])   ans = 'Bob';
  if (strength[a] === strength[b]) ans = 'Draw';

  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
// kyopro.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include<map>
#include<algorithm>
#include<set>
#include<queue>
#include<cmath>
#include<stack>
#include<vector>
#include<string>
using namespace std;
#define ll long long int
#define rep(N) for(ll i=0;i<N;i++)
#define For(i,N) for(ll i=0;i<N;i++)
int main()
{
	ll P, Q, R;
	cin >> P >> Q >> R;
	ll a = 0;
	a = P;
	if (a < Q)a = Q;
	if (a < R)a = R;

	cout << P + Q + R - a;
}


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

int main(void)
{
    intmax_t N, K, p[200000];
    double E[1001];
    double ans = 0;

    E[0] = 0;
    for (size_t i = 1; i <= 1000; i++) {
        E[i] += E[i - 1] + i;
    }
    for (size_t i = 1; i <= 1000; i++) {
        E[i] /= (double)i;
    }

    scanf("%jd%jd", &N, &K);
    for (size_t i = 0; i < N; i++) {
        scanf("%jd", &p[i]);
    }

    intmax_t sum = 0, max, maxi;
    for (size_t i = 0; i < K; i++) {
        sum += p[i];
    }
    max = sum;
    maxi = K - 1;
    for (size_t i = K; i < N; i++) {
        sum -= p[i - K];
        sum += p[i];
        if (sum > max) {
            max = sum;
            maxi = i;
        }
    }

    for (size_t i = (maxi - K + 1); i < (maxi + 1); i++) {
        ans += E[p[i]];
    }

    printf("%.7f\n", ans);

    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <vector>
#include <cmath>

using namespace std;
int main()
{
    string  S;

    cin >> S;

    if ((S[0] == S[1]) && (S[1] == S[2])) {
        cout << "No" << endl;
    }
    else {
        cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;

int a[15][15];
int main(){
	int n;
	while(cin>>n&&n){
		memset(a,0,sizeof(a));
		int y=n/2+1,x=n/2;
		int cur=1;
		while(cur<=n*n){
			if(a[y][x]==0){
				a[y][x]=cur++;
				y++;x++;
			}else{
				y++;x--;
			}	
			if(x<0)x=n-1;
			else if(n<=x)x=0;
			if(n<=y)y=0;
		}
		for(y=0;y<n;y++){
			for(x=0;x<n;x++){
				printf(" %3d",a[y][x]);
			}
			puts("");
		}
	}
	return 0;
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
#define llMAX 9223372036854775807
#define llMIN -9223372036854775808
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;

int main(){
  ll ans=0;
  
  
  vi a(32);
  a={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cin >> k;
  cout<<a[k-1]<<endl;
  
  return 0;
}

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

int main(){
  int A,B;
  cin >> A >> B;
  int price;
  if (A <=5) price = 0;
  else if (6 <= A && A <= 12) price = B / 2;
  else price = B;
  cout << price << endl;
}

Measured memory_bytes: 256
// Clockwork is still ticking.

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef unsigned int UI;
typedef pair<int, int> pii;

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define fst first
#define snd second
#define SZ(u) ((int) (u).size())
#define ALL(u) (u).begin(), (u).end()

inline void proc_status()
{
	ifstream t("/proc/self/status");
	cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>()) << endl;
}

namespace fastIO
{
	const UI BUFFER_SIZE = (UI) 1 << 15;
	char buffer[BUFFER_SIZE], *cur, *ed;

	inline char getc() { return *(cur == ed ? ed = buffer + fread(buffer, 1, BUFFER_SIZE, stdin), cur = buffer : cur)++; }
}
using fastIO::getc;

template<typename T> inline T read()
{
	register T sum(0), fg(1);
	register char ch(getc());
	for(; !isdigit(ch); ch = getc()) if(ch == '-') fg = -1;
	for(;  isdigit(ch); ch = getc()) sum = sum * 10 - '0' + ch;
	return sum * fg;
}

template<typename T> inline T sqr(const T &val) { return val * val; }
template<typename T> inline int chkmin(T &a, const T &b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline int chkmax(T &a, const T &b) { return b > a ? a = b, 1 : 0; }

// END tpl.

const int MOD = (int) 1e9 + 7;

const int MAXN = 600;

int n, K;

int p[MAXN + 5], cnt[MAXN + 5];

inline void input()
{
	n = read<int>() * 2, K = read<int>();
	for(int i = 1; i <= K; ++i)
	{
		int u = read<int>(), v = read<int>();
		p[u] = v, ++cnt[u];
		p[v] = u, ++cnt[v];
	}
}

inline void solve()
{
	for(int i = 1; i <= n; ++i) cnt[i] += cnt[i - 1];

	static int g[MAXN + 5];

	g[0] = 1;
	for(int i = 2; i <= n; i += 2) g[i] = (LL) g[i - 2] * (i - 1) % MOD;

	static int f[MAXN + 5][MAXN + 5];

	for(int i = 1; i <= n; ++i)
	{
		for(int j = i + 1; j <= n; j += 2)
		{
			int mn = n + 1, mx = 0;
			for(int k = i; k <= j; ++k) if(p[k])
			{
				chkmin(mn, p[k]);
				chkmax(mx, p[k]);
			}

			if(mn >= i && mx <= j)
			{
				f[i][j] = g[(j - (i - 1)) - (cnt[j] - cnt[i - 1])];
				for(int k = i + 1; k < j; k += 2)
					(f[i][j] -= (LL) f[i][k] * g[(j - k) - (cnt[j] - cnt[k])] % MOD) %= MOD;
			}
		}
	}

	int ans = 0;
	for(int i = 1; i <= n; ++i) for(int j = i + 1; j <= n; j += 2)
		(ans += (LL) f[i][j] * g[n - cnt[n] - ((j - (i - 1)) - (cnt[j] - cnt[i - 1]))] % MOD) %= MOD;
	printf("%d\n", (ans + MOD) % MOD);
}

int main()
{
#ifdef K_ON // K-ON!
	freopen("D.in", "r", stdin);
	freopen("D.out", "w", stdout);
#endif

	input();
	solve();

	return 0;
}



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

using namespace std;

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

    vector<int> a(m), b(m);
    for (int i = 0; i < m; i++) {
        cin >> a[i] >> b[i];
    }

    vector<bool> possible(n + 1, false);
    for (int i = 0; i < m; i++) {
        if (b[i] == n) {
            possible[a[i]] = true;
        }
    }

    bool res = false;
    for (int i = 0; i < m; i++) {
        if (a[i] == 1 && possible[b[i]]) {
            res = true;
        }
    }

    cout << (res ? "POSSIBLE" : "IMPOSSIBLE") << endl;
}


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

int main(){
  int n, k;
  string s;
  cin >> n >> k >> s;
  for (int i = 0; i < n; i++) {
    if (i == k-1) {
      cout << (char)(s[i] + ('a'-'A'));
    } else {
      cout << s[i];
    }
  }
  cout << '\n';
}

Measured memory_bytes: 3628
#!/usr/bin/env python3
import sys


def solve(N: int, K: int, p: "List[int]"):
    def f(pp):
        return pp * (pp + 1) / 2 / pp
    q = tuple(map(f, p))
    ma = su = sum(q[:K])
    for i, (qq, qqq) in enumerate(zip(q, q[K:]), 1):
        su = su - qq + qqq
        ma = max(ma, su)
    return ma


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    p = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, K, p))

if __name__ == '__main__':
    main()


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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
 
Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

Int n;
vector<Int> G[100001];
bool visited[100001];

// 0 : black
// 1 : white
Int dp[100001][2];

void rec(Int x) {
    visited[x] = true;
    Int sum = 1;
    Int white = 1;
    bool check = false;
    for (Int i = 0; i < (Int)G[x].size(); i++) {
        check = true;
        Int to = G[x][i];
        if (not visited[to]) {
            rec(to);
            sum *= (dp[to][0] + dp[to][1]);
            sum %= mod;
            white *= dp[to][1];
            white %= mod;
        }
    }
    if (not check) {
        dp[x][0] = dp[x][1] = 1;
    } else {
        dp[x][0] = white;
        dp[x][1] = sum;
    }
}

int main() {
    cin >> n;
    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);
    }
    rec(0);
    dump((dp[0][0] + dp[0][1]) % mod);
    return 0;
}

Measured memory_bytes: 14336
#include<iostream>
#include<string>
#include<cstdlib>
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

class Stack{
private:
  int inf[1000];
  int tp;

public:

  Stack(){
    tp=0;
  }


  void push(int x){
    tp++;
    inf[tp] = x;
  }

  void pop(){
    tp--; 
  }

  int top(){
    int x = inf[tp];
    return x;
  }

  bool isempty(){
    if(tp == 0)return true;
    return false;
  }

  int size(){
    return tp;
  }

};



int main(){
  Stack stack;
  string str,s[10000];
  int ind=0,th=0;
  
  getline(cin,str);
  for(int i=0;i<str.length();i++){
    
    if(str[i] == ' ')
      {
	th=0;
	ind++;
      }    else
      {
	
	s[ind].insert(th,str.substr(i,1));
	th++;
      }
  }
  ind++;

  for(int i=0;i<ind;i++){
       
       if(s[i] == "+" || s[i] == "*" || s[i] == "-")
	 {
	
	 int x2 = stack.top();
	 stack.pop();
	int x1 = stack.top();
	stack.pop();
	if(s[i] == "+")
	  {
	    stack.push(x1+x2);
	  }       
	else if(s[i] == "-")
	  {
	    stack.push(x1-x2);
	  }
	else if(s[i] == "*")
	  {
	    stack.push(x1*x2);
	  }
	 }
       else 
	 {
	   if(s[i] == " ")continue;
	   int n = atoi(s[i].c_str());
	   stack.push(n);	
	 }
  }
  cout << stack.top() << endl;


}

Measured memory_bytes: 0
import math

def is_prime(num):
    m = int(math.sqrt(num))

    for i in range(2, m + 1):

        if num == 2:
            return True

        elif num % i == 0:
            return False
    
    return True

def main():
    n = int(input())
    count = 0

    for _ in range(n):
        num = int(input())
        if is_prime(num):
            count += 1

    print(count)

main()


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

int main(){

int n,i=0;
bool judge=true;
cin>>n;

vector<int> v(3);
while(n>0){
v[i]=n%10;
n/=10;
i++;
}


for(int i=0;i<3;i++){
if(v[i]!=v[2-i]) judge=false;

}

if(judge) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
  }

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	k, x := intScanner(), intScanner()
	if k*500 >= x {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1772