akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	double t,x;
	cin>>t>>x;
	cout<<fixed<<t/x<<endl;
	return 0;
}


Measured memory_bytes: 256
// #include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<string>
#define pb emplace_back
#define LOCAL
  
using namespace std;
  
const int mod = 1e9+7;
const int inf = 0x3f3f3f3f;
const int maxn = 1e5+5;
typedef long long ll;
typedef pair<int,int> Pii;
 
template <typename T>inline void read(T& t){
    char c=getchar();t=0;
    int f=1;
    while(!isdigit(c)){
       if(c=='-')f=-1;
        c=getchar();
    }
    while(isdigit(c))t=t*10+c-48,c=getchar();
    t=f*t;
}
  
template <typename T,typename... Args> inline void read(T& t,Args&... args){
    read(t);read(args...);
}

ll a[maxn<<1];
 
int main(){
    int t=1;
    // read(t);
    while(t--){
        int n;
        read(n);
        for(int i=0;i<n;i++){
            read(a[i]);
        }
        ll ans=a[0],tmp=0;
        for(int i=1;i<n;i++){
            if(a[i]<=ans){
                tmp+=ans-a[i];
            }else{
                ans=a[i];
            }
        }
        printf("%lld\n",tmp);
    }
    return 0;
}

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

typedef long long ll;
static const ll MOD = 1e9+7;

int main(){
    int N;
    cin>>N;
    vector<ll> A(N);
    vector<ll> Acnt(N,0);
    vector<ll> Bcnt(N,0);
    for(int i=0; i<N; i++){
        cin>>A[i];
        Acnt[A[i]]++;
    }

    for(int i=N-1; i>=0; i -=2){
        if(i != 0)Bcnt[i] += 2;
        else Bcnt[i]++;
    }

    ll ans = 1;

    for(int i=0; i<N; i++){
        if(Acnt[A[i]] != Bcnt[A[i]]){
            ans = 0;
            break;
        }
    }

    if(ans == 0) cout<<ans<<endl;
    
    else{
        ans = 1;
        for(int i=0; i<(N/2); i++){
            ans *= 2;
            ans %= MOD;
        }
        cout<<ans<<endl;
    }

    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main(){
    int N,x;
    cin >> N >> x;
    vector<int>a(N);
    for(int i = 0; i < N; i++) {
        cin >> a[i];
    }
    int ans = 0;
    sort(a.begin(),a.end());
    for(int i = 0; i < N; i++) {
        if(x >= a[i]) {
            ans++;
            x-=a[i];
        }
    }
    if(ans == N && x) {
        cout << N-1 << endl;
    }
    else {
        cout << ans << endl;
    }
}


Measured memory_bytes: 3592
# E
n, m = map(int, input().split())
a_list = list(map(int, input().split()))


# bonus map
bonus_str_cnt = [0]*(m+1)
bonus_end_vol = [0]*(m+1)
bonus_end_cnt = [0]*(m+1)

# 1
one_res = 0
bonus_cnt = 0
for i in range(n-1):
    difm = (a_list[i+1] - a_list[i]) % m
    if difm > 1:
        if a_list[i] + 2 > m:
            bonus_str_cnt[(a_list[i] + 2) - m] += 1
        else:
            bonus_str_cnt[a_list[i] + 2] += 1
        bonus_end_cnt[a_list[i+1]] += 1
        bonus_end_vol[a_list[i+1]] += difm - 1
    if difm <= a_list[i+1]:
        one_res += difm
    else:
        one_res += a_list[i+1]
        bonus_cnt += 1

res_list = [one_res]
res = one_res
for i in range(2, m+1):
    res += bonus_end_vol[i-1]
    bonus_cnt += bonus_str_cnt[i] - bonus_end_cnt[i-1]
    res -= bonus_cnt
    res_list.append(res)

print(min(res_list))

Measured memory_bytes: 16228
#include<iostream>
#include<algorithm>
using namespace std;
int a[10000000], n, maxup, maxdown, p;
int main() {
	cin >> p;
	for (int h = 0; h < p; h++) {
		cin >> n;
		maxup = 0;
		maxdown = 0;
		for (int i = 0; i < n; i++) {
			cin >> a[i];
			if (i >= 1) {
				if (a[i - 1] > a[i]) {
					maxdown = max(maxdown, a[i - 1] - a[i]);
				}
				else {
					maxup = max(maxup, a[i] - a[i - 1]);
				}
			}
		}
		cout << maxup << ' ' << maxdown << endl;
	}
	return 0;
}

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


using namespace std;

int main(void){
    string a,b;
    cin >> a>>b;
    int x = a.size();
    int y = b.size();
    if(x== (y-1)){
        if(a == b.substr(0,x)){
            cout << "Yes";
        }else{
            cout << "No";
        }
    }else{
        cout << "No";
    }
    
}


Measured memory_bytes: 3608
import sys, collections
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()


def resolve():
    N, M = LI()
    G = [[] for _ in range(N)]
    for _ in range(M):
        A, B = LI_()
        G[A].append(B)
        G[B].append(A)

    que = collections.deque()
    que.append(0)
    dist = [INF]*N
    dist[0] = 0
    ans = [-1]*N
    while que:
        room_c = que.popleft()
        for room_n in G[room_c]:
            if dist[room_n]>=INF:
                que.append(room_n)
                dist[room_n] = dist[room_c] + 1
                ans[room_n] = room_c
    # print('dist', dist)
    # print('ans', ans)
    if -1 in ans[1:]:
        print('No')
    else:
        print('Yes')
        for i in ans[1:]:
            print(i+1)

if __name__ == '__main__':
    resolve()

Measured memory_bytes: 35592
#include<bits/stdc++.h>
#define fr(i1,m) for(int i1=0;i1<m;i1++)
using namespace std;
int main()
{
    string s,s1;
    while(cin>>s>>s1)
    {
        string ss;
        long l=s.size();
        long p=s1.size();
        long i=0,j=0,c=1;
        while(1)
        {
            if(l==0&&p==0)
                break;
            if(c==1)
            {
                ss+=s[i];
                c=2;
                i++;
                l--;
            }
            else
            {
                 ss+=s1[j];
                c=1;
                j++;
                p--;
            }
        }
        cout<<ss<<"\n";
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.* ;
/*
NOTES:
-more than 10 digits (10^10), use long
-prefix sum of 1's and -1's to control flow of highlighting a region
-log(a)/log(b) = log base b of a
-create a position array if trying to see if elements show up next to each other sequentially
 i.e. elements 1,2,3 are within 3 spots of each other in an array
      arr[scannedInt - 1] = i; (position of i at p[i] in original)
- use a freq array when counting instances of an element occurring
- increment the counter first before simulating anything turn-based (two player game)

 */

public class Main {
    static long mod = (long)(Math.pow(10, 9) + 7);
    public static String alpha = "zabcdefghijklmnopqrstuvwxy";
    public static void main(String[] args) throws IOException{
        Scanner scan = new Scanner(System.in);
        long t = 1;
        while (t-- > 0) {
            int x = scan.nextInt();
            int y = scan.nextInt();
            if(y<=x*4 && y>=x*2 && y%2==0) System.out.println("Yes");
            else System.out.println("No");

        }
        scan.close();

    }

    static ArrayList factors(int n ){
        ArrayList<Integer> facts = new ArrayList<>();
        for(int i = 1; i<=(int)Math.sqrt(n); i++){
            if(n%i == 0){
                if( i == Math.sqrt(n)) facts.add(i);
                else{
                    facts.add(i);
                    facts.add(n/i);
                }
            }
        }
        Collections.sort(facts);
        return facts;
    }

    static boolean isPrime (int n){
        if(factors(n).size() ==2) return true;
        else return false;
    }





    static long GCD(long a, long b) {
        // Everything divides 0
        if (a == 0) return b;
        if (b == 0) return a;

        // base case
        if (a == b) return a;

        // a is greater
        if (a > b) return GCD(a-b, b);
        return GCD(a, b-a);
    }
    static long LCM(long a, long b){
        return (a*b)/(GCD(a,b));
    }
    static String rev(String s){
        char[] arr = s.toCharArray();
        for(int i = 0; i<(s.length()+1)/2; i++){
            char temp = arr[i];
            arr[i] = arr[s.length()-i-1];
            arr[s.length()-i-1] = temp;
        }
        String fin = new String(arr);
        return fin;
    }
    static long pow(long a, long N) {
        if (N == 0) return 1;
        else if (N == 1) return a;
        else {
            long R = pow(a,N/2);
            if (N % 2 == 0) {
                return R*R;
            }
            else {
                return R*R*a;
            }
        }
    }

    static long powMod(long a, long N) {
        if (N == 0) return 1;
        else if (N == 1) return a % mod;
        else {
            long R = powMod(a,N/2) % mod;
            R *= R;
            R %= mod;
            if (N % 2 == 1) {
                R *= a;
                R %= mod;
            }
            return R % mod;
        }
    }

}

Measured memory_bytes: 35612
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void){
    int w, h, x, y;
    cin >> w >> h >> x >> y;
    int ans;
    if(x == w/2 && y == h/2 && w%2 == 0 && h%2 == 0)    ans = 1;
    else                        ans = 0;

    cout << (double)w*(double)h/2.0 << " " << ans << endl;

    return 0;
}

Measured memory_bytes: 256
//this code is not form me
//i find it on the internet
//internet have a problem as the as atcoder's
//i think this is not good
//so i submit this code to tell atcoder
//and to increase my rating,too. 
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define rep(N) for(int i=0;i<N;i++)
#define repj(N) for(int j=0;j<N;j++)
#define LL long long 
#define pii pair<int,int>
#define For(I,N) for(int I=0;I<N;I++)
#define cinone(N) int N;cin>>N;
#define scanfone(N) int N;cin>>N;
#define cingroup(N,M) int N[M];for(int yiuytvnm=0;yiuytvnm<M;yiuytvnm++) cin>>N[yiuytvnm];
#define scanfgroup(N,M) int N[M];for(int qrwuoiq=0;qrwuoiq<M;qrwuoiq++) scanf("%d",&N[qrwuoiq]);
typedef unsigned long long ull;
using namespace std;
const int N = 1100005, INF = 1<<25;

int in[N], n, cc[129];
bool used[N];
char str[N];
vector<int>g[129];

int lowbit(int t)
{
    return t&(t^(t-1));
}

int sum(int end)
{
    int ans=0;
    while(end>0)
    {
        ans+=in[end];
        end-=lowbit(end);
    }
    return ans;
}

void add(int pos ,int num)
{
    while(pos<=n)
    {
        in[pos]+=num;
        pos+=lowbit(pos);
    }
}

void solve()
{
    memset(in, 0, sizeof(in));
    for(int i=1; i<=n+1; i++)
    {
        add(i,1);
    }
    LL ans = 0;
    int v, u, size;
    char s;
    memset(used, 0, sizeof(used));
    for(int i=1; i<=n; i++)
    {
        if(!used[i])
        {
            s = str[i];
            size = g[s].size();
            u = g[s][size-1];
            if(i == u)
            {
                ans += (sum(n) - sum(i))/2;
            }
            else
            {
                ans += sum(n) - sum(u);
            }
            add(u, -1);
            add(i, -1);
            used[i] = used[u] = 1;
            g[s].erase(g[s].end()-1);
        }
    }
    printf("%lld", ans);
    puts("");
}

int main()
{
    scanf("%s", str+1);
//    {
        n = strlen(str+1);
        memset(cc, 0, sizeof(cc));

        for(int i=1; i<129; i++)
            g[i].clear();

        for(int i=1; i<=n; i++)
        {
            cc[str[i]]++;
            g[str[i]].push_back(i);
        }

        int flag = 0;
        for(int i=0; i<26; i++)
        {
            if(cc['a'+i]%2) flag++;
            if(cc['A'+i]%2) flag++;
        }
        if(flag > 1)
        {
            printf("-1");
            puts("");
//            continue;
        }
        else
        {
            solve();
        }
//    }
    return 0;
}

Measured memory_bytes: 6904
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,i,sum=0;
    cin>>n>>k;
    int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    for(i=0;i<k;i++)
    {
        sum+=a[i];
    }
    cout<<sum;
}


Measured memory_bytes: 3572
//minamoto
#include<bits/stdc++.h>
#define R register
#define ll long long
#define inf 0x3f3f3f3f3f3f3f3f
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
char buf[1<<21],*p1=buf,*p2=buf;
inline char getc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}
ll read(){
    R ll res,f=1;R char ch;
    while((ch=getc())>'9'||ch<'0')(ch=='-')&&(f=-1);
    for(res=ch-'0';(ch=getc())>='0'&&ch<='9';res=res*10+ch-'0');
    return res*f;
}
inline char getop(){R char ch;while((ch=getc())>'Z'||ch<'A');return ch;}
const int N=505;
struct eg{int v,nx,w;ll c;}e[N*N];int head[N],tot;
inline void add(R int u,R int v,R ll c){
	e[++tot]={v,head[u],1,c},head[u]=tot,
	e[++tot]={u,head[v],0,-c},head[v]=tot;
}
int x[N],y[N],a[N],b[N],t[N],LL[N],RR[N],DD[N],UU[N],vis[N],pe[N],n,m,S,T;
ll v[N],dis[N],res,ans;queue<int>q;
bool spfa(){
	memset(dis,0x3f,sizeof(dis));
	dis[S]=0,q.push(S);
	while(!q.empty()){
		int u=q.front();q.pop(),vis[u]=0;
		go(u)if(e[i].w&&(cmin(dis[v],dis[u]+e[i].c)?pe[v]=i,1:0)&&!vis[v])q.push(v),vis[v]=1;
	}
	if(dis[T]==inf)return false;
	res+=dis[T];
	for(R int i=T;i!=S;i=e[pe[i]^1].v)--e[pe[i]].w,++e[pe[i]^1].w;
	return true;
}
ll calc(int k){
	fp(i,1,k)LL[i]=DD[i]=0,RR[i]=UU[i]=19260817;
	fp(i,1,m)if(b[i]<k){
		switch(t[i]){
			case 'L':LL[b[i]+1]=a[i]+1;break;
			case 'R':RR[k-b[i]]=a[i]-1;break;
			case 'D':DD[b[i]+1]=a[i]+1;break;
			case 'U':UU[k-b[i]]=a[i]-1;break;
		}
	}
	fp(i,2,k)cmax(LL[i],LL[i-1]),cmax(DD[i],DD[i-1]);
	fd(i,k-1,1)cmin(RR[i],RR[i+1]),cmin(UU[i],UU[i+1]);
	memset(head,0,sizeof(head)),tot=1;
	S=0,T=(n+k)<<1|1;
	fp(i,1,n)add(i,n+i,-v[i]);
	fp(i,1,k){
		add(S,n+n+i,0),add(n+n+k+i,T,0);
		fp(j,1,n){
			if(x[j]>=LL[i]&&x[j]<=RR[i])add(n+n+i,j,0);
			if(y[j]>=DD[i]&&y[j]<=UU[i])add(n+j,n+n+k+i,0);
		}
	}
	res=0;while(spfa());
	return -res;
}
int main(){
//	freopen("testdata.in","r",stdin);
	n=read();
	fp(i,1,n)x[i]=read(),y[i]=read(),v[i]=read();
	m=read();
	fp(i,1,m)t[i]=getop(),a[i]=read(),b[i]=read();
	fp(i,1,n)cmax(ans,calc(i));
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 2816
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        string s = Console.ReadLine();
        string ans = "";
        for(int i = 0; i < s.Length; i += 2)
        {
            ans += s[i].ToString();
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 34772
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    private const long INFINITY = 9223372036854775807;
    public static void Main()
    {
        string c = NextString();
        string ans = "A";
        if (c == "A") ans = "T";
        if (c == "G") ans = "C";
        if (c == "C") ans = "G";
        Console.WriteLine(ans);
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 11220
mod = 10**9+7
n,k = map(int,input().split())
ans = 0
lst1 = [i for i in range(n+1)]
lst2 = lst1[::-1]
s1 = [0]*(n+2)
s2 = [0]*(n+2)
for i in range(1,n+2): 
    s1[i] = (s1[i-1] + lst1[i-1])%mod
    s2[i] = (s2[i-1] + lst2[i-1])%mod
for i in range(k,n+2):
    ans += (s2[i] - s1[i] + 1)%mod
    ans %= mod
print(ans)

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

using namespace std;

#define pb push_back
#define mp make_pair
#define mem(a) memset(a,0,sizeof(a))

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

const int mn=1e5+5;

int a,b;

int main() {
#ifdef LOCAL
	freopen("../1.txt", "r", stdin);
	clock_t cc=clock();
#endif
	cin>>a>>b;
	if (a+b==15) puts("+");
	else if (a*b==15) puts("*");
	else puts("x");
#ifdef LOCAL
	cout<<"time:"<<(double)(clock()-cc)/CLOCKS_PER_SEC;
#endif
	return 0;
}

Measured memory_bytes: 384
import std.stdio;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;

struct JOI {
    int j, o, i;
    JOI opBinary(string op)(const ref JOI joi) const {
        static if (op == "+") {
            return JOI(j + joi.j, o + joi.o, i + joi.i);
        } else static if (op == "-") {
            return JOI(j - joi.j, o - joi.o, i - joi.i);
        }
        assert(0);
    }
}

void main() {
    int M, N, K;
    scanf("%d %d\n%d\n", &M, &N, &K);
    auto F = new string[M];
    foreach (p; 0 .. M) F[p] = readln.chomp;
    auto T = new JOI[][](M + 1, N + 1);
    foreach (p; 0 .. M) {
        JOI x;
        foreach (q; 0 .. N) {
            char c = F[p][q];
            switch (c) {
                case 'J': x.j++; break;
                case 'O': x.o++; break;
                case 'I': x.i++; break;
                default: assert(0);
            }
            T[p + 1][q + 1] = T[p][q + 1] + x;
        }
    }
    //foreach (ref _; T) _.writeln;
    foreach (_; 0 .. K) {
        int a, b, c, d;
        scanf("%d %d %d %d\n", &a, &b, &c, &d);
        a--; b--;
        JOI ans = T[c][d] - T[c][b] - T[a][d] + T[a][b];
        writeln(ans.j, " ", ans.o, " ", ans.i);
    }
}

Measured memory_bytes: 15548
from heapq import heapify, heappop, heappush
N = int(input())
v = list(map(int, input().split()))
heapify(v)
while len(v)>1:
    newfood = heappop(v) + heappop(v)
    heappush(v, newfood/2)
print(heappop(v))

Measured memory_bytes: 3060
#include <stdio.h>
#define MAX 1000000
typedef struct pp{
  char s[100];
  int t;
}q;
q a[MAX];
int head,tail,n;
void en(q x){
  a[tail]=x;
  tail=(tail+1)%MAX;
}
q de(){
  q x=a[head];
  head=(head+1)%MAX;
  return x;
}
int min(int a,int b){
  return a<b ? a:b;
}

int main(){
  int n,i,c,laps=0,cc;
  q u;
  scanf("%d %d",&n,&c);
  for(i=1;i<=n;i++){
    scanf("%s",a[i].s);
    scanf("%d",&a[i].t);
  }
  head=1;
  tail=n+1;
  while(head!= tail){
    u=de();
    cc=min(c,u.t);
    u.t-=cc;
    laps+=cc;
    if(u.t>0){
      en(u);
    }
    else {
      printf("%s %d\n",u.s,laps);
    }
  }
  return 0;
}

Measured memory_bytes: 21072
from collections import Counter

s = input()

for i in range(len(s) - 2):
    for v in Counter(s[i:i+3]).values():
        if v >= 2:
            print(i+1, i+3)
            exit()

for i in range(len(s) - 1):
    for v in Counter(s[i:i+2]).values():
        if v >= 2:
            print(i+1, i+2)
            exit()

print(-1, -1)

Measured memory_bytes: 3444
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (ll i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define Rev(a) reverse(a.begin(), a.end())
#define MATHPI acos(-1)
#define itn int
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-19;


signed main() {
    ll a, b, c;
    cin >> a >> b >> c;
    
    mes(min(b/a, c));
    
        
    
    
    
    
    
    
    
    
}

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

constexpr int NUM = 5;

int main() {
  int loc[NUM], k;
  for (int i{}; i < NUM; ++i) cin >> loc[i];
  cin >> k;

  bool ans{true};
  for (int i{}; i < NUM-1; ++i) {
    for (int j{i}; j < NUM; ++j) {
      if (abs(loc[i] - loc[j]) > k) {
        ans = false;
        break;
      }
    }
  }

  cout << (ans ? "Yay!" : ":(");
}


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

int main(){
  char s[1001], t[1001];
  scanf("%s", s);
  scanf("%s", t);
  int tam= strlen(s)- strlen(t)+1;
  int min= 1002;
  int tt= strlen(t);

  for(int i=0; i<tam;++i){
    int num=0, cont=0;
    for(int j=i; j< tt+i;++j){
      if(s[j]!= t[num])
        cont++;
      num++;
    }
    if(cont < min)
      min=cont;
  }
  printf("%d\n", min);
  return 0;
}


Measured memory_bytes: 1720
package main

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

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func ReadLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func main() {
	nkc := ReadLine()
	var n, k, c int
	fmt.Sscanf(nkc, "%d %d %d", &n, &k, &c)

	s := ReadLine()

	leftGreedy := make([]int, k)
	{
		pos := 0
		for i := 0; i < n; i++ {
			if s[i] == 'x' {
				continue
			}

			if pos >= k {
				return
			}
			leftGreedy[pos] = i
			pos++
			i += c
		}
	}

	rightGreedy := make([]int, k)
	{
		pos := k - 1
		for i := n - 1; i >= 0; i-- {
			if s[i] == 'x' {
				continue
			}

			rightGreedy[pos] = i
			pos--
			i -= c
		}
	}

	for i := 0; i < k; i++ {
		left := leftGreedy[i]
		right := rightGreedy[i]
		if left == right {
			fmt.Println(left + 1)
		}
	}
}

// util
// *   math/simple

func Abs(x int) int {
	if x >= 0 {
		return x
	}
	return -x
}

func Min(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}
	min := values[0]
	for _, v := range values {
		if v < min {
			min = v
		}
	}
	return min
}

func Max(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}
	max := values[0]
	for _, v := range values {
		if v > max {
			max = v
		}
	}
	return max
}

func Pow(base int, exponent uint) int {
	answer := 1
	for i := uint(0); i < exponent; i++ {
		answer *= base
	}
	return answer
}

func Abs64(x int64) int64 {
	if x >= 0 {
		return x
	}
	return -x
}

func Min64(values ...int64) int64 {
	if len(values) == 0 {
		panic("no values")
	}
	min := values[0]
	for _, v := range values {
		if v < min {
			min = v
		}
	}
	return min
}

func Max64(values ...int64) int64 {
	if len(values) == 0 {
		panic("no values")
	}
	max := values[0]
	for _, v := range values {
		if v > max {
			max = v
		}
	}
	return max
}

func Pow64(base int64, exponent uint) int64 {
	answer := int64(1)
	for i := uint(0); i < exponent; i++ {
		answer *= base
	}
	return answer
}

// *   io

type Scanner struct {
	bufScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bufSc := bufio.NewScanner(os.Stdin)
	bufSc.Split(bufio.ScanWords)
	return &Scanner{bufSc}
}

func (sc *Scanner) ReadString() string {
	bufSc := sc.bufScanner
	bufSc.Scan()
	return bufSc.Text()
}

func (sc *Scanner) ReadInt() int {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.Atoi(text)
	if err != nil {
		panic(err)
	}
	return num
}

func (sc *Scanner) ReadInt64() int64 {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.ParseInt(text, 10, 64)
	if err != nil {
		panic(err)
	}
	return num
}


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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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


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

    cin >> N >> K;

    double ans = 0.0;
    for(int i = 1; i <= min(K-1, N); i++){
        ans += pow(double(0.5), double(ceil(log2(K * 1.0 / i))))/N;
    }
    ans += max((N-K+1.0)/double(N), 0.0);
    
    cout << setprecision(15) << ans << endl;


    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        while(true){
            int n = scan.nextInt();
            if(n==0){
                break;
            }
            int scores[] = new int[n];
            for(int i=0;i<n;i++){
                scores[i]=scan.nextInt();
            }
            double average=0;
            double variance=0;
            double sum=0;
            for(int i=0;i<scores.length;i++){
                sum = sum + scores[i];
            }
            average = sum/n;
            double sumsum=0;
            for(int i=0;i<scores.length;i++){
                sumsum = sumsum + Math.pow(scores[i] - average,2);
            }
            variance = sumsum/n;
            System.out.println(Math.sqrt(variance));
        }
        scan.close();
    }
}


Measured memory_bytes: 31408
#include <iostream>
#include <vector>

using namespace std;

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

    vector<int> h(n);
    vector<bool> v(n, true);
    for(int i = 0; i < n; ++i) {
        cin >> h[i];
    }

    for(int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        a--; b--;

        if(h[a] < h[b]) {
            v[a] = false;
        } else if(h[b] < h[a]) {
            v[b] = false;
        } else {
            v[a] = false;
            v[b] = false;
        }
    }

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


Measured memory_bytes: 3708
#!/usr/bin/python3
import copy

def minOp(h, w, k, yl, s):
    xl = []
    ks = [ 0 for i in range(len(yl) + 1) ]

    for x in range(w):
        py = 0
        cks = [ 0 for i in range(len(yl) + 1) ]
        for idx, y in enumerate(yl + [h - 1]):
            for yy in range(py, y + 1):
                if s[yy][x] == '1':
                    cks[idx] += 1

            py = y + 1

        over = False
        for idx, kk in enumerate(ks):
            if kk + cks[idx] > k:
                over = True

        if over:
            for ck in cks:
                if ck > k:
                    return (h - 1) + (w - 1)
            xl.append(x - 1)
            ks = copy.copy(cks)
        else:
            ks = list(map(lambda a, b: a + b, ks, cks))
            
    return len(xl) + len(yl)
    

def devideVertical(h, w, k, cy, yl, s):
    m = (h - 1) + (w - 1)
    for y in range(cy, h - 1):
        nyl = copy.copy(yl)
        nyl.append(y)
        m = min(m, devideVertical(h, w, k, y + 1, nyl, s))
    
    m = min(m, minOp(h, w, k, yl, s))
    return m

(h, w, k) = map(int, input().split())
s = []
for i in range(h):
    s.append(input())

print(devideVertical(h, w, k, 0, [], s))



Measured memory_bytes: 48988
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <string>
#include <sstream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <stack>
#include <cstdio>
#include <climits>
#include <tuple>
#include <ctime>
#define FOR(i,a,n) for (int i = a; i < n; i++)
#define IFOR(i,n,a) for (int i = n; i >= a; i--)
#define mp make_pair
#define full(a) a.begin(), a.end()
#define SZ(x) ((int)(x).size())
#define TC(tc) while (tc--)
#define VI vector<int>
#define PII pair<int, int>
#define trav(a,x) for (auto& a : x)
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
using namespace std;
const int mod = 1e9 + 7;
const ull num = 1e18;

int main()
{
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int n; cin >> n;
	bool flag = 0;
	double a = 0;
	ull res = 1;
	FOR(i, 0, n)
	{
		ull b; cin >> b;
		if (!b) flag = 1;
		a += log10(b);
		res *= b;
	}
	if (flag)
	{
		cout << 0;
	}
	else if (a > 18 || res > num) cout << -1;
	else cout << res;
	
	return 0;
}

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

int main(){
    int ar[3];
    for(int i = 0; i < 3; i++) scanf("%d", &ar[i]);
    sort(ar, ar+3);
    if(ar[0] == ar[2]) printf("No\n");
    else if(ar[0] == ar[1] or ar[1] == ar[2]) printf("Yes\n");
    else printf("No\n");
    return 0;
}


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

int main() {
    int n; cin >> n;
    for (int i = n; i > 1; --i) {
        if ((i & (i - 1)) == 0) {
            cout << i << endl;
            return 0;
        }
    }
    cout << 1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
//long long
using ll = long long;
 
// pair<int, int>
using PII = pair<int, int>;
 
//最大値、mod
const int MOD = 1000000007;
const int INF = 1000000000;
const long long LINF = 1e18;
const int MAX = 510000;
 
//出力系
#define print(x) cout << x << endl
#define prints(x) cout << fixed << setprecision(10) << x << endl
#define printc(x) cout << setw(2) << setfill('0') << x << endl;
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()
 
//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
 
//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
 
// 最小公倍数
unsigned lcm(unsigned a, unsigned b){
    return a / gcd(a, b) * b; 
}
 
// a = max(a, b), a = min(a, b)
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; }
 
// 階乗(MODをとる)
ll pow_mod(ll num, ll pow, ll mod) {
    ll prod = 1;
    num %= mod;
    while (pow > 0) {
        if (pow & 1) prod = prod * num % mod;
        num = num * num % mod;
        pow >>= 1;
    }
    return prod;
}
 
 
 
// 二項係数(MODとる、1 ≦ k ≦ n ≦ 10^7 程度)
// COMinit()
// COM(x, y)
// とコンビで使う
 
// テーブルを作る前処理
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
//int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main(){
    int N;
    cin >> N;
    vector<int>A(N);
    REP(i, N) cin >> A.at(i);

    vector<ll>sum(N + 1, 0);
    map<ll, ll>num;
    for(int i = 1; i < N + 1; i++){
        sum.at(i) = sum.at(i - 1) + A.at(i - 1);
    }
    for(int i = 0; i < N + 1; i++) num[sum.at(i)]++;

    ll ans = 0;
        for (auto x : num) {
        ll n = x.second;
        ans += n * (n - 1) / 2;
    }
    print(ans);
}

Measured memory_bytes: 15104
while True:
    m, f, r = map(int, raw_input().split())
    if m != -1 or f != -1 or r != -1:
        if(m == -1 or f == -1):
            print 'F'
        elif(m + f >= 80):
            print 'A'
        elif(m + f >= 65 and m + f < 80):
            print 'B'
        elif(m + f >= 50 and m + f < 65):
            print 'C'
        elif(m + f >= 30 and m + f < 50):
            if(r >= 50):
                print 'C'
            else:
                print 'D'
        elif(m + f < 30):
            print 'F'
    if m == -1 and f == -1 and r == -1:
        break

Measured memory_bytes: 4232
#!/usr/bin/env python3
import sys


def solve(K: int, A: int, B: int):
    n = ((A-1) // K +1)*K
    print('OK' if A <= n and n <= B else 'NG')
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(K, A, B)

if __name__ == '__main__':
    main()



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

int main(int, char**) {
    ios_base::sync_with_stdio(0); cin.tie(NULL);

    lint A, B;
    cin >> A >> B;
   
    for (int x = 0; x < 1500; ++x) {
        if (int(x * 0.08) == A && int(x * 0.1) == B) {
            cout << x << endl;
            return 0;
        }
    }
    
    cout << "-1" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ff first
#define ss second
#define MAX 10005
#define endl "\n"
#define mp make_pair
#define pb push_back
#define int long long
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define vi vector<int>
#define mii map<int,int>
#define pii pair<int,int>
#define len(x) (x.size())
#define all(a) a.begin(),a.end()
#define f(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) for(int i=0;i<a;i++)
#define debug(x) cerr<<#x<<": "<<x<<endl
#define T int tc;cin>>tc;for(int t=1;t<=tc;t++)
#define set_arr(arr,i) memset(arr,i,sizeof(arr))
#define trace1(x)							cerr << #x << ": " << x << endl;
#define trace2(x, y)						cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)						cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       			cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    			cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) 			cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
using namespace std;

signed main(){
	ios_base::sync_with_stdio(false);	
	cin.tie(0);
	cout.tie(0);
	
 	int n;
 	cin >> n;
 	vi b(n-1);
 	rep(i,n-1){
 		cin>>b[i];
 	}
 	vi a(n);
 	a[0] = b[0];
 	f(i,1,n-1){
 		a[i] = min(b[i],b[i-1]);
 	}
 	a[n-1] = max(b[n-2],a[n-1]);
 	int ans = 0;
 	rep(i,n) ans += a[i];
 	cout << ans;
	return 0;
}



Measured memory_bytes: 256
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Isize1, Usize1},
};

const tmax: usize = 50 * 100 + 100;

#[fastout]
fn main() {
    input! {
        n:usize,m:usize,s:isize,
        r:[(Usize1,Usize1,isize,isize);m],
        v:[(isize,isize);n]
    }

    let mut dp = vec![vec![isize::max_value() / 1000; tmax]; n];
    let mut q = 0;
    for i in 0..tmax {
        if i <= s as usize {
            dp[0][i] = 0;
        } else {
            if q == 0 {
                dp[0][i] = if i == 0 { 0 } else { dp[0][i - 1] } + v[0].1;
                q = v[0].0-1;
            } else {
                q -= 1;
                dp[0][i] = dp[0][i - 1];
            }
        }
    }

    for _ in 0..m * 6 {
        for &(u, w, a, b) in &r {
            for i in 0..tmax {
                if i >= a as usize {
                    let e = i - (a as usize);
                    dp[u][e] = std::cmp::min(dp[u][e], dp[w][i] + b);
                }
                if i >= a as usize {
                    let e = i - (a as usize);
                    dp[w][e] = std::cmp::min(dp[w][e], dp[u][i] + b);
                }
            }
        }
        for l in 0..n {
            for i in 0..tmax {
                //if i <= s as usize {
                    //dp[l][i] = 0;
                //} else {
                    if i + v[l].0 as usize >= dp[0].len() {
                        continue;
                    }
                    dp[l][i + v[l].0 as usize] =
                        std::cmp::min(dp[l][i] + v[l].1, dp[l][i + v[l].0 as usize]);
             //   }
            }
        }
    }

    for i in 1..n {
        println!("{}", dp[i].iter().min().unwrap());
    }
}

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

using namespace std;
const int maxn = 1e5 + 5, mod = 1e9 + 7;
int n, c[maxn], a[maxn], m;
bool f[maxn];

bool dp(int stone)
{
    if (stone == 0) return false;
    if (!c[stone]) {
        c[stone] = true;
        for(int i=1; i<=n; ++i) if (stone >= a[i]) 
            f[stone] |= (!dp(stone - a[i]));
    }
    return f[stone];
}

int main()
{
    #ifdef NTMA 
        freopen("abc.inp", "r", stdin);
    #endif
    //memset(f, 255, sizeof(f));
    cin >> n >> m;
    for(int i=1; i<=n; ++i) cin >> a[i];
    if (dp(m)) cout << "First";
    else cout << "Second";
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
using ll = long long;
const ll mod = 1000000007;
const ll INF = 100000000000000000LL;
signed main(){
    int a,b;
    cin>>a>>b;
    cout<<max({a+b,a-b,a*b})<<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void) {
  int K;
  cin >> K;

  int N = 7;
  int ans = -1;
  for (int i = 1; i <= K; i++) {
    if (N%K==0) {
      ans = i;
      break;
    }
    N = (N%K)*10+7;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector< vector<int> > VVI;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back

int main(){
  int H,W,A,B;
  cin>>H>>W>>A>>B;
  if(H>=2*B&&W>=2*A){
    rep(i,H){
      rep(j,W){
        if((i<B&&j<A)||(i>=B&&j>=A)) cout<<0;
        else cout<<1;
      }
      cout<<endl;
    }
  }
}

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

Int mod_pow(Int x,Int y,Int mod){
  Int res = 1;
  while(y){
    if(y&1) res = res * x % mod;
    x = x * x % mod;
    y /= 2;
  }
  return res;
}

Int extgcd(Int a,Int b,Int &x,Int &y){
  Int d = a;
  if(b != 0){
    d = extgcd(b, a%b, y,x);
    y -= (a/b) * x;
  } else{
    x = 1, y = 0;
  }
  return d;
}

Int mod_inverse(Int a,Int mod){
  Int x,y;
  extgcd(a,mod,x,y);
  return (mod+x%mod)%mod;
}

const Int MOD = 1e6+3;
const Int MAX_P = 200000;
Int fact[MAX_P],inv[MAX_P],finv[MAX_P];
  
void init(Int mod){
  fact[0] = 1;
  for(Int i=1;i<MAX_P;i++)
    fact[i] = (fact[i-1]*i)%mod;

    inv[1] = 1;
    for(Int i=2;i<MAX_P;i++)
      inv[i] = inv[mod%i]*(mod-mod/i)%mod;

    
    finv[0] = 1;
    for(Int i=1;i<MAX_P;i++)
      finv[i] = finv[i-1] * inv[i]%mod;
}

Int mod_comb3(Int n,Int k,Int mod){
  if(k < 0|| k > n) return 0;
  return fact[n] * finv[k] % mod * finv[n-k]%mod;
}

const Int MAX = 2020;
vector<vector<Int> > ds(MAX);

Int dp[MAX][MAX];
Int memo[MAX][MAX];

Int dfs(Int p,Int n){
  Int &res=memo[p][n];
  if(~res) return res;

  res=dp[p][n];
 
  for(Int l:ds[n]){
    Int a=(n/l);
    if(p%a) continue;
    res+=MOD-dfs(p/a,l)*(p/a)%MOD;
  }
  
  res%=MOD;
  res*=mod_inverse(p,MOD);
  res%=MOD;
  return res;
}

signed main(){  
  cin.tie(0);
  ios::sync_with_stdio(0);
  for(Int i=1;i<MAX;i++)
    for(Int j=i+i;j<MAX;j+=i)
      ds[j].emplace_back(i);

  init(MOD);
  
  Int n,k;
  while(cin>>n>>k,n||k){

    vector<Int> co(MAX,0);
    for(Int i=1;i<=k;i++)
      for(Int j=1;j<=k;j++)
	co[i+j]++;
    
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    for(Int p=0;p<n;p++){
      for(Int i=0;i<=n;i++){
	dp[p][i]%=MOD;
	//cout<<p<<":"<<i<<":"<<dp[p][i]<<endl;
	if(!dp[p][i]) continue;       
	for(Int a=2;i+a<=n;a++){
	  dp[p+1][i+a]+=dp[p][i]*co[a]%MOD;
	}
      }
    }
    
    memset(memo,-1,sizeof(memo));
    Int ans=0;
    for(Int i=0;i<=n;i++) dfs(i,n);
    if(n<=k) ans+=2;
    
    for(Int p=0;p<=n;p++)
      for(Int i=0;i<=n;i++)
	if(~memo[p][i]) ans+=memo[p][i];
    
    ans%=MOD;
    cout<<ans<<endl;
  }
  
  return 0;
}



Measured memory_bytes: 71832
#include <stdio.h>

int main(void)
{
     int s,a,b,c,d;

     scanf("%d",&s);

     a = s/3600;
     b = s%3600;
     c = b/60;
     d = b%60;

     printf("%d:%d:%d\n",a,c,d);

    return 0;
}

Measured memory_bytes: 1816
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
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;}
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;


int main()
{
    int d,t,s;
    cin >> d >> t >> s;
    if(d <= t*s) cout << "Yes" << endl;
    else cout << "No" << endl;


    return 0;
}

Measured memory_bytes: 3592
def main():
    import sys
    input=sys.stdin.buffer.readline
    n=int(input())
    dp=[0]*-~n
    for h,a in zip(map(int,input().split()),map(int,input().split())):
        i,s=h,0
        while i:
            t=dp[i]
            if t>s:s=t
            i-=i&-i
        s+=a
        i=h
        while i<=n:
            if s>dp[i]:dp[i]=s
            i+=i&-i
    print(max(dp))
main()

Measured memory_bytes: 33684
def prime_factorization(n)
  s = Math.sqrt(n).floor
  primes = Hash.new { |h, k| h[k] = 0 }
  while n % 2 == 0
    primes[2] += 1
    n /= 2
  end

  3.step(s, 2) do |i|
    while n % i == 0
      primes[i] += 1
      n /= i
    end

    break if n == 1
  end

  primes[n] = 1 if s < n
  primes
end

n = gets.to_i
x = 1
2.upto(n) { |i| x *= i }
primes = prime_factorization(x)
ans = 0
comb = [1]
primes.each_value do |cnt|
  next_comb = []
  1.upto(cnt + 1) do |c1|
    comb.each do |c2|
      c3 = c1 * c2
      if c3 == 75
        ans += 1
      elsif c3 < 75
        next_comb << c3
      end
    end
  end
  comb = next_comb
end
puts ans


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

int main()
{
    set<int> s;
    int N, M;

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

    for(int i=1; i*i<=M; i++)
    {
        if(M % i == 0)
        {
            s.insert(i);
            s.insert(M/i);
        }
    }

    vector<int> vec;

    for(auto i: s)
        vec.push_back(i);

    for(int i=vec.size()-1; i>=0; i--)
    {
        if(M/vec[i] >= N)
        {
            printf("%d", vec[i]);
            break;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

int main() {
  const char right_hands[11] = {
    'y', 'u', 'i', 'o', 'p',
    'h', 'j', 'k', 'l',
    'n', 'm'
  };

  while (true) {
    string s;
    cin >> s;
    if (s == "#") {
      break;
    }
    int isRight = -1;
    int cnt = 0;
    REP(i, s.size()) {
      bool isR = false;
      REP(j, 11) {
        if (s[i] == right_hands[j]) {
          isR = true;
          break;
        }
      }
      
      if ((isRight == 0 && isR == true) ||
        (isRight == 1 && isR == false)) {
        cnt++;
      }
      isRight = isR;
    }
    cout << cnt << endl;
  }

  return 0;
}

Measured memory_bytes: 1192
import java.util.Scanner;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        if (Math.max(A, B) <= 8){
            System.out.println("Yay!");
        } else {
            System.out.println(":(");
        }
        /*int[] cake = new int[15];

        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        sc.close();
        for (int i = 0; i < 15; i++) {
            if (A != 0 && B != 0) {
                if (i % 2 == 0) {
                    cake[i] = 1;
                    A--;
                } else {
                    cake[i] = 2;
                    B--;
                }
            } else if (A == 0 && B != 0) {
                cake[i] = 2;
                B--;
            } else if (A != 0 && B == 0) {
                cake[i] = 1;
                A--;
            } else if (A == 0 && B == 0) {
                System.out.println("Yay!");
                break;
            }
        }

        if(A != 0 || B != 0){
            System.out.println(":(");
        }
        */
    }
}

Measured memory_bytes: 25044