akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    string s, t, u;
    int a, b;
    cin >> s >> t >> a >> b >> u;
    if (s == u){
        a--;
    } else{
        b--;
    }
    printf("%d %d\n", a, b);
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2441&lang=jp
typedef long long ll;
ll calc_sum(int digit, ll l, ll r) {
	ll three, five, fifteen;
	three = r / 3 - (l - 1) / 3;
	five = r / 5 - (l - 1) / 5;
	fifteen = r / 15 - (l - 1) / 15;
	return digit * (r - l + 1 - three - five + fifteen) + 4 * (three + five);
}

void put_solve(ll v, ll s, ll v_s,ll v_range) {
	string ans = "";
	string from = "";
	if (v % 15 == 0) from = "FizzBuzz";
	else if (v % 3 == 0) from = "Fizz";
	else if (v % 5 == 0) from = "Buzz";
	else {
		from = to_string(v);
	}
	ans = from.substr(s - (v_s - v_range) - 1);
	for (ll x = v + 1;; x++) {
		if (x % 15 == 0) from = "FizzBuzz";
		else if (x % 3 == 0) from = "Fizz";
		else if (x % 5 == 0) from = "Buzz";
		else {
			from = to_string(x);
		}
		ans += from;
		if (ans.length() > 20)break;
	}
	cout << ans.substr(0, 20) << endl;
}

int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
	ll s; cin >> s;
	ll sum = 0;
	vector<ll> D_sum(1, 0);
	int digit = 1;
	for (;; digit++) {
		ll l = 1; for (int i = 0;i < digit - 1;i++)l *= 10;
		ll r = l * 10 - 1;
		sum += calc_sum(digit, l, r);
		D_sum.push_back(sum);
		if (sum >= s) break;
	}
	ll l = 1; for (int i = 0; i < digit - 1;i++)l *= 10;
	ll lv = l, rv = l * 10;
	ll pre_sum = D_sum[D_sum.size() - 2];
	while (true) {
		ll mid = lv + (rv - lv) / 2;
		ll temp = pre_sum + calc_sum(digit, l, mid);
		ll mid_range;

		if (mid % 15 == 0) mid_range = 8;
		else if (mid % 3 == 0 || mid % 5 == 0) mid_range = 4;
		else mid_range = digit;

		if (temp - mid_range < s && s <= temp) {
			put_solve(mid, s, temp,mid_range);
			return 0;
		}
		if (temp - mid_range >= s) rv = mid;
		else if (s > temp) lv = mid;
	}
	return 0;
}

Measured memory_bytes: 3252
#include<iostream>
#include<atcoder/all>
int main(){int n,q,t,u,v;std::cin>>n>>q;for(atcoder::dsu s(n);std::cin>>t>>u>>v,q--;)t&&std::cout<<s.same(u,v)<<std::endl||s.merge(u,v);}

Measured memory_bytes: 3468
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a=0,b,c,d=0;
  string s;
  cin >>a>>b;
  for(int n=1;n<=a;n++){
    for(int m=1;m<=31;m++){
      if(n==m){
	d++;
	if(a==n&&m>b) d--;
      }
    }
  }
  cout <<d<<'\n';
  return (0);
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n,m,l;
    cin>> n>> m>>l;
    long long a[105][105],b[105][105],c[105][105];
    for(int i=0;i<105;i++){
        for(int j=0;j<105;j++){
            a[i][j]=0;
            b[i][j]=0;
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin >>a[i][j];
        }
    }
    for(int i=0;i<m;i++){
        for(int j=0;j<l;j++){
            cin >> b[i][j];
        }
    }
    for(int i=0;i<n;i++){
        for(int j;j<l;j++){
            c[i][j]=0;
        }
    }
    for (int i=0;i<n;i++){
        for(int j=0;j<l;j++){
            for(int k=0;k<m;k++){
                c[i][j]+=a[i][k]*b[k][j];
            }
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<l;j++){
            if(j==0){
                cout << c[i][j];
            }
           else {cout << " "<< c[i][j];
           }

        }
        cout << endl;
    }
    return 0;
}



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

typedef long long ll;

int main () {
    int n,l;
    cin >> n >> l;
    vector<string> s(n);
    for (int i=0; i<n; ++i) {
	cin >> s[i];
    }
    sort(s.begin(), s.end());
    for(auto& e : s) {
	cout << e;
    }
    cout << endl;

    
    
    return 0;
}


Measured memory_bytes: 256
use std::cmp;

fn main() {
    let (n, a, b, c) = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let mut it = buf.trim_end().split_whitespace();
        let n: i32 = it.next().unwrap().parse().unwrap();
        let a: i32 = it.next().unwrap().parse().unwrap();
        let b: i32 = it.next().unwrap().parse().unwrap();
        let c: i32 = it.next().unwrap().parse().unwrap();
        (n, a, b, c)
    };

    let mut ls: Vec<i32> = Vec::new();
    for _ in 0..n {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let l: i32 = buf.trim_end().parse().unwrap();
        ls.push(l);
    }

    // 4**n通りを試して一番魔力消費が少ないものを答えとする
    // それぞれのパターンでは全部の枝を足した後目標まで足し引き
    let mut ans: i32 = 1000000;
    for i in 0..(1 << 2 * n) {
        let mut al: Vec<i32> = vec![];
        let mut bl: Vec<i32> = vec![];
        let mut cl: Vec<i32> = vec![];
        for j in 0..(n as usize) {
            if 3 & i >> j * 2 == 3 {
                al.push(ls[j]);
            } else if 2 & i >> j * 2 == 2 {
                bl.push(ls[j]);
            } else if 1 & i >> j * 2 == 1 {
                cl.push(ls[j]);
            }
        }

        if al.len() == 0 || bl.len() == 0 || cl.len() == 0 {
            continue;
        }

        let cost_a = {
            let mut cost: i32 = 0;
            let lgth: i32 = al.iter().sum();
            cost += 10 * ((al.len() as i32) - 1);
            cost += (a - lgth).abs();
            cost
        };

        let cost_b = {
            let mut cost: i32 = 0;
            let lgth: i32 = bl.iter().sum();
            cost += 10 * ((bl.len() as i32) - 1);
            cost += (b - lgth).abs();
            cost
        };

        let cost_c = {
            let mut cost: i32 = 0;
            let lgth: i32 = cl.iter().sum();
            cost += 10 * ((cl.len() as i32) - 1);
            cost += (c - lgth).abs();
            cost
        };

        ans = cmp::min(ans, cost_a + cost_b + cost_c);
    }
    println!("{}", ans);
}


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

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

	vector<int> v;
	while (n--) {
		int a;
		cin >> a;

		v.push_back(a);
	}

	int m;
	cin >> m;

	vector<int> w;
	while (m--)
	{
		int a;
		cin >> a;
		w.push_back(a);
	}

	for (int i = 0; i < w.size() && i < v.size(); i++) {
		if (v[i] < w[i]) {
			cout << "1" << endl;
			return 0;
		}
		else if (v[i] > w[i]) {
			cout << "0" << endl;
			return 0;
		}
	}
	
	if (v.size() < w.size()) {
		cout << "1" << endl;
	}
	else {
		cout << "0" << endl;
	}

	return 0;
}


Measured memory_bytes: 3164
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

#define MAX_N 1
#define PI 3.14159265359
#define mod 1000000007

const long long INF = 1000000000;

int main(){
    int N;
    cin >> N;
    set<int> distinct;
    for(int i = 0 ; i < N;i++){
        int a;
        cin >> a;
        distinct.insert(a);
    }
    if(distinct.size() == N){
        cout << "YES" << endl;
    }
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 9600
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
template<class T, class Compare = less<T> >
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template<class T, class Compare = greater<T> >
using MinHeap = priority_queue<T, vector<T>, Compare>;
using llong = long long;

double sum;
double a;
int n;

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a;
        sum += 1 / a;
    }

    sum = 1 / sum;

    printf("%.10lf\n", sum);

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<cstring>

using namespace std;

#ifdef LDEBUG
#define debug(x) cout << #x << ":" << x << endl
#else
#define debug(...)
#endif

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

typedef unsigned long long u64;
typedef long long i64;

string b;

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

        cin >> b;

        if (b == "A")
                cout << "T" <<endl;
        else if (b == "T")
                cout << "A" << endl;
        else if (b == "G")
                cout << "C" <<endl;
        else
                cout << "G" <<endl;

        return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int a,b,ans;
	scanf("%d %d",&a,&b);
	if (a-2>=b)ans=a*2-1;
	else if (b-2>=a)ans=b*2-1;
	else ans=a+b;
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;

int N;

void solve(int s, int d) {
	int cnt;

	cnt = 0;
	for (int i = 0; i < 30; ++i) {
		if (s&(1 << i)) {
			++cnt;
			s += 1 << i;
		}
		if (d&(1 << i)) {
			++cnt;
			d -= 1 << i;
		}
		//cout << "s:" << s << "   d:" << d << endl;
		if (s == d) {
			break;
		}
	}

	cout << cnt << endl;
}

int main() {
	int s, d;

	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> s >> d;
		solve(s, d);
	}

}



Measured memory_bytes: 3104
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define int long long

void solve() {
	int x; cin >> x;
    vector<int> dp(2 * x, 0);
    dp[0] = 1;
    for(int i = 0; i <= x; ++i) {
        dp[i + 100] |= dp[i];
        dp[i + 101] |= dp[i];
        dp[i + 102] |= dp[i];
        dp[i + 103] |= dp[i];
        dp[i + 104] |= dp[i];
        dp[i + 105] |= dp[i];
    }
    cout << (int)dp[x] << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=1e9+7;

int main() {
  int n;
  cin>>n;
  int ans=1;
  while(ans*ans<=n) ans++;
  ans--;
  cout<<ans*ans<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys

n = int(input())
s = list(input())

rs = []
gs = []
bs = []

for i in range(n):
  if s[i] == "R":
    rs.append(i)
  elif s[i] == "G":
    gs.append(i)
  elif s[i] == "B":
    bs.append(i)

def binary(lst, d):
  low = 0
  high = len(lst) - 1
  while low <= high:
    mid = (low + high) // 2
    if lst[mid] == d:
      return True
    elif lst[mid] < d:
      low = mid + 1
    else:
      high = mid - 1
  return False

ans = len(rs)*len(gs)*len(bs)
if len(bs) == 0:
  print(0)
  sys.exit()
for i in range(len(rs)):
  for j in range(len(gs)):
    dis = abs(rs[i] - gs[j])
    if (rs[i] + gs[j])%2 == 0:
      can1 = abs(rs[i] + gs[j])//2
      if binary(bs, can1):
      	ans -= 1
    if max(rs[i], gs[j]) + dis <= bs[-1]:
      can2 = max(rs[i], gs[j]) + dis
      if binary(bs, can2):
      	ans -= 1
    if min(rs[i], gs[j]) - dis > 0:
      can3 = min(rs[i], gs[j]) - dis
      if binary(bs, can3):
      	ans -= 1
        
print(ans)

Measured memory_bytes: 80028
a,b,ab,x,y=map(int, input().split())
if(a+b<=2*ab ):
  ans=a*x+b*y
elif(a>=2*ab and b>=2*ab):
  ans=max(x,y)*2*ab
elif(a>=2*ab):
  if(x<=y):
    ans=ab*2*x+b*(y-x)
  else:
    ans=ab*2*x
elif(b>=2*ab):
  if(x<=y):
    ans=ab*2*y
  else:
    ans=ab*2*y+a*(x-y)
elif(a+b>=2*ab):
  if(x<=y):
    ans=ab*2*x+b*(y-x)
  else:
    ans=ab*2*y+a*(x-y)
print(ans)

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

#define REP(i, a, b) for (int i = (a); i <= (b); ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define FORV(a, A) for (auto &a : A)

using namespace std;

using ll = long long;

void Main()
{
   int N;
   cin >> N;
   ll S[N];
   FORV(s, S)
   {
      cin >> s;
   }

   ll ans = 0;
   ll score;
   REP(C, 1, N - 1)
   {
      score = 0;
      if ((N - 1) % C != 0)
      {
         for (int k = 1; C * (k + 1) < N; k++)
         {
            score += S[k * C];
            score += S[N - 1 - k * C];
            ans = max(ans, score);
         }
      }
      else if (N - 1 & 1)
      {
         for (int k = 1; C * k <= (N - 1) / 2; k++)
         {
            score += S[k * C];
            score += S[N - 1 - k * C];
            ans = max(ans, score);
         }
      }
      else
      {
         for (int k = 1; C * k < (N - 1) / 2; k++)
         {
            score += S[k * C];
            score += S[N - 1 - k * C];
            ans = max(ans, score);
         }
      }
   }
   cout << ans << endl;
}

int main()
{
   std::cin.tie(nullptr);
   std::ios_base::sync_with_stdio(false);
   std::cout << std::fixed << std::setprecision(15);
   Main();
   return 0;
}


Measured memory_bytes: 1024
import sys

str = input()
str = sorted(str)

flag = False
for index, s in enumerate(str):
    if index+1 < len(str) and s == str[index+1]:
        flag ^= True
    else:
        if not flag:
            print("No")
            sys.exit()
        else:
            flag = False

print("Yes")

Measured memory_bytes: 3060
#include <iostream>
#include <functional>
#include <cmath>
#include <iomanip>

struct Closed_Section_Double {
    bool valid; // 条件を満たす範囲が見つかったか。falseの場合、begin,endは意味を持たない。
    double begin; // [begin, end]で条件が成り立つ。
    double end;
    Closed_Section_Double(bool _valid, double _begin, double _end) { valid = _valid; begin = _begin; end = _end; }
};
 
Closed_Section_Double binary_search_double(double L, double R, double eps, std::function<bool(double)> func) {
    const bool resL = func(L);
    const bool resR = func(R);
    if (resL && resR) {
        return Closed_Section_Double(true, L, R);
    } else if (!resL && !resR) {
        return Closed_Section_Double(false, 0, 0);
    } else {
        double lb = L;
        double ub = R;
        while (eps < ub - lb && eps < (ub-lb)*2/(fabs(ub)+fabs(lb))) {
            double mid = (lb + ub) / 2;
            if (resL == func(mid)) {
                lb = mid;
            } else {
                ub = mid;
            }
        }
        if (resL) {
            return Closed_Section_Double(true, L, lb);
        } else {
            return Closed_Section_Double(true, ub, R);
        }
    } 
}

// end of template

double a, b, x;

double calc(double ang) {
    if (b*cos(ang) > a*sin(ang)) {
        double tmp = 0.5*a*a*a*tan(ang);
        return a*a*b - tmp;
    } else {
        return 0.5*a*b*b/tan(ang);
    }
}
 
int main(int argc, char **argv) {
    std::cout << std::fixed << std::setprecision(15);
    std::cin >> a >> b >> x;
 
    const double PI = acos(-1.0);
    const double EPS = 1.0e-12;
 
    auto cs = binary_search_double(EPS, 90.0-EPS, EPS, [&](double ang){
        return x < calc(PI/180.0 * ang);
    });
    std::cout << cs.end << std::endl;
}

Measured memory_bytes: 256
MOD = 1000000007

def power(m, n):
    a = m
    ans = 1
    while n > 0:
        if n & 1:
            ans = ans * a % MOD
        n >>= 1
        a = a * a % MOD
    return ans

line = input()
m, n = list(map(int, line.split()))
print(power(m, n))


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

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


int main(){
  int N,i,j,X;
  cin>>N>>X;
  int x[N];
  for(i=0;i<N;i++) cin>>x[i];
  for(i=0;i<N;i++) {
	 x[i]-=X;
	if(x[i]<0)x[i]=-x[i];
  }
  int ans=x[0];
  for(i=1;i<N;i++) {
	ans=gcd(ans,x[i]);
  }
  cout<<ans<<endl;
  return 0;
};

Measured memory_bytes: 640
#include <stdio.h>

int main(){
	int a,b,sum;
	scanf("%d %d",&a,&b);
	sum=a+a-1;
	if(sum<a+b) sum=a+b;
	if(sum<b+b-1) sum=b+b-1;
	printf("%d", sum);
	return 0;
}


Measured memory_bytes: 128
n,k=map(int,input().split())
a=list(map(int,input().split()))
if k> max(a):
    print('IMPOSSIBLE')
    exit()
import fractions
b=a[0]
for i in range(1,n):
    b=fractions.gcd(b,a[i])
print('POSSIBLE' if k%b==0 else 'IMPOSSIBLE')


Measured memory_bytes: 14224
n=int(input())
w_before=input()
word=[w_before]
ans="Yes"
for i in range(1,n):
    w=input()
    if  w[0]!=w_before[-1] or w in word:
        ans="No"
        break
    else:
        w_before=w
        word.append(w)
print(ans)

Measured memory_bytes: 3060
//Author: Fuadul Hasan(fuadul202@gmail.com)
//BSMRSTU,Gopalganj
#include<bits/stdc++.h>
using namespace std;int tc = 1;
#define happy ios::sync_with_stdio(false);
#define coding  cin.tie(0);
#define mp make_pair
#define ll long long
#define Pi atan(1)*4
#define pb  push_back
#define vpr vector<pr> 
#define pr pair<int, int> 
#define vi std::vector<int>
#define vll std::vector<ll>
#define YES printf("YES\n");
#define NO printf("NO\n");
#define Yes printf("Yes\n");
#define No printf("No\n");
#define all(n) n.begin(),n.end()
#define point(x) setprecision(x)
#define Test printf("Case %d: ",tc++);
#define Unique(c) (c).resize(unique(all(c))-(c).begin())

const int M = 1e9 + 7;
const ll  Inf = (ll)2e18 + 5;
const int N   = 2e5 + 5;


// Longest common subsequence using recursion
/*int LCS(string a,string b,int m,int n){
	if(m==0||n==0){
		return 0;
	}
	if(a[m-1]==b[n-1]){
		return 1+ LCS(a,b,m-1,n-1);
	}else{
		return max(LCS(a,b,m,n-1),LCS(a,b,m-1,n));
	}
}
*/
//longest common subsequence using dynamic programming

/*int LCS(string a,string b,int m,int n)
{
	int l[m+1][n+1];
	for(int i=0;i<=m;i++){
		for(int j=0;j<=n;j++){
			if(i==0 or j == 0) l[i][j] = 0;
			else if(a[i-1]==b[j-1]) l[i][j] = l[i-1][j-1] + 1;
			else l[i][j] = max(l[i-1][j],l[i][j-1]);
		}
	}
	return l[m][n];
}*/

//print longest common subsequence  using dynamic progarmming
string LCS(string a,string b,int m,int n)
{
	int l[m+1][n+1];
	for(int i=0;i<=m;i++){
		for(int j=0;j<=n;j++){
			if(i==0 or j == 0) l[i][j] = 0;
			else if(a[i-1]==b[j-1]) l[i][j] = l[i-1][j-1] + 1;
			else l[i][j] = max(l[i-1][j],l[i][j-1]);
		}
	}
	//return l[m][n];
	int index = l[m][n];

	char lcs[index+1];
	lcs[index] = '\0';

	int i = m;
	int j = n;
	while(i>0&&j>0){
		if(a[i-1]==b[j-1]){
			lcs[index-1] = a[i-1];
			i--;j--;index--;
		}else if(l[i-1][j]>l[i][j-1]){
			i--;
		}else{
			j--;
		}
	}

	//cout<<lcs<<endl;
	return lcs;
}



int solve() 
{
	//happy coding

	string a,b;
	cin>>a>>b;

	int x = a.size();
	int y = b.size();

	//cout<<"Length of LCS "<<LCS(a,b,x,y)<<endl;
	cout<<LCS(a,b,x,y)<<endl;
	
	return 0;
}
int main(){
	int test = 1;
	//scanf("%d", &test);
	while (test--)solve();return 0;
}

Measured memory_bytes: 35456
number = [int(input()) for i in range(3)]  # コイン枚数の上限
x = int(input())   # 合計金額

a=0
b=0
c=0
ans = 0

for i in range(number[0]+1):
    a = i
    for k in range(number[1]+1):
        b = k
        for l in range(number[2]+1):
            c = l 
            if x ==500*a + 100*b + 50*c:
                ans += 1
            else:
                pass

print(ans)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class125
    {
        static void Main()
        {
            string S = Console.ReadLine();
            int ans = int.MaxValue;
            for(int i = 0; i < S.Length - 2; i++)
            {
                int sub = int.Parse(S.Substring(i, 3));
                ans = Math.Min(ans, Math.Abs(753-sub));

            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
 
  string s,t;
  cin >> s >> t;
  int a,b;
  cin >> a >> b;
  string u;
  cin >> u;

  if(s == u) {
    cout << a-1 << " " << b << endl;;
  } else {
    cout << a << " " << b-1 << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
// cout << fixed << setprecision(10) << ans << endl; 有効桁数指定
// *min_element(c + l, c + r) *max_element(c + l, c + r) 配列の中のmin-max
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// ~ は、-1の時だけfalse

int a[3010];
vector<ll> p(3010);

const int mod = 998244353;

int main () {

    int n,s;cin>>n>>s;

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

    ll ans=0;

    rep(i,n) {
        vector<ll> q(3010);
        p[0]++;
        rep(j,s+1) {
            q[j]=(q[j]+p[j])%mod;
            if (j+a[i]<=s) {
                q[j+a[i]]=(q[j+a[i]]+p[j])%mod;
            }
        }
        ans=(ans+q[s])%mod;
        p=q;
    }

    cout<<ans<<endl;


}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
using namespace std;

int dist(int a, int b, int K) {
    return min(abs(a-b), K-abs(a-b));
}

int main() {
    int N;
    int K;
    cin >> K >> N;
    vector <int> loc(N);

    for (int i = 0; i < N; ++i) {
        cin >> loc[i];
    }

    int ans = K;
    sort(loc.begin(), loc.end());

    for (int i = 0; i < N; ++i) {
        ans = min(ans, K - max(dist(loc[(i+N-1)%N], loc[i], K), dist(loc[(i+1)%N], loc[i], K)));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1152
import sys

#fp = open("input.txt", "r")
fp = sys.stdin

def gcd(a, b):
    return a if b == 0 else gcd(b, a%b)

class Mobile:
    def __init__(self):
        self.len_l = 0
        self.len_r = 0
        self.mob_l = None
        self.mob_r = None
        self.parent = None

    def getWeight(self):
        weight_l = 1 if self.mob_l == None else self.mob_l.getWeight()
        weight_r = 1 if self.mob_r == None else self.mob_r.getWeight()

        moment_l = self.len_l * weight_l
        moment_r = self.len_r * weight_r

        g = gcd(moment_l, moment_r)

        n_l = moment_r / g
        n_r = moment_l / g
        
        return weight_l * n_l + weight_r * n_r

    def getRoot(self):
        if self.parent == None:
            return self
        else:
            return self.parent.getRoot()

    def printTest(self):
        print self.len_l,
        print ", ",
        print self.len_r

while True:
    n = int(fp.readline()[:-1])
    if n == 0:
        break

    li = [Mobile() for i in xrange(n)]

    for i in xrange(n):
        ele = map(int, fp.readline()[:-1].split(" "))
        li[i].num = i+1
        li[i].len_l = ele[0]
        li[i].len_r = ele[1]
        if ele[2] != 0:
            child = li[ele[2]-1]
            li[i].mob_l = child
            child.parent = li[i]
        if ele[3] != 0:
            child = li[ele[3]-1]
            li[i].mob_r = child
            child.parent = li[i]

    print li[0].getRoot().getWeight()

Measured memory_bytes: 4956
#include<bits/stdc++.h>
using namespace std;
const int maxn = 3e3 + 10;
const int mod = 1e9 + 7;
typedef long long ll;
#define lowbit(i) (i & (-i))
ll sum[maxn];
int n,m,k,a[maxn][maxn];
char s[maxn][maxn];
int qry(int x1,int y1,int x2,int y2) {			//查询区间和 
	return a[x2][y2] - a[x1 - 1][y2] - a[x2][y1 - 1] + a[x1 - 1][y1 - 1];
}
vector<int> g;
int solve() {
	int lsty = 0,cnt = 0;
	bool f = true;
	for (int y = 1; y <= m; y++) {
		for (int j = 1; j < g.size(); j++) {
			if (qry(g[j - 1] + 1,lsty + 1,g[j],y) > k) {
				if (y - 1 <= lsty)	 {
					f = false;
					break;
				} else {
					cnt++;
					lsty = y - 1;
					y--;
				}
			}
		}
		if (!f) break;
	}
	if (!f) return 0x3f3f3f3f;
	else return cnt;
}
int main() {
	scanf("%d%d%d",&n,&m,&k);
	for (int i = 1; i <= n; i++)
		scanf("%s",s[i] + 1);
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			a[i][j] = s[i][j] - '0';
			a[i][j] += a[i - 1][j] + a[i][j - 1] - a[i - 1][j - 1];
		}
	}
	int ans = 0x3f3f3f3f;
	for (int i = 0; i < (1 << n); i++) {		//枚举行 
		g.clear();
		int res = 0;
		for (int j = 0; j < n - 1; j++) {
			if ((i >> j) & 1) {
				g.push_back(j + 1);	
				res++;
			}
		}
		g.push_back(0); g.push_back(n);
		sort(g.begin(),g.end());
		res += solve();
		ans = min(ans,res);
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 2304
#include<stdio.h>

int main(void){
	int X, t;
	do{
		scanf("%d%d", &X, &t);
	}while(X < 1 || X > 1000000000 || t < 1 || t > 1000000000);

	if (X < t)	printf("0\n");
	else	printf("%d\n", X - t);

	return 0;
}

Measured memory_bytes: 128
# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

# include <stdio.h>
# include <bits/stdc++.h>


#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

using namespace __gnu_pbds;
using namespace std;
 
typedef
tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;

inline bool isvowel (char c) {
	c = tolower(c);
    if (c == 'a' || c == 'e' || c == 'i' || c == 'y' || c == 'o' || c == 'u') return 1;
    return 0;
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
ll n, m, k;
int cnt[N];
string s;
int a[N];
vector < int > g[N];
int u[N];
int ans, res;
int cur;

int main () {
	SpeedForce;
	cin >> n >> m >> k;
	for (int i = 1; i <= 10 ;i ++) {
		k = k * n - m;
		cout << k << '\n';
	}

	return Accepted;
}

// B...a

Measured memory_bytes: 18688
s = input()
n = len(s) - 1

res = 0
for bit in range(2**n):
    tmp = []
    for i in range(n):
        if (bit >> i) & 1:
            tmp.append('+')
        else:
            tmp.append('')
    e = ''
    for j in range(n):
        e += s[j] + tmp[j]
    else:
        e += s[n]
    res += eval(e)

print(res)

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

using namespace std;
int check_pal(string s){
	for(int i = 0; i < s.length()/2; i++){
		if(s[i] != s[s.length()-  i - 2])	
			return 1;
	}
	return 0;
}
int main(){
	string s;
	cin  >> s;
	int root = 1;
	if(s[s.length() - 1] == '1' || s[0] == '0' || check_pal(s))
		return cout << "-1",0;
	for(int i = 1; i < s.length(); i++){
		cout << root << " " << i+1 << "\n";
		if(i > 1 && s[i-1] == '1'){
			root = i+1;
		}
	}
}

Measured memory_bytes: 1664
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
        while (true) {
            String W = stdIn.next();
            if(W.equals("-")) {
                break;
            }
            int m = stdIn.nextInt();
            for(int i = 0; i < m; i++) {
                int h = stdIn.nextInt();
                String s1 = W.substring(0, h);
                String s2 = W.substring(h);
                W = s2 + s1;
            }
            System.out.println(W);
        }
    }
}


Measured memory_bytes: 26228
# frozen_string_literal: true

n = gets.to_i
d, x = gets.split.map(&:to_i)
a = []
n.times { a << gets.to_i }
count = 0

a.each do |i|
  j = 0
  tmp = i + 1

  while tmp <= d
    tmp += i
    j += 1
  end

  count += j
end

puts count + n + x

Measured memory_bytes: 1788
#include<bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof(a))
#define  For(i,a,b) for(int i=a,i##E=b;i<=i##E;++i)
#define rFor(i,a,b) for(int i=a,i##E=b;i>=i##E;--i)
typedef long long LL;
using namespace std;
const int N=2010;
const LL mod=1e9+7;
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
template<typename T>inline void read(T &x)
{
	x=0;int _f(0);char ch=getchar();
	while(!isdigit(ch))_f|=(ch=='-'),ch=getchar();
	while( isdigit(ch))x=x*10+ch-'0',ch=getchar();
	x=_f?-x:x;
}
inline void file()
{
#ifndef ONLINE_JUDGE
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
}
int n,m;
LL C[N][N],S[N][N],ans;
inline void init(int n)
{
	C[0][0]=1;
	For(i,1,n)
		For(j,0,i)
			C[i][j]=(C[i-1][j]+(j?C[i-1][j-1]:0))%mod;
	For(i,0,n)
		For(j,0,n)
			S[i][j]=((j?S[i][j-1]:0)+C[i][j])%mod;
}
int main()
{
	//file();
	read(n),read(m);
	init(max(n,m));
	ans=n+1;
	For(i,0,n)
	{
		LL ret=0;
		For(j,1,n-i)
			ret=(ret+C[m-1][j]*S[j-1][n-i-j]%mod)%mod;
		ans=(ans+ret*((LL)i+1)%mod)%mod;
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 63232
#include<iostream>
#include<cstdio>

using namespace std;

int main(){
	int lim;
	
	while( cin >> lim, lim != 0){
		int a = 0, b = 0;
		while(lim-- > 0){
			int n, m;
			cin >> n >> m;
			(n == m)? a+=n, b+=m:
			(n > m)? a += n+m: b += n+m;
		}
		printf("%d %d\n", a, b);
	}
	return 0;
}

Measured memory_bytes: 1144
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <deque>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <fstream>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const double EPS = 1e-9;


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

  int n;
  cin>>n;
  int a[n + 2];
  a[0] = 0;a[n+1] = 0;
  rep(i,n) cin>>a[i+1];
  ll sum = 0;
  rep(i, n + 1) {
    sum += abs(a[i] - a[i+1]);
  }
  FOR(i, 1, n + 1) {
    if((a[i] - a[i - 1]) * (a[i+1] - a[i]) >= 0) {
      cout << sum << endl;
    } else {
      int mi = min(abs(a[i] - a[i-1]), abs(a[i] - a[i + 1]));
      cout << sum - mi * 2 << endl;
    }
  }

  return 0;
}


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

 
int main() {
  long long a,n,m,s,op;
  cin >> a >> n >> m;
  long long kl[63] = {};
  for(int i = 1;i <= 63;i++){
    s = 1;
    for(int k = 0;k < n;k++){
      s *= i + a;
    }
    if(s >= m)continue;
    for(int k = 0;k < 9;k++){
      kl[i] += s % 10;
      s /= 10;
    }
    if(kl[i] == i)op++;
  }
  
  cout << op << endl;
}


Measured memory_bytes: 3096
n,m=map(int,input().strip().split(" "))
ans=[0]*m
from collections import defaultdict
d=defaultdict(int)
prev=0
d1=defaultdict(int)
ar=[]

def g(i):
    return i[1]
for i in range(m):
    p,y=map(int,input().strip().split(" "))
    ar.append((p,y,i))

ar.sort(key=g)

for i in range(m):
    b=ar[i][0]
    a=i+1
    s=d[b]+1
    d[b]+=1
    a1=str(1000000+b)[1:]
    a2=str(1000000+s)[1:]
    ans[ar[i][2]]=a1+a2
for i in ans:
    print(i)

Measured memory_bytes: 114356
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    if (N == 1){
        cout << "Hello World" << endl;
    }
    if (N == 2){
        int A, B;
        cin >> A >> B;
        cout << A + B << endl;
    }
}

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

int main()
{
  int n;
  cin >> n;
  string s;
  long ans=0;
  map<string,int> ap;
  
  for(int i=0;i<n;++i){
    cin >> s;
    sort(s.begin(),s.end());
    ans+=ap[s];
    ap[s]+=1;
  }
  
  cout << ans;
  return 0;
}

Measured memory_bytes: 11136
#include<bits/stdc++.h>
using namespace std;
char b[17],c[17]={"CODEFESTIVAL2016"};
int main()
{
    int ans=0;scanf("%s",b);
    for(int i=0;i<strlen(b);i++)
        if(b[i]!=c[i])ans++;
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <queue>
#include <vector>
const int MAXN = 1e5+5;
std::vector<int> G[MAXN];
int deg[MAXN];
int dis[MAXN];
int M, N;
int x, y;

void init() {
  for (int i = 1; i <= N; ++i) {
    deg[i] = dis[i] = 0;
    G[i].clear();
  }
}

int solve() {
  std::queue<int> Q;
  for (int i = 1; i <= N; ++i) {
    if (deg[i]) continue;
    dis[i] = 0;
    Q.push(i);
  }
  while (!Q.empty()) {
    int cur = Q.front();
    Q.pop();
    for (int nxt: G[cur]) {
      if (--deg[nxt]) continue;
      dis[nxt] = dis[cur] + 1;
      Q.push(nxt);
    }
  }
  return *std::max_element(dis+1, dis+N+1);
}

int main() {
  scanf(" %d%d", &N, &M);
  init();
  for (int i = 0; i < M; ++i) {
    scanf(" %d%d", &x, &y);
    G[x].push_back(y);
    ++deg[y];
  }
  printf("%d\n", solve());
  return 0;
}

Measured memory_bytes: 6528
import java.util.*;

public class Main {
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

			if(a != 7){
				if(a != 5){
					System.out.println("NO");
				}
				if(a == 5){
					if(b == 7){
						if(c != 5){
							System.out.println("NO");
						}
						if(c == 5){
							System.out.println("YES");
						}
					}
					if(b == 5){
						if(c != 7){
							System.out.println("NO");
						}
						if(c == 7){
							System.out.println("YES");
						}
					}
					if(b != 7 && b != 5){
						System.out.println("NO");
					}
				}
			}
			if(a == 7){
				if(b == 7){
					System.out.println("NO");
				}
				if(b == 5){
					if(c == 5){
						System.out.println("YES");
					}
					if(c != 5){
						System.out.println("NO");
					}
				}
				if(b != 7 && b != 5){
					System.out.println("NO");
				}
			}
	}
}


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

int main(){
	while(true){
		int x,y,s;
		cin>>x>>y>>s;
		
		if(x==0&&y==0&&s==0)
			break;
		
		int tmax=-1;

		for(int a=1;a<=s-1;a++){
			int ax=a*(100+x)/100;
			int ay=a*(100+y)/100;
			
			for(int b=1;b<=s-1;b++){
				int bx=b*(100+x)/100;
				int by=b*(100+y)/100;
				
	
				if(ax+bx==s){
					tmax=max(tmax,ay+by);
				}else if(ax+bx>s){
					break;
				}
			}
		}
		cout<<tmax<<endl;
	}
	return 0;
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define fast        ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define filein      freopen("input.txt","r",stdin)
#define fileout     freopen("output.txt","w",stdout)
#define ll          long long
#define pii         pair<int,int>
using namespace std;

ll dp[5007][5007];
ll a,b,n;
ll arr[5007],pos[5007];

ll DP(int ind,int cur){
    if(dp[ind][cur]!=-1) return dp[ind][cur];

    if(ind==0) return dp[ind][cur]=0;

    if(pos[ind]>cur) {
        return dp[ind][cur] = DP(ind-1,cur)+b;
    }

    dp[ind][cur] = min(DP(ind-1,pos[ind]),DP(ind-1,cur)+a);
    return dp[ind][cur];
}

int main(){
    fast;
    memset(dp,-1,sizeof dp);

    cin>>n>>a>>b;

    for(int i=1;i<=n;i++) {
        cin>>arr[i];
        pos[arr[i]] = i;
    }

    cout<<DP(n,n)<<endl;

    return 0;
}


Measured memory_bytes: 196480
n = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)

n -= 1

idx = 0
score = a[idx]
n -= 1
idx += 1

while n > 0:
    if n > 1:
        score += a[idx] * 2
        n -= 2
        idx += 1
    else:
        score += a[idx]
        n -= 1

print(score)


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

using namespace std;
typedef long long ll;
ll n,W;
ll wt[100000+1],v[100000+1];
ll mo(ll x){
  if(x>0) return x;
  else return -x;
}
ll cal(){
  ll dp[100000+1],ans=0;
  memset(dp,0x3f,sizeof dp);
  dp[0]=0;
  for(int i=1; i<=n; i++){
    for(int j=100000; j>=v[i]; j--){
      dp[j] = min(dp[j], dp[j - v[i]]+wt[i]);
	  if (dp[j] <= W)ans = max(ans, (ll)j);
    }
  }
  return ans;
}
int main() {
  cin>>n>>W;
  for(int i=1; i<=n; i++){
    cin>>wt[i]>>v[i];
  }
  ll ans = cal();
  cout<<ans<<endl;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define FORI(i,v) for (auto i = v.begin(); i != v.end(); i++)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)
#define YES(b) cout << ((b) ? "YES" : "NO") << endl
#define Yes(b) cout << ((b) ? "Yes" : "No") << endl

int main() {
    cout << fixed << setprecision(15);
    char a; cin >> a;
    if ('a' <= a && a <= 'z') cout << 'a' << endl;
    else cout << 'A' << endl;
}

Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define endl '\n';
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;




int main() {
    
    int n,k,q;
    cin>>n>>k>>q;
    vi v(n,0);
    rep(i,q){
        int a;
        cin>>a;
        v[a-1]++;
    }
    rep(i,n){
        v[i]=k-q+v[i];
    }
    rep(i,n){
        if(v[i]>0)fin("Yes");
        else fin("No");
    }
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(void){
  
    int a=0;
    int b=0;
    int c=0;
    int A[30];
    int d;
    int r=1;
        scanf("%d",&a);
  for(b=0;b<a;b++){
      scanf("%d",&A[b]);
  }
  for(b=1;b<a;b++){
      for(d=0;d<b;d++){
      if(A[b]>=A[d]){
          c=c+1;
      }
  }
  if(b==c){
r=r+1;

  }
  c=0;
  }
printf("%d",r);
}



Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#ifndef U_L_LONG
typedef unsigned long long U_L_LONG;
#endif
#ifndef L_LONG
typedef long long L_LONG;
#endif

static void ABC120D_DecayedBridges();
static void ABC119C_SyntheticKadomatsu();

#if 1
int main()
{
	//ABC120D_DecayedBridges();
	ABC119C_SyntheticKadomatsu();

	fflush(stdout);
	return 0;
}
#endif


class BambooInfo
{
public:
	int _id = -1;
	int _len = 0;
};


class UsePattern
{
public:
	enum {
		ExtendShrinkMP = 1,
		UnionMP = 10,

		Impossible = 0x1FFFFFFF,
	};

public:
	int _targetLen = 0;
	std::vector<BambooInfo> _bbInfos;

	void Register(BambooInfo& bi) {
		_bbInfos.push_back(bi);
	}

	void Erase(BambooInfo& bi) {

		for(auto biit = _bbInfos.begin(); biit != _bbInfos.end(); biit++) {
			if(bi._id == biit->_id) {
				_bbInfos.erase(biit);
				break;
			}
		}
	}

	int calcMp() {
		int infoSize = 0;
		if ((infoSize = _bbInfos.size()) == 0) return Impossible;

		int unionConsumed = (infoSize - 1) * UnionMP;
		int bbLen = 0;
		for (int i = 0; i < infoSize; i++) {
			bbLen += _bbInfos[i]._len;
		}

		int ShrinkOrExtend = abs(_targetLen - bbLen) * ExtendShrinkMP;

		return (unionConsumed + ShrinkOrExtend);
	}
};


static int calc(std::vector<BambooInfo> bbInfo, int infoIdx, int infoSize, std::vector<UsePattern>targets, int targSize)
{
	int minMp = 0x1FFFFFFF;
	int mp = 0;

	if (infoIdx == infoSize) {
		int mp = 0, retMp = 0;
		for (auto it = targets.begin(); it != targets.end(); it++) {
			if ((mp = it->calcMp()) == UsePattern::Impossible) {
				retMp = mp;
				break;
			}
			else {
				retMp += mp;
			}
		}
		return retMp;
	}

	for (int i = 0; i < targSize; i++) {
		//	どの目標長さに対して使用するか
		targets[i].Register(bbInfo[infoIdx]);

		if (minMp > (mp = calc(bbInfo, infoIdx + 1, infoSize, targets, targSize))) {
			minMp = mp;
		}
		targets[i].Erase(bbInfo[infoIdx]);
	}
	//	「この竹を使用しない」パターン
	if (minMp > (mp = calc(bbInfo, infoIdx + 1, infoSize, targets, targSize))) {
		minMp = mp;
	}

	return minMp;
}


static void ABC119C_SyntheticKadomatsu()
{
	enum {
		LenA = 0,
		LenB,
		LenC,

		LenKinds,
	};

	int N = 0;
	scanf(" %d", &N);
	
	UsePattern up;
	std::vector<UsePattern> targets;
	for (int i = 0; i < 3; i++) {
		scanf(" %d", &(up._targetLen));
		targets.push_back(up);
	}

	BambooInfo bi;
	std::vector<BambooInfo> bbInfo;
	for (int i = 0; i < N; i++) {
		scanf(" %d", &(bi._len));
		bi._id = i;
		bbInfo.push_back(bi);
	}

	printf("%d\n", calc(bbInfo, 0, bbInfo.size(), targets, targets.size()));

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> VI;
typedef vector<VI> VVI;
typedef pair<ll, ll> P;
#define FOR(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const ll INF = numeric_limits<ll>::max();
int main()
{
    ll a, b, c, d; cin >> a >> b >> c >>d;
    ll ans = -INF;
    ans = max(ans, a*c);
    ans = max(ans, a*d);
    ans = max(ans, b*c);
    ans = max(ans, b*d);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3648
#include "bits/stdc++.h"
#include<cassert>
#pragma warning(disable:4996)
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define MRE assert(0)
const int mod = 1000000007;
const long long inf = 1ll << 61;
typedef pair<int, int> P;
typedef pair<P, int>PP;
int dp[2][3007][2];
signed main() {
	int n, m; cin >> n >> m;
	rep(i, n + 1) dp[0][i][0]++;

	rep(i, 2 * m) {
		rep(j, n + 1)rep(k, 2)dp[(i+1)&1][j][k] = 0;
		rep(j, n + 1) {
			if (i & 1) {
				if (j == n)break;
				rep(k, 2)dp[0][j + 1][k] += dp[1][j][k];
				rep(k, 2)dp[0][j][k] += dp[1][j][k];
				rep(k, 2)dp[0][j + 1][k] %= mod;
				rep(k, 2)dp[0][j][k] %= mod;
			}
			else {
				if (j != n){
					rep(k, 2)dp[1][j][k] += dp[0][j][k];
					rep(k, 2)dp[1][j][k] += dp[0][j + 1][k];
					rep(k, 2)dp[1][j][k] %= mod;
				}
			}
			dp[(i + 1)&1][0][1] += dp[(i + 1)&1][0][0];
			dp[(i + 1)&1][0][0] = 0;
		}

	}
	int sum = 0;

	/*
	rep(i, 2 * m + 1) {
		rep(j, n + 1) {
			cout << dp[i][j][0] << ' ';
		}
		cout << "| ";
		rep(j, n + 1) {
			cout << dp[i][j][1] << ' ';
		}
		cout << endl;
	}
	*/
	rep(i, n + 1)sum = (sum + dp[0][i][1]) % mod;
	cout << sum << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define rep_start(a,i,n) for(ll i=a;i<=n;i++)
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define rev1(i,n) for(ll i=n;i>0;i--)
#define sz(a) int((a).size())
#define all(c) c.begin(),c.end()
#define tr(c,i) for(typeof(c).begin() i+=c.begin; i!=c.end(); i++)
#define present(c,x) (c.find(x)!=c.end())
#define cpresent(c,x) (find(all(c),x)!=c.end())
#define pb push_back
#define F first
#define S second
#define INF INT_MAX
#define mod 1000000007
#define print1(a) cout<<a<<"\n";
#define print2(a,b) cout<<a<<" "<<b<<"\n";
#define print3(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n";
#define mt make_tuple
#define eb emplace_back

typedef unsigned long long int ll;
typedef vector<ll> vi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef tuple<int,int,int> State;

void solve(){
    int k;cin>>k;
    string s;cin>>s;
    int l=s.length();
    if(l<=k) cout<<s;
    else cout<<s.substr(0,k)<<"...";
}

signed main() {
    // your code goes here
    IOS
    ll t=1;
    //cin>>t;
    rep1(i,t){
        solve(); 
    }
    return 0;
}

Measured memory_bytes: 3664
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int main() {
    double a, b, x;
    cin >> a >> b >> x;
    double ans;
    if(x <= a*a*b/2) {
        ans = atan2(b*b*a, (2.0 * x)) * 360 / (2*M_PI);
    } else {
        ans = atan2(2*(a*a*b-x), a*a*a) * 360 / (2*M_PI);
    }

    printf("%.10f\n", ans);
    return 0;
}

Measured memory_bytes: 256