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

#define SIZE 300005
#define MOD 1000000007LL
#define INF 1 << 30
#define LLINF 1LL << 60
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define DOWN(i,b,a) for(int i=b;i>=a;i--)
#define SET(a,c) memset(a,c,sizeof a)
#define FORALL(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FOREACH(i,c) for(auto (i) : (c))
#define BIT(i,j) ((i)>>(j))&1
#define ALL(o) (o).begin(), (o).end()
#define ERASE(o) (o).erase(unique((o).begin(),(o).end()), (o).end())
#define SQ(x) ((x)*(x))
using namespace std;
typedef long long ll;
typedef valarray<int> Array;
typedef pair<ll,ll> Pll;
typedef pair<int, int> Pii;
typedef pair<double, double> Pdd;
template<typename T> inline void priv(vector<T>a){REP(i,a.size()){cout<<a[i]<<((i==a.size()-1)?"\n":" ");}}
int gcd(int a,int b){int c=max(a,b);int d=min(a,b);return c==0||d==0?c:gcd(c%d,d);}
int lcm(int a,int b){return a==0||b==0?0:a*b/gcd(a,b);}

bool dfs(vector<int> a)
{
  if(accumulate(a.begin(),a.end(),0) == 2)
  {
    REP(i,9) if(a[i] == 2) return true;
    return false;
  }
  REP(i,9)
  {
    if(a[i] == 0) continue;
    if(a[i] >= 3)
    {
      a[i] -= 3;
      if(dfs(a)) return true;
      a[i] += 3;
    }
  }
  REP(i,7)
  {
    if(a[i]>0 && a[i+1]>0 && a[i+2]>0)
    {
      a[i]--;a[i+1]--;a[i+2]--;
      if(dfs(a)) return true;
      a[i]++;a[i+1]++;a[i+2]++;
    }
  }
  return false;
}

void solve(string s)
{
  vector<int> a(9,0);
  vector<int> ans;
  REP(i,s.size()) a[s[i]-'1']++;
  REP(i,9)
  {
    if(a[i] == 4) continue;
    a[i]++;
    if(dfs(a)) ans.push_back(i+1);
    a[i]--;
  }
  if(ans.empty()) cout << "0" << "\n";
  else priv(ans);
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  while(cin >> s) solve(s);
  return 0;
}

Measured memory_bytes: 3020
/*
                    Author: Ankit Kaul
    **********************Code Belongs to Respective Author Only************************************
    */
    /*#pragma GCC optimize("O3")
    #pragma GCC optimize("Ofast")
    #pragma GCC optimize("unroll-loops")
    #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
    #include <bits/stdc++.h>
    #define endl       '\n'
    #define PI          3.141592653589
    #define jaldi       ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #define M           1000000007
    #define int         long long int
    #define inf         INT_MAX
    #define pb          emplace_back
    #define pf          emplace_front
    #define pii         pair<int,int>
    #define vi          vector<int>
    #define vii         vector<pii>
    #define mi          map<int,int>
    #define mii         map<pii,int>
    #define all(a)      (a).begin(),(a).end()
    #define rall(a)     (a).rbegin(),(a).rend()
    using namespace std;
    int gcd(int a,int b) { return b == 0 ? a : gcd(b, a % b); }
    int power(int x,int n){
        int result=1;
        while(n>0)
        {   if(n % 2 ==1)
            result=(result * x) % M;
            x=(x*x)% M;
            n=n/2;
        }
    return result % M;
    }      
    bool isPrime(int n) 
    { 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
    return true; 
    } 
signed main()
{   jaldi
    int n;
    cin>>n;
    cout<<(n/2)+(n%2);
}

Measured memory_bytes: 256
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def solve(a,b,c):
    if c - a - b < 0:
        return False
    return (c - a - b) ** 2 - (4 * a * b) > 0

a,b,c = map(int,read().split())
print('Yes' if solve(a,b,c) else 'No')

Measured memory_bytes: 3064
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
namespace mp =boost::multiprecision;
const ll mod = 1000000007;
const ll mod9 = 1000000009;

signed main(){
    mp::cpp_dec_float_50 a,b,ans;
    cin>>a>>b;
    ans = (a*b);
    cout<<(ll)ans<<endl;
}


Measured memory_bytes: 3816
#! -*- coding:utf-8 -*-
n = int(input())
a = map(int,input().split())
a = list(a)

sum_2 = 0
sum_4 = 0
for i in range(len(a)):
    if a[i] % 4 == 0:
        sum_4 += 1
    elif a[i] % 2 == 0:
        sum_2 += 1

if len(a)//2 == sum_4 or (len(a)+1)//2 == sum_4:
    print('Yes')
elif sum_4*2 + sum_2 >= len(a):
    print('Yes')
else:
    print('No')


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

long long a[26];
long long MOD=1000000007;
int c;



int main(){
    long long n;
    c=0;
    cin>>n;
    string s;
    cin>>s;
    long long ans=1;
    for(int i=0;i<n;i++){
        a[s[i]-'a']++;
    }
    for(int i=0;i<26;i++){
        ans=ans*(a[i]+1)%MOD;
    }
    if(ans==0) ans=MOD-1;
    else ans--;


    cout<<ans<<endl;

}

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

using namespace std;

int main() {
    int n,m;

    cin >> n >> m;

    vector<int> peaks(n);
    vector<int> results(n);
    for (int i = 0; i < n; i++) {
        int h;
        cin >> h;
        peaks[i] = h;
        results[i] = 1;
    }

    for (int i = 0; i < m; i++) {
        int p1, p2;
        cin >> p1 >> p2;
        if (peaks[p1 - 1] > peaks[p2 - 1]) {
            results[p2 - 1] = 0;
        } else if (peaks[p1 - 1] < peaks[p2 - 1]) {
            results[p1 - 1] = 0;
        } else if (peaks[p1 - 1] == peaks[p2 - 1]) {
            results[p1 - 1] = 0;
            results[p2 - 1] = 0;
        }
    }

    int count = 0;
    for (int i = 0; i < n; i++) {
        if (results[i] == 1) {
            count++;
        }
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 3996
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_set>

using namespace std;

typedef pair<int,int> P;

#define INF (1e9)

void solve(int n,int m,int h,int k) {
    vector<P> amida;
    int ind[n];
    int s[n];
    vector<P> swp;
    unordered_set<int> check;

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

    for(int i=0; i<m; ++i) {
        int a,b;
        cin >> a >> b;
        amida.push_back(P(b,a-1));
    }

    sort(amida.rbegin(),amida.rend());

    for(int i=0; i<m; ++i) {
        swap(ind[amida[i].second],ind[amida[i].second+1]);
        swp.push_back(
            P(min(ind[amida[i].second],ind[amida[i].second+1])
            ,max(ind[amida[i].second],ind[amida[i].second+1])));
    }

    int sum=0;
    for(int i=0; i<k; ++i) {
        sum+=s[ind[i]];
        check.insert(ind[i]);
    }

    int ans=sum;
    for(vector<P>::iterator itr=swp.begin(); itr!=swp.end(); ++itr) {
        if(check.count(itr->first)!=0 && check.count(itr->second)==0) {
            ans=min(ans,sum-s[itr->first]+s[itr->second]);
        } else if(check.count(itr->second)!=0 && check.count(itr->first)==0) {
            ans=min(ans,sum-s[itr->second]+s[itr->first]);
        }
    }

    cout << ans << endl;

    return;
}


int main() {
    int n,m,h,k;
    while(true) {
        cin >> n >> m >> h >> k;
        if(n==0 && m==0 && h==0 && k==0) break;
        solve(n,m,h,k);
    }
    return 0;
}


Measured memory_bytes: 5240
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define MAX 510000
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

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

//cout << fixed << setprecision(10);//
//最小公倍数//
ll gcd(ll x, ll y) {
	if (x == 0) return y;
	return gcd(y%x, x);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

//べき//
ll squ(ll n, ll p, ll m){
	if(p==0) return 1;
	if(p%2==0){
		ll t=squ(n, p/2, m);
		return t*t%m;
	}
	return n*squ(n,p-1,m);
	
}


//逆元mod(mを法とするaの逆元)//
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//Cmonp//
ll 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;
	}
}

// 二項係数計算
ll 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;
}

//nが大

ll com(ll n,ll m){
	if(n<=0 || m<=0 || n==m){
		return 1;
	}
	if(n<m){
		return 0;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}

	return k;
}


//


////////////////////////////////////////////////////////////////////




int main() {
  ll n;
  cin>>n;
  ll a[n+1];
  for(int i=1;i<=n;i++){
      cin>>a[i];
  }

vector<ll> vec{};
for(ll k=1;k<=2;k++){
for (ll i = 1; i*i <= a[k]; i++) {
	if (a[k]%i == 0) {
		vec.push_back(i);
		vec.push_back(a[k] / i);
		
	}
}
}




ll ans=1;
for(int i=0;i<vec.size();i++){

ll q=vec[i];
ll cnt=0;
for(int j=1;j<=n;j++){
    if(a[j]%q==0){
        cnt++;
    }
}

if(cnt>=n-1){
    ans=max(ans,vec[i]);
}


}



cout<<ans<<endl;
return 0;

}



Measured memory_bytes: 1024
import math
from decimal import *

n=int(input())

t_prev,a_prev=1,1
for i in range(n):
  t,a=map(int,input().split())
  n_koho1=math.ceil(Decimal(t_prev)/Decimal(t))
  n_koho2=math.ceil(Decimal(a_prev)/Decimal(a))

  #これはダメ
  #n_koho1=math.ceil(t_prev/t)
  #n_koho2=math.ceil(a_prev/a)

  #これはOK
  #n_koho1 = t_prev // t
  #n_koho2 = a_prev // a
  #if t_prev % t != 0:
  #    n_koho1 += 1
  #if a_prev % a != 0:
  #    n_koho2 += 1
        
  n=max(n_koho1,n_koho2)
  t=n*t
  a=n*a
    
  t_prev=t
  a_prev=a

print(t_prev+a_prev)

Measured memory_bytes: 5076
/*
* @Author: 王文宇
* @Date:   2017-11-18 23:16:44
* @Last Modified by:   王文宇
* @Last Modified time: 2017-11-19 11:41:10
*/
//D
#include <iostream>
#include <algorithm>
using namespace std;

const int N=2333;
typedef long long LL;
const int INF=0x3f3f3f3f;
LL num[N];

int main(){
    LL n,z,w;
    cin>>n>>z>>w;
    for(LL i=1;i<=n;i++) cin>>num[i];
    if(n==1) cout<<abs(num[1]-w)<<endl;
    else cout<<max(abs(num[n]-w),abs(num[n-1]-num[n]))<<endl;
    return 0;
}

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

int n,a;
vector<int> array0;

int main(){
    cin>>n;
    for(int i=0;i<n;++i){
        cin>>a;
        array0.push_back(a);
    }
    for(int i=array0.size()-1;i>=0;--i){
        cout<<array0[i];
        if(i!=0)cout<<" ";
        else cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 3100
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

int digits(int n) {
    if (n == 0) return 0;

    int x = 0;
    while (n > 0) {
        x += n % 10;
        n /= 10;
    }
    return x;
}

int calc(int n) {

    int ans = int.max;
    for (int i = 1; i < n; i++) {
        int a = i;
        int b = n - a;

        ans = min(ans, digits(a) + digits(b));
    }
    return ans;
}

void main() {
    int n = readint;
    auto ans = calc(n);
    writeln(ans);
}

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

int main() {
  int A,B,C,D ;
  cin >> A >> B >> C >> D;
  int ans =0;
  if (B>C&&A<=C&&B<D) ans = B-C;
  else if (D>A&&C<=A&&D<B) ans =D-A;
  else if (A<=C&&D<=B) ans =D-C;
  else if (C<=A&&B<=D) ans =B-A;
  else ans = 0;
  cout << ans << endl;
}


Measured memory_bytes: 3636
H, W, N, *a = map(int, open(0).read().split())
a = [None] + a
mapp = [[-1] * W for _ in range(H)]
x = 0
y = 0
c = 1
for _ in range(W):
    for _ in range(H):
        if a[c] == 0:
            c += 1
        mapp[y][x] = c
        a[c] -= 1
        y += 1 * [+1, -1][x % 2]
    y -= 1 * [+1, -1][x % 2]
    x += 1

for y in range(H):
    print(*mapp[y])

Measured memory_bytes: 3828
#include <iostream>
#include<vector>
#include <algorithm>
#include <cstdlib>
long min_cost(long n, long k, std::vector<long> h);

int main() {
    long n, k;
    std::cin >> n >> k;
    std::vector<long> h(n);
    for(long i=0;i<n;i++) {
        std::cin >> h[i];
    }
    std::cout << min_cost(n, k, h) << std::endl;
  return 0;
}

long min_cost(long n, long k, std::vector<long> h) {
    std::vector<long> cost(n);
    for (long i = 0; i < n; i++) {
        cost[i] = 10000000000;
    }
    cost[0] = 0;
    for (long i = 0; i < n; i++) {
        for (long j = 1; j <= k; j++) {
            if (i + j < n) {
                cost[i + j] = std::min(cost[i + j], cost[i] + std::abs(h[i] - h[i + j]));
            }
        }
    }
    return cost[n - 1];
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;

int main() {
  int H, N, P;
  cin >> H >> N;
  P=0;
  vector<int> A(N);
  for (int i=0; i<N; i++) {
    cin >> A[i];
  }
  for (int j=0; j<N; j++) {
    P=P+A[j];
  }
  if (H<=P) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


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


int main()
{

  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin>>n;
  int dp[n][3];
  for(int i=0; i<n; i++){
    int a,b,c;
    cin>>a>>b>>c;
    if(i==0){
        dp[i][0]=a;
        dp[i][1]=b;
        dp[i][2]=c;
    }
    else{
        dp[i][0]=max(dp[i-1][1],dp[i-1][2])+a;
        dp[i][1]=max(dp[i-1][2],dp[i-1][0])+b;
        dp[i][2]=max(dp[i-1][1],dp[i-1][0])+c;
    }
  }
  cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));

  return 0;
}

Measured memory_bytes: 4744
/*https://atcoder.jp/contests/abc090/tasks/abc090_b*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	int l, r, count = 0;
	cin >> l >> r;

	for (int i = l; i <=r; i++)
	{
		int x = i;
		string s = to_string(x);
		if (s[0] == s[4] && s[1] == s[3])
			count++;
	}
	cout << count;
}

Measured memory_bytes: 3776
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <numeric>
#include <set>
#include <iomanip>
#include <functional>
#define FOR(i, a, n) for (long long i = (a); i < (n); i++)
#define REP(i, n) for(long long i = 0; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
using namespace std;

typedef long long ll;

long long myGcd(long long a, long long b)
{
	if (a % b == 0)return b;
	return myGcd(b, a % b);
}

int myGcd(int a, int b)
{
	if (a % b == 0)return b;
	return myGcd(b, a % b);
}

long long myLcm(long long a, long long b)
{
	return a * b / myGcd(a, b);
}

int myLcm(int a, int b)
{
	return a * b / myGcd(a, b);
}


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

	string S, T;

	cin >> S >> T;

	if (S == T.substr(0, T.size() - 1))
		cout << "Yes\n";
	else
		cout << "No\n";

		return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <sstream>

using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> High(N);
    vector<vector<int>> net;
    net.resize(N);
 
    // 高さリスト
    for(int i = 0; i < N; i++)
    {
        cin >> High[i];
    }

    // ネットワーク条件
    for (size_t i = 0; i < M; i++)
    {
        int a = 0;
        int b = 0;
        cin >> a >> b;
        net[a-1].push_back(High[b-1]);
        net[b-1].push_back(High[a-1]);
    }

    // 
    int count = 0;
    for (int i = 0; i < net.size(); i++)
    {
        if (net[i].empty())
        {
            count ++;
        }
        else
        {
            auto imax = max_element(net[i].begin(), net[i].end());
            // cout << *imax << "," << endl;
            if (*imax < High[i])
            {
                count++;
            }            
        }
    }

    cout << count << endl;    
}

Measured memory_bytes: 8804
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int d = sc.nextInt();
        int ans = 0;
        while(n != 0){
            n /= d;
            ans++;
        }
        System.out.println(ans);
    }
}


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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) {is >> x;} return is;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'['; for(T i: a) {out<<i<<',';} out<<']'; return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    ll n;
    cin >> n;
    vector<ll> c(n);
    vector<vector<ll>> v(200001);
    REP(i, n) {
        cin >> c[i];
        c[i]--;
        v[c[i]].push_back(i);
    }
    vector<ll> prev(n, -1);
    vector<ll> dp(n);
    REP(i, 200001) {
        if(v[i].size() == 0) continue;
        sort(ALL(v[i]));
        // cout << v[i] << endl;
        dp[v[i][0]] = 1;
        FOR(j, 1, v[i].size()) {
            // cout << v[i][j] << endl;
            prev[v[i][j]] = v[i][j-1];
        }
    }
    // cout << prev << endl;

    dp[0] = 1;
    FOR(i, 1, n) {
        dp[i] = dp[i-1];
        if(prev[i] != -1 && prev[i]!=i-1) (dp[i] += dp[prev[i]]) %= MOD;
    }
    // cout << dp << endl;
    cout << dp[n-1] << endl;

    return 0;
}


Measured memory_bytes: 15872
import sys

S = input()

if S[0] != 'A':
    print('WA')
    sys.exit()
if S[2:-1].count('C') != 1:
    print('WA')
    sys.exit()
position_C = S.find('C',2,-1)
AC_removed_S = S[1:position_C] + S[position_C+1:]

print('AC' if AC_removed_S.islower() else 'WA')

Measured memory_bytes: 3060
def main():
    N = int(input())
    maximum = 0
    next_maximum = 0
    A = []
    for _ in range(N):
        a = int(input())
        A.append(a)
        if a > maximum:
            maximum = a
        elif a > next_maximum:
            next_maximum = a
    for b in A:
        if b == maximum:
            print(next_maximum)
        else:
            print(maximum)


if __name__ == '__main__':
    main()

Measured memory_bytes: 12532
#include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())

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

using namespace std;
int main(void)
{
  for(;;){
    string dig;
    cin >> dig;
    if(dig=="0") return 0;
    int answer=0;
    vector<vector<int> >dp(dig.size(),vector<int>(11,0));
    REP(i,dig.size()){
      if(i) REP(j,11) dp[i][(j*10+dig[i]-'0')%11]=dp[i-1][j];
      if(dig[i]!='0') ++dp[i][dig[i]-'0'];
      answer+=dp[i][0];
    }
    cout << answer << endl;
  }
}

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

int abs(int x){
    if(x<0){
        return -x;
    }
    else{
        return x;
    }
}

int main() {
    int h,w,n;
    cin >> h >> w >> n;
    int count = 0;
    int ans = 0;
    while(ans<n){
        ans += max(h,w);
        count++;
    }
    cout << count;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <queue>
#include <stack>
using namespace std;


int main(){
	string S;
	cin>>S;
	bool flag = false;
	for(int i=0;i<8;i++){
		string check="";
		for(int j=0;j<i;j++){
			check+=S[j];
		}
		for(int j=0;j<7-i;j++){
			check+=S[S.size()-(7-i)+j];
		}
		if(check=="keyence")flag=true;
	}
	if(flag)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
		
	
	
	
	return 0;
}


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

vector<int> adj[100005];
bool vis[100005];

void dfs(int node)
{
    vis[node]=1;
    for(int i:adj[node])
    {
        if(!vis[i])
        dfs(i);
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int tt=1;
    //cin>>tt;
    while(tt--)
    {
        int n,m,x,y,i;
        cin>>n>>m;
        while(m--)
        {
            cin>>x>>y;
            adj[x].emplace_back(y);
            adj[y].emplace_back(x);
        }
        x=0;
        for(i=1;i<=n;++i)
        {
            if(!vis[i])
            x++,dfs(i);
        }
        cout<<max(0,x-1);
    }
}

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

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

using namespace std;

struct Edge {
  int src,dst,weight;
  bool operator < ( const Edge &e ) const { return weight > e.weight; }
};

const int MAX = 10001;
int V,t,k,par[MAX],base[MAX],CNT=1;
Edge edge[MAX];

int find(int x){
  if( x == par[x] ) return x;
  return par[x] = find(par[x]);
}

void unit(int x,int y){
  x = find(x), y = find(y);
  if( x != y ) par[x] = y;
}

int main(){
  while( scanf(" %d %d %d",&V,&t,&k), V|t|k ){
    rep(i,V) par[i] = i;
    int sum = 0;
    rep(i,V-1){
      scanf(" %d %d %d",&edge[i].src,&edge[i].dst,&edge[i].weight);
      --edge[i].src, --edge[i].dst;
      sum += edge[i].weight;
    }
    rep(i,t) {
      scanf(" %d",base+i);
      --base[i];
      if( i ) unit(base[0],base[i]);
    }
    sort(edge,edge+V-1);
    int coef = 0, remain = t - 1 - k;
    rep(i,V-1) {
      int s = edge[i].src, t = edge[i].dst;
      if( find(s) == find(t) ) {
	if( remain ) {
	  --remain;
	  coef += edge[i].weight;
	}
      } else {
	unit(s,t);
	coef += edge[i].weight;
      }
    }
    printf("Case %d: %d\n",CNT++,sum-coef);
  }
  return 0;
}

Measured memory_bytes: 1548
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1e9+7;


int main(){
    int A,B; cin>>A>>B;
    if(abs(A-B)%2==1){
        cout<<"IMPOSSIBLE"<<endl;
    }else{
        cout<<min(A,B)+abs(A-B)/2<<endl;
    }

    return 0;
}



Measured memory_bytes: 256
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
#include <chrono>

using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=a-1;i>=n;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pii>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
template<typename T>void max_self(T &a,T b){a=max(a,b);}
template<typename T>void min_self(T &a,T b){a=min(a,b);}
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=3e5+10,oo=0x3f3f3f3f,MOD=998244353;
const long double PI = acos(-1),eps=1.0e-14;

void solve(){
    int n,a;
    cin>>n>>a;
    n%=500;
    cout<<(n<=a?"Yes":"No")<<'\n';
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();

}


Measured memory_bytes: 3572
/*
ID: garvits2 
TASK: ride
LANG: C++14                 
*/
#include <bits/stdc++.h>

using namespace std;
int main(){
	int n;
	cin >> n;
	int count = 0;
	for(int i = 0; i < n; i++){
		int x , y;
		cin >> x >> y;
		if(count >= 3){
			break;
		}
		else{
			if(x == y){
				count++;
			}
			else{
				count = 0;
			}
		}
	}
	if(count >= 3){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
    return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<vector>
#include<stack>
using namespace std;

int main(){
    string s;
    cin >> s;
    stack<char> st;
    for(int i=0;i<s.size();i++){
        //cout << s[i] << endl;
        if(s[i]=='S'){
            //cout << "yes" << endl;
            st.push('S');
        }else if(s[i]=='T'&&(st.empty()==true||st.top()=='T')){
            st.push('T');
        }else{
            st.pop();
        }
    }
    cout << st.size() << endl;
}

Measured memory_bytes: 644
#include <bits/stdc++.h>
using namespace std;
#define N 200005
int a[N],b[N];
int main() {
	int n,mx = 0;
	cin >> n;
	for(int i=1; i<=n; i++) {
		scanf("%d",&a[i]),b[i] = a[i];
	}
	sort(b+1,b+n+1);
	for(int i=1; i<=n; i++) {
		if(a[i] == b[n]) printf("%d\n",b[n-1]);
		else printf("%d\n",b[n]);
	}

	return 0;
}

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

int n;
int arr[105];
int dp[100005][2];

int kil(int k, int player)
{
  if(k <= 0)
  {
    // which ever players turn he looses
    return 1 - player;
  }

  if(dp[k][player] != -1)
    return dp[k][player];

  int res = 1-player;
  for(int i=0;i<n;i++)
  {
    if(arr[i] <= k)
    {
      res = kil(k-arr[i], 1-player);
      if(res == player)
        break;
    }
  }
  dp[k][player] = res;
  return dp[k][player];
}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  memset(dp, -1, sizeof dp);

  int k, res;
  cin>>n>>k;
  for(int i=0;i<n;i++)
    cin>>arr[i];

  res = kil(k, 1);

  cout<<((res == 1) ? "First" : "Second")<<endl;  

  return 0;
}


Measured memory_bytes: 5760
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] a = new int[n + 1];
		
		for (int i = 0; i < m; i++) {
			a[sc.nextInt()]++;
		}
//		for (int i = 0; i <= n; i++) {
//			System.out.printf("a[%d]=%d\n", i, a[i]);
//		}
		
		long[] cmb = new long[n + 1];
		cmb[0] = 1;
		cmb[1] = a[1] ^ 1;
		
		final long mod = 1_000_000_007;
		for (int i = 2; i <= n; i++) {
			cmb[i] = (a[i] ^ 1) * (cmb[i - 2] + cmb[i - 1]) % mod;
		}
//		for (int i = 0; i <= n; i++) {
//			System.out.printf("cmb[%d]=%d\n", i, cmb[i]);
//		}
		System.out.println(cmb[n]);
	}
}


Measured memory_bytes: 51528
N,H=map(int,input().split())
ab=sorted([list(map(int,input().split())) for _ in range(N)],key=lambda x:x[1],reverse=True)
a_M=max([ab[i][0] for i in range(N)])

ans =0
for a,b in ab:
    if b <= a_M:
        break
    H -= b
    ans += 1
    if H<=0:break
if H>0:
    ans += (H-1)//a_M+1
print(ans)

Measured memory_bytes: 29672
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define pp pair<ll,ll>
#define vi vector<pair<pp,pp> >
#define pq_min priority_queue<ll,vector<ll>,greater<ll>>
#define pq_max priority_queue<ll>
#define f(i,a,b) for(ll i=a;i<b;i++)
#define r(i,a,b) for(ll i=b-1;i>=a;i--)
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define fill(a,b) memset((a),(b),sizeof((a)))
#define ld long double
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef pair<pp,pp> ppll;
const ll mod=1e9 +7;
const ll N = 1e12 + 5 ;
ll ans=0;

ll power(ll a,ll b)
{
    ll res=1;
    a%=mod;
    while(b>0)
    {
        if(b%2==1)
        {
            res = (res * a)%mod;
        }
        b/=2;
        a = (a*a)%mod;
    }
    return res;
}



int main()
{
    fast;
    string s;
    cin>>s;
    if(s[0]=='7' || s[1]=='7' || s[2]=='7')
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
}


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

int main() {
  int n, m, x, o = 1001001001;
  scanf("%d %d %d", &n, &m, &x);
  vector<int> c(n);
  vector<vector<int>> a(n, vector<int>(m));
  for(int i = 0; i < n; i++) {
    scanf("%d", &c[i]);
    for(int j = 0; j < m; j++) scanf("%d", &a[i][j]);
  }
  for(int i = 0; i < (1 << n); i++) {
    bitset<12> b(i);
    int cs = 0;
    vector<int> r(m);
    for(int j = 0; j < n; j++) {
      if(b.test(j)) {
        cs += c[j];
        for(int k = 0; k < m; k++) r[k] += a[j][k];
      }
    }
    int f = 1;
    for(int j = 0; j < m; j++)
      if(r[j] < x) f = 0;
    if(f) o = min(o, cs);
  }
  if(o == 1001001001)
    printf("-1\n");
  else
    printf("%d\n", o);
}

Measured memory_bytes: 3792
//PLUS ULTRA
//one who atops 

#include<bits/stdc++.h>
using namespace std;
     
     
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pb push_back 
#define mp make_pair
#define forn(i,st,n) for(int i = st; i < n ; i++)
#define nfor(i,st,n) for(int i = st; i >= n ; i--)
#define ss second
#define ff first
#define ll long long 

typedef pair <int , int> pii;

const int N = 1e5 + 10 , mod =  1000000007;

void solve(){

	int n; cin >> n;
	set<string> SET;

	string str;
	forn(i,0,n){
		cin >> str;
		if(SET.end() == SET.find(str)){
			SET.insert(str);
		}
	
	}


	int diff = SET.size();

	cout << diff << endl;
    




}

int main(){
    SPEED;

 solve();




    return 0;
}
      
       


Measured memory_bytes: 19244
#include <bits/stdc++.h>
#define REP(i, n) for(long long i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
 
int main(){
  ll x,a = 0,ans = 0,f = 0;
  cin >> x;
  if(x % 11 == 0) {
    cout << x/11*2;
  } else if (x % 11 <= 6) {
    cout << x/11*2 +1;
  } else {
    cout << x/11*2 +2;
  }
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  ll n; cin >> n;
  set<ll> d;
  d.insert(n);
  if(n > 2)d.insert(n-1);
  for(ll i = 2; i*i <= n; ++i){
    if(n%i==0)d.insert(i);
    if((n-1)%i==0){
      d.insert(i);
      if((n-1)/i > 1)d.insert((n-1)/i);
    }
  }
  int cnt = 0;
  for(auto e:d){
    ll x = n;
    while(x%e==0)x/=e;
    cnt += x%e==1;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cctype>
#include <cstdlib>
#include <cassert>
#include <string>
using namespace std;

char s[5000];
int len;

int length(int const k, int const l, int const r){
    int cur = 0, res = 0, p = l;
    while(s[p] && p < r){
        if(isalpha(s[p])){
            while(isalpha(s[p])){
                if(cur == k) throw s[p];
                res++;
                p++;
                cur++;
            }
        } else if(isdigit(s[p])){
            int mul = 0;
            while(isdigit(s[p])){
                mul = mul * 10 + s[p] - '0';
                p++;
            }
            int d = 0, i = p++;
            while(1){
                if(s[i] == '(') d++;
                else if(s[i] == ')') d--;
                if(d == 0) break;
                i++;
            }
            for(int j = 0; j < mul; j++){
                int d = length(k - cur, p, i);
                res += d;
                cur += d;
            }
            p = i + 1;
        }
    }
    return res;
}

int main(){
    static char t[5000];
    int k;
    while(scanf("%s%d",t,&k), t[0] != '0'){
        int tlen = strlen(t);
        len = 0;
        for(int i = 0; i < tlen; i++){
            if(i > 0 && isdigit(t[i - 1]) && isalpha(t[i])){
                s[len++] = '(';
                s[len++] = t[i];
                s[len++] = ')';
            } else {
                s[len++] = t[i];
            }
        }
        s[len] = 0;
        try{
            length(k, 0, len);
            putchar('0');putchar('\n');
        } catch (char e) {
            putchar(e);putchar('\n');
        }
    }
}

Measured memory_bytes: 1236
import itertools
n, k = map(int, input().split())
d = list(map(int, input().split()))
u = []
for i in range(0, 10):
    if i not in d:
        u.append(i)
for j in range(1, 6):
    for i in itertools.product(u, repeat=j):
        t = int("".join(map(str, i)))
        if n <= t <= 100000:
            print(t)
            exit()


Measured memory_bytes: 3060
import java.io.*;
import java.math.*;
import java.util.*;
public class Main { 
 
	public static void main(String[] args) { 
		Scanner input = new Scanner(System.in);
		int A = input.nextInt();
		int B = input.nextInt();
		int T = input.nextInt();
		int time = T/A;
		System.out.println(time*B);
	}
}

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

using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define out(ans) cout << ans << endl;
const long long mod = 1e9 + 7;

int n;
string s;
int a,b,c,d;

bool fib(int x){

  if(x>n-1)return false;
  else{
    // cout<<x<<" "<<s[x]<<endl;
    if(x==d&&s[x]!='#')return true;
    if(s[x]=='#')return false;
  }

  return fib(x+1)||fib(x+2);
}
bool fib1(int x){

  if(x>n-1)return false;
  else{
    // cout<<x<<" "<<s[x]<<endl;
    if(x==c&&s[x]!='#')return true;
    if(s[x]=='#')return false;
  }

  return fib1(x+1)||fib1(x+2);
}

int main(){

  cin>>n;
  cin>>a>>b>>c>>d;
  a--,b--,c--,d--;
  cin>>s;

  if(c<d){
    if(fib(b)){
      s[d]='#';
      // cout<<endl;
      if(fib1(a))out("Yes")
      else out("No")
    }else out("No");

  }else if(c>d){
    bool e=false;
    rep(i,b,n-1){
      if(s[i-1]=='.'&&s[i]=='.'&&s[i+1]=='.'&&i<=d){
        b=i;
        s[b]='#';
        e=true;
        break;
      }
    }
    if(!e){out("No");return 0;}

    if(fib1(a)){
    s[c]='#';
    // cout<<endl;
    s[b]='.';
    if(fib(b))out("Yes")
    else out("No")
    }else out("No");
  }



  return 0;
}


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

#define HAS_TEST_CASE 0  // Do you forget to complete this?

namespace registerGen
{
typedef long long ll;

const int N=5e5;
const double eps=1e-6;

int n,m,a[N+10];
char str[N+10];

inline bool check(double x)
{
	int res=0;
	for(int i=1;i<=n;i++)
	{
		double tmp=1.0*a[i]/x;
		if(double(tmp-int(tmp))==0.0)res+=int(tmp)-1;
		else res+=int(tmp);
	}
	return res<=m;
}

inline void main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		scanf("%d",a+i);
	int l=1,r=0x3f3f3f3f,ans=0;
//	for(int i=1;i<=n;i++)
//		ans=std::max(ans,a[i]);
	while(l<=r)
	{
		int mid=(l+r)>>1;
		if(check(mid))ans=mid,r=mid-1;
		else l=mid+1;
	}
	printf("%d\n",ans);
}
}

int main()
{
#if !defined(ONLINE_JUDGE) && HAS_TEST_CASE
	freopen("tmp.out","w",stdout);
#endif
	int T=1;
#if HAS_TEST_CASE
	scanf("%d",&T);
#endif
	while(T--)registerGen::main();
	return 0;
}


Measured memory_bytes: 4496
import copy

S = input()

S_list = [0] * len(S) 

for index, s in enumerate(S):
    if(s=="A" or s=="C" or s=="G" or s=="T"):
        S_list[index] = 1

max_counter = 0
counter = 0
for i in range(len(S)):
    if(S_list[i]==1):
        counter+=1
        if(counter > max_counter):
            max_counter = copy.deepcopy(counter)
    else:
        counter = 0

print(max_counter)


Measured memory_bytes: 3572
import java.util.*;

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

        String N = sc.next();

        //文字列
        String strN = N;

        char[] NChar = new char[strN.length()];
        for(int i = 0; i<strN.length(); i++){
            NChar[i] = strN.charAt(i);
            //System.out.println(NChar[i]);
        }

        int[] Nint = new int[strN.length()];
        for(int j = 0; j<strN.length(); j++){
            Nint[j] = Character.getNumericValue(NChar[j]);
            //Nint[j] = NChar[j];
            //System.out.println(Nint[j]);
        }


        //ここから計算
        int sum = 0;
        //System.out.println(Nint.length);
        for(int k = 0;k<Nint.length; k++){
            sum += Nint[k];
        }

        if(sum % 9 == 0){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }

        
    }
}

Measured memory_bytes: 41632
def main():
    from collections import deque

    K = int(input())

    dq = deque([i for i in range(1, 10)])

    cnt = 0

    while dq:
        x = dq.popleft()
        cnt += 1
        if cnt == K:
            print(x)
            return

        r = x % 10

        s = max(0, r - 1)
        t = min(9, r + 1)

        for k in range(s, t + 1):
            dq.append(x * 10 + k)


if __name__ == '__main__':
    main()


Measured memory_bytes: 12396
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
string a,b;
cin>>a>>b;
string arr[1001];
int j=0,k=1;
for(int i=0;i<(n*2);i++){
  arr[j]=a[i];
  arr[k]=b[i];
  j=j+2;
  k=k+2;
}
//int len=sizeof(arr)/sizeof(arr[0]);
for(int i=0;i<n*2;i++){
  cout<<arr[i];
}
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
char s[10];
int main()
{
    scanf("%s",s);
    for(int i=0;i<=strlen(s);i++)
        if(s[i]=='9') return 0*puts("Yes");
    return 0*puts("No");
}

Measured memory_bytes: 256
#include <stdio.h>
using namespace std;

int main() {
  int in;
  scanf("%d",&in);
  printf("Christmas");
  if(in <= 24){
    printf(" Eve");
    if(in <= 23){
      printf(" Eve");
      if(in == 22){
        printf(" Eve");
      }
    }
  }
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1e9;
int v,e;
int g[15][15];
int dp[1<<15][15];

void dfs(int idx,int bit)
{
	for(int i = 0;i<v;i++)
	{
		 if((bit&(1<<i))==0)
		 {
			 //cout<<i<<endl;
			 if(g[idx][i]!=-1)
			 {
				if(dp[bit|(1<<i)][i]>dp[bit][idx]+g[idx][i])
			 	{
					 dp[bit|(1<<i)][i] = dp[bit][idx]+g[idx][i];
				 dfs(i,bit|(1<<i));
				 }
			 }
		 }
	}
}

int main()
{
	cin >> v >> e;
	for(int i = 0 ;i<15;i++)
	{
		for(int j = 0;j<15;j++)
		{
			g[i][j] = -1;
		}
	}
	for(int i = 0;i<(1<<15);i++)
	{
		for(int j = 0;j < 15;j++)
		{
			dp[i][j] = INF;
		}
	}
	for(int i = 0;i<e;i++)
	{
		int fr,to,cost;
		cin >> fr >> to >> cost;
		fr;
		to;
		g[fr][to] = cost;
	}
	dp[0][0] = 0;
	dfs(0,0);
	int ans = INF;
	for(int i = 0;i<v;i++){ans = min(ans,dp[(1<<v)-1][0]);}
	//for(int i = 0;i<(1<<v);i++){for(int j = 0;j<v;j++){cout<<dp[i][j]<<' ';}cout<<endl;}
	cout<<(ans==INF?-1:ans)<<endl;
	return 0;
}


Measured memory_bytes: 5012
#include<stdio.h>

int main(){
	
	char huruf1;
	char huruf2;
	
	scanf("%c %c",&huruf1,&huruf2);
	
	if(huruf1=='A'|| huruf2=='A'){
		
		huruf1=='10';
		huruf2=='10';
	}
	
	if(huruf1=='B'|| huruf2=='B'){
		
		huruf1=='11';
		huruf2=='11';
	}
	
	if(huruf1=='C'|| huruf2=='C'){
		
		huruf1=='12';
		huruf2=='12';
	}
	if(huruf1=='D'|| huruf2=='D'){
		
		huruf1=='13';
		huruf2=='13';
	}
	if(huruf1=='E'|| huruf2=='E'){
		
		huruf1=='14';
		huruf2=='14';
	}
	if(huruf1=='F'|| huruf2=='F'){
		
		huruf1=='15';
		huruf2=='15';
	}
	
	
	if(huruf1>huruf2){
		printf(">\n");
	}
	else if(huruf1<huruf2){
		printf("<\n");
	}
	else{
		printf("=\n");
	}
	
	
	return 0;
}

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

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

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  int N,Q; cin >> N >> Q;
  string S; cin >> S;

  vector<int> ans(N, 0);
  for(int i = 1; i < N; i++){
    if(S[i] == 'C' && S[i-1] == 'A'){
      ans[i] = 1;
    }
  }
  for(int i = 1; i < N; i++){
    ans[i] += ans[i-1];
    // cerr << "i: " << i << " ans[i]: " << ans[i] << endl;
  }

  while(Q--){
    int l,r; cin >> l >> r; l--; r--;
    int ret;
    if(l == 0){
      ret = ans[r];
    } else {
      ret = ans[r] - ans[l-1];
      if(S[l] == 'C' && S[l-1] == 'A'){
        ret--;
      }
    }
    cout << ret << endl;
  }



}



Measured memory_bytes: 3800
#include<iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>

using namespace std;

int gcd(int p, int q) {
    if (p % q == 0)return q;
    return gcd(q, p % q);
}

int main()
{
    int n;
    int count = 1;
    cin >> n;
    vector<string> s(n);
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }
    
    sort(s.begin(), s.end());

    for (int i = 0; i < n-1; i++) {
        if (s[i] != s[i + 1]) {
            count++;
        }
    }

    cout <<  count;
    
    return 0;
}



Measured memory_bytes: 9596
if __name__ == '__main__':
    n = input().split(' ')
    roads = int(n[0])
    good_time = int(n[1])
    answer = -1
    for road in range(0, roads):
        n = input().split(' ')
        cost = int(n[0])
        time = int(n[1])
        if time > good_time:
            continue
        if answer < 0 or answer > cost:
             answer = cost
    if answer < 0:
        print('TLE')
    else:
        print(str(answer))

Measured memory_bytes: 3064
using System;

namespace A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string input = Console.ReadLine();
            int A = Int32.Parse(input.Split(' ')[0]);
            int B = Int32.Parse(input.Split(' ')[1]);

            if(A > 9 | B > 9)
            {
                Console.WriteLine(-1);
            }
            else
            {
                Console.WriteLine(A * B);
            }
        }
    }
}


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

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, s, n) for (i64 i = (s); i <= (n); ++i)
#define VAR(Type, ...) Type __VA_ARGS__; IN(__VA_ARGS__)
#define Float(x) OUTN(fixed, setprecision(x));

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

template <class A, class B>
inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }

template <class A, class B>
inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

// IN
void IN() {}
template <class Head, class... Tail>
void IN(Head&& head, Tail&&... tail) {
  cin >> head;
  IN(forward<Tail>(tail)...);
}

// OUTS
void OUTS() {}
template <class Head, class... Tail>
void OUTS(Head&& head, Tail&&... tail) {
  cout << head << " \n"[sizeof...(tail)==0];
  OUTS(forward<Tail>(tail)...);
}

template <class T>
void OUTS(vector<T> &vec) {
  for (auto &e : vec) cout << e << " \n"[&e==&vec.back()];
}

template <class T>
void OUTS(vector<vector<T>> &df) {
  for (auto &vec : df) OUTS(vec);
}

// OUTL
void OUTL() {}
template <class Head, class... Tail>
void OUTL(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  OUTL(forward<Tail>(tail)...);
}

template <class T>
void OUTL(vector<T> &vec) {
  for (auto &e : vec) cout << e << "\n";
}

// OUTN
void OUTN() {}
template <class Head, class... Tail>
void OUTN(Head&& head, Tail&&... tail) {
  cout << head;
  OUTN(forward<Tail>(tail)...);
}
// }}} End

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  VAR(int, N);
  OUTL((N % 2 == 0) ? N : N * 2);
  return 0;
}


Measured memory_bytes: 256
#約数をちょうど８個持つ奇数を考える。N以下の整数で、そのような奇数はいくつあるか
N = int(input())
result = []
for i in range(3,N+1,2):
    divisor = []
    for j in range(1,int(i**0.5)+1):
        if i % j == 0:
            divisor.append(j)
            if j**2 != i:
                divisor.append(i//j)
    #print(i,divisor)
    if len(divisor) == 8:
        result.append(i)
print(len(result))

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

int main(){
    int a,b;
    cin >> a >> b;
    if(a>b) swap(a,b);
    if(a==1&&b==2) cout << 3 <<endl;
    if(a==1&&b==3) cout << 2 <<endl;
    if(a==2&&b==3) cout << 1 <<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  long long int bell,aizu;
  char hess;
  cin >> bell;
  while(1){
    cin >> hess;
    if(hess=='='){
      break;
    }
    else{
      cin >> aizu;
      if(hess=='+'){
	bell+=aizu;
      }
      else if(hess=='-'){
	bell-=aizu;
      }
      else if(hess=='*'){
	bell*=aizu;
      }
      else if(hess=='/'){
	bell/=aizu;
      }
    }
  }
  cout << bell << endl;
  return (0);
}

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

// TODO: 簡潔に書けないのかな
typedef std::pair<int, int> p;

int main() {
  int H, W;
  cin >> H >> W;

  string a[H];
  for (int i = 0; i < H; i++) cin >> a[i];

  // 8マスチェック用
  pair<int, int> xyPair[8] = {
      p(1, 0), p(0, 1),   p(-1, 0), p(0, -1),
      p(1, 1), p(-1, -1), p(1, -1), p(-1, 1),
  };

  for (int y = 0; y < H; y++) {
    for (int x = 0; x < W; x++) {
      if (a[y][x] == '#') continue;

      int mineCount = 0;

      for (pair<int, int> p : xyPair) {
        int xx = x + p.first;
        int yy = y + p.second;

        if (xx < 0 || W <= xx) continue;
        if (yy < 0 || H <= yy) continue;

        if (a[yy][xx] == '#') mineCount++;
      }
      a[y][x] = char(mineCount + '0');
    }
  }

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

Measured memory_bytes: 256