akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;}
template <typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;}

bool isMM(string &S) {
    if (S[0] == '0' && S[1] != '0' || S[0] == '1' && S[1] <= '2') {
        return true;        
    }
    return false;
}

void solve() {
    string S;
    cin >> S;
    string s1 = S.substr(0, 2);
    string s2 = S.substr(2, 2);
    bool s1MM = isMM(s1);
    bool s2MM = isMM(s2);
    if (s1MM && s2MM) {
        cout << "AMBIGUOUS" << endl;
    } else if (s1MM && !s2MM) {
        cout << "MMYY" << endl;
    } else if (!s1MM && s2MM) {
        cout << "YYMM" << endl;
    } else {
        cout << "NA" << endl;
    }
}

int main() {
    #ifdef LOCAL_ENV
    cin.exceptions(ios::failbit);
    #endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    
    solve();
}

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

int main() {
  int N, M, max = 0, count;
  
  cin >> N;
  vector<string> s(N);
  for (int i = 0; i < N; i++)
    cin >> s.at(i);
  
  cin >> M;
  vector<string> t(M);
  for (int i = 0; i < M; i++)
    cin >> t.at(i);
  
  for (int i = 0; i < N; i++) {
    count = 0;
    for (int j = 0; j < N; j++) {
      if (s.at(i) == s.at(j))
        count++;
    }
    for (int j = 0; j < M; j++) {
      if (s.at(i) == t.at(j))
        count--;
    }
    if (count > max)
      max = count;
  }
  cout << max << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007


int main() {
	ll n,k,q;
	cin>>n>>k>>q;
	ll a[100010];
	for(ll i=0;i<n;i++){
		a[i]=k-q;
	}
	for(ll i=0;i<q;i++){
		ll x;
		cin>>x;
		x--;
		a[x]++;
	}
	for(ll i=0;i<n;i++){
		if(a[i]<=0){
			cout << "No";
		}
		else{
			cout << "Yes";
		}
		cout <<endl;
	}
	// your code goes here
	return 0;
}

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

class UF{
  vi p,r;

public:
  UF(int n):p(n,-1),r(n,0){ }

  inline int find(int x){ return (p[x]<0)?x:(p[x] = find(p[x])); }

  inline void unite(int x,int y){
    x = find(x); y = find(y);
    if(x==y)return;

    if(r[x] < r[y])p[x] = y;
    else p[y] = x;
    if(r[x] == r[y])r[x]++;
  }

  inline bool same(int x,int y){return find(x)==find(y);}
};

int memo[1001][1001][2];

inline int rec(int odd, int even, int edges){
  if(memo[odd][even][edges]>=0)return memo[odd][even][edges];
  if(odd + even == 2)return edges;

  int &res = memo[odd][even][edges];
  if(edges && !rec(odd, even, 1-edges))return res=1;
  if(odd && even && !rec(odd, even-1, 1-edges))return res=1;
  if(odd >= 2 && !rec(odd-2, even+1, edges))return res=1;
  if(even >= 2 && !rec(odd, even-1, 1-edges))return res=1;

  return res = 0;
}

int main(){
  int n;
  scanf("%d",&n);
  UF uf(n);

  char s[1010];
  int num = 0;
  rep(i,n){
    scanf("%s",s);
    rep(j,i)if(s[j] == 'Y')uf.unite(i,j), num--;
  }

  vi card(n,0);
  rep(i,n)card[uf.find(i)]++;
  
  int odd = 0, even = 0;
  rep(i,n){
    if(card[i]){
      if(card[i] & 1)odd++;
      else even++;
      num += card[i]*(card[i]-1)/2;
    }
  }

  memset(memo,-1,sizeof(memo));
  if(rec(odd, even, num&1))puts("Taro");
  else puts("Hanako");
}

Measured memory_bytes: 9112
def main():
    from collections import Counter
    from itertools import accumulate
    s = input()

    n = 2019
    l = [0]
    t = 1
    for i, x in enumerate(s[::-1]):
        t = t * 10 % n
        y = (l[-1] + int(x) * t) % n
        l.append(y)

    c = Counter(l)
    ans = accumulate([v * (v - 1) // 2 for v in c.values()])
    print(list(ans)[-1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 16952
x = [[0]*50 for i in range(11)]
for i in range(0, 2**10):
    B = format(i,'b')[::-1]
    s,c,j = 0,0,0
    for e in B:
        if e=="1": s,c = s+j, c+1
        j +=1
    x[c][s]+=1

while 1:
    n, s=map(int, raw_input().split())
    if n==0 and s==0: break
    print 0 if s>=50 else x[n][s]

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

int main(){
  int l , r , d;
  int count = 0;
  scanf("%d %d %d",&l,&r,&d);
  for(int i = l;i <= r;i++){
    if(i % d == 0)
      count++;
  }
  cout << count << "\n";
  return 0;
}


Measured memory_bytes: 3600
#include<stdio.h>
#include<string.h>
int main(void)
{
	int cnt,x;
	char s[4];
	scanf("%s",&s);
	cnt=0;
	if(s[0]=='o'){
		cnt++;
	}
	if(s[1]=='o'){
		cnt++;
	}
	if(s[2]=='o'){
		cnt++;
	}
	x=700+cnt*100;
	printf("%d\n",x);
	return 0;
}

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

std::vector<int> v[26];
std::vector<int> sibling[26];
struct Data
{
    int parent_index, depth, sibling, degree, height;
    std::string type;
};
std::map<int, Data> data;

int dfs(const int index, const int parent_index, const int depth)
{
    
    int size = v[index].size();
    //cout << index << ", " << parent_index << ", " << depth << ", "
    //     << size << ", " << sibling[index].size() << endl;
    Data d;
    d.parent_index = parent_index;
    if(sibling[index].size() == 0){
        d.sibling = -1;
    }else{
        d.sibling = sibling[index].front();
    }
    if(d.parent_index == -1){
        d.degree = size;
    }else{
        d.degree = size - 1;
    }
    d.depth = depth;
    d.height = 0; //初期化のみ、dfsの戻り値で設定する

    if(d.parent_index == -1) d.type = "root";
    else if(size == 1) d.type = "leaf";  // 接点が親だけ
    else d.type = "internal node";
    data[index] = d;
    
    for(int i=0; i<size; i++){
        int child = v[index][i];
        if(child == parent_index) continue;
        int height = dfs(child, index, depth+1);
        height++;
        if(height > data[index].height) data[index].height = height;
    }
    return data[index].height;
}

int main()
{
    int n;
    cin >> n;
    std::vector<int> childlist;
    for(int i=0; i<n; i++){
        int id, left, right;
        cin >> id >> left >> right;
        if(left != -1){
            v[id].push_back(left);
            v[left].push_back(id);
            childlist.push_back(left);  // root検索用
            sibling[left].push_back(right);
        }
        if(right != -1){
            v[id].push_back(right);
            v[right].push_back(id);
            childlist.push_back(right);  // root検索用
            sibling[right].push_back(left);
        }
    }
    int root = -1;
    for(int i=0; i<n; i++){
        std::vector<int>::iterator itr;
        itr = std::find(childlist.begin(), childlist.end(), i);
        if(itr == childlist.end()){
            root = i;
        }
    }
    if(root == -1) cout << "root not found." << endl;
    int height = dfs(root, -1, 0);
    
    for(int index=0; index<n; index++){
        Data d = data[index];
        cout << "node " << index << ": parent = " << d.parent_index
             << ", sibling = " << d.sibling << ", degree = " << d.degree
             << ", depth = " << d.depth << ", height = " << d.height
             << ", " << d.type << endl;
    }
}



Measured memory_bytes: 3212
using System;

namespace Circle
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = int.Parse(Console.ReadLine());
            double area = Math.PI * Math.Pow(input, 2);
            area = Convert.ToInt32(area);
            
            var countArea = area / Math.PI * Math.Pow(1, 2);
            int output = Convert.ToInt32(countArea);

            Console.WriteLine(output);
        }
    }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
int main(){
  int F, C100, C10, C1;
  cin >> F;
  
  C100 = F / 100;
  F = F % 100;
  
  C10 = F / 10;
  C1 = F % 10;
  
  if(C100 != 0 && C100 % 7 == 0) cout << "Yes" << endl;
  else if(C10 != 0 && C10 % 7 == 0) cout << "Yes" << endl;
  else if(C1 != 0 && C1 % 7 == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 3616
import sys
H,W,A,B = (int(i) for i in input().split())

ans = []
for h in range(B):
  row = [0]*A + [1]*(W-A)
  print(*row,sep="")
for h in range(H-B):
  row = [1]*A + [0]*(W-A)
  print(*row,sep="")
sys.exit()



Measured memory_bytes: 5492
#include<bits/stdc++.h>
using namespace std;
int main()
{
    
    long long int n,k,j,sum=0;
    cin>>n>>k;
    for(j=0;j<k;j++)
    {
        
        int y;
        cin>>y;
        sum+=y;
    }
    if(sum>=n)
        cout<<"Yes";
    else
        cout<<"No";
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define INF (1<<28)
#define DEKAI 1000000007
#define FDST int hogehoge;cin>>hogehoge;
 
int main(){
  int c,n,m;
  int gv[10000],gs[10000];
  int a[10001];
  int ans[10001];
  cin>>c>>n>>m;
  for(int i=0;i<n;i++){
    cin>>gs[i]>>gv[i];
  }
  for(int i=0;i<c+1;i++){
    a[i]=-1;
  }
  a[0]=0;
  for(int i=0;i<n;i++){
    for(int j=c+1-gs[i];j>=0;j--){
      if(a[j]!=-1) a[j+gs[i]]=max(a[j+gs[i]],a[j]+gv[i]);
    }
  }
  ans[0]=0;
  for(int i=1;i<c+1;i++){
    if(ans[i-1]<a[i]) ans[i]=a[i];
    else ans[i]=ans[i-1];
  }
  
  for(int i=0;i<m;i++){
    cout<<ans[c/(i+1)]*(i+1)<<endl;
    }
  return 0;
}


Measured memory_bytes: 3236
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
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;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] >= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int main() {
	long long int k, n;
	cin >> k >> n;
	vector<long long int>s;
	for (int i = 0; i < n; i++) {
		long long int a;
		cin >> a;
		s.push_back(a);
	}
	long long int maxsum = 0;
	for (int i = 0; i < n; i++) {
		if (i == n - 1) {
			maxsum = max(maxsum, s[0]+k - s[n-1]);
		}
		else {
			maxsum = max(maxsum, s[i + 1] - s[i]);
		}
	}
	cout << k-maxsum;
}


Measured memory_bytes: 2420
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;
#define RET(ans) {cout<<ans<<endl;return 0;} 

    // 二次元ベクターの基本
    /*
    vector<vector<int>> dp; // 宣言
    dp.resize(n); // 1次元めの要素数決定
    dp[i].push_back(int); // プッシュバック
    rep(i,n){
        sort(dp[i].begin(),dp[i].end()); // 二次元めを昇順ソート
    }
    */

    // 整数スキャン（複数）
    /*
    int x,y,z;
    scanf("%d%d%d",&x,&y,&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s; cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s; cin >> s;
        slist.push_back(s);
    }
    */

int main() {
    int n;
    cin >> n;
    int v[n];
    rep(i,n){
        cin >> v[i];
    }
    int c[n];
    rep(i,n){
        cin >> c[i];
    }


    ll ans = 0;

    rep(i,n){
        if(v[i]>c[i]){
            ans += v[i]-c[i];
        }
    }
    
    cout << ans << endl;
    return 0;
}
 
 


Measured memory_bytes: 256
def main():
    n, k = map(int, input().split())
    d = set(map(int, input().split()))

    for i in range(n, 90000):
        for j in str(i):
            if int(j) in d:
                break

        else:
            print(i)
            break


if __name__ == '__main__':
    main()


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

int main() {
  int n, m, c;
  cin >> n >> m >> c;
  vector<int> b(m);
  rep(i, m){
	cin >> b.at(i);  	
  }
  int cnt = 0;
  rep(i, n){
    int sum = 0;
  	rep(j, m){
    	int num; cin >> num;
      	sum += b[j] * num;
    }
    if(sum + c > 0){
    	cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}

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

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

int main() {
  int K, N;
  cin >> K >> N;
  int a[N+1];
  rep(i, N) {
    cin >> a[i];
  }

  a[N] = K + a[0];

  int m;

  rep(i, N) {
    int temp = a[i+1] - a[i];
    m = max(m, temp);
  }

  int ans = K - m;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<ctype.h>


int main()
{
	char a[11],b[11],c[11],d[3];
	int j=0;
	char ch;
	
	scanf("%s%s%s",a,b,c);
	d[0]=a[0];
	d[1]=b[0];
	d[2]=c[0];

	for(int i=0;i<3;i++){

		ch=d[i];
		putchar(toupper(ch));
	}
	

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll s(ll n) {
  ll res = 0;
  while (n) {
    res += n % 10;
    n /= 10;
  }
  return res;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int k;
  cin >> k;
  ll base = 0;
  ll cnt = 0;
  vector<pair<ll,double>> ans;
  for (ll base = 0; base <= 1e16-1; base = base * 10 + 9) {
    ll mul = 1LL;
    for (int i = 0; i < cnt; i++) {
      mul *= 10;
    }
    for (ll p = 1; p < 150; p++) {
      ll tmp = p * mul + base;
      ans.push_back(make_pair(tmp, (double)tmp / (double)s(tmp)));
    }
    cnt++;
  }
  sort(ans.begin(),ans.end());
  vector<ll> out;
  double mi = ans.back().second;
  ll before = -1;
  for (int i = ans.size() - 1; i >= 0; i--) {
    if (ans[i].second <= mi && ans[i].first != before) {
      mi = ans[i].second;
      before = ans[i].first;
      out.push_back(before);
    }
  }
  sort(out.begin(), out.end());
  for (int i = 0; i < k; i++) {
    cout << out[i] << endl;
  }
  return 0;
}


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

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if(abs(c-a)<=d || max(abs(b-a), abs(b-c))<=d)cout << "Yes";
  else cout << "No";
  return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
int main() {
char a[2];
int x = 0;
scanf("%s", a);
if (a[0] == 'o') {
x = 100;
} if (a[1] == 'o') {
x += 100;
} if (a[2] == 'o') {
x += 100;
} printf("%d\n", x + 700);
return 0;
}  

Measured memory_bytes: 128
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=100005;
int p[N],noww[2*N],goal[2*N],col[N],c[5];
long long n,m,cnt,t1,t2,nb;
void link(int f,int t)
{
    noww[++cnt]=p[f];
    goal[cnt]=t,p[f]=cnt;
}
void dye(int nde,int cor)
{
    col[nde]=cor,c[cor]++;
    for(int i=p[nde];i;i=noww[i])
        if(!col[goal[i]]) dye(goal[i],3-cor);
        else if(col[goal[i]]==cor) {nb=true; return ;}
}
int main ()
{
    scanf("%lld%lld",&n,&m);
    for(int i=1;i<=m;i++)
        scanf("%lld%lld",&t1,&t2),link(t1,t2),link(t2,t1);
    for(int i=1;i<=n;i++)
        if(!col[i]) dye(i,1);
    if(nb) printf("%lld",1ll*n*(n-1)/2-m);
    else printf("%lld",1ll*c[1]*c[2]-m);
    return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:
// Description: グラフの型定義(これは最小費用流)
// Verifyed: Many Diffrent Problem 

//Appropriately Changed
using edge=struct{int to;};
using G=vector<vector<edge>>;

void add_edge(G &graph,int from,int to){ 
	graph[from].push_back({to});
	graph[to].push_back({from});
}


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

	G graph(n);

	int a,b;
	rep(i,m){
		cin >> a >> b;
		a--,b--;
		add_edge(graph,a,b);
	}

	vector<int> visited(n,0);

	vector<int> patha={a},pathb={b};

 
	visited[a]=visited[b]=1;

	{
		int cv = a;
		bool update= true;
			
		while(update){
			update = false;

			for(auto &e:graph[cv]){			
				const int nv=e.to;
				if(visited[nv]==false){
					visited[nv]=true;
					cv = nv;
					patha.push_back(cv);
					update = true;
					break;
				}
			}
		}
	}

	{
		int cv = b;
		bool update= true;
			
		while(update){
			update = false;
			for(auto &e:graph[cv]){			
				const int nv=e.to;
				if(visited[nv]==false){
					visited[nv]=true;
					cv = nv;
					pathb.push_back(cv);
					update = true;
					break;
				}
			}
		}
	}


	reverse(begin(patha),end(patha));
	const int k = int(patha.size())+ int(pathb.size());
	cout << k << endl;

	bool first = true;
	
	for(const auto &it:patha){
		if(first==false) cout << " ";
		first=false;
		cout << it+1;
	}

	for(const auto &it:pathb){
		if(first==false) cout << " ";
		first=false;
		cout << it+1;
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 7160
s=input()
n=len(s)
if s==s[::-1]:
    if s[:(n-1)//2:]==s[(n-3)//2::-1] and s[(n+1)//2::]==s[:(n-1)//2:-1]:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Measured memory_bytes: 3060
#include <stdio.h> 
#include <algorithm> 
#include <iostream> 
#include <string.h> 
#include <queue>
#include <stack>
#include <stdlib.h>
using namespace std;

stack<int> kuohao;

int main(){
    double a,b;
    cin>>a>>b;
    int c;
    c = 2*b-a;
    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
//#include <iomanip>
#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
//#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	ll n ; cin >> n ;
	set<string> s ;
	for(int i=0;i<n;i++){
		string sub ; cin >> sub ;
		s.insert(sub) ;
	}
	cout << s.size() << endl ;
}


Measured memory_bytes: 19228
n,m = map(int,input().split())
di = [[] for _ in range(n)]
ac = 0
wa = 0
for i in range(m):
    a,b = map(str,input().split())
    di[int(a)-1].append(b)
for j in range(n):
    if "AC" in di[j]:
        wa += di[j].index("AC")
        ac += 1
print(ac,wa)

Measured memory_bytes: 20340
#include <stdio.h>

int main(void){
        int i, j;
        int h, w;

        while(1){
                scanf("%d %d", &h, &w);

                if( h==0 && w==0 )
                        break;

                for( i=0 ; i<h ; i++ ){
                        for( j=0 ; j<w ; j++ ){
                                if( (i%2==0 && j%2==0) || (i%2==1 && j%2==1))
                                        putchar('#');
                                else if( (i%2==1 && j%2==0) || (i%2==0 && j%2==1) )
                                        putchar('.');
                        }
                        putchar('\n');
                }
                        putchar('\n');
        }

        return 0;
}


Measured memory_bytes: 2040
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner sc = new Scanner(System.in);
		while ( sc.hasNext() ) {
			Point p1 = new Point( sc.nextDouble(), sc.nextDouble() );
			Point p2 = new Point( sc.nextDouble(), sc.nextDouble() );
			Point p3 = new Point( sc.nextDouble(), sc.nextDouble() );
			Point p = new Point( sc.nextDouble(), sc.nextDouble() );

			Line l1 = new Line(p1, p2);
			Line l2 = new Line(p2, p3);
			Line l3 = new Line(p3, p1);

			if (issameside(p, p1, l2)
					&& issameside(p, p2, l3)
					&& issameside(p, p3, l1)) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	}

	public static class Point {
		double x;
		double y;

		public Point(double x, double y) {
			this.x = x;
			this.y = y;
		}
	}

	public static class Line {
		Point p1; // (p1.x, p1.y)
		Point p2; // (p2.x, p2.y)

		public Line(Point p1, Point p2) {
			this.p1 = p1;
			this.p2 = p2;
		}
	}

	private static boolean isvertical(Line l) {
		if (l.p1.x == l.p2.x) return true;
		else return false;
	}

	private static double gety(Line l, double x) {
		if (isvertical(l)) return 0;
		double a = (l.p2.y - l.p1.y)/(l.p2.x - l.p1.x);
		double b = l.p1.y - a * l.p1.x;
		return a*x + b;
	}

	public static boolean issameside(Point a, Point p, Line l) {
		//  l.p1 = (l.p1.x, l.p1.y) ??¨ l.p2 = (l.p2.x, l.p2.y) ???????????´??? l ??????
		//  y - p1.y = (p2.y - p1.y)/(p2.x - p1.x) * (x - p1.x)
		if (isvertical(l)) {
			if (a.x < l.p1.x && p.x < l.p1.x) return true;
			else if (l.p1.x < a.x && l.p1.x < p.x) return true;
			else return false;
		}

		if (a.y < gety(l, a.x) && p.y < gety(l, p.x)) return true;
		else if (gety(l, a.x) < a.y && gety(l, p.x) < p.y) return true;
		else return false;
	}
}

Measured memory_bytes: 31916
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define ENDL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n;
	std::cin >> n;
	std::string s;
	std::cin >> s;
	int count = 0;
	rep(i,1000) {
		int a,b,c;
		a=i/100;b=(i%100)/10;c=i%10;
		int x = 0;
		while(x<n && s[x]-'0'!=a) x++;
		if(x==n) continue;
		x++;
		while(x<n && s[x]-'0'!=b) x++;
		if(x==n) continue;
		x++;
		while(x<n && s[x]-'0'!=c) x++;
		if(x==n) continue;
		count++;
	}
	print(count);

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define X real()
#define Y imag()
const double EPS = 1e-8;
const double INF = 1e12;
typedef complex<double> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}

//外積
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}

//内積
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

//線 (線分)
struct L : public vector<P> {
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};

int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // counter clockwise
  if (cross(b, c) < 0)   return -1;       // clockwise
  if (dot(b, c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0;
}

bool intersectSP(const L &s, const P &p) {
  return abs(s[0]-p)+abs(s[1]-p)-abs(s[1]-s[0]) < EPS; // triangle inequality
}

bool intersectSS(const L &s, const L &t) {
  return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0 &&
         ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0;
}

//線分lに対する、点pの射影
//射影とは、pからlに垂線を引いた時の交点
P projection(const L &l, const P &p) {
  double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
  return l[0] + t*(l[0]-l[1]);
}


double distanceSP(const L &s, const P &p) {
  const P r = projection(s, p);
  if (intersectSP(s, r)) return abs(r - p);
  return min(abs(s[0] - p), abs(s[1] - p));
}

double distanceSS(const L &s, const L &t) {
  if (intersectSS(s, t)) return 0;
  return min(min(distanceSP(s, t[0]), distanceSP(s, t[1])),
             min(distanceSP(t, s[0]), distanceSP(t, s[1])));
}


int main() {
  int Q; cin >>Q;
  REP(q, Q){
    int x0, y0, x1, y1, x2, y2, x3, y3;
    scanf("%d %d %d %d %d %d %d %d", &x0, &y0, &x1, &y1, &x2, &y2, &x3, &y3);
    L l1 = L(P(x0, y0), P(x1, y1)), l2 = L(P(x2, y2), P(x3, y3));
    printf("%.10lf\n", distanceSS(l1, l2));
  }
  
  return 0;
}

Measured memory_bytes: 1288
my $N = glob<>;
my @A = glob<>;
my $r = 1;
my $i = 0;
while($r && $i < $N){
    if($A[$i]%2==0){
        $r = ($A[$i]%3==0 || $A[$i]%5==0) ? 1 : 0;
    }
    $i++;
}
my $m = $r ? "APPROVED" : "DENIED";
print $m;

Measured memory_bytes: 768
#include <iostream>
using namespace std;
int main(){
	int n,m,ans=0;
	cin>>n>>m;
	while(n--){
		int count = 0;
		for(int i=0,a;i<m;++i){
			cin>>a;
			if(a==1) count++;
		}
		if(ans<count)ans=count;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
using namespace std;

int main()
{
	string S;
	vector<int> I;
	cin >> S;
	int A=0, B=0, C=2,D=2;

	for (int i = 0; i < 4; i++)
	{
		int a = S[i] - '0';
		I.push_back(a);
	}
	for (int i = 0; i < 4; i++)
	{
		if (i == 0)
		{
			A = A + 10 * I[i];
		}
		if (i == 1)
		{
			A = A + I[i];
		}
		if (i == 2)
		{
			B = B + 10*I[i];
		}
		if (i == 3)
		{
			B = B + I[i];
		}
	}

	if (A > 12)
	{
		C = 0;
	}
	if (B > 12)
	{
		D = 0;
	}
	if (A == 0)
	{
		C = 1;
	}
	if (B == 0)
	{
		D = 1;
	}

	if (C == 2 && D == 2)
	{
		cout << "AMBIGUOUS" << endl;
	}
	if (C != 2 && D == 2)
	{
		cout << "YYMM" << endl;
	}
	if (C == 2 && D != 2)
	{
		cout << "MMYY" << endl;
	}
	
	if (C == 0 && D == 1)
	{
		cout << "NA" << endl;
	}
	if (C == 1 && D == 0)
	{
		cout << "NA" << endl;
	}
	if (C == 0 && D == 0)
	{
		cout << "NA" << endl;
	}
	if (C == 1 && D == 1)
	{
		cout << "NA" << endl;
	}
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
	int n;
	cin >> n;
	int *array = new int[n];
	for (int i = 0;i < n;i++) {
		cin >> array[i];
	}

	for (int i = 0;i < n;i++) {
		if(i<n-1)cout << array[i] << ' ';
		else cout << array[i] <<endl;
	}
	for (int i = 1;i < n;i++) {
		int v = array[i];
		int j = i - 1;
		while (j>=0 && array[j]>v) {
			array[j + 1] = array[j];
			j--;
		}
		array[j+1] = v;
		for (int k = 0;k < n;k++) {
			if (k<n - 1)cout << array[k] << ' ';
			else cout << array[k] << endl;
		}
	}

    return 0;
}


Measured memory_bytes: 3072
// ######      ###      #######    #######    ##     #     #####        ###     ##### //
// #     #    #   #          #        #       # #    #    #     #      #   #     ###  //
// #     #   #     #        #         #       #  #   #   #       #    #     #    ###  //
// ######   #########      #          #       #   #  #   #           #########    #   //
// #     #  #       #     #           #       #    # #   #    ####   #       #    #   //
// #     #  #       #    #            #       #     ##   #    #  #   #       #        //
// ######   #       #   #######    #######    #      #    #####  #   #       #    #   //


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> ppl;
#define ain(a,n) for(ll i=0;i<(n);++i)	cin>>(a)[i];
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(ll i=0;i<(n);++i)
#define FOR(i,a,b) for(ll i=(a);i<=(b);++i)
#define FORD(i,a,b) for(ll i=(a);i>=(b);--i)
#define cases ll T=0;cin>>T;while(T--)
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define END "\n"
#define pb push_back
#define mp make_pair
#define go(c,itr) for(auto itr=(c).begin(); itr!=(c).end(); ++itr)
// #define back(c,itr) for(auto itr=(c).rbegin(); itr!=(c).rend(); ++itr)
#define PI 3.14159265359
#define inf 9e18
#define MOD 1000000007
#define MODU 998244353
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define MAXN 200005
#define BLOCK 555
const string alpha = "abcdefghijklmnopqrstuvwxyz";
const ll N = 200005;
const long double epsilon = 1e-9;
ll binexp(ll a, ll b, ll m) {
	a %= m;
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return res;
}
ll modinvfermat(ll a, ll m)
{
	return binexp(a, m - 2, m);
}
void task(bool flag)
{
	if (flag)
		cout << "YES\n";
	else
		cout << "NO\n";
}
ll lcm(ll a, ll b)
{
	return ((1LL * a * b) / (__gcd(a, b)));
}

signed main() {

	fast
	ll n, k;
	cin >> n >> k;
	vl a(n);
	ain(a, n);
	vl dp(k + 1, 0);
	FOR(i, 1, k)
	{
		for (auto x : a)
		{
			if (i >= x && dp[i - x] == 0)
			{
				dp[i] = 1;
				break;
			}
		}
	}
	if (dp[k])
		cout << "First\n";
	else
		cout << "Second\n";




	return 0;
}


Measured memory_bytes: 3940
fun main(args: Array<String>) {
    val (n,h) = readLine()!!.split(" ").map { it.toInt() }
    val ab = (1..n).map { readLine()!!.split(" ").map { it.toInt() } }

    val a = ab.map { it[0] }.max()!!
    val b = ab.map { it[1] }.filter { it>a }.sortedDescending()

    var damage = 0
    var count = 0
    while(damage<h) {
        if(b.isNotEmpty()) damage += b[count++]
        if(count==b.size) {
            count += (h-damage+a-1)/a
            break
        }
    }
    println(count)

}


Measured memory_bytes: 62956
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>
typedef long long int ll;
//#include<bits/stdc++.h>


using namespace std;





int main()
{
    ll n, k, a = 1;
    cin >> n >> k;
    cout << setprecision(20);
    while (n--) {
        a *= k;
        a %= 1000000007;
    }
    cout << a<< endl;
   

    return 0;

}


Measured memory_bytes: 3112
#include"bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long INT;
double PI = 3.14159265;

const long long INF = 1LL << 60;


int main() {
    int n,l;
    string s[101];

    cin >> n >> l;

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

    sort(s, s + n);

    rep(i,n)cout << s[i] << flush;
    cout << endl;

  return 0;
}

Measured memory_bytes: 256
//1.read question_2.read I/O_3.read test cases_4.read constraints(to decide TC of solution)_5.decide method_6.dry run_
//7.code_8.test_9.submit
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define mod 1000000007
#define F first
#define S second
#define _READ freopen("input.txt","r", stdin);
#define pb push_back
#define MP make_pair
#define _FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int main()
{
    
    _FAST
    lli n,t,i,j,k,ans=0,flag=0,a,b,m;
    cin>>n>>m;
    vector<string> v(n);
    for(auto &i:v)
        cin>>i;
    vector<vector<lli>> dp(n,vector<lli>(m,0));
    for(i=1;i<n;i++)
    {
        if(v[i][0]=='.')
            dp[i][0]=1;
        else
            break;
    }
    for(i=1;i<m;i++)
    {
        if(v[0][i]=='.')
            dp[0][i]=1;
        else
            break;
    }
    for(i=1;i<n;i++)
        for(j=1;j<m;j++)
            if(v[i][j]=='.')
                dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
    cout<<dp[n-1][m-1];
    return 0;
}


Measured memory_bytes: 9216
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
#include <iomanip>
#define M_PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;

const int MAX = 200000;
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;
}
struct edge {
	int t;
	ll cost;
	edge(int _t, ll _cost) : t(_t)
		, cost(_cost) {
	}
};
bool isPrime(int n) {

	if (n == 1) return false;
	for (ll i = 2; i * i <= n; i++)
	{
		if (n % i == 0) return false;
	}
	return true;
}
int anyDigitSum(int n) {
	int res = 0;
	while (n > 0)
	{
		res += n % 10;
		n /= 10;
	}
	return res;
}

void Solve() {

	string s;
	cin >> s;
	bool exc = false;
	for (size_t i = 0; i < s.size(); i++)
	{
		if (s[i] == 'C') exc = true;
		if (s[i] == 'F' && exc) {
			cout << "Yes" << endl;
			return;
		}
	}
	cout << "No" << endl;
}
int main() {
	Solve();
	return 0;
}



Measured memory_bytes: 256
L, R = map(int, input().split())
m = 2019

if R - L >= 2018:
    print("0")
else:
    ans = 2020
    for i in range(L, R+1):
        for j in range(i+1, R+1):
            t = ((i%m) * (j%m)) % m
            ans = min(ans, t)
    print(ans)


Measured memory_bytes: 9184
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
//----------------------------------------------------------------

// int MOD = 998244353;
int MOD = 1000000007;
int m[1001][1001] = {0};
//----------------------------------------------------------------
signed main(){

	ll h,w,a,b;
	cin >> h >> w >> a >> b;
	if(h == 1){
		rep(i,a)cout << 1;
		rep(i,w-a)cout << 0;
		return 0;
	}
	if(w == 1){
		rep(i,b)cout << 1 << endl;
		rep(i,h-b)cout << 0 << endl;
		return 0;
	}
	rep(i,h){
		rep(j,w){
			if((i<b&&j<a)||(i>=b&&j>=a))m[i][j] = 1;
			else m[i][j] = 0;
		}
	}
	rep(i,h){
		rep(j,w)cout << m[i][j];
		cout << endl;
	}

	

	return 0;
}

//----------------------------------------------------------------

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://ddcc2017-final.contest.atcoder.jp/tasks/ddcc2017_final_b
// rm -r -f test;oj dl https://agc038.contest.atcoder.jp/tasks/agc038_a

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

using namespace std;

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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;

int main()
{
	ll n;
	cin >> n;
	ll ans = 0;
	ans += (n / 500) * 1000;
	n %= 500;
	ans += (n / 5)*5;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
int mod= pow(10,9) +7;
int main() {
int n;
cin>>n;
double a[n];

for(int i=0;i<n;i++){
    cin>>a[i];

}


double dp[n+1][n+1];

dp[0][0]=1;

for(int i=1;i<=n;i++){
    dp[i][0]=(1.0-a[i]);
    dp[0][i]=0.0;

}
// probability of getting j heads with n coins 

for(int i=1;i<=n;i++){
    for(int j=0;j<=n;j++){

        if(j==0){
        dp[i][j]=(1.0-a[i-1])*dp[i-1][j];
        }else{
        dp[i][j]=(a[i-1]*dp[i-1][j-1])+(1.0-a[i-1])*dp[i-1][j];
        }

    }
}

double ans=0.0;

for(int i=n/2+1;i<=n;i++){
    ans+=dp[n][i];

}

cout<<fixed<<setprecision(10)<<ans;


return 0;

}


Measured memory_bytes: 74064
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        NSData *stdinData = [[NSFileHandle fileHandleWithStandardInput] availableData];
        NSString *s = [[NSString alloc] initWithData:stdinData encoding:NSUTF8StringEncoding];
        NSArray *arr = [s componentsSeparatedByString:@" "];
        NSInteger a = [[arr objectAtIndex:0] integerValue];
        NSInteger b = [[arr objectAtIndex:1] integerValue];
        
        NSString *answer = [NSString stringWithFormat:@"%ld",(a-1)*(b-1)];
        
        NSFileHandle *fileHandle = [NSFileHandle fileHandleWithStandardOutput];
        [fileHandle writeData:[answer dataUsingEncoding:NSUTF8StringEncoding]];
        [fileHandle writeData:[@"\n" dataUsingEncoding:NSUTF8StringEncoding]];
        [fileHandle closeFile];
    }
    
    return 0;
}


Measured memory_bytes: 2404
#include <iostream>

using namespace std;

int main(){
	double v,t,y;
	int n;
	while(cin>>v){
		n=1;
		t=v/9.8;
		y=4.9*(t*t);
		while(true){
			n++;
			if(5*n-5>y){
				cout<<n<<endl;
				break;
		}
	}
}
}

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

// why am I so weak

int n, m;
bool used[100055];
vector<int> g[100055];

void dfs(int v, deque<int> &vs) {
	vs.push_back(v);

	used[v] = true;

	for (auto u : g[v]) {
		if (!used[u]) {
			dfs(u, vs);
			break;
		}
	}
}
void rdfs(int v, deque<int> &vs) {
	vs.push_front(v);

	used[v] = true;

	for (auto u : g[v]) {
		if (!used[u]) {
			rdfs(u, vs);
			break;
		}
	}
}
int main() {
	scanf("%d %d", &n, &m);

	while (m--) {
		int x, y;
		scanf("%d %d", &x, &y);
		x--, y--;

		g[x].push_back(y);
		g[y].push_back(x);
	}

	deque<int> vs;

	dfs(0, vs);

	for (auto u : g[0]) if (!used[u]) {
		rdfs(u, vs);
		break;
	}

	printf("%d\n", (int)vs.size());

	for (int i = 0; i < (int)vs.size(); i++) {
		if (i) printf(" ");
		printf("%d", vs[i] + 1);
	}

	puts("");

	return 0;
}


Measured memory_bytes: 6784
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <cmath>

using namespace std;
typedef pair<int,int> pii;

int h,w,c;
vector<vector<int> > g;
int ans;
int dy[4] = {-1, 0, 1, 0};
int dx[4] = { 0, 1, 0,-1};


bool r(int y, int x) {
    if (y >= 0 && y < h && x >= 0 && x < w) return true;
    else return false;
}

set<pii> func() {
    set<pii> se;
    se.insert(make_pair(0,0));
    queue<pii> que;
    que.push(make_pair(0,0));
    
    while (!que.empty()) {
        pii p = que.front(); que.pop();
        int ty = p.first, tx = p.second;
        
        for (int k = 0; k < 4; k++) {
            int ny = ty+dy[k], nx = tx+dx[k];
            if (se.count(make_pair(ny,nx))) continue;
            
            if (r(ny, nx) && g[ny][nx] == g[0][0]) {
                se.insert(make_pair(ny,nx));
                que.push(make_pair(ny,nx));
            }
        }
    }
    
    return se;
}

void solve(int cnt) {
    set<pii> se = func();
    
    if (cnt == 5) {
        ans = max(ans, (int)se.size());
        return;
    }
    
    vector<vector<int> > t(h, vector<int>(w));
    t = g;
    for (int i = 1; i < 7; i++) {
        if (g[0][0] == i) continue;
        if (cnt == 4 && i != c) continue;
        
        for (set<pii>::iterator it = se.begin(); it != se.end(); it++) {
            pii p = *it;
            int ty = p.first, tx = p.second;
            g[ty][tx] = i;
        }
        solve(cnt+1);
        g = t;
    }
}

int main(void){
    while (cin>>h>>w>>c && h) {
        vector<vector<int> > t(h, vector<int>(w));
        g = t;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                cin >> g[i][j];
            }
        }
        ans = 0;
        solve(0);
        cout << ans << endl;
    }
}

Measured memory_bytes: 3156
#define rep(i,x) for (int i = 0; i < x; i++)
#define mod 1000000007
#define MOD 998244353
#define inf 1e18
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p;
typedef complex<double> com;



int main() {
	int a, b, q;
	cin >> a >> b >> q;
	vector<ll> s(a), t(b),ans(q);
	rep(i, a) {
		cin >> s[i];
	}
	rep(i, b) {
		cin >> t[i];
	}
	ll s1, s2, t1, t2;
	rep(i, q) {
		ll p;
		cin >> p;
		ans[i] = inf;
		s1 = lower_bound(s.begin(), s.end(), p) - s.begin();
		t1 = lower_bound(t.begin(), t.end(), p) - t.begin();
		s2 = s1 - 1;
		t2 = t1 - 1;
		if (s1 < a) {
			if (t1 < b) {
				ans[i] = min(ans[i],min(s[s1],t[t1]) - p + abs(s[s1] - t[t1]));
			}
			if (t2 >= 0) {
				ans[i] = min( ans[i],min(s[s1] - p,p-t[t2]) + s[s1] - t[t2]);
			}
		}
		if (s2 >= 0) {
			if (t1 < b) {
				ans[i] = min(ans[i], min(p - s[s2], t[t1] - p) + t[t1] - s[s2]);
			}
			if (t2 >= 0) {
				ans[i] = min(ans[i], min(p - s[s2], p - t[t2]) + abs(s[s2] - t[t2]));
			}
		}
	}
	rep(i, q) {
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 3712
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n;
    long double oto,gou=0;
    string a;
    long double btcs = 380000;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> oto >> a;
        
        if(a == "JPY"){
            gou +=　oto;
            //cout << "btc";
        }else{
            
            gou += oto * btcs;
        }
        
    }
    cout << gou;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdlib>
using namespace std;
int main()
{
	char a[15];
	scanf("%s", a);
	int len = strlen(a);
	if (len >= 4 && a[0] == 'Y' && a[1] == 'A' && a[2] == 'K' && a[3] == 'I')
		printf("Yes\n");
	else printf("No\n");
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int64_t i=0;i<(int64_t)N;i++)
const int INF=0x7f7f7f7f;
int main()
{
  int N,M,X,check,cost,pay=INF;
  cin>>N>>M>>X;
  vector<int> C(N,0),up(M,0);
  vector<vector<int>> A(N,vector<int>(M,0));
  rep(i,N){cin>>C.at(i);rep(j,M)cin>>A.at(i).at(j);}
  rep(i,pow(2,N))
  {
    cost=0;rep(k,M)up.at(k)=0;
    rep(j,N)
    {
      if((i/(int)pow(2,j))%2==1)
      {
        cost+=C.at(j);check=1;
        rep(k,M){up.at(k)+=A.at(j).at(k);check&=((up.at(k)<X)?0:1);}
        if(check)pay=min(cost,pay);
      }
    }
  }
  return cout<<((pay==INF)?-1:pay)<<endl,0;
}

Measured memory_bytes: 4072
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
int n,k,mo;
int g[1001][1001],f[1001][1001];
int Sum(int x,int y) {
    x+=y;
    return (x>=mo)?x-mo:x;
}
int Mul(int x,int y) {
    return (long long)x*y%mo;
}
int main() {
    scanf("%d%d%d",&n,&k,&mo);
    g[0][0]=1;
    for (int i=1;i<=n;i++)
        for (int j=0;j<=i;j++) {
            g[i][j]=g[i-1][j];
            if (j) g[i][j]=Sum(g[i][j],Mul(g[i-1][j-1],i-j+1));
        }
    f[0][0]=1;
    for (int i=1;i<=k;i++)
        for (int j=0;j<=n;j++) {
            f[j][i]=0;
            for (int kx=0;kx<=j;kx++)
                f[j][i]=Sum(f[j][i],Mul(f[kx][i-1],g[j][j-kx]));
        }
    printf("%d\n",f[n][k]);
    return 0;
}


Measured memory_bytes: 5504