akhauriyash/Code-Regression huggingface dataset:
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto x = RD;

	writeln(x < 1200 ? "ABC" : "ARC");
	stdout.flush();
	debug readln();
}

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

int main(){
    int N;
    long long K;
    scanf("%d%lld",&N,&K);
    long long A[N];
    for(int i = 0;i < N;i++){
        scanf("%lld",&A[i]);
    }


    long long res = 0;
    for(int d = 41;d >= -1;--d){
        if(d != -1 && !(K & (1LL << d))){
            continue;
        }

        long long tmp = 0;
        for (int e = 60; e >= 0; --e) {
            long long mask = 1LL<<e;
            int num = 0;
            for (int i = 0; i < N; ++i) if (A[i] & mask) ++num;
            
            if (e > d) {
                if (K & mask) tmp += mask * (N - num);
                else tmp += mask * num;
            }
            else if (e == d) {
                tmp += mask * num;
            }
            else {
                tmp += mask * max(num, N - num);
            }
        }
        res = max(res, tmp);
    }

    printf("%lld",res);

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second

using namespace std;

const int maxN = 2e5 + 10;

typedef pair<int, int> ii;

map<ii, int> mp;

int n,k,l;
int par1[maxN], par2[maxN];

int findSet(int u, int *par){
    if(u != par[u]) par[u] = findSet(par[u], par);
    return par[u];
}

void join(int x, int y, int *par){
    int px = findSet(x, par);
    int py = findSet(y, par);
    if(px != py){
        par[px] = py;
    }

}

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

    cin >> n >> k >> l;

    for(int i = 1; i <= n; ++i){
        par1[i] = i;
        par2[i] = i;
    }

    for(int i = 1; i <= k; ++i){
        int x,y;
        cin >> x >> y;
        join(x, y, par1);
    }

    for(int i = 1; i <= l; ++i){
        int x,y;
        cin >> x >> y;
        join(x, y, par2);
    }

    for(int i = 1; i <= n; ++i){
        findSet(i, par1);
        findSet(i, par2);
    }

    for(int i = 1; i <= n; ++i){
        ++mp[{par1[i], par2[i]}];
    }

    for(int i = 1; i <= n; ++i)
        cout << mp[{par1[i], par2[i]}] << " ";

}


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

int main(){
  int n,k;
  cin >> n >> k;
  if(k>(n-1)*(n-2)/2) cout << -1 << endl;
  else{
    int x=n*(n-1)/2;
    int y=(n-1)*(n-2)/2;
    int a[x],b[x];
    int t=0;
    for(int i=1;i<=n;i++){
      for(int j=i+1;j<=n;j++){
        a[t]=i;
        b[t]=j;
        t++;
      }
    }
    cout << x-k << endl;
    for(int i=0;i<x-k;i++){
      cout << a[i] << " " << b[i] << endl;
    }
  }
}

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

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

  int ans = 0;
  for (int i = 1; i <= 100; i++) {
    bool flag = false;
    for (int j = 0; j < N; j++) {
      if (A.at(j) >= i) {
        if (!flag) ans++;
        flag = true;
      }
      else {
        flag = false;
      }
    }
  }
  cout << ans << endl;
}

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

int main(){
    string s; int q;
    cin>>s>>q;
    for(int i=0; i<q; ++i){
        string t; int a,b;
        cin>>t>>a>>b;
        if(t=="print"){
            cout<<s.substr(a,b-a+1)<<endl;
        }
        else if(t=="reverse"){
            reverse(s.begin()+a,s.begin()+b+1);
        }
        else{
            string x; cin>>x;
            s.replace(a,b-a+1,x);
        }
    }
    return 0;
}


Measured memory_bytes: 3212
#include <stdio.h>
#include <cctype>
int main(){
    char ch;
    while(1){
        scanf("%c",&ch);
        if(islower(ch)) ch=toupper(ch);
        else if(isupper(ch)) ch=tolower(ch);
        printf("%c",ch);
        if(ch=='\n') break;
    }
    return 0;
}

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


// ABC119B - Digital Gifts
// https://atcoder.jp/contests/abc119/tasks/abc119_b
void ABC119B() {
	int N;
	cin >> N;
	
	vector<double> x(N);
	vector<string> u(N);
	for (int i = 0; i < N; i++)
	{
		cin >> x[i] >> u[i];
	}

	double sum = 0;
	for (int i = 0; i < N; i++)
	{
		if (u[i] == "JPY") {
			sum += x[i];
		}
		else {
			sum += x[i] * 380000.0;
		}
	}

	printf("%f\n", sum);
}

int main() {
	ABC119B();

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <limits.h>

#define WHITE 1
#define BLACK 2
#define NIL -2

int A[101][101], pi[101], w[101][101], n;

prim(){
  int mincost, u, v, i;
  int color[n], d[n];

  for(u=0; u<n; u++){
    d[u] = INT_MAX;
    pi[u] = NIL;
    color[u] = WHITE;
  }

  d[0] = 0;

  while(1){
    mincost = INT_MAX;
    for(i=0; i<n; i++){
      if(color[i] != BLACK && d[i] < mincost){
	mincost = d[i];
	u = i;
      }
    }
    
    if(mincost == INT_MAX){
      break;
    }

    color[u] = BLACK;
    
    for(v=0; v<n; v++){
      if(color[v] != BLACK && w[u][v] < d[v] && w[u][v] != -1){
	pi[v] = u;
	d[v] = w[u][v];
      }
    }

  }

}  

  
int main(){
  int i, j, sum=0;

  scanf("%d", &n);

  for(i=0; i<n; i++){
    for(j=0; j<n; j++){
      scanf("%d", &A[i][j]);
      w[i][j] = A[i][j];
    }
  }

  prim();

  for(i=0; i<n; i++){
    if(w[i][pi[i]] != -1){
      sum += w[i][pi[i]];
    }
  }

  printf("%d\n", sum); 

  return 0;
}

Measured memory_bytes: 676
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1e9 + 7;
#define pival 3.14159265359
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pqq priority_queue
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl '\n'
ll power(ll x, ll y, ll p)
{ 
    ll res = 1;  
    x = x % p;
    while (y > 0) { 
        if (y & 1) res = (res * x) % p; 
        y = y >> 1;
        x = (x * x) % p;   
    } 
    return res; 
}
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 	ll n, k;
 	cin >> n >> k;
 	ll temp = n / k;
 	n -= temp * k;
 	ll ans = 1e18;
 	ans = min(ans, n);
 	n = n - k;
 	ans = min(ans, abs(n));
 	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
// ConsoleApplication9.cpp : アプリケーションのエントリ ポイントを定義します。
//


#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 9999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define p(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
//#define int long long


using namespace std;


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




ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}

ll pow2(ll a, ll n) {//aのn乗を計算します。
	ll x = 1;
	while (n > 0) {//全てのbitが捨てられるまで。
		if (n & 1) {//1番右のbitが1のとき。
			x = x * a;
		}
		a = a * a;
		n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
	}
	return x;
}

long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}

const int MAX = 510000;
const int MOD = 1000000007;

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

bool arr[100000100];
vector<ll>sosuu;
void Eratosthenes() {
	ll N = 10000010;
	int c = 0;
	for (int i = 0; i < N; i++) {
		arr[i] = 1;
	}
	for (ll i = 2; i < sqrt(N); i++) {
		if (arr[i]) {
			for (ll j = 0; i * (j + 2) < N; j++) {
				arr[i *(j + 2)] = 0;
			}
		}
	}

	for (int ll i = 2; i < N; i++) {
		if (arr[i]) {
			sosuu.pb(i);
			//cout << sosuu[c] << " ";
			c++;
		}
	}
	//cout << endl;
	//cout << c << endl;
}

ll stoL(string s) {
	ll n = s.length();
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		ans += pow2(10, n - i-1)*(ll)(s[i]-'0');
	}
	return ans;
}

int main() {
	string s; cin >> s;
	int N = s.length();
	int cnt = 0;
	REP(i, N - 1) {
		if (s[i + 1] != s[i])cnt++;
	}
	p(cnt);
}



Measured memory_bytes: 512
#include<ctime>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#define file(x)freopen(x".in","r",stdin);freopen(x".out","w",stdout)
#define rt register int
#define l putchar('\n')
#define ll long long
#define r read()
using namespace std;
inline ll read(){
    ll x=0;char zf=1;char ch=getchar();
    while(ch!='-'&&!isdigit(ch))ch=getchar();
    if(ch=='-')zf=-1,ch=getchar();
    while(isdigit(ch))x=x*10+ch-'0',ch=getchar();return x*zf;
}
void write(ll y){if(y<0)putchar('-'),y=-y;if(y>9)write(y/10);putchar(y%10+48);}
void writeln(const ll y){write(y);putchar('\n');}
int k,m,n,x,y,z,cnt,ans;
int main(){
	int a=r,b=r,c=r;
	cout<<min(c,b/a);
	return 0;
}


Measured memory_bytes: 256
from sys import stdin
# stdin = open('./input.txt')
l = stdin.readline().rstrip()
month_possible = ['01','02','03','04','05','06','07','08','09','10','11','12']
year_possible = ['00']

fo = ''.join(l[0:2])
la = ''.join(l[2:])

if 0 < int(fo) <= 12:
    if 0 < int(la) <= 12:
        print("AMBIGUOUS")
    elif 0 <= int(la) < 100:
        print("MMYY")
    else:
        print("NA")
else:
    if 0 < int(la) <= 12:
        print("YYMM")
    else:
        print("NA")


Measured memory_bytes: 38256
h,w = map(int,input().split())
s = [input() for _ in range(h)]

from collections import deque

ans = 0
stack = deque([[0,0,1]])
dxdy = [(0,1),(0,-1),(1,0),(-1,0)]
visited = [[0 for i in range(w)] for j in range(h)]
minus = 0
for i in range(h):
    for j in range(w):
        if s[i][j] == "#":
            visited[i][j] = 1
            minus += 1


ans = -1
while(stack):
    ne = stack.popleft()
    x,y = ne[0],ne[1]
    if x < 0 or x > h-1: continue
    if y < 0 or y > w-1: continue
    if visited[x][y] == 1: continue
    if x== h -1 and y == w-1:
        ans = h*w - ne[2] - minus

    visited[x][y] = 1

    for dx,dy in dxdy:
        stack.append([dx+x,dy+y,ne[2]+1])

print(ans)






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

using namespace std;
using ll = long long;
constexpr int mod = 1e9+7;
constexpr int md = mod;
constexpr int MOD = mod;
constexpr ll inf = 1e9+5;
const int MAX=510000;
int main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    int n;
    cin>>n;
    vector<ll> v(n);
    ll sum = 0;
    int minuscount  = 0;
    ll mi = 1e10;
    for(auto & a : v){
        cin>>a;
        if(a <0)minuscount++;
        sum += abs(a);
        mi = min(abs(a),mi);
    }
    if(minuscount%2){
        cout << 1LL*(sum - 2LL*mi) << endl;
    }else{
        cout << sum << endl;
    }
    return 0;
}



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

int main() {
  int N, t;
  double x, h ,a = 0;
  scanf("%d%d", &N, &t);
  for(int i=0; i<N; ++i) {
    cin >> x >> h;
    a = max(h/x, a);
  }
  printf("%lf\n", a * t);
}




Measured memory_bytes: 3280
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

		public static void main(String[] args){
			Scanner sc = new Scanner(System.in);
			// 整数の入力
			// スペース区切りの整数の入力
			int N = sc.nextInt();
			
			if (N == 1){
	       		// 出力
	        	System.out.println(1);
	        	return ;
	        	
			}

			int n = N;
			int ans = 0;
			int kaisu = 0;
			
			for (int i = 1; i <= N;i ++ ){
				int work = keisan(i);
				if (kaisu < work){
					kaisu = work;
					ans = i;
				}
			}

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

		private static int keisan(int N) {
			int n = N;
			int ans = 0;

			for (int i = 1; i <= N;i ++ ){
				int work = n % 2;
				if (work == 1){
					i = N ;
				}else{
					ans++ ;
					n = n / 2;
				}
			}
			return ans;
		}

}


Measured memory_bytes: 22868
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <climits>
#include <math.h>
#include <bitset>

#define P pair
#define X first
#define Y second
#define VSORT(v) sort(v.begin(), v.end())
#define VREV(v) reverse(v.begin(), v.end())
#define VMAX_P(v) max_element(v.begin(), v.end())
#define VMIN_P(v) min_element(v.begin(), v.end())
#define VMAX_IDX(v) distance(v.begin(), VMAX_P(v))
#define VMIN_IDX(v) distance(v.begin(), VMIN_P(v))
#define VCOPY(src, dst) copy(src.begin(), src.end(), back_inserter(dst))
#define SUPPER(src, dst) transform(src.begin(), src.end(), dst.begin(), toupper);
#define SLOWER(src, dst) transform(src.begin(), src.end(), dst.begin(), tolower);

using namespace std;
using ll = long long;

int main(int argc, const char *argv[])
{
    string a, b;
    cin >> a >> b;

    int cnt = 0;
    for (int i = 0; i < a.length(); i++)
    {
        if (a[i] == b[i])
        {
            cnt++;
        }
    }

    cout << cnt << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef vector<pair<ll,ll> > vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>(b);--i)
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
  string a,b,c;cin>>a>>b>>c;
  cout<<a[0]<<b[1]<<c[2]<<endl;
}




Measured memory_bytes: 256
import java.util.Scanner;
class Main {
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
   	int k;
    k = scan.nextInt();
   	String s;
    s = scan.next();
    int num = s.length();
    if (k>=num)
      System.out.println(s);
    else{
      String str= s.substring(0,k);
      System.out.println(str+"...");
    }
  }         
}

Measured memory_bytes: 38620
k=int(input())
s=input()
#n,m,k=map(int,input().split())
#a=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]


if len(s)<=k:
    print(s)
else:
    print(s[:k],"...",sep="")


Measured memory_bytes: 61584
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var N = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(elem => long.Parse(elem)).ToArray();

            var breakCount = 0;
            var current = 0;
            for (int i = 0; i < a.Length; i++)
            {
                if (a[i] != current + 1)
                {
                    breakCount++;
                }
                else
                {
                    current++;
                }
            }

            Console.WriteLine(current == 0 ? -1 : breakCount);
        }

        // 最小公倍数
        public static long Lcm(long a, long b)
        {
            return a * b / Gcd(a, b);
        }

        // ユークリッドの互除法 
        public static long Gcd(long a, long b)
        {
            if (a < b)
                // 引数を入替えて自分を呼び出す
                return Gcd(b, a);
            while (b != 0)
            {
                var remainder = a % b;
                a = b;
                b = remainder;
            }
            return a;
        }
    }
}


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

int main(){
    ll n, k;
    cin >> n >> k;
    int count=1;
    while(n>=k){
        n /= k;
        count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 3572
#include<iostream>
#include<string>
using namespace std;
int main(){
  string str;
  int ab[26]={};
  int i;
  while(getline(cin,str)){
    for(i=0;i<str.size();i++){
      if(str[i]>='a'&&str[i]<='z') ab[str[i]-'a']++;
      else if(str[i]>='A'&&str[i]<='Z') ab[str[i]-'A']++;
    }
  //cout << str << endl;
  }
  for(i=0;i<26;i++){
    cout << (char)('a'+i) << " : " << ab[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

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

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int n,m;
	cin >> n >> m;
	const int inf = 1e9;
	vector<int> v(n, inf);
	rep(i,0,m){
		int x,y;
		cin >> x >> y;
		--x, --y;
		gmin(v[x],y-1);
	}
	int mn = inf; 
	int ans = 0;
	rep(i,0,n){
		gmin(mn,v[i]);	
		if(mn == i){
			++ans;
			mn = inf;
		}
	}
	cout << ans << '\n';
}


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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

const int L = 470;
ll dp[L][8];

int main() {
	ll k; cin >> k;
	dp[0][0] = 1;

	for (int i = 1; i < L; ++i) {
		for (int j = 0; j <= 7; ++j) {
			for (int k = j; k <= 7; ++k) {
				dp[i][k] += dp[i-1][j];
			}
		}
	}

	vi vec;
	for (int i = L-1; i >= 1; --i) {
		int num = k / dp[i][7];
		vec.pb(num);
		k %= dp[i][7];
	}

	reverse(ALL(vec));
	string ans;
	for (int x : vec) {
		ans += "FESTIVA";
		rep(i, x) ans.pb('L');
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
/*
      author : nishi5451
      created: 12.08.2020 14:20:46
*/

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


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

Measured memory_bytes: 3628
#include<stdio.h>
int main(void)
{
	int a, b;
	scanf("%d %d", &a, &b);
	if(a<b){
		printf("a < b\n");
}else if(a>b){
	printf("a > b\n");}
	else if(a==b){
		printf("a == b\n");
}	
	return 0;
}

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

void fnInput(int& rnTrgSu, int& rnTrgKin)
{
  cin >> rnTrgSu >> rnTrgKin;
}

int fnRcsSch(int nTrgSu, int nTrgKin)
{
  vector<int> cnvnMoney{10000, 5000, 1000};

  int nCalKin;
  int i, j;
  for (i = 0; i <= nTrgSu; i++)
  {
    for (j = 0; j <= (nTrgSu - i); j++)
    {
      nCalKin = nTrgKin;

      nCalKin -= cnvnMoney[0] * i;
      nCalKin -= cnvnMoney[1] * j;
      nCalKin -= cnvnMoney[2] * (nTrgSu - i - j);
      if (!nCalKin)
        break;
    }
    if (!nCalKin)
      break;
  }
  if (!nCalKin)
    cout << i << " " << j << " " << (nTrgSu - i - j) << endl;
  else
    cout << -1 << " " << -1 << " " << -1 << endl;
}

int main()
{
  int nTrgSu, nTrgKin;
  
  fnInput(nTrgSu, nTrgKin);
  fnRcsSch(nTrgSu, nTrgKin);

  return 0;
}

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

using ll = long long;
#define debug(x) cerr << #x << ": " << x << endl;
#define line() cerr << "---------------" << endl;

int a[60];

int main() {
   int n;
   cin >> n;
   for (int i = 0; i < n; i++) {
      cin >> a[i];
   }
   int Max = 0;
   for (int i = 1; i < n; i++) {
      if ( abs(a[i]) > abs(a[Max]) ) {
         Max = i;
      }
   }

   // 全要素に足す
   cout << 2 * n - 1 << endl;
   int cnt = 0;
   for (int i = 0; i < n; i++) {
      a[i] += a[Max];
      cout << Max + 1 << " " << i + 1 << endl;
      cnt++;
   }
   
   // 累積和
   if (a[Max] >= 0) {
      for (int i = 1; i < n; i++) {
         a[i] += a[i] + a[i-1];
         cout << i << " " << i + 1 << endl;
         cnt++;
      }
   } else {
      for (int i = n-2; i >= 0; i--) {
         a[i] += a[i] + a[i+1];
         cout << i + 2 << " " << i + 1 << endl;
         cnt++;
      }
   }

   return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
S_lists = [list(map(int, input().split()))[1:] for _ in range(M)]
P = list(map(int, input().split()))
count = 0
for n in range(2**N):
  l = 1
  for p, S in zip(P, S_lists):
    l *= (sum([int(bin(n)[2:].zfill(N)[s-1]) for s in S]) % 2 == p)
  count += l
print(count)

Measured memory_bytes: 3064
package main

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

func main() {
	var n int
	fmt.Scan(&n)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	a := make([]int, n)
	for i := range a {
		sc.Scan()
		a[i], _ = strconv.Atoi(sc.Text())
	}
	var cnt int
	for i := 0; i < n-2; i++ {
		for j := i + 1; j < n-1; j++ {
			for k := j + 1; k < n; k++ {
				if a[i] == a[j] || a[j] == a[k] || a[k] == a[i] {
					continue
				}
				s := []int{a[i], a[j], a[k]}
				sort.Sort(sort.IntSlice(s))
				if s[2] >= s[0]+s[1] {
					continue
				}
				cnt++
			}
		}
	}
	fmt.Println(cnt)
}

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

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

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


Measured memory_bytes: 6332
#include <iostream>
#include <vector>
#include <set>
#include <cstdio>
using namespace std;

int main(void) {
    int H,W;cin>>H>>W;
    vector<string> s;
    for (int i = 0; i < H; i++) {
        string tmp;cin>>tmp;
        bool hit = false;
        for (int j = 0; j < W; j++) {
            if (tmp[j] == '#') hit = true;
        }
        if (hit) s.push_back(tmp);
    }
    int len = s.size();
    set<int> trim_index;
    for (int i = 0; i < W; i++) {
        bool hit = false;
        for (int j = 0; j < len; j++) {
            if (s.at(j)[i] == '#') hit = true;
        }
        if (!hit) trim_index.insert(i);
    }
    // output
    for (int j = 0; j < len; j++) {
        for (int i = 0; i < W; i++) {
            if (trim_index.find(i) == trim_index.end()) {
                printf("%c", s.at(j)[i]);
            }
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))
max_cost = 0
now = 0
for i in range(n):
    max_cost += abs(A[i] - now)
    now = A[i]
max_cost += abs(now)

for i in range(n):
    if i == 0:
        diff = abs(A[1]-A[0])+abs(A[0]-0) - abs(A[1]-0)
    elif i == n-1:
        diff = abs(0-A[n-1]) + abs(A[n-1]-A[n-2]) - abs(0-A[n-2])
    else:
        diff = abs(A[i+1]-A[i]) + abs(A[i]-A[i-1]) - abs(A[i+1]-A[i-1])
    print(max_cost - diff)


Measured memory_bytes: 14168
//https://atcoder.jp/contests/dp/tasks/dp_c

#include <bits/stdc++.h>
#include <limits.h>
#include <algorithm>  


using namespace std;

typedef long long int ll;

const int precision = 16;
const int modulo =  1000000007; // 10^9 + 7
using ll = long long;
const double EPS = 1e-9;

int maxOfTree(ll a, ll b, ll c) {
	ll ret = max(a, b);
	return max(ret, c);
}

// int recVacV1(int ind, int excludeAct, const vector<vector<int>> & act) 
// {
// 	if(ind >= (int) act.size()) return 0;

// 	int ret = INT_MIN;
// 	int retEx = -1;
// 	for(auto i : {0, 1, 2}) {
// 		if(i == excludeAct) continue;
// 		if (act[ind][i] > ret) {
// 			retEx = i;
// 			ret = act[ind][i];
// 		}
// 	}

// 	ret += recVac(ind + 1, retEx, act);
// 	return ret;
// }


// ll recVacV2(int ind, int excludeAct, const vector<vector<int>> & act, map<pair<int, int>, ll> & memo) 
// {
// 	if(ind >= (int) act.size()) return 0;
// 	if(memo.count({ind, excludeAct})) return memo[{ind, excludeAct}];
// 	ll ret = INT_MIN;

// 	for(auto i : {0, 1, 2}) {
// 		if(i == excludeAct) continue;
// 		ret = max(recVacV2(ind + 1, i, act, memo), ret);
// 	}

// 	ret +=  act[ind][excludeAct];
// 	memo[{ind, excludeAct}] = ret;
// 	return ret;
// }


int max_exclude(const vector<int> & a, int exclude) 
{
	int ret = INT_MIN;
	for(auto i = 0; i < (int)a.size(); ++i) {
		if (i == exclude) continue;
		ret = max(ret, a[i]);

	}
	return ret;
}

int vacV3(vector<vector<int>> & act) 
{
	vector<vector<int>> dp(act.size(), vector<int>(3, INT_MIN));
	int n = act.size();
	for(auto i : {0, 1, 2}) {
		dp[0][i] = act[0][i];
	}
	for(auto i = 1; i < n; ++i) {
		for(int prev : {0, 1, 2}) {
			for(int cur: {0, 1, 2})
				if(prev != cur) {
					dp[i][cur] = max(dp[i][cur], dp[i - 1][prev] + act[i][cur]);
				}
			
		}
	}

	return max_exclude(dp[n - 1], 5);

}

void solveVacation() {
	int n; cin >> n;

	vector<vector<int>> act(n, vector<int>(3, 0));

	for(auto i = 0; i < n; ++i) {
		cin >> act[i][0] >> act[i][1] >> act[i][2];
	}

	

	// int maxVal = maxOfTree(recVacV1(0, 0, act, memo), 
	// 			recVacV1(0, 1, act, memo), recVacV1(0, 2, act, memo));

	//map<pair<int, int>, ll> memo;
	// ll maxVal = maxOfTree(recVacV2(0, 0, act, memo), 
	// 			recVacV2(0, 1, act, memo), recVacV2(0, 2, act, memo));

	ll maxVal = vacV3(act);
	cout <<  maxVal <<endl;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cout.precision(precision);
	cout.setf(ios_base::fixed);

	solveVacation();
	return 0;
}


Measured memory_bytes: 11136
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vpint> vvpint;
typedef vector<vpll> vvpll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<string>> vvstring;
typedef vector<vector<bool>> vvbool;

typedef vector<vector<vector<ll>>> vvvll;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================





int main() {

	////==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	////==================================
	
	ll N, A, B;
	cin >> N >> A >> B;

	string S;
	cin >> S;

	ll japan = 0;
	ll others = 0;

	for (int i = 0; i < N; i++)
	{
		if (S[i] == 'a')
		{
			if (japan + others < A + B)
			{
				cout << "Yes" << endl;
				japan++;
			}
			else
			{
				cout << "No" << endl;
			}
		}
		else if (S[i] == 'b')
		{
			if (japan + others < A + B && others < B)
			{
				cout << "Yes" << endl;
				others++;
			}
			else
			{
				cout << "No" << endl;
			}
		}
		else
		{
			cout << "No" << endl;
		}
	}


}





Measured memory_bytes: 976
#include<bits/stdc++.h>
using namespace std;
#define mem(a) memset(a,0,sizeof(a))
#define dbg(x) cout<<#x<<" = "<<x<<endl
#define ll long long
//不要再爆long long了！！！！！！！！不要再爆long long了！！！！！！！ 
ll a[200010]; 
bool cmp(ll a,ll b){return a>b;}
int main()
{
	int n,i;
	ll s=0;
	cin>>n;
	for(i=0;i<n;i++)
	{
		scanf("%lld",&a[i]);
	}
	sort(a,a+n,cmp);
	s=a[0];
	for(i=0;i<(n)/2-1;i++)
	{
		s+=2*a[i+1];
	}
	if(n%2)s+=a[(n)/2];
//	s=a[n-1];
//	for(i=0;i<n/2;i++)
//	{
//		s+=2*a[n-2-i];
//	}
//	if(n%2)s+=a[n-n/2-2];
	printf("%lld\n",s);
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    int val;
    int*a =new int[N];
    for(int i=0; i<N; i++){
        cin >> val;
        a[val-1] = i+1;
    }
    for(int i=0; i<N-1; i++){
        cout << a[i] << " ";
    }
    cout << a[N-1] << endl;

    return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;
typedef long long int lli;
typedef vector<int> vi;
typedef vector<long long int> vlli;
typedef pair<int,int> pii;
typedef pair<long long int,long long int> plli;
typedef vector< vi > vvi ;
typedef vector< vlli > vvlli  ;
#define fi(i,a,b) for(int i=a;i<=b;i++)
#define flli(i,a,b) for(long long int i=a;i<=b;i++)
#define bi(i,a,b) for(int i=a;i>=b;i--)
#define blli(i,a,b) for(long long int i=a;i>=b;i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define pi 2*acos(0.0)
#define pb push_back
#define tr(v,it) for(decltype(v.begin()) it=v.begin();it!=v.end();it++)
#define present(v,num) (v.find(num)!=v.end())
#define cpresent(v,num) (find(v.begin(),v.end(),num)!=v.end())
#define pq priority_queue
#define mp make_pair
const int inf=INT_MAX;
const lli INF =LLONG_MAX;
const lli mod = 1e9+7;
void dfs(vvlli &graph, vector<bool> &vis, lli curr)
{
	tr(graph[curr],it)
	{
		if(!vis[*it])
		{
			vis[*it]=true;
			dfs(graph,vis,*it);
		}
	}
}
int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    fast;
    lli n,m;cin>>n>>m;
    vvlli graph(n);
    flli(i,0,m-1)
    {
    	lli a,b;cin>>a>>b;
    	a--;
    	b--;
    	graph[a].pb(b);
    	graph[b].pb(a);
    }
    vector<bool> vis(n,false);
    lli ans=0;
    flli(i,0,n-1)
    {
    	if(!vis[i])
    	{
    		vis[i]=true;
    		dfs(graph,vis,i);
    		ans++;
    	}
    }
    ans--;
    cout<<ans;
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}

Measured memory_bytes: 10308
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long LL;
const int N=1000006,p=998244353;
int c[N],fc[N],i,j,k,n,m,X,an;

inline char getc()
{
	#define VV 10000000
	static char s[VV],*l=s,*r=s;
	if (l==r)
		l=s,r=s+fread(s,1,VV,stdin);
	return l==r?0:*l++;
}

int read(){ char c; int z=0; do c=getc(); while (c<'0'||c>'9'); while (c>='0'&&c<='9') z*=10,z+=c-'0',c=getc(); return z; }

int power(int z,int k)
{
	int d=1;
	for (;k;z=(LL)z*z%p,k>>=1) if (k&1) d=(LL)d*z%p;
	return d;
}

int C(int n,int m)
{
	return (LL)c[n]*fc[m]%p*fc[n-m]%p;
}

int main()
{
	//freopen("1.in","r",stdin);
	n=read(),m=read(),X=n+m;
	if (n<m) swap(n,m);
	for (c[0]=i=1;i<=X;++i) c[i]=(LL)c[i-1]*i%p;
	for (fc[X]=power(c[X],p-2),i=X;i;--i) fc[i-1]=(LL)fc[i]*i%p;
	for (i=0;i<m;++i)
		an=(an+(LL)C(n-m+i+i,i)*C(m-i<<1,m-i))%p;
	printf("%d\n",n+(LL)an*power(2,p-2)%p*power(C(n+m,m),p-2)%p);
	return 0;
}

Measured memory_bytes: 8320
import math
from decimal import Decimal

def ML(): return map(int, input().split())

a, b, h, m = ML()

h += m/60

x1 = a*math.cos(h/6*math.pi)
y1 = a*math.sin(h/6*math.pi)

x2 = b*math.cos(m/30*math.pi)
y2 = b*math.sin(m/30*math.pi)

distance = Decimal(math.sqrt((x1-x2) ** 2 + (y1-y2) ** 2))

print(distance)

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

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    long a, b, c, k;
    long sum = 0;
    cin >> a >> b >> c >> k;
    if (a > k) {
        cout << k;
        return 0;
    }
    sum += a;
    k = k - a;
    if (b > k) {
        cout << sum;
        return 0;
    }
    k = k - b;
    sum -= k;
    cout << sum;
}


Measured memory_bytes: 3604
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

import copy

n,m,q = i2()
a = []
b = []
c = []
d = []

for i in range(q):
	ai,bi,ci,di = i2()
	a.append(ai)
	b.append(bi)
	c.append(ci)
	d.append(di)
#print(n,m,q)
#print(a,b,c,d)

l = [1]
ans = []
def saiki(l):
	if len(l) == n+1:
		sum = 0
		for j in range(q):
			#print(j)
			#print(l)
			if l[b[j]] - l[a[j]] == c[j]:
				sum += d[j]
		ans.append(sum)
		return
	l.append(l[-1])
	while l[-1] <= m:
		saiki(copy.copy(l))
		l[-1] += 1
saiki(l)
print(max(ans))

Measured memory_bytes: 12788
#include <stdio.h>

int main(){
    long long H,W;
    long long ct = 0;

    scanf("%lld%lld",&H,&W);

    if(H > 1 && W > 1){
        ct += (H / 2)*(W / 2);
        ct += (H - H / 2)*(W - W / 2);
    }else{
        ct = 1;
    }

    printf("%lld\n",ct);

    return 0;
}

Measured memory_bytes: 128
def resolve():
    import bisect
    N = int(input())
    A = sorted([int(i) for i in input().split()])
    if N == 2:
        print(max(A), min(A))
        return
    maxA = A[-1]
    half = maxA / 2
    i = bisect.bisect_left(A, half)
    if A[i] - half < half - A[i - 1]:
        print(maxA, A[i])
    else:
        print(maxA, A[i - 1])


resolve()


Measured memory_bytes: 19944
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>

using namespace std;

using ll = long long;
using ld = long double;

const ld pi = 3.141592653589793;

#ifdef EBUG
#define debug(x) cout << "\033[31m" << #x << ": " << x << "\033[0m\n";
#else
#define debug(x)
#endif

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

ll k, n, a[200005], d[200005];

int main() {
  cin >> k >> n;
  rep(i, n) {
    cin >> a[i];
  }
  rep(i, n - 1) {
    d[i] = abs(a[i + 1] - a[i]);
  }
  d[n - 1] = a[0] + abs(k - a[n - 1]);
  ll max_d = 0;
  rep(i, n) {
    max_d = max(max_d, d[i]);
  }
  cout << k - max_d << endl;
}

Measured memory_bytes: 3328
def slove():
    import sys
    import fractions
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    ans = 1
    for i in range(n):
        t = int(input().rstrip('\n'))
        ans = ans * t // fractions.gcd(ans, t)
    print(ans)


if __name__ == '__main__':
    slove()


Measured memory_bytes: 65132
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000000
#define MAX 2000005
using ll=long long;
using Graph=vector<vector<int>>;
using pp=pair<pair<int,int>,int>;

//Binary Indexed Tree (1-indexed)
template<class T>
class BIT{
  int N;
  std::vector<T> bit;
public:
  BIT(int n){
    N=n;
    bit.resize(N+1,0);
  }

  //i番目の要素にwを追加
  void add(int i,T w){
    for(int x=i;x<=N;x+=x&-x){
      bit[x]+=w;
    }
  }

  //[1,i]の和を求める
  T sum(int i){
    int ret=0;
    for(int x=i;x>0;x-=x&-x){
      ret+=bit[x];
    }
    return ret;
  }

  //[i,j]の和を求める
  T sum(int i,int j){
    if(i==1){
      return sum(j);
    }else{
      return sum(j)-sum(i-1);
    }
  }
};

int main(){
  int N,Q;
  cin>>N>>Q;
  vector<int> c(N),ans(Q);
  vector<pp> rl(Q);
  for(int i=0;i<N;i++){
    cin>>c[i];
    c[i]--;
  }

  for(int i=0;i<Q;i++){
    cin>>rl[i].first.second>>rl[i].first.first;
    rl[i].second=i;
  }
  sort(rl.begin(),rl.end());

  vector<int> index(N,0);
  int j=0;
  BIT<int> tree(N);
  for(int i=0;i<N;i++){
    if(index[c[i]]!=0){
      tree.add(index[c[i]],-1);
    }
    index[c[i]]=i+1;
    tree.add(index[c[i]],1);
    while(rl[j].first.first==i+1){
      int x=tree.sum(rl[j].first.second,rl[j].first.first);
      ans[rl[j].second]=x;
      j++;
      if(j==Q){
        break;
      }
    }
    if(j==Q){
      break;
    }
  }

  for(int i=0;i<Q;i++){
    cout<<ans[i]<<endl;
  }

}


Measured memory_bytes: 17404
/*
???????????´??° a???b???c ??????????????????a ?????? b ?????§?????´??°????????????
c ????´???°?????????????????????????±???????????????°????????????????????????????????????
*/
#include <iostream>

int main() {
	int num1, num2, num3;
	int count = 0;

	std::cin >> num1 >> num2 >> num3;
	// c????´???°?????°??????
	for (int i = 1; i <= num3; i++)
	{
		// ?????????????????????????????§????????????
		if (num3%i == 0) {
			if (num1 <= i && i <= num2) count++;
		}
	}
	std::cout << count << std::endl;
	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;
const int SIZE = 100005;
const int INF = int (1e9) + int (1e5);
const ll INFL = ll(2e18) + ll(1e10);
const ll MOD = 1E9 + 7;
#define rep(i,n) for (long long i=0;i<(n);++i)
#define repp(i,a,b) for (long long i=(a);i<(b);++i)
#define per(i,x) for(long long i = (x) ; i >= 0 ; --i)
#define perr(i,x,y) for(long long i = (x) ; i >= (y) ; --i)
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(a) (a).begin(),(a).end()
#define lla(a) (a).rbegin(),(a).rend()
#define p(x) cout<<x<<" "
#define pn(x) cout<<x<<"\n"
#define p2(x,y) cout<<x<<" "<<y<<"\n"
#define p3(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define p4(x,y,z,w) cout<<x<<" "<<y<<" "<<z<<" "<<w<<"\n"
#define p5(x,y,z,w,s) cout<<x<<" "<<y<<" "<<z<<" "<<w<<" "<<s<<"\n"
#define FAST ios_base::sync_with_stdio(false); cin.tie(0)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << std::endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif


//template<class T>
//bool isPrime(T n){
//    if(n==1)return false;
//    T i = 2;
//    while(i*i<=n){
//       if(n%i==0)return false;
//       i+=1;
//    }
//    return true;
//}

// bool prime[100005];
// void seive()
// {
//     memset(prime,true,sizeof(prime));
//     prime[0]=0;
//     prime[1]=0;
//     for(ll p=2;p*p<=100000;p++)
//     {
//         if(prime[p]==true)
//         {
//             for(ll i=p*2;i<=100000;i+=p)
//             prime[i]=false;
//         }
//     }    
// }

// ll power(ll n,ll k, ll mod){
//     if(k==0)
//         return 1;
//     if(k==1)
//         return n%mod;

//     ll get=power(n,k/2,mod);
//     ll ret = ((get%mod)*(get%mod))%mod;

//     if(k%2)
//         ret = ((ret%mod)*(n%mod))%mod;

//     return ret%mod;
// }

int main(){
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    FAST;
    
    string s,t; cin>>s>>t;
    int n = s.size(), m = t.size();
    int dp[n+1][m+1];

    for(int i=0;i<=n;++i){
        for(int j=0;j<=m;++j){
            if(i==0 || j==0)dp[i][j] = 0;
            else{
                if(s[i-1] == t[j-1])dp[i][j] = dp[i-1][j-1] + 1;
                else dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }

    string ans = "";

    int i = n, j = m;
    while(i>0 && j>0){
        if(s[i-1] == t[j-1]){
            ans += s[i-1]; --i; --j;
        }else{
            if(dp[i-1][j] > dp[i][j-1]){
                --i;
            }else{
                --j;
            }
        }
    }
    reverse(all(ans));
    pn(ans);

}

Measured memory_bytes: 35456
#include<stdio.h>
int main(){
	int n;
	scanf("%d", &n);
	int m=0;
	while(m<n){
		m = m+1000;
	}
	if (m==n){
		printf("0");
	}
	else if(m>=n){
		printf ("%d", m-n);
	}
	return 0;
}

Measured memory_bytes: 1724
def help(a):
    x = a[0] % a[1]
    a[0] = a[1]
    a[1] = x
    return a

a = list(map(int, input().split()))
if a[0]<a[1]:
    tmp = a[0]
    a[0] = a[1]
    a[1] = tmp

while a[1]>1:
    help(a)
if a[1]==0:
    print(a[0])
else:
    print(a[1])


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

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

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	char ch;
	
	while(1)
	{
		scanf("%c",&ch);
		if('a' <= ch && ch <= 'z')
		{
			printf("%c",ch-32);
		}else if('A' <= ch && ch <= 'Z')
		{
			printf("%c",ch+32);
		}else
		{
			printf("%c",ch);
		}
		
		if(ch=='\n') break;
	}
	return 0;
}


Measured memory_bytes: 2628
#include <cstdio>
#include <algorithm>

using namespace std;

int main(){
	int N,K;

	scanf("%d %d",&N,&K);

	int h[N];

	for(int i=0;i<N;i++){
		scanf("%d",&h[i]);
	}

	sort(h,h+N);

	for(int i=0;i<N;i++){
//		printf("%d\n",h[i]);
	}

	int min = 1000000000;
	int temp;
	for(int i=0;i<N-K+1;i++){
		temp = h[i+K-1]-h[i];
//		printf("%d\n",temp);
		if(temp<min){
			min = temp;
		}
	}
	printf("%d\n",min);

	return 0;
}

Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin>>a>>b;
    if((a*b)%2==0)
    {
        PUTS("No");
    }
    else
    {
        PUTS("Yes");
    }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AOJ_Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            var regText = Console.ReadLine();

            var list = new List<string>();
            while (true)
            {
                var oneLine = Console.ReadLine();
                if (oneLine == "END_OF_TEXT")
                {
                    break;
                }

                list.Add(oneLine);
            }

            var allCount = 0;
            foreach (var oneLine in list)
            {
                var splitedStr = oneLine.Split(' ');
                //var count = Regex.Matches(oneLine, $@"(^|\s){regText}($|\s)", RegexOptions.IgnoreCase).Count;
                var count = splitedStr.Count(x => Regex.IsMatch(x, $@"^{regText}$", RegexOptions.IgnoreCase));
                if (count > 0)
                {
                    allCount += count;
                }
            }

            Console.WriteLine(allCount);

        }
    }
}



Measured memory_bytes: 21792