akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
const long double PI = (acos(-1));
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int ctoi(char c)
{
    switch (c)
    {
    case '0':
        return 0;
    case '1':
        return 1;
    case '2':
        return 2;
    case '3':
        return 3;
    case '4':
        return 4;
    case '5':
        return 5;
    case '6':
        return 6;
    case '7':
        return 7;
    case '8':
        return 8;
    case '9':
        return 9;
    default:
        return 0;
    }
}
int main()
{
    string s;
    cin >> s;
    map<char, int> mp;
    for (int i = 0; i < s.size(); i++)
    {
        mp[s[i]]++;
    }
    bool ans = true;
    for (auto x : mp)
    {
        if (x.second % 2 != 0)
        {
            ans = false;
        }
    }
    cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
using namespace std;

int main() {
    int n;
    vector<int> v;
    int sum = 0;
    
    cin >> n;
    for ( int i = 0; i < n; i++ ) {
        int x;
        cin >> x;
        v.push_back(x);
        sum += x;
    }
    
    sort(v.begin(), v.end());
    
    if ( sum % 10 == 0 ) {
        for ( int i = 0; i < v.size(); i++ ) {
            if ( v[i] % 10 != 0 ) {
                sum -= v[i];
                break;
            } else if ( v[i] % 10 == 0 && i == v.size() - 1 ) {
                sum = 0;
            }
        }
    }
    
    cout << sum << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		//入力表示
		int r = sc.nextInt();
		
		System.out.println(3*r*r);
	}

}

Measured memory_bytes: 23892
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 

using namespace std;

int h, w;
char board[2010][2010];

struct Section
{
	int start, end;
};
std::vector<Section> colSection[2010];	//每列的距离陈述情况 
int pColSection[2010];	//每列的距离陈述情况指针 

std::vector<Section> rowSection;

int generateCol(int c)
{
	pColSection[c] = 0;
	Section curSection;
	int p = 0;
	
	while (p < h)
	{
		while ((p < h) && (board[p][c] == '#')) {
			p++;
		}
		if (p >= h)
			break;
			
		curSection.start = p;
		while ((p < h) && (board[p][c] == '.')) {
			p++;
		}
		curSection.end = p - 1;
		colSection[c].push_back(curSection);
	}
}

int generateRow(int r)
{
	rowSection.clear();
	Section curSection;
	int p = 0;
	
	while (p < w)
	{
		while ((p < w) && (board[r][p] == '#')) {
			p++;
		}
		if (p >= w)
			break;
			
		curSection.start = p;
		while ((p < w) && (board[r][p] == '.')) {
			p++;
		}
		curSection.end = p - 1;
		rowSection.push_back(curSection);
	}
}


int main()
{
	scanf("%d%d\n", &h, &w);
	
	for (int i = 0 ; i < h ; i++)
		scanf("%s\n", board[i]);
		
	for (int i = 0 ; i < w ; i++)
		generateCol(i);
		
	int curDist;
	int maxDist = -1;
		
	for (int r = 0 ; r < h ; r++)
	{
		generateRow(r);
		
		int pRow = 0;
		for (int c = 0 ; c < w ; c++)
		{
			if (board[r][c] == '#')
				continue;
			
			curDist = 0;
			while (pRow < rowSection.size()) 
			{
				if ((rowSection[pRow].start <= c) && (c <= rowSection[pRow].end))
				{
					curDist = curDist + rowSection[pRow].end - rowSection[pRow].start + 1;
					break;
				}
				pRow++;
			}
			
			int pCol = pColSection[c];
			while (pCol < colSection[c].size())
			{
				if ((colSection[c][pCol].start <= r) && (r <= colSection[c][pCol].end))
				{
					curDist = curDist + colSection[c][pCol].end - colSection[c][pCol].start + 1;
					break;
				}
				pCol++;
			}
			pColSection[c] = pCol;
			
			curDist = curDist - 1;	//交叉点计算了两次 
			
			if (maxDist < curDist)
				maxDist = curDist;
		}
	}
	
	printf("%d\n", maxDist);

	return 0;
}


Measured memory_bytes: 12288
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

const long long INF = 1e18;
//const ll mod = 1000000007;
ll N;
ll A[201000];
map<l_l, ll> mp[201000];

int main() {
    cin >> N;
    for(int i = 0; i < N; i++) cin >> A[i];
    //mp[0][{0, 1}] = 1e15;
    mp[0][{0, 1}] = 0;
    for(int i = 0; i < N; i++) {
        for(auto tmp : mp[i]) {
            ll num = tmp.first.first;
            ll ok = tmp.first.second;
            ll val = tmp.second;
            //cerr << i << " " << num << " " << ok << " " << (ll)(val - 1e15) << endl;
            //cerr << i << " " << num << " " << ok << " " << (ll)(val) << endl;
            if(ok) {
                ll newnum = num + 1;
                ll newok = 0;
                ll newval = val + A[i];
                if(abs(i/2 - newnum) <= 3) {
                    //cerr << "new: " << newnum << " " << newok << " " << newval << endl;
                    if(mp[i+1].count({newnum, newok})) chmax(mp[i+1][{newnum, newok}], newval);
                    else mp[i+1][{newnum, newok}] = newval;
                }
            }
            if(abs(i/2 - num) <= 3) {
                if(mp[i+1].count({num, 1})) chmax(mp[i+1][{num, 1}], val);
                else mp[i+1][{num, 1}] = val;
            }
        }
    }
    ll ans = mp[N][{N/2, 0}];
    chmax(ans, mp[N][{N/2, 1}]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 127040
#include <iostream>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#define INF 900000000
 
using namespace std;

int main()
{
    int a;
    int b;
    cin>>a;
    cin>>b;
    cout<<a*b<<" "<< a+a+b+b<<endl;
    
    
	

	return 0;
}


Measured memory_bytes: 3080
x,y=map(int,input().split())
if x*y==1:
  print(1000000)
elif x*y==2:
  print(200000+300000)
elif x*y==3:
  print(300000+100000)
elif (x==1 and y!=1) or (x!=1 and y==1):
  print(300000)
elif (x==2 and y>3) or (y==2 and x>3):
  print(200000)
elif (x==3 and y>3) or (y==3 and x>3):
  print(100000)
elif (x==2 and y==3) or (y==2 and x==3):
  print(300000)
elif (x==3 and y==3):
  print(200000)
elif (x==y==2):
  print(400000)
else:
  print(0)

Measured memory_bytes: 38384
#include<cstdio>
#include<iostream>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<list>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<iomanip>
#include<fstream>
#include<ctime>
using namespace std;
typedef vector<int> VI;
typedef pair <int,int> ii;
typedef long long LL;
#define pb push_back
const int INF = 2147483647;

int n, k, res;

int main() {
scanf("%d %d", &n, &k);
res = 1;
while (n--) {
	res = min(res * 2, res + k);
}
printf("%d\n", res);
return 0;
}


Measured memory_bytes: 256
#include <stdlib.h>
#include <iostream>
#include <math.h>
 
using namespace std;
 
int main(){
  int i; cin >> i;
  for(int ans=0;ans<=i;ans++){
    if(floor(ans*1.08)==i){
      cout << ans << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
}

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

vector<int> g[100005];
int color[100005];
const int INF = 1001001001;
int nc = 0;

void dfs(int x, int b=-1){
    color[x] = nc;
    if(g[x].empty())return;
    for (int i = 0; i < g[x].size(); i++){
        int v = g[x][i];
        if(color[v] != INF)continue;
        color[v] = nc;
        dfs(v, x);
    }
    return;
}

int main() {
    int n, m; cin >> n >> m;
    rep(i, m){
        int s, t; cin >> s >> t;
        g[s].push_back(t);
        g[t].push_back(s);
    }

    rep(i, n){
        color[i] = INF;
    }

    rep(i, n){
        if(color[i] == INF){
            dfs(i);
            nc++;
        }
    }
    
    int q; cin >> q;
    rep(i, q){
        int s, t; cin >> s >> t;
        if(color[s] == color[t]){
            cout << "yes" << endl;
        } else {
            cout << "no" << endl;
        }
    }

    
    return 0;
}


Measured memory_bytes: 12084
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define REV(x) reverse(ALL(x))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ld = long double;
using ll = long long;
using ui = unsigned int;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using Pll_ll = pair<ll, ll>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;
const double EPS = 1E-10;

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


int main(){
    int A, B, C; cin >> A >> B >> C;
    int poi(min(C, A+B+1));
    cout << B + poi << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int64_t INF=9999999999999999;

int main() {
   string S;
   cin>>S;
   int N=S.size();
   string RS=S;
   reverse(RS.begin(),RS.end());
   string SS=S.substr(0,(N-1)/2);
   string RSS=SS;
   reverse(RSS.begin(),RSS.end());
   string SSS=S.substr((N+3)/2-1);
   string RSSS=SSS;
   reverse(RSSS.begin(),RSSS.end());
   if(S==RS&&SS==RSS&&SSS==RSSS){cout<<"Yes"<<endl;}
   else{cout<<"No"<<endl;}
return 0;}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>

int main() {
    int n, k; std::cin >> n >> k;
    std::map<int, int> m;
    for (int i = 0; i < n; i++) {
        int a; std::cin >> a;
        m[a]++;
    }

    int s = m.size();
    std::map<int, int> v;
    for (const auto& mm: m) {
        v[mm.second]++;
    }

    std::vector<std::pair<int, int>> l;
    for (const auto vv: v) {
        l.push_back(std::make_pair(vv.first, vv.second));
    }
    std::sort(l.begin(), l.end(), [](const auto& a, const auto& b) {
        return a.first < b.first;
    });

    int c = 0;
    int i = 0;
    while (k < s) {
        if (l[i].second == 0) {
            i++;
        }
        l[i].second--;
        c += l[i].first;
        s--;
    }

    std::cout << c << std::endl;

    return 0;
}

Measured memory_bytes: 9600
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
//#define int long long 
int n;
void get(int n)
{
	if (n == 0)
		return;
	else
	{
		int x = n % -2;
		n /= -2;
		if (x < 0)
		{
			x += 2;
			n++;
		}
		get(n);
		printf("%d", x);
	}
}
signed main(){
   scanf("%d", &n);
   if (n)
   get(n);
   else
   printf("0");
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

    static int N;
    static int[] A;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        N = sc.nextInt();
        A = sc.nextIntArray(N);

        System.out.println(solve());
    }

    static int solve() {
        int min = Integer.MAX_VALUE;
        int max = -1;

        for (int i = 0; i < N; i++) {
            min = Math.min(A[i], min);
            max = Math.max(A[i], max);
        }
        return max - min;
    }

    @SuppressWarnings("unused")
    static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken("\n");
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


Measured memory_bytes: 21204
#include <stdio.h>

int main()
{
    int i, j, r,c;
    while(scanf("%d%d",&r,&c)){
            if(r==0 && c==0)
            break;


    for(i=1; i<=r; i++)
    {
        for(j=1; j<=c; j++)
        {
            if(i==1 || j==1 || i==r || j==c)
            printf("#");
            else
                printf(".");
        }

        printf("\n");
    }
            printf("\n");
    }

    return 0;
}



Measured memory_bytes: 2072
import math

K=int(input())
ans=0
for i in range(1,K+1,1):
    for j in range(1,K+1,1):
        for k in range(1,K+1,1):
            a = math.gcd(i,j)
            b = math.gcd(a,k)
            ans += b

print(ans) 

Measured memory_bytes: 67892
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<tr1/unordered_map>
using namespace std;
using namespace std::tr1;
const long long p1=100000000007LL;
const long long p2=233333333333LL;
const long long p3=998244353LL;
unordered_map<long long,int>mp;
char buf[37];
int n;
long long ans;
int main()
{
	scanf("%d",&n);
	scanf("%s",buf);
	for(int i=0;i<(1<<n);i++)
	{
		long long res1=0LL,res2=0LL;
		for(int j=0;j<n;j++)
		{
			if(i>>j&1)res1=res1*p1+buf[j];
			else res2=res2*p2+buf[j];
		}
		mp[res1*p3+res2]++;
	}
	for(int i=0;i<(1<<n);i++)
	{
		long long res1=0LL,res2=0LL;
		for(int j=0;j<n;j++)
		{
			if(i>>j&1)res1=res1*p1+buf[n+n-j-1];
			else res2=res2*p2+buf[n+n-j-1];
		}
		ans+=mp[res1*p3+res2];
	}
	printf("%lld",ans);
	return 0;
}

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

int main(){
    int n;  cin>>n;
    if(n%4==0|| n%7==0)cout<<"Yes"<<endl;
    else {
        while(n>0){
            n-=4;
            if(n%7==0){
                cout<<"Yes"<<endl;
                break;
            }
        }

        if(n<=0)cout<<"No"<<endl;
    }


    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
u=[]
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        u.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            u.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        u.append(n)
    #return a
    return
for i in range(1,n+1):
    prime_factorize(i)
#print(u)
c=Counter(u)
ans=1
for j in c.keys():
    ans=ans*(c[j]+1)%mod
print(ans)

Measured memory_bytes: 3316
#include<iostream>
#include<utility>
#include<queue>
#define rep(i,a) for(int i=0;i<a;i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
ll dp[2010][2010]={0},in[2020],n,out;
queue<pii>q;
int main(){
	cin>>n;rep(i,n)cin>>in[i];
	rep(i,n)dp[i][1]=in[i],q.push(pii(i,1));
	while(!q.empty()){
		pii b=q.front();q.pop();
		int s=b.first-1,t=(s+1+b.second)%n;
		if(s==-1)s=n-1;
		if(b.second%2){
			if(in[s]<in[t])s=b.first;
			if(dp[s][b.second+1]<dp[b.first][b.second]){
				dp[s][b.second+1]=dp[b.first][b.second];
				if(b.second+1!=n)q.push(pii(s,b.second+1));
			}
		}else{
			rep(i,2){
				if(dp[s][b.second+1]<dp[b.first][b.second]+in[(i?t:s)]){
					dp[s][b.second+1]=dp[b.first][b.second]+in[(i?t:s)];
					if(b.second+1!=n)q.push(pii(s,b.second+1));
				}
				s=b.first;
			}
		}
	}
	rep(i,n)out=max(out,dp[i][n]);
	cout<<out<<endl;
}

Measured memory_bytes: 32668
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long l,r;
    cin >> l >> r;
    r = min(r,l+4038);
    int ans=2018;
    
    for(long long i=l;i<r;i++){
        for(long long j=l+1;j<r+1;j++){
            int x = i*j%2019;
            ans = min(ans,x);
           // if(ans = 0)break;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];
		for (int i=0;i<N;i++) {
			A[i]=sc.nextInt();
		}

		int[] L = new int[N+1];
		int[] R = new int[N+1];
		int[] ans = new int[N];
		
		for (int i=0;i<N;i++) {
			L[i+1]=gcd(L[i],A[i]);
		}
		for (int i=N;i>0;i--) {
			R[i-1]=gcd(R[i],A[i-1]);
		}
		for (int i=0;i<N;i++) {
			ans[i]=gcd(L[i],R[i+1]);
		}
		int max=0;
		for (int i=0;i<N;i++) {
			max=Math.max(max,ans[i]);
		}
		System.out.println(max);
		sc.close();
	}

	static int gcd(int m,int n) {
		if (m<n) {
			return gcd(n,m);
		}
		if (n==0) {
			return m;
		}
		return gcd(n,m%n);
	}
}


Measured memory_bytes: 50352
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>

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

using ll = long long;
using namespace std;

constexpr int INF = 2147483647; // 2 * 1e9
constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	if(s[0] == '9' || s[1] == '9') cout << "Yes\n";
	else cout << "No\n";
	return 0;
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
#define MOD (ll)(1e9+7)

ll gcd(ll p,ll q){
    if(q==0)
        return p;
    return gcd(q, p % q);
}
ll moddiv(ll a,ll b){
    a %= MOD;
    b %= MOD;
    for(ll m=MOD-2;m>0;m/=2){
        if(m&1){
            a=a*b%MOD;
        }
        b=b*b%MOD;
    }
    return a;
}

ll pow(ll a,ll b){
    if(b==0)
        return 1;
    ll c = pow(a * a % MOD, b / 2);
    if(b&1){
        return c * a%MOD;
    }
    return c;
}

ll N,A[10101];
ll mk[1010101];
ll abc;
ll i, j,ans;

int main(){
    scanf("%lld",&N);
    fornum(i,0,N){
        scanf("%lld", &A[i]);
    }
    

    //printf("%d\n", pr.size());
    abc = 1;
    fornum(i,0,N){
        ll c = A[i];
        fornum(j,2,1001){
            ll b = 0;
            while(c%j==0){
                c /= j;
                ++b;
            }
            mk[j] = max(mk[j], b);
        }
        mk[c] = 1;
    }

    abc = 1;
    fornum(i,2,1010100){
        abc = abc * pow(i, mk[i]) % MOD;
    }
    fornum(i,0,N){
        ans = (ans + moddiv(abc , A[i])) % MOD;
    }
    printf("%lld", ans);
    return 0;
}

Measured memory_bytes: 6656
#include<bits/stdc++.h>
using namespace std;
/*bool is(long long a){
    if(a==2) return true;
    if(a<=1||a%2==0) return false;
    for(int i=3;i*i<=a;i+=2){
        if(a%i==0) return false;
    }
    return true;
}*/
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    //cout.setf(ios_base::fixed,ios_base::floatfield);
    int n,m,z=0;
    set<string> s;
    cin>>n;
    string q[n];
    
    for(int i=0;i<n;i++){
        cin>>q[i];
        
    }
    cin>>m;
    pair<string,int> a[n+m];
    for(int i=0;i<n;i++){
        a[i].first=q[i];
        a[i].second=1;
        s.insert(a[i].first);
    }
    for(int i=n;i<m+n;i++){
        cin>>a[i].first;
        a[i].second=-1;
        s.insert(a[i].first);
        
    }
    sort(a,a+n+m);
    for(int i=0;i<n+m;i++){
        if(a[i-1].first==a[i].first){
            a[i].second+=a[i-1].second;
            a[i-1].second=0;
        }
        z=max(z,a[i].second);
    }
    cout<<z<<'\n';
    return 0;
}

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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
typedef vector<ll> VL; const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	ll n, k, ans =0;
	cin >>n >>k;
	VL dp(k+10);

	auto bin_pow =[](ll x, ll n, ll mod)->ll{
		ll res = 1LL;
		for(; n > 0; n >>=1, x = x*x %mod) if(n & 1) res = res * x %mod;
		return res;
	};
	
	rep2(i, 1, k+1) dp[i] = bin_pow(k / i, n, MD);
	repr(i, k, 1){
		for(int j=2*i; j<=k; j+=i) (dp[i] += MD - dp[j]) %=MD;
		(ans += dp[i] * i) %=MD;
	}
	cout << ans <<"\n";
	return 0;
}


Measured memory_bytes: 3988
#include <string>
#include <iostream>

using namespace std;

int main(){
  int n;
  string s, t;
  cin >>n;
  cin >> s;
  cin >> t;
  for(int i=0; i<n; i++){
    cout << s[i] << t[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

int sqr(int x) {
  return x * x;
}

int main() {
  int n;
  scanf("%d", &n);
  vector<int> x(n), y(n), p(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &x[i], &y[i]);
    p[i] = i;
  }
  double sum = 0;
  int cnt = 0;
  do {
    for (int i = 0; i + 1 < n; ++i) {
      int cur = sqr(x[p[i + 1]] - x[p[i]]) + sqr(y[p[i + 1]] -
  y[p[i]]);
      sum += sqrt(1.0 * cur);
    }
    cnt += 1;
  } while (next_permutation(p.begin(), p.end()));
  sum /= cnt;
  printf("%.10f\n", sum);
  return 0;
}


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

int main(){
    int n;
    int t[110000], x[110000], y[110000];
    cin >> n;
    t[0] = x[0] = y[0] = 0;
    for(int i = 0; i < n; i++)
        cin >> t[i+1] >> x[i+1] >> y[i+1];

    bool can = true;
    for(int i = 0; i < n; i++){
        int dt = t[i+1] - t[i];
        int dist = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i]);
        if(dt < dist) can = false;
        if(dist % 2 != dt % 2) can = false;
    }
    cout << (can ? "Yes" : "No") << endl;
}


Measured memory_bytes: 1408
n, a, b, c = map(int, input().split())
column = [a, b, c]
dict_convert = {"A": 0, "B": 1, "C": 2}
reverse_convert = {0: "A", 1: "B", 2: "C"}
s = list()
for _ in range(n):
  pair = tuple(dict_convert[val] for val in tuple(input()))
  s.append(pair)
choices = list()
def generate_play():
  for i in range(n):
    if column[s[i][0]] == 0 and column[s[i][1]] == 0:
      return "No"
    elif column[s[i][0]] == 1 and column[s[i][1]] == 1 and i<n-1:
      other_index = next(x for x in range(3) if x not in (s[i][0], s[i][1]))
      if s[i+1] == (other_index, s[i][0]) or s[i+1] == (s[i][0], other_index):
        choice = s[i][0]
        column[s[i][1]] -= 1
        column[s[i][0]] += 1
      else:
        choice = s[i][1]
        column[s[i][1]] += 1
        column[s[i][0]] -= 1
      choices.append(choice)
    else:
      if column[s[i][0]] >= column[s[i][1]]:
        choice = s[i][1]
        column[s[i][1]] += 1
        column[s[i][0]] -= 1
      else:
        choice = s[i][0]
        column[s[i][1]] -= 1
        column[s[i][0]] += 1
      choices.append(choice)
  return "Yes"
ans = generate_play()
print(ans)
if ans == "Yes":
  [print(reverse_convert[val]) for val in choices]

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

int main() {
	ll n,m;
	cin >> n >> m;
	ll a[n];
	for(ll i=0;i<n;i++){
		cin >> a[i];
		a[i]/=2;
	}
	bool same=true;
	while(a[0]%2==0){
		for(int i=0;i<n;i++){
			if(a[i]%2!=0){
				cout << 0 << endl;
				return 0;
			}
			a[i]/=2;
		}
		m/=2;
	}
	for(int i=0;i<n;i++){
		if(a[i]%2==0){
			cout << 0 << endl;
			return 0;
		}
	}
	ll com;
	if(n==1) com=a[0];
	else{
		com=a[1]/__gcd(a[1],a[0])*a[0];
		for(ll i=2;i<n;i++){
			com=a[i]/__gcd(a[i],com)*com;
			if(com>2*m){
				cout << 0 << endl;
				return 0;
			}
		}
	}
	ll res=0;
	ll count=com;
	while(count<=m){
		res++;
		count+=com*2;
	}
	cout << res << endl;
}


Measured memory_bytes: 4412
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define REPR(i, m, n) for (int i = (int)(m); i >= (int)(n); i--)
#define all(v) v.begin(), v.end()
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; }
const int INF = 1001001001;
typedef unsigned long long ll;

static const int dx[4] = {1, 0, -1, 0};
static const int dy[4] = {0, 1, 0, -1};
int MDT[16][16];

struct Puzzle{
  int f[16];
  int space;
  int cnt;
  int MD;

  bool operator < (const Puzzle &p) const {
    rep(i, 16){
      if(f[i] == p.f[i]) continue;
      return f[i] < p.f[i];
    }
    return false;
  }
};

struct State{
  Puzzle puzzle;
  int estimated;
  bool operator < (const State &s) const {
    return estimated > s.estimated;
  }
};


int getALLMD(Puzzle pz){
  int sum = 0;
  rep(i, 16){
    if(pz.f[i] == 16) continue;
    sum += MDT[i][pz.f[i]-1];
  }
  return sum;
}

int astar(Puzzle in) {
  priority_queue<State> PQ;
  in.MD = getALLMD(in);
  in.cnt = 0;
  map<Puzzle, bool> V;
  Puzzle u, v;
  State initial;
  initial.puzzle = in;
  initial.estimated = in.MD;
  V[in] = true;
  PQ.push(initial);
  int ans;
  while(!PQ.empty()){
    State st = PQ.top(); PQ.pop();
    u = st.puzzle;
    if(u.MD == 0) return u.cnt;
    int sx = u.space / 4;
    int sy = u.space % 4;
    rep(i, 4){
      int tx = sx + dx[i];
      int ty = sy + dy[i];
      if(tx<0 || ty<0 || 4<=tx || 4<=ty) continue;
      v = u;
      v.MD -= MDT[tx*4+ty][v.f[tx*4+ty]-1];
      v.MD += MDT[sx*4+sy][v.f[tx*4+ty]-1];
      swap(v.f[sx*4+sy], v.f[tx*4+ty]);
      v.space = tx * 4 + ty;
      if(!V[v]){
        v.cnt++;
        State news;
        news.puzzle = v;
        int tmp =  v.cnt + v.MD;
        news.estimated = tmp;
        if(tmp <= 45){
          V[v] = true;
          PQ.push(news);
        }
      }
    }
  }
  return -1;
}

int main(){
  rep(i, 16){
    rep(j, 16){
      MDT[i][j] = abs(i/4-j/4) + abs(i%4 - j%4);
    }
  }

  Puzzle in;
  rep(i, 16){
    cin >> in.f[i];
    if(in.f[i] == 0){
      in.f[i] = 16;
      in.space = i;
    }
  }

  cout << astar(in) << endl;

  return 0;
}






Measured memory_bytes: 230176
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=998244353;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-11;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 11100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	inline long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ

int main(){
	int a;scanf("%d",&a);
	for(int i=1;;i++){
		if(a*i%360==0){
			printf("%d\n",i);return 0;
		}
	}
}

Measured memory_bytes: 1708
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define n_p(v) next_permutation(v.begin(),v.end())
#define print(a) cout<<(a)<<endl;
#define to_ll(b) stoll(b)
#define MOD 1000000007
#define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define lcm(a,b) (a)/__gcd((a),(b))*(b)

signed main(){
	IOS;
	ll ans=1;
	ll k; cin>>k;
	rep(i,0,k){
		ll a; cin>>a;
		ans=lcm(a,ans);
	}
	cout<<ans;
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vb = vector<bool>;
using vs = vector<string>;
using pint = pair<int, int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main() {
    int n;
    cin >> n;
    vi a(n), b(n), c(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    rep(i, n) cin >> c[i];
    
    sort(all(a)); sort(all(c));

    ll ans = 0;
    rep(i, n) {
        auto it1 = lower_bound(all(a), b[i]);
        auto it2 = upper_bound(all(c), b[i]);
        ll num1 = it1 - a.begin();
        ll num2 = c.end() - it2;
        ans += (num1 * num2);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1408
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
while 500 * A > X:
    A = A - 1
while A >= 0:
    B_1 = B
    X_A = X - 500 * A
    while 100 * B_1 > X_A:
        B_1 = B_1 - 1
    while B_1 >= 0:
        X_B = X_A - 100 * B_1
        if 50 * C >= X_B:
            count = count + 1
        else:
            pass
        B_1 = B_1 - 1
    A = A - 1
print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long LL;
const double eps = 1e-10;
const int maxn = 1e5 + 100;
vector<int>g;
long long a[maxn],sum[maxn],ss[maxn]; char s[maxn];
int main() {
#ifdef ac
    freopen("in.txt" , "r" , stdin);
//    freopen("out.txt" , "w" , stdout);
#endif
    int n;
    cin >> n;
    cin >> a[1];
    if(n==1)
    sum[0]=0;ss[0]=0;
    sum[1]=ss[1]=a[1];int flag=0;

    for(int i=2;i<=n;++i) {
        cin >> s[i] >> a[i];
        sum[i]=sum[i-1]+a[i];
        if(s[i]=='-'){g.push_back(i);ss[i]=ss[i-1]-a[i];flag=1;}
        else ss[i]=ss[i-1]+a[i];
    }
    if(!flag){cout <<sum[n]<<endl;return 0;}
    ss[n+1]=ss[n];sum[n+1]=sum[n];
    g.push_back(g[g.size()-1]+1);
    long long ans=ss[n];
    for(int i=0;i<g.size()-1;++i) {
        int x=g[i],y=g[i+1]-1;

        ans=max(ss[x-1]-(sum[y]-sum[x-1])+(sum[n]-sum[y]),ans);
//         cout <<x << " " << y << " " << ans << endl;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3192
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n=1;
  int m=1;
  int count=0;
  vector<int> sum(50000, 0);
  vector<int> flg(50000, 0);

  while(n!=0&&m!=0)
    {
      cin >> n >> m;
      if(n==0&&m==0)
	{
	  break;
	}
      vector<int> a(n);
      for(int i=0;i<n;i++)
	{
	  cin >> a[i];
	}
      for(int i=0;i<n;i++){
	for(int j=0;j<n;j++){
	  if(a[i]+a[j]>sum[count] && a[i]+a[j]<=m && i!=j)
	    {
	      sum[count] = a[i]+a[j];
	      flg[count] = 0;
	    } 
	  else
	    {
	      if(sum[count]==0)
		{
		  flg[count]=1;
		}
	    }
	}
      }
      count++;
    }
  for(int i=0;i<count;i++)
    {
        if(flg[i]==0)
	{
	  cout << sum[i] << endl;
	}
      if(flg[i]==1)
	{
	  cout << "NONE" << endl;
	}
    }
  return 0;
}





Measured memory_bytes: 3340
#include <cstdio>
using namespace std;

int main(){
  int N;
  scanf("%d",&N);
  int l[N],r[N];
  int i;
  int num=0;
  for(i=0;i<N;i++){
    scanf("%d %d",&l[i],&r[i]);
    num+=r[i]-l[i]+1;
  }
  printf("%d\n",num);
  return 0;
}


Measured memory_bytes: 128
n, m = map(int, input().split())
a, b = map(list, zip(*(map(int, input().split()) for i in range(m))))

print("POSSIBLE" if len({b_i for a_i, b_i in zip(a, b) if a_i == 1} & {a_i for a_i, b_i in zip(a, b) if b_i == n}) > 0 else "IMPOSSIBLE")


Measured memory_bytes: 112044
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>

using namespace std;

int main(){
    int n;
    cin>>n;
    vector<int> a(n/2);
    vector<int> b=a;
    map<int,int> A;
    map<int,int> B;
    A[-1]=0;
    B[-1]=0;
    
    for(int i=0;i<n/2;i++){
        cin>>a.at(i)>>b.at(i);
        
        if(A.count(a.at(i))){
            A[a.at(i)]++;
        }else{
            A[a.at(i)]=1;
        }
        
        if(B.count(b.at(i))){
            B[b.at(i)]++;
        }else{
            B[b.at(i)]=1;
        }
    }
    
    int maxnumA=-1,secondnumA=-1,maxnumB=-1,secondnumB=-1;
    int maxcount=-1;
    
    for(auto at:a){
        if(at==maxnumA) continue;
        int pre=maxnumA;
        maxcount=max(maxcount,A[at]);
        if(maxcount==A[at]){
            maxnumA=at;
            secondnumA=pre;
        }else{
            if(A[secondnumA]<A[at]) secondnumA=at;
        }
    }//cout<<maxnumA<<" "<<A[maxnumA]<<" "<<secondnumA<<" "<<A[secondnumA]<<endl;
    
    maxcount=-1;
    
    for(auto at:b){
        if(at==maxnumB) continue;
        int pre=maxnumB;
        maxcount=max(maxcount,B[at]);
        if(maxcount==B[at]){
            maxnumB=at;
            secondnumB=pre;
        }else{
            if(B[secondnumB]<B[at]) secondnumB=at;
        }
    }//cout<<maxnumB<<" "<<B[maxnumB]<<" "<<secondnumB<<" "<<B[secondnumB]<<endl;
    
    if(maxnumA!=maxnumB) cout<<n-A[maxnumA]-B[maxnumB]<<endl;
    else cout<<min(n-A[maxnumA]-B[secondnumB],n-A[secondnumA]-B[maxnumB])<<endl;
    
    return 0;
}

Measured memory_bytes: 5376
#define STOPIT
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

void debug_impl() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
    #define debug(...)\
    do {\
        cerr << boolalpha << "[" << #__VA_ARGS__ << "]:";\
        debug_impl(__VA_ARGS__);\
        cerr << std::noboolalpha;\
    } while (false)
#else
    #define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, enable_if_t<!is_same< Container, string >::value, nullptr_t> = nullptr>
istream& operator>> (istream& is, Container& v)
  { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, enable_if_t<!is_same< Container, string >::value, nullptr_t> = nullptr >
ostream& operator<< (ostream& os, Container const& v) {
  os << "{";
  for (auto it = v.begin(); it != v.end(); it++)
    {os << (it != v.begin() ? "," : "") << *it;}
  return os << "}";
}
int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int cnt1 = (a+d-1)/d;
    int cnt2 = (c+b-1)/b;
    debug(cnt1, cnt2);
    if (cnt1>=cnt2)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3636
n = int(input())
m = int(input())
in_linkset = [set() for _ in range(n)]
out_linkset = [set() for _ in range(n)]
for _ in range(m):
    s, t = (x - 1 for x in map(int, input().split()))
    in_linkset[t].add(s)
    out_linkset[s].add(t)

result = []
roots = {s for s, links in enumerate(in_linkset) if not links}
unique = True

while roots:
    if unique and len(roots) > 1:
        unique = False
    root = roots.pop()
    result.append(root)
    for neighbor in out_linkset[root]:
        in_links = in_linkset[neighbor]
        in_links.remove(root)
        if not in_links:
            roots.add(neighbor)

if len(result) < n:
    result.extend(s for s in range(n) if s not in result)

print('\n'.join(str(s + 1) for s in result))
print(int(not unique))

Measured memory_bytes: 27520
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;

int main(){
	
	ll n, c, k, t[100000], ans=0;
	cin >> n >> c >> k;
	for(int i=0; i<n; i++){
		cin >> t[i];
	}
	sort(t, t+n);
	ll cnt=0, T;
	for(int i=0; i<n; i++){
		if(cnt==0){
			T=t[i]+k;
			cnt++;
			ans++;
		} else if(cnt<c){
			if(t[i]<=T){
				cnt++;
			} else {
				T=t[i]+k;
				cnt=1;
				ans++;
			}
		} else if(cnt==c){
			T=t[i]+k;
			cnt=1;
			ans++;
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
/*input
10 0 12 0 120
*/
 
 
 
#include <bits/stdc++.h>
using namespace std;
 
 
 
#define int long long int
#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(c) \
    c.begin(), c.end()
#define init(arr, num) \
    memset(arr, num, sizeof(arr))
#define fast\
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define inputFile \
    freopen("input.txt", "r", stdin); 
#define outputFile \
    freopen("output.txt", "w", stdout);
#define modM 1000000007
#define PI 3.1415926535897932
#define F first
#define S second  
#define pb push_back  
 
#ifdef gaviria
#define TRACE
#endif
#ifdef TRACE
#define trace(...) _f(#VA_ARGS, __VA_ARGS_)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cout << name << " : " << arg1 << std::endl;
 
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
 
 
typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair< int, int > ii;
typedef unordered_set<int> usi;
 
ll n,i,j,k,m;
int target;


void solve() 
{ 
int h1,m1,h2,m2,k;

cin>>h1>>m1>>h2>>m2>>k;

int gap=(h2-h1)*60;
gap= gap+m2-m1;
cout<<gap-k;

}
 
 
 
signed main()
{
 
    // inputFile;
    fast;
    int T = 1;
// cin >> T;
ll h=T;
    while(T--){
 
        solve();
cout<<endl;
     
        
        
 
    }
    
    
    return 0;
 
}

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define ALL(v) v.begin(), v.end()
typedef long long ll;


int main(){

int a,b,c;
cin >> a >> b ;

if(a%3==0 or b%3==0 or (a+b)%3==0)cout << "Possible" << endl;
else cout << "Impossible" << endl;



return 0;
}



Measured memory_bytes: 256
#include<sstream>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


using namespace std;



int main(){
	int h,w;
	cin>>h>>w;
	string s[26][26];
	rep(i, h)rep(j, w)cin >> s[i][j];

	char a;
	int b;
	rep(i,h){
		rep(j, w){
			if (s[i][j]=="snuke"){
				a = j + 'A';
				b=i+1;
			}
		}
	}
	cout<<a<<b<<endl;

	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream &operator << (ostream& out,const pair<S,T>& o){
    out << "(" << o.first << "," << o.second << ")"; return out;
}
/*
<url:>
問題文============================================================

=================================================================

解説=============================================================

================================================================
*/
bool check(ll X){
    string S = to_string(X);
    ll len = (int)S.length();
    for(int i = 0; i < len/2;i++){
        if(S[i] != S[len-1-i])return false;
    }
    return true;
}
ll solve(){
    ll res = 0;
    ll A,B; cin >> A >> B;
    for(;A <= B;A++){
        if(check(A)) res++;
    }
    return res;
}
int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

const int mod=998244353;
ll p[2001];
int x[201],y[201];
bool used[201][201];
int main(){
    int n;
    cin>>n;
    rep(i,n){
        cin>>x[i]>>y[i];
    }
    p[0]=1;
    rep(i,2000) p[i+1]=p[i]*2%mod;
    ll sum=n+1;
    rep(i,n)FOR(j,i+1,n){
        if(used[i][j]) continue;
        int cnt=0;
        vector<int> u;
        rep(k,n){
            int a=(x[k]-x[i])*(y[j]-y[i]);
            int b=(x[j]-x[i])*(y[k]-y[i]);
            if(a==b){
                //used[i][j]=used[j][i]=true;
                u.pb(k);
                ++cnt;
            } 
        }
        for(int it1:u)for(int it2:u) used[it1][it2]=true;
        sum+=p[cnt]-cnt-1;
        sum%=mod;
    }
    ll ans=(p[n]-sum+mod)%mod;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
S = input()

score = [0 for _ in range(len(S))]

# s
previous_l = 0
for index in range(len(S)):
    if S[index] == "L":
        if previous_l + 1 < index:
            # L
            score[index] += (index - previous_l) // 2 
            # R
            score[index - 1] += (index - previous_l - 1) // 2 
        previous_l = index + 1

#print(score)
previous_r = len(S) - 1
for index in reversed(range(len(S))):
    if S[index] == "R":
        if previous_r -1 > index:
            score[index] += (previous_r - index) // 2 
            score[index + 1] += (previous_r - index - 1) // 2 
        previous_r = index - 1

#print(score)
# LR
for index in range(len(S)):
    if S[index] == "R" and S[index + 1] == "L":
        score[index] += 1
        score[index + 1] += 1
print(" ".join(map(str, score)))



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

int main() {
	long long int n, ans;
	scanf("%lld", &n);
	ans = n;

	for(long long int i=1; i<=1000000; i++) {
		if(n%i != 0)
			continue;
		long long int j = (n/i);
		ans = min(ans, i+j-2);
	}
	printf("%lld",ans);

	return 0;
}

Measured memory_bytes: 256