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

int main(){
    int N, R, score;
    cin >> N >> R;
    if (N < 10){
        score = R + (100 * (10 - N));
    }
    else {
        score = R;
    }
    cout << score << endl;
}

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<string> s(n);
    for(int i = 0; i < n; ++i) {
        cin >> s[i];
    }
    vector<vector<int>> cnt(n, vector<int>(26));

    bool ans = false;
    vector<int> p1(n, -1);
    function<bool(int)> dfs1 = [&](int depth) {
        if(ans) return true;
        if(depth == n / 2) {
            int rest = -1;
            for(int i = 0; i < n; ++i) {
                if(p1[i] == -1) rest = i;
            }
            if(rest != -1) p1[rest] = rest;

            vector<bool> dp(1 << m);
            dp[0] = true;
            for(int S = 0; S < (1 << m); ++S) {
                if(!dp[S]) continue;
                for(int i = __builtin_popcount(S) / 2; i < m; ++i) {
                    if(S & (1 << i)) continue;
                    for(int j = i + 1; j < m; ++j) {
                        if(S & (1 << j)) continue;
                        bool ok = true;
                        for(int k = 0; k < n; ++k) {
                            int y1 = k, y2 = p1[k];
                            ok &= s[y1][i] == s[y2][j];
                        }
                        if(ok) {
                            dp[S | (1 << i) | (1 << j)] = true;
                        }
                    }
                }
            }
            const int mask = (1 << m) - 1;
            bool res = dp[mask];
            if(m & 1) {
                for(int i = 0; i < m; ++i) {
                    if(dp[mask ^ (1 << i)]) {
                        bool check = true;
                        for(int j = 0; j < n; ++j) {
                            int y1 = j, y2 = p1[j];
                            check &= s[y1][i] == s[y2][i];
                        }
                        res |= check;
                    }
                }
            }
            if(rest != -1) p1[rest] = -1;
            return ans |= res;
        }

        bool res = false;
        for(int i = depth; i < n; ++i) {
            if(p1[i] != -1) continue;
            for(int j = i + 1; j < n; ++j) {
                if(p1[j] != -1) continue;
                p1[i] = j;
                p1[j] = i;
                res |= dfs1(depth + 1);
                p1[i] = p1[j] = -1;
            }
        }
        return res;
    };

    cout << (dfs1(0) ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
// #include <unordered_map>
// #include <bitset>
// #include <iomanip>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define EPS 1e-9
#define LL_INF 0x3fffffffffffffff
#define MEM(a, b) memset(a, b, sizeof(a))
#define PPER(i, n, m) for (int i = n; i >= m; i--)
#define REPP(i, n, m) for (int i = n; i <= m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define PER(i, n, m) for (int i = n; i > m; i--)
#define SA(n) scanf("%d", &(n))
#define SLLA(n) scanf("%lld", &(n))
#define MP make_pair
#define FF first
#define SS second
#define PB push_back
#define DE(val) cout << #val << ": " << val << endl;
// #define DBG(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
// #else
// #define DBG(...) 42
// #endif
const int dx44[6] = {0, -1, -1, 1, 1};
const int dy44[6] = {0, -1, 1, -1, 1};
const int dx4[6] = {0, 0, 1,-1};
const int dy4[6] = {1, -1, 0,0};
const int dx8[9] = {0, -1, 0, 1, 0, 1, 1, -1, -1};
const int dy8[9] = {0, 0, 1, 0, -1, 1, -1, 1, -1};
const int dx82[9] = {0, -1, -1, 1, 1, 2, 2, -2, -2};
const int dy82[9] = {0, 2, -2, 2, -2, 1, -1, 1, -1};

void update(ll& x,ll v){
    if(x==-1)x=v;
    else if(x>v)x=v;
}
 
ll po(ll a, ll b, ll mod)
{
    ll res = 1;
    a %= mod;
    for (; b; b >>= 1)
    {
        if (b & 1)
            res = res * a % mod;
        a = a * a % mod;
    }
    return res;
}
ll gcd(ll a, ll b)
{
    if (a == 0)
    {
        return b;
    }
    else
    {
        return gcd(b % a, a);
    }
}
void extgcd(ll a, ll b, ll &d, ll &x, ll &y)
{
    if (!b)
    {
        d = a;
        x = 1;
    }
    else
    {
        extgcd(b, a % b, d, y, x);
        y -= x * (a / b);
    }
}
ll inverse(ll a, ll n)
{
    ll d, x, y;
    extgcd(a, n, d, x, y);
    return d == 1 ? (x + n) % n : -1;
}
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const int maxn = 1e5 + 15;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
#define mst(x, a) memset(x, a, sizeof(x))
/*************************************************************************/




int main()
{   

    //  ios::sync_with_stdio(false);
    //  cin.tie(nullptr);
    ll xx, yy;
    ll xx2, yy2;
    cin>>xx>>yy>>xx2>>yy2;
    ll res = xx*xx2;
    res = max(res,xx*yy2);
    res = max(res,yy*xx2);
    res = max(res,yy*yy2);
    cout<<res<<endl;
    return 0;
 
}


Measured memory_bytes: 3228
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,s,n) for(int i = s; i < n; i++)
#define INF 1000000007
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
ll ceil(const ll a, const ll b) { return (a + b - 1) / b; }
ll f[100],num[100];
ll solve(ll n,ll b){
  if(b == 0)return 0;
  if(n == 0)return 1;
  if(b >= 2 * num[n - 1] + 2)return f[n];
  else if(b >= num[n - 1] + 2){
    ll tmp = b - (num[n - 1] + 2);
    ll res = f[n - 1] + 1 + solve(n - 1,tmp);
    return res;
  }
  else{
    ll tmp = b - 1;
    return solve(n - 1,tmp);
  }
}
int main(){
  ll n,x;
  cin >> n >> x;
  f[0] = num[0] = 1;
  rep(i,50){
    f[i + 1] = 2 * f[i] + 1;
    num[i + 1] = 2 * num[i] + 3;
  }
  cout << solve(n,x) << endl;
  return 0;
}


Measured memory_bytes: 3632
#include <set>
#include <map>
#include <queue>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define fi first
#define se second
#define pp pop_back
#define mp make_pair
#define pb push_back
#define rep(x, a, b) for(int x=a; x<=b; x++)
#define drp(x, a, b) for(int x=a; x>=b; x--)
typedef long long ll;
const int mod=924844033;
const int N=200200;
const int G=5;
int ans[N], n, m, l, rev[N<<2], fac[N], inv[N], f[N<<2], u[N], v[N], g[N<<2], head[N], cnt, siz[N], c[N];
ll read(){
	ll x=0; char ch=getchar();
	while(ch<'0' || ch>'9') ch=getchar();
	while(ch>='0' && ch<='9') x=(x<<3)+(x<<1)+ch-'0', ch=getchar();
	return x;
}
void write(ll x){
	 if(x<10)
	 {
	  putchar(x+'0');
	  return;
	 }
	 write(x/10);
	 putchar(x%10+'0');
}
struct Edge{
	int to, next;
}edge[N<<1];
void AddEdge(int u, int v){
	edge[++cnt]=(Edge){ v, head[u] }, head[u]=cnt;
	edge[++cnt]=(Edge){ u, head[v] }, head[v]=cnt;
}
void dfs(int u, int fa){
	siz[u]=1;
	for(int i=head[u]; i; i=edge[i].next)
	{
		int v=edge[i].to;
		if(v==fa) continue;
		dfs(v, u);
		c[n-siz[v]]--;
		siz[u]+=siz[v];
	}
	c[siz[u]]--;
}
int power(int a, int k){
	int ret=1;
	while(k)
	{
		if(k&1) ret=1ll*ret*a%mod;
		a=1ll*a*a%mod; k>>=1;
	}
	return ret;
}
void DFT(int *a, int n, int f){
	rep(i, 0, n-1) if(i<rev[i]) swap(a[i], a[rev[i]]);
	for(int i=1, t=1; i<n; i<<=1, t++)
	{
		int wn=power(G, f?(mod-1-((mod-1)>>t)):((mod-1)>>t));
		for(int j=0; j<n; j+=i<<1)
		{
			int w=1;
			for(int k=0; k<i; k++, w=1ll*w*wn%mod)
			{
				int u=a[j+k], v=1ll*w*a[j+k+i]%mod;
				a[j+k]=(u+v)%mod; a[j+k+i]=(u+mod-v)%mod;
			}
		}
	}
	if(f)
	{
		int v=power(n, mod-2);
		rep(i, 0, n-1) a[i]=1ll*a[i]*v%mod;
	}
}
int main(){
	n=read();
	fac[0]=1;
	rep(i, 1, n) fac[i]=1ll*fac[i-1]*i%mod;
	inv[n]=power(fac[n], mod-2);
	drp(i, n, 1) inv[i-1]=1ll*inv[i]*i%mod;
	rep(i, 1, n-1){ u[i]=read(), v[i]=read(); AddEdge(u[i], v[i]); }
	rep(i, 1, n-1) c[i]=mod;
	dfs(1, 0);
	c[n]=n;
	rep(i, 1, n) f[i]=1ll*c[i]*fac[i]%mod;
	rep(i, 0, n) g[n-i+1]=inv[i];
	for(m=1; m<=((n<<1)|1); m<<=1) l++;
	rep(i, 0, m-1) rev[i]=(rev[i>>1]>>1)|((i&1)<<(l-1));
	DFT(f, m, 0); DFT(g, m, 0);
	rep(i, 0, m-1) f[i]=1ll*f[i]*g[i]%mod;
	DFT(f, m, 1);
	rep(k, 1, n) ans[k]=1ll*inv[k]*f[n+k+1]%mod;
	rep(i, 1, n) write(ans[i]), puts("");
}

Measured memory_bytes: 28928
import java.util.*;

public class Main{

    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        char[] c = s.toCharArray();
        sc.close();

        int idx = 0;
        int count = 0;

        if(s.length() == 1)
            count = 1;
        else {
            while(idx < s.length()-1){
                if(c[idx] == c[idx+1]){
                    if(idx != s.length()-2){
                        count += 2;
                        idx += 3;
                    } else {
                        count++;
                        idx += 2;
                    }
                }
                else{
                    idx += 1;
                    count += 1;
                }
                if(idx == s.length()-1)
                    count++;
            }
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 28584
#include <bits/stdc++.h>
using namespace std;
bool is_prime(int x){
	if(x <= 1) return false;
	for(int i = 2; i * i <= x; i++) if(x % i == 0) return false;
	return true;
}
const int maxn = 500;
long long r[maxn][maxn], p[2][4 * maxn];
long long gcd(long long a, long long b){
	while(b){
		a %= b;
		swap(a, b);
	}
	return a;
}
int main(){
	vector<int> primes;
	for(int i = 1; primes.size() < 2000; i++) if(is_prime(i)) primes.push_back(i);
	for(int i = 0; i < maxn; i++) for(int j = 0; j < maxn; j++) r[i][j] = 1;
	int stk = 0;
	for(int i = 0; i < maxn + maxn; i += 2){
		p[0][i] = stk++;
	}
	for(int i = maxn + maxn - 2; i >= 0; i -= 2){
		p[1][i] = stk++;
	}	
	assert(stk <= primes.size());
	for(int i = 0; i < maxn; i++) for(int j = 0; j < maxn; j++) {
		int x = i - j + maxn;
		int y = i + j;
		if(x % 2 == 0){
			r[i][j] *= primes[p[0][x]] * primes[p[1][y]];
		}
	}
	for(int i = 0; i < maxn; i++) for(int j = 0; j < maxn; j++){
		int x = i - j + maxn;
		if(x % 2 == 1){
			vector<long long> cand;
			if(i) cand.push_back(r[i - 1][j]);
			if(j) cand.push_back(r[i][j - 1]);
			if(i + 1 < maxn) cand.push_back(r[i + 1][j]);
			if(j + 1 < maxn) cand.push_back(r[i][j + 1]);
			long long lc = cand[0] / gcd(cand[0], cand[1]) * cand[1];
			for(int j = 2; j < cand.size(); j++) lc = lc / gcd(lc, cand[j]) * cand[j];
			r[i][j] = lc + 1;
		}
	}
	int n; cin >> n;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n - 1; j++){
			long long mn = r[i][j], mx = r[i][j + 1];
			if(mn > mx) swap(mn, mx);
			assert(mx % mn == 1);
		}
		for(int j = 0; j < n - 1; j++){
			long long mn = r[j][i], mx = r[j + 1][i];
			if(mn > mx) swap(mn, mx);
			assert(mx % mn == 1);
		}
	}
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++)
			cout << r[i][j] << " ";
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 5120
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val list = (1..n).map { readLine()!!.toInt() }
    val ans = solve(list)
    print(ans)
}

fun solve(nums: List<Int>): Int {
    // 無限ループ構造
    // そもそも2が存在しない
    // 2のindexに紐づく値が存在しない
    return calculate(nums, 0, 0)
}

tailrec fun calculate(list: List<Int>, n: Int, index: Int): Int {
    val a = list[index]

    return when {
        list.size == n -> {
            -1
        }
        a == 2
        -> {
            n + 1
        }
        else -> {
            calculate(list, n + 1, a - 1)
        }
    }


}



Measured memory_bytes: 39288
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yassin
 */

#include <bits/stdc++.h>

using namespace std;

class agc025_a {
private:
    int sod(int a) {
        int res = 0;
        while (a) {
            res += a % 10;
            a /= 10;
        }
        return res;
    }
public:
    void solve(istream& in, ostream& out) {
        int N;
        in >> N;
        int res = 1'000'000;
        for (int a = 1; a < N; ++a) {
            int b = N - a;
            res = min(res, sod(a) + sod(b));
        }
        out << res << "\n";
    }
};

int main() {
	std::ios::sync_with_stdio(false); cin.tie(nullptr);
	agc025_a solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 892
#include<bits/stdc++.h>
#pragma GCC optimize ("-O3")
#define ll long long
#define en "\n"
const ll inf = 1e9;
const ll mod = 1e9 + 7;
using namespace std;
int main(){
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
    ll a[100005], b[100005], m, n, dp[300005] = {0};
    cin>>n>>m;
    for(int i = 1; i <= n; i++){
        cin>>a[i]>>b[i];
    }
    for(int i = 1; i <= n; i++){
        for(int j = m; j > 0; j--){
            if(dp[j] != 0){
                dp[j + a[i]] = max(dp[j + a[i]], b[i] + dp[j]);
            }
        }
        dp[a[i]] = max(dp[a[i]], b[i]);
    }
    ll mx = -inf * inf;
    for(int i = m; i > 0; i--){
        mx = max(mx, dp[i]);
    }
    cout<<mx<<endl;
    return 0;
}


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

using namespace std;
typedef long long ll;

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

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

    string tmp = n;
    reverse(all(tmp));
    cout << ((tmp == n) ? "Yes" : "No") << "\n";

    return 0;
}


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


int main(){
    int a,b;
    cin>>a>>b;
    char sa='0'+a,sb='0'+b;
    string ans="";
    if(a<b){
        rep(i,b)cout<<sa;
    }else{
        rep(i,a)cout<<sb;
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
s=list(input())
a=["+"]*3
d=[]
for ss,aa in zip(s,a):
    d.append(ss)
    d.append(aa)
d.append(s[-1])
import copy
for i in range(2**3):
    dd=copy.deepcopy(d)
    for j in range(3):
        if ((i>>j)&1):
            dd[2*j+1]="-"
    st="".join(dd)
    if eval(st)==7:
        print("{}{}".format(st,"=7"))
        exit()

Measured memory_bytes: 3444
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = (long long)1e9 + 7; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}

const long double PAI = acos(-1);

int r, X, Y;

long double calarea(int e, int f){
	int an = f - e;
	e = 100 - (e - 25); f = 100 - (f - 25);
	// cout<<"------------"<<endl;
	// cout<<e<<" fe "<<f<<endl;
	long double res = 0, x = X, y = Y;
	long double ax = cos(((long double)e/100)*2*PAI)*r, ay = sin(((long double)e/100)*2*PAI)*r;
	long double bx = cos(((long double)f/100)*2*PAI)*r, by = sin(((long double)f/100)*2*PAI)*r;
	long double z = (bx - ax)*(y - ay) - (x - ax)*(by - ay);
	long double triangle, s, a, b, c;
	a = sqrt((bx - ax)*(bx - ax) + (by - ay)*(by - ay));
	b = sqrt((bx - x)*(bx - x) + (by - y)*(by - y));
	c = sqrt((ax - x)*(ax - x) + (ay - y)*(ay - y));
	s = (a + b + c)/2;
	triangle = sqrt(s*(s - a)*(s - b)*(s - c));
	
	// cout<<"A "<<triangle<<endl;
	
	if(z > 0) res = -triangle;
	else res = triangle;
	
	// cout<<"res "<<res<<endl;
	
	x = 0, y = 0;
	z = (bx - ax)*(y - ay) - (x - ax)*(by - ay);
	a = sqrt((bx - ax)*(bx - ax) + (by - ay)*(by - ay));
	b = sqrt((bx - x)*(bx - x) + (by - y)*(by - y));
	c = sqrt((ax - x)*(ax - x) + (ay - y)*(ay - y));
	s = (a + b + c)/2;
	triangle = sqrt(s*(s - a)*(s - b)*(s - c));
	
	// cout<<"B "<<triangle<<endl;
	
	if(z < 0){
		res += -triangle;
		// cout<<"z  - - "<<endl;
	}else res += triangle;
	
	// cout<<"z "<<z<<endl;
	
	res += (long double)r*r*PAI*an/100;
	
	// cout<<"ax = "<<ax<<" ay = "<<ay<<endl;
	// cout<<"bx = "<<bx<<" by = "<<by<<endl;
	
	// cout<<"XX "<<(long double)r*r*PAI*an/100<<endl;
	
	return res;
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	long double area, area2;
	int sum = 0, p = 0, n;
	
	cin>>r>>X>>Y>>n;
	
	for(int i = 0; i < n; i++){
		sum += p;
		cin>>p;
		area = (long double)r*r*PAI*p/100;
		area2 = calarea(sum, p+sum)*100;
		
		if(i) cout<<" ";
		// cout<<area2<<endl;
		cout<<(int)(area2/area);
	}
	
	cout<<endl;
	
	return 0;
}


Measured memory_bytes: 3528
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            Solver solver = new Solver();
            solver.solve();
            return;
        }
    }

    class Solver
    {
        public Solver()
        {
            /* Here Initialize */
        }

        public void solve()
        {
            for (int i = 1; i < 10; i++)
                for (int j = 1; j < 10; j++)
                    Console.WriteLine(i + "x" + j + "=" + (i * j));
        }

        static String rs() { return Console.ReadLine(); }
        static int ri() { return int.Parse(Console.ReadLine()); }
        static long rl() { return long.Parse(Console.ReadLine()); }
        static double rd() { return double.Parse(Console.ReadLine()); }
        static String[] rsa() { return Console.ReadLine().Split(' '); }
        static int[] ria() { return Array.ConvertAll(Console.ReadLine().Split(' '), e => int.Parse(e)); }
        static long[] rla() { return Array.ConvertAll(Console.ReadLine().Split(' '), e => long.Parse(e)); }
        static double[] rda() { return Array.ConvertAll(Console.ReadLine().Split(' '), e => double.Parse(e)); }
    }

}

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

int main(void){
    while(true){
        int n=0, min = 10000000, dif=0, score[1010];
        cin >> n;
        if(n==0) break;
        for(int i=0;i<n;++i) cin >> score[i];
        for(int i=0;i<n;++i){
            for(int j=i+1;j<n;++j){
                int dif = abs(score[i]-score[j]);
                if(min > dif) min = dif;
            }
        }
        cout << min << endl;
    }
}


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

int main(){
  string a,b,c; cin >> a >> b >> c;
  if(a.at(a.size()-1) == b.at(0) &&
    b.at(b.size()-1) == c.at(0))
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}


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

int main(){
  int n;cin>>n;
  int m=n%10;
  
  if(m==2||m==4||m==5||m==7||m==9)cout<<"hon"<<endl;
  else if(m==0||m==1||m==6||m==8)cout<<"pon"<<endl;
  else cout<<"bon"<<endl;
}

Measured memory_bytes: 3636
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>

using namespace std;

struct Node{
  int key;
  Node *right,*left,*parent;
};

Node *root,*NIL;

void insert(int k){
  Node *y = NIL;
  Node *x = root;
  Node *z;
  
  z = (Node*)malloc(sizeof(Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  
  while(x!=NIL){
    y=x;
    if(z->key < x->key){
      x = x->left;
    }else{
      x = x->right;
    }
  }
  
  z->parent = y;
  if(y==NIL){
    root=z;
  }else{
    if(z->key < y->key){
      y->left = z;
    }else{
      y->right = z;
    }
  }
}

void inorder(Node *u){
  if(u==NIL)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(Node *u){
  if(u==NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}

int main(){
  int n,x;
  string com;
  
  scanf("%d",&n);
  
  for(int i=0;i<n;++i){
    cin>>com;
    if(com=="insert"){
      scanf("%d",&x);
      insert(x);
    }else if(com == "print"){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  
  return 0;
}



Measured memory_bytes: 26632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

int main(){
    ll n,k;
    cin >> n >> k;
    ll ans = 0;
    for(ll i=k+1;i<=n;i++){
        ll t = n/i * (i-k);
        t += max(n%i - k + 1,0LL);
        ans += t;
    }
    if(k==0){
        ans = n*n;
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define lop(i,n) for(ll i=0;i<n;i++)
#define lop1(i,n) for(ll i=1;i<=n;i++)
#define lopr(i,n) for(ll i=n-1;i>=0;i--)
#define ll long long int
#define pb push_back
#define all(v) v.begin(),v.end()
#define IOS  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl "\n"
#define F first
#define S second	
#define mem(arr,val) memset(arr,val,sizeof(arr))
#define pii pair<int,int>
#define pll pair<ll,ll>
#define LCM(a,b) (a*b)/__gcd(a,b)
#define mii map<int,int>
#define mll map<ll,ll>
#define ub upper_bound
#define lb lower_bound
#define sz(x) (ll)x.size()
#define ld long double
#define pcnt(x) __builtin_popcountll(x)
const long long I1=1e9;
const long long I2=1e18;
const int32_t M1=1e9+7;
const int32_t M2=998244353;
template<typename T,typename T1>T maxn(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T minn(T &a,T1 b){if(b<a)a=b;return a;}
ll dp[100001];
pll w[101];
void solve()
{
  //code begins from here//
  int n,k;
  cin>>n>>k;
  lop1(i,n) cin>>w[i].F>>w[i].S;
  lop1(i,n)
  {
      for (ll j=k-w[i].F;j>=0;j--)
      {
        maxn(dp[j+w[i].F],dp[j]+w[i].S);
      }
  }
  ll ans=0;
  lop1(i,k) maxn(ans,dp[i]);
  cout<<ans<<endl;
}

signed main()
{
    IOS;
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #ifdef MODULO
        initialize();
    #endif
    #ifdef SIEVE
        sieve();
    #endif
    int testcase=1;
   // cin>>testcase;
    while(testcase--) solve();
    return 0;
}


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

int main(){
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;

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

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
#define ll long long 
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define ld long double
int const M=2e5+10,M2=1e7+10,mod=1e9+7,inf=1e9+10;
vector<int>ans;
int id[M],n,a[M];
set<pair<pii,pii> >st;
struct se
{
	int fard,zoj;
};
se seg[M*4];
void build(int l,int r,int node)
{
	if(r-l==1)
	{
		if(l%2)seg[node].fard=a[l],seg[node].zoj=inf;
		else seg[node].zoj=a[l],seg[node].fard=inf;
		return;
	}
	int mid=(l+r)>>1;
	build(l,mid,node*2);
	build(mid,r,node*2+1);
	seg[node].zoj=min(seg[node*2].zoj,seg[node*2+1].zoj);
	seg[node].fard=min(seg[node*2].fard,seg[node*2+1].fard);
}
int get(int l,int r,int st,int en,int t,int node)
{
	if(st<=l && r<=en)
	{
		if(t)return seg[node].fard;
		return seg[node].zoj;
	}
	if(st>=r || l>=en)return inf;
	int mid=(l+r)>>1;
	return min(get(l,mid,st,en,t,node*2),get(mid,r,st,en,t,node*2+1));
}
void add(int l,int r)
{
	if(r<l)return;
	int tmp=get(1,n+1,l,r+1,1-(r%2),1);
	int x=id[tmp];
	int tmp2=get(1,n+1,x+1,r+1,1-(x%2),1);
	st.insert(mp(mp(tmp,tmp2),mp(l,r)));
}
int32_t main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);	
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i],id[a[i]]=i;
	build(1,n+1,1);
	add(1,n);
	while(st.size())
	{
		pair<pii,pii> tmp=*st.begin();
		st.erase(tmp);
		ans.pb(tmp.F.F);
		ans.pb(tmp.F.S);
		int l=tmp.S.F,r=tmp.S.S;
		int x1=id[tmp.F.F];
		int x2=id[tmp.F.S];
		add(l,x1-1);
		add(x1+1,x2-1);
		add(x2+1,r);
	}
	for(int i=0;i<ans.size();i++)cout<<ans[i]<<" ";
}	

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

int main() {
  string s;
  cin>>s;
  int a=s.size();
  int cnt=0;
  int m;
  if (a%2==0) {
    m=a/2;
  } else {
    m=(a-1)/2;
  }
  for (int i=0;i<m;++i) {
    if (s[i]!=s[a-i-1]) {
      cnt+=1;
    }
  }
  cout<<cnt<<endl;
}



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

using namespace std;

#define MAX_N 1

typedef long long ll;

const double PI = 3.141592653589793;
const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;


int main(){
    int d[5];
    for(int i = 0 ; i < 5; i++){
        cin >> d[i];
    }
    int k;
    cin >> k;
    for(int i = 0 ; i < 4; i++){
        for(int j = i; j < 5;j++){
            if(abs(d[i]-d[j]) > k){
                cout << ":(" << endl;
                return 0;
            }
        }
    }
    cout << "Yay!" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string S;int a[3],i;
main(){
cin>>S;if(S=="mewmew"){goto E;}
if(S.find("mw")!=-1){goto E;}
for(int i=0;i<S.size();i++){
if(S[i]=='m'){a[0]++;}
else if(S[i]=='e'){a[1]++;}
else{a[2]++;}
if(!(a[0]>=a[1]&&a[1]>=a[2])){goto E;}
}
cout<<"Cat"<<endl;goto F;
E:;
cout<<"Rabbit"<<endl;
F:;
}

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

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,a,n) for (int i = n-1;i >= a;i--)

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };

#define MAX_N (int)2e5+20
#define INF 1e12+20

typedef long long ll;
using namespace std;

int n,a,b;
int main() {
    cin >> n;
    
    int a[2][n];
    int c = 0;
    rep(i,0,2){
        rep(j,0,n){
            cin >> a[i][j];
            if(i == 0) c += a[i][j];
        }
    }
    int an = 0;
    rep(i,0,n){
        rep(k,0,i+1){
            an += a[0][k];
        }
        rep(j,i,n){
            an += a[1][j];
        }
        c = max(c,an);
        an = 0;
    }
    pout(c);
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int X, A, B;
	int N;
	int i;
	int asumikana;
	if (scanf("%d%d%d", &X, &A, &B) != 3) return 1;
	asumikana = X;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		char S[16];
		if (scanf("%15s", S) != 1) return 1;
		switch (S[0]) {
			case 'n': asumikana += A; break;
			case 't': asumikana += B; break;
			case 'k': asumikana = 0; break;
		}
		if (asumikana < 0) asumikana = 0;
	}
	printf("%d\n", asumikana);
	return 0;
}



Measured memory_bytes: 2144
H, W = map(int, input().split())
A = [list(map(int, input().split())) for i in range(H)]
B = [list(map(int, input().split())) for i in range(H)]

dp = [[0] * W for i in range(H)]
dp[0][0] = 1 << (abs(A[0][0] - B[0][0]) + 6400)
for i in range(H):
    for j in range(W):
        d = abs(A[i][j] - B[i][j])
        if i > 0:
            dp[i][j] |= dp[i - 1][j] << d | dp[i - 1][j] >> d
        if j > 0:
            dp[i][j] |= dp[i][j - 1] << d | dp[i][j - 1] >> d
ans = 0
res = dp[H - 1][W - 1] >> 6400
while res & 1 == 0:
    res >>= 1
    ans += 1
print(ans)


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

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

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#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)

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

LL N, M, L;
LL naive(VI s, vector<LL>& acc){
  LL res = 1e15;
  do{
	LL sum = 0;
	REP(i,N){
	  int mx = max(s[i], s[(i+1)%N]);
	  int mn = min(s[i], s[(i+1)%N]);
	  sum += (acc[mx+1] - acc[mn]) / L;
	}
	res = min(res, sum);
  }while(next_permutation(ALL(s)));
  return res;
}

LL naive2(VI s, vector<LL>& acc){
  LL res = 1e15;
  REP(b,1<<N){
	LL sum = 0;
	int p = s[0];
	FOR(i,1,N-1)
	  if((b>>i&1) == 0){
		sum += (acc[s[i]+1] - acc[p])/L;
		p = s[i];
	  }
	sum += (acc[s.back()+1] - acc[p])/L;
	p = s.back();
	for(int i=N-2;i>0;--i){
	  if((b>>i&1) == 1){
		sum += (acc[p+1] - acc[s[i]])/L;
		p = s[i];
	  }
	}
	sum += (acc[p+1] - acc[s[0]])/L;
	res = min(res, sum);
  }

  return res;
}

LL cost(vector<LL>& acc, int s, int t){
  return (acc[t+1] - acc[s]) / L;
}

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

  cin >> N >> M >> L;
  VI ks(N);
  REP(i,N){
	cin >> ks[i]; --ks[i];
  }
  vector<LL> s(M), acc(M+1);
  REP(i,M){
	cin >> s[i];
	acc[i+1] = acc[i] + s[i];
  }
  SORT(ks);
  //cout << naive2(ks, acc) << endl;

  LL ans = 0;
  REP(i,N-1) ans += cost(acc, ks[i], ks[i+1]);
  ans += cost(acc, ks[0], ks.back());

  int crt = 0, nxt = 1;
  map<PII,LL> memo[2];
  memo[crt][MP(ks[0],ks[0])] = cost(acc,ks[0],ks[1]) * 2;
  FOR(i,2,N){
	memo[nxt].clear();
	for(auto& p: memo[crt]){
	  PII prv = p.FF;
	  LL t1 = p.SS - cost(acc,prv.FF,ks[i-1])
		+ cost(acc,prv.FF,ks[i]) + cost(acc,ks[i-1],ks[i]);
	  LL t2 = p.SS - cost(acc,prv.SS,ks[i-1])
		+cost(acc,ks[i-1],ks[i]) + cost(acc,prv.SS,ks[i]);

	  prv = MP(p.FF.FF, ks[i-1]);
	  if(!memo[nxt].count(prv)) memo[nxt][prv] = t1;
	  else memo[nxt][prv] = min(memo[nxt][prv], t1);
	  prv = MP(ks[i-1], p.FF.SS);
	  if(!memo[nxt].count(prv)) memo[nxt][prv] = t2;
	  else memo[nxt][prv] = min(memo[nxt][prv], t2);
	}
	swap(crt, nxt);
  }
  for(auto& p: memo[crt]) ans = min(ans, p.SS);
  cout << ans << endl;
  
  return 0;
}

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

int main() {
    int n,y;
    cin >> n >> y;
    bool ans=false;
    int com;
    int a=-1,b=-1,c=-1;
    for(int i=n;i>=0;i--){
        for(int j=0;j<=n-i;j++){
            com=10000*i+5000*j+1000*(n-i-j);
            if(com==y){
                ans=true;
                a=i;
                b=j;
                c=n-i-j;
                break;
            }
        }
        if(ans) break;
    }
    cout << a << " " << b << " " << c << endl;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item = U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}
fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let N: usize = sc.get();
    let mut v: Vec<usize> = sc.vec(N);
    v.sort();
    let mut i = 0;
    let mut ans = 0.;
    ans += (v[0] as f64+v[1] as f64)/2.;
    for i in 2..N {
        ans = (ans + v[i] as f64) / 2.;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<deque>
#include<cmath>
#include<stack>
#include<string.h>
#include <iomanip>
#define rep(i,n) for(int i = 0;i<n;i++)
#define _GLIBCXX_DEBUG
using ll = long long; 
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    ll x;
    cin >> x;
    int A,B;
    for(ll a = -200;a<=200;a++) {
        for(ll b = -200;b<=200;b++) {
            if(a*a*a*a*a - b*b*b*b*b == x) {
                A = a;
                B = b;
            }
        }
    }
    cout << A <<" "<< B << endl;
}

Measured memory_bytes: 3604
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T,vector<T>,greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define puts(x) cout << x << ' ';
#define putln(x) cout << x << endl;
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const int MAX = 200000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<31-1;
const int MOD = 1000000007;

int dx4[4]={1,0,-1,0};
int dy4[4]={0,1,0,-1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

void solve(void){
	int N;
	cin >> N;
	vector <int> xs(2*N);
	rep(2*N, i) {
		cin >> xs[i];
	}
	sort(all(xs));
	
	int ans = 0;
	rep(2*N, i) {
		if (i & 1) continue;
		ans += xs[i];
	}
	cout << ans << endl;
}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


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

void prians(bool answer) {
  if(answer)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
int a, b, c;
bool ch;

int main() {
  cin >> a >> b >> c;
  if((a + b + c) % 2 == 0 &&
     (a + b + c) / 2 == max(a, max(b, c)))
    ch = 1;
  prians(ch);
  return 0;
}

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

int main() {
	int a,b,c,x,cnt=0;
	cin>>a>>b>>c>>x;
	for(int i=0;i<=a;i++){
		for(int j=0;j<=b;j++){
			for(int k=0;k<=c;k++){
				if(i*500 + j*100 + k*50 ==x) cnt++;
			}
		}
	}
	cout<<cnt<<endl;

	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>

using namespace std;

int main(){
		double a;
	while(cin>>a){
		if(a<=48.00){
		cout<<"light fly"<<endl;
		}
		else if(a>48.00&&a<=51.00){
		cout<<"fly"<<endl;
		}
		else if(a>51.00&&a<=54.00){
		cout<<"bantam"<<endl;
		}
		else if(a>54.00&&a<=57.00){
		cout<<"feather"<<endl;
		}
		else if(a>57.00&&a<=60.00){
		cout<<"light"<<endl;
		}
		else if(a>60.00&&a<=64.00){
		cout<<"light welter"<<endl;
		}
		else if(a>64.00&&a<=69.00){
		cout<<"welter"<<endl;
		}
		else if(a>69.00&&a<=75.00){
		cout<<"light middle"<<endl;
		}
		else if(a>75.00&&a<=81.00){
		cout<<"middle"<<endl;
		}
		else if(a>81.00&&a<=91.00){
		cout<<"light heavy"<<endl;
		}
		else if(a>91.00){
		cout<<"heavy"<<endl;
		}

	
	}

	return 0;
}

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

int main(){
    int k;cin>>k;
    int Check[k]={0};
    int t=7;int i=1,ans;
    while(true){
        if(t%k==0){ans=i;break;}
        if(Check[t%k]==1){ans=-1;break;}
        Check[t%k]=1;
        t=10*t+7;
        t%=k;
        i++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 7468
T = list(map(str,input()))

count = 0
flag1 = 0
list_count = []
for i in T:
    if i == 'A' or i == 'T' or i == 'G' or i == 'C':
        flag1 = 1
        count = count +1
    elif flag1 ==1:
        list_count.append(count)
        flag = 0
        count = 0
list_count.append(count)
print(max(list_count))


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var sc = new Scanner();
            int n = sc.NextInt();
            int[] h = new int[n];
            for (int i = 0; i < n; i++) h[i] = sc.NextInt();
            
            int ans = 0;
            while (true)
            {
                int head = 0;
                while (head < n && h[head] == 0) head++;
                if (head == n) break;
                int min = h[head];
                int count = 1;
                for (int i = head + 1; i < n; i++)
                {
                    if (h[i] == 0) break;
                    if (h[i] < min) min = h[i];
                    count++;
                }
                ans += min;
                for (int i = 0; i < count; i++) h[head + i] -= min;
            }
            Console.WriteLine(ans);
        }
    }

    class Scanner
    {
        int index = -1;
        string[] buf;

        public Scanner()
        {
        }

        public int NextInt()
        {
            CheckNext();
            return int.Parse(buf[index++]);
        }

        public long NextLong()
        {
            CheckNext();
            return long.Parse(buf[index++]);
        }

        public string NextString()
        {
            CheckNext();
            return buf[index++];
        }

        private void CheckNext()
        {
            if (index >= 0 && index < buf.Length) return;

            buf = Console.ReadLine().Split(' ');
            index = 0;
        }
    }
}


Measured memory_bytes: 13140
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = [_b-_a for _a, _b in zip(a, b)]
x, y = 0, 0
for _c in c:
    if _c > 0:
        x += _c//2
    else:
        y -= _c
if x >= y:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 40688
//$g++ -std=c++11 Template.cpp 

//#include <bits/stdc++.h>
#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>
#include <climits>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define ROF(i, j, k) for(int i = (int)(j); i >= (int)(k); --i)
#define FORLL(i, n, m) for(long long i = n; i < (long long)(m); i++)
#define SORT(v, n) sort(v, v+n)
#define REVERSE(v) reverse((v).begin(), (v).end())

using namespace std;
using ll = long long;
const ll MOD=1000000007LL;
typedef pair<int, int> P;

ll ADD(ll x, ll y) { return (x+y) % MOD; }
ll SUB(ll x, ll y) { return (x-y+MOD) % MOD; }
ll MUL(ll x, ll y) { return x*y % MOD; }
ll POW(ll x, ll e) { ll v=1; for(; e; x=MUL(x,x), e>>=1) if (e&1) v = MUL(v,x); return v; }
ll DIV(ll x, ll y) { /*assert(y%MOD!=0);*/ return MUL(x, POW(y, MOD-2)); }

priority_queue<int> q_descending;
priority_queue<int, vector<int>, greater<int> > q_ascending;

/* 解説AC */

map<ll, ll> dp;

ll cd(ll x){
  if(dp[x]) return dp[x];
  else dp[x] = (cd(x/2)+cd((x-1)/2)+cd((x-2)/2))%MOD;
  return dp[x];
}

int
main(void){  
  ios_base::sync_with_stdio(false);

  ll n;
  cin >> n;
  dp[0] = 1; dp[1] = 2; dp[2] = 4;
  ll ans = cd(n);

  cout << ans << endl;
  
  return 0;
}


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

int main(){
    int n,m;cin>>n>>m;
    vi a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    vector<P> in(m);
    rep(i,m){
        int a,b;
        cin >> a >> b;
        in[i] = make_pair(b,a);
    }
    sort(in.begin(),in.end(),greater<P>());
    int ind=0;
    for(int i=0;i<n;i++){
        if(ind>=m) break;
        rep(j,in[ind].second){
            if(i+j>=n) break;
            if(a[i+j]>=in[ind].first) break;
            a[i+j] = in[ind].first;
        }
        i += in[ind].second-1;
        ind++;
    }
    ll sum=0;
    for(auto t : a){
        sum += t;
        //cout << t << " ";
    }
    cout << sum << endl;
}

Measured memory_bytes: 1536
//Code By CXY07
#include<bits/stdc++.h>
using namespace std;

//#define int long long

const int MAXN = 1;
const int INF = 2e9;
const int mod = 1e9 + 7;

int n,ans;

int GCD(int x,int y) {
	if(!y) return x;
	return GCD(y,x % y);
}

signed main () {
	cin >> n;
	for(register int a = 1;a <= n; ++a) 
		for(register int b = 1;b <= n; ++b)
			for(register int c = 1;c <= n; ++c)
				ans += GCD(GCD(a,b),c);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3636
N = input()
K = int(input())

ln = len(N)

dp = [[[0] * 4 for _ in range(2)] for _ in range(ln + 1)]
dp[0][0][0] = 1

for i in range(1, ln + 1):
    for j in range(2):
        for k in range(4):
            num = int(N[i-1])
            if j:
                l_mx = 9
            else:
                l_mx = num

            for l in range(l_mx + 1):
                if l == 0:
                    dp[i][j or l < num][k] += dp[i-1][j][k]
                else:
                    if k > 0:
                        dp[i][j or l < num][k] += dp[i-1][j][k-1]

ans = dp[ln][0][K] + dp[ln][1][K]
print(ans)


Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>

int main()
{
  int mat[101][101];
  int n,i,j,u,k,v;
  for(i=0;i<=100;i++){
    for(j=0;j<=100;j++){
      mat[i][j]=0;
    }
  }
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d %d",&u,&k);
    for(j=0;j<k;j++){
      scanf("%d",&v);
      mat[u][v]=1;
    }
  }
  for(i=1;i<=n;i++){
    printf("%d",mat[i][1]);
    for(j=2;j<=n;j++){
      printf(" %d",mat[i][j]);
    }
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 2040
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	int n,x,t,ans;
	cin >> n >> x >> t ;
	if(n%x==0){
		ans = n/x*t;
	}else{
		ans = (n/x+1)*t;
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 3652
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

N, H, W =I()
board = []
for i in range(N):
    a = l()
    board.append(a)

for i in board:
    if i[0]>=H and i[1] >= W:
        count += 1



print(count)


Measured memory_bytes: 10188
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    N=ii()
    K=ii()

    ans = INF
    for a in range(N+1):
        b = N-a
        res = 1
        for i in range(a):
            res *= 2

        for j in range(b):
            res += K

        ans = min(ans,res)

    
    print(ans)


    


if __name__ == "__main__":
    main()

Measured memory_bytes: 61924
#include<iostream>
#define LEN 200000

typedef struct process{
	char name[100];
	int time;
} P;

P Q[LEN];
int head, tail, n;

P dequeue(){
	P x = Q[head];
	head = (head+1) % LEN;
	return x;
}

void enqueue(P x){
	Q[tail] = x;
	tail = (tail + 1) % LEN;
}
int main (){
	int i, n, t, elaps;
	P h;
	elaps = 0;
	std::cin >> n >> t;
	for (i=0;i<n;i++){
		std::cin >> Q[i].name >> Q[i].time;
	}
	
	head = 0;
	tail = n;
	
	while(head != tail){
		h = dequeue();
		if(h.time <= t){
			elaps += h.time;
			h.time = 0;
			std::cout << h.name << " " << elaps << std::endl;
		} else{
			h.time -= t;
			elaps += t;
			enqueue(h);
		}
	}
	return 0;
}

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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()

Int INF = 1e18;
Int mod = 1e9+7;
//Int mod = 998244353;

typedef struct {
    double y, x;
} p_t;

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

int g(int x) {
    int ret = 0;
    while (x > 0) {
        x /= 10;
        ret++;
    }
    return ret;
}

Int used[10][10] = {};

int main() {
    Int n;
    cin >> n;
    Int res = 0;
    for (Int i = 1; i <= n; i++) {
        Int h = f(i) % 10;
        Int l = i % 10;
        used[h][l]++;
    }
    for (Int i = 1; i <= 9; i++) {
        for (Int j = 1; j <= 9; j++) {
            // cout << i << " " << j << " "  << used[i][j] << endl;
            res += used[i][j] * used[j][i];
        }
    }
    dump(res);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int dp(int n){
    if(n==1) return 1;
    if(n==2) return 2;
    if(n==3) return 4;
    return dp(n-1) + dp(n-2) + dp(n-3);
}

int main(void){
    int n;
    while(cin >> n){
        if(n == 0) break;
        cout << dp(n) / 3650 + 1 << endl;
    }
    return 0;
}



Measured memory_bytes: 3080