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


using namespace std;

int main() {
	int A,B,K;
	cin >> A >> B >> K;
	
	int count = 0;
	int ans;
	
	for(int i = min(A,B); count < K; i--){
		
	//	cout << "dbgloopbegin i=" << i << ", count=" << count << endl;
		
		if(A % i == 0 && B % i == 0){
			
	//		cout << "hit" << endl;
			
			ans = i;
			count++;
		}
		
	//	cout << "dbgloopend i=" << i << ", count=" << count << endl;
	}
	
	cout << ans << endl;
	
		
	return 0;
}


Measured memory_bytes: 256
t[9999],W,N,a,b,i;main(c){for(;scanf("%d",&W),W;printf("Case %d:\n%d\n%d\n",c++,t[W],i),memset(t,0,W*9)){for(scanf("%d",&N);N--&&scanf("%d,%d",&a,&b);)for(i=W;i>=b;i--)t[i]=fmax(t[i],t[i-b]+a);	for(i=0;t[++i]-t[W];i);}}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {
    private static Scanner sc;

    public Main() {
    }

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

    }

    private void solve() {
        int A = sc.nextInt();
        int B = sc.nextInt();

        if (A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0) {
            System.out.println("Possible");
        } else {
            System.out.println("Impossible");
        }
    }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    int h, w, n;
    cin >> h >> w >> n;
    int sr, sc;
    cin >> sr >> sc;
    sr--; sc--;
    string s, t;
    cin >> s >> t;
    int lr = 0, lc = 0, rr = h - 1, rc = w - 1;
    rrep(i, n) {
        if (t[i] == 'U') rr++;
        else if (t[i] == 'R') lc--;
        else if (t[i] == 'D') lr--;
        else if (t[i] == 'L') rc++;
        if ((rr < lr) || (rc < lc)) {
            cout << "NO" << endl;
            return 0;
        }
        lr = max(0, min(h - 1, lr));
        lc = max(0, min(w - 1, lc));
        rr = max(0, min(h - 1, rr));
        rc = max(0, min(w - 1, rc));
        if (s[i] == 'U') lr++;
        else if (s[i] == 'R') rc--;
        else if (s[i] == 'D') rr--;
        else if (s[i] == 'L') lc++;
        if ((rr < lr) || (rc < lc)) {
            cout << "NO" << endl;
            return 0;
        }
        lr = max(0, min(h - 1, lr));
        lc = max(0, min(w - 1, lc));
        rr = max(0, min(h - 1, rr));
        rc = max(0, min(w - 1, rc));
        // printf("(%d, %d), (%d, %d)\n", lr, lc, rr, rc);
    }
    if ((sr >= lr) && (sr <= rr) && (sc >= lc) && (sc <= rc)) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 920
#include <stdio.h>
int main(void){
    
    int a, b, c;
    
    scanf("%d %d %d", &a, &b, &c);
    
    if(a < b && b < c){
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    
    return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const ll mod = 1e9 + 7;

ll powll(ll x, ll y){
    ll res = 1LL;
    while(y){
        if (y & 1LL)
            res *= x;
        res %= mod;
        x = (x*x) % mod;
        y >>= 1LL;
    }
    return res;
}

ll naive(ll n, ll k){
    set<VI> st;
    int m = (n + 1) / 2;
    VI a(n);
    REP(mask, powll(k, m)){
        REP(i,m){
            a[i] = (mask / powll(k, i)) % k;
            a[n - 1 - i] = a[i];
        }
        VI b(n);
        REP(s,n){
            REP(i,n) b[i] = a[(i+s)%n];
            st.insert(b);
        }
    }
    return st.size();
}

int main() {
    ll n, k;
    cin >> n >> k;

    // if (k <= 10){
    //     cout << naive(n, k) << endl;
    // }

    VL factor;
    for (ll x = 1; x * x <= n; ++x){
        if (n % x == 0){
            factor.push_back(x);
            if (x * x != n) factor.push_back(n / x);
        }
    }
    sort(ALL(factor));

    int m = factor.size();
    VL way(m);
    ll ans = 0;

    REP(i,m){
        ll x = factor[i];
        way[i] = powll(k, (x + 1) / 2);
        REP(j,i){
            if (x % factor[j] == 0){
                way[i] = (way[i] - way[j] + mod) % mod;
            }
        }
        ll tmp;
        if (x % 2) tmp =  (way[i] * x) % mod;
        else tmp = (way[i] * (x / 2)) % mod;
        ans = (ans + tmp) % mod;
        // cout << "f " << x << "  ";
        // cout << tmp << endl;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#template
def inputlist(): return [int(j) for j in input().split()]
#template
n_ = []
x_ = []
while True:
    n,x = inputlist()
    if n == 0 and x == 0:
        break
    n_.append(n)
    x_.append(x)
for i in range(len(n_)):
    n = n_[i]
    x = x_[i]
    tmp = 0
    for a in range(1,n+1):
        for b in range(a+1,n+1):
            for c in range(b+1,n+1):
                if a+b+c == x:
                    tmp +=1
    print(tmp)



Measured memory_bytes: 5604
s = list(input())
alphabets = list('abcdefghijklmnopqrstuvwxyz')
for i in range(len(s)):
  if s[i] in alphabets:
    alphabets.pop(alphabets.index(s[i]))
if len(alphabets) > 0:
  print(alphabets[0])
else:
  print("None")

Measured memory_bytes: 3956
a = []
for i in range(3):
    a.append([int(i) for i in input().split()])

c = [[a[0][0], a[0][1], a[0][2]],
    [a[1][0], a[1][1], a[1][2]],
    [a[2][0], a[2][1], a[2][2]],
    [a[0][0], a[1][0], a[2][0]],
    [a[0][1], a[1][1], a[2][1]],
    [a[0][2], a[1][2], a[2][2]],
    [a[0][0], a[1][1], a[2][2]],
    [a[0][2], a[1][1], a[2][0]]]

n = int(input())
b = []
for i in range(n):
    b.append(int(input()))

for i in c:
    flag = True
    for j in i:
        if j not in b:
            flag = False
            continue
    if flag:
        print("Yes")
        break
else:
    print("No")

Measured memory_bytes: 3064
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define k 10000

/*
*
*/

void countingSort(int A[], int n, int B[]);

int main(int argc, char** argv) {
int *A, *B, n;
scanf("%d", &n);

A = (int *)malloc(sizeof(int) * n+1);
B = (int *)malloc(sizeof(int) * n+1);
for (int i = 0; i < n; ++i) scanf("%d", &A[i+1]);

countingSort(A, n, B);

for (int x = 1; x <= n; ++x)
{
if (x > 1) printf(" ");
printf("%d", B[x]);
}
printf("\n");

return (EXIT_SUCCESS);
}

void countingSort(int A[], int n, int B[])
{
int C[k+1];
for (int ix = 0; ix <= k; ++ix) C[ix] = 0;
for (int jx = 0; jx < n; ++jx) C[A[jx+1]]++;
for (int kx = 1; kx <= k; ++kx) C[kx] += C[kx-1];
for (int w = 1; w <= n; ++w)
{
B[C[A[w]]] = A[w];
C[A[w]]--;
}
}


Measured memory_bytes: 17444
def gcda(a,b):
    if a < b:
        a, b = b, a
    r = a % b
    if r == 0:
        return b
    return gcda(r, b)

def lcm(a,b):
    return a*b//gcda(a,b)

X=int(input())
shukai=lcm(360,X)
print(shukai//X)
        


Measured memory_bytes: 9104
N,M = map(int,input().split())
S = [list(map(int,input().split())) for n in range(N)]
P = [list(map(int,input().split())) for m in range(M)]

for a,b in S:
  D = []
  for c,d in P:
    D.append(abs(a-c)+abs(b-d))
  print(1+P.index(P[D.index(min(D))]))

Measured memory_bytes: 9136
#include<iostream>
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
int n, ans1, ans2, c1, c2=1;
string s;
int main()
{
    IO
    cin>>s;
    n=s.size();
    for(int i=0; i<n; i++)
    {
        if(s[i]-'0'!=c1)
            ans1++;
        if(s[i]-'0'!=c2)
            ans2++;
        c1=1-c1;
        c2=1-c2;
    }
    cout<<min(ans1,ans2);
}


Measured memory_bytes: 3736
import bisect, copy, heapq, math, sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
def celi(a,b):
    return -(-a//b)
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n=int(input())
a=list(map(int,input().split()))
pc="pairwise coprime"
sc="setwise coprime"
nc="not coprime"
a.sort()
tmp=a[0]

for i in range(n):
    tmp=math.gcd(tmp,a[i])
if tmp!=1:
    print(nc)
    exit()

dic={}
for i in range(n):
    if a[i] in dic:
        dic[a[i]]+=1
    else:
        dic[a[i]]=1

ans=0
for i in range(a[-1]):
    now=i+1
    cnt=0
    # print(i)
    for j in range(a[-1]//now):
        if now in dic:
            cnt+=dic[now]
        now+=i+1
    if cnt>1:
        ans=i+1

if ans!=1:
    print(sc)
else:
    print(pc)
# print(ans)

Measured memory_bytes: 241172
class UnionFind
  def initialize(n)
    @parents = Array.new(n, -1)
  end
  def find(x)
    @parents[x] < 0 ? x : @parents[x] = find(@parents[x])
  end
  def parents
    @parents
  end
  def union(x, y)
    x = find(x)
    y = find(y)
    return if x == y
    if @parents[x] > @parents[y]
      x, y = y, x
    end
    @parents[x] += @parents[y]
    @parents[y] = x
  end  
end

n, m = gets.split.map(&:to_i)
u = UnionFind.new(n)
m.times do
  a, b = gets.split.map(&:to_i)
  u.union(a - 1, b - 1)
end
puts -u.parents.min

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

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define vll vector<ll>
#define mll map<ll,ll>
#define MOD 1000000007
#define pll pair<ll,ll>
#define fastio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)

int main(){
  fastio;
  
  int n;
  cin>>n;
  vll v;
  for(int i=0;i<n;i++)
  {
    int x;
    cin>>x;
    v.pb(x);
  } ll ans=0;
  for(int i=0;i<n;i++)
  {  int x=v[i];
    for(int j=i+1;j<n;j++)
    {
      ans=ans+x*(v[j]);
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;	cin >> n;
  unordered_map<string,long long>	s;
  long long ans=0;
  for(int i=0;i<n;i++){
    string t;	cin >> t;
    sort(t.begin(),t.end());
    if(s.count(t))	s[t]+=1;
    else	s[t]=1;
  }

  for(auto	p:s){
    long long x=p.second;
    ans+=x*(x-1)/2;
  }
  cout << ans;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rep(i,N) for(ll i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

vector<ll> divisor(ll n){
    vector<ll> res;
    for (ll i = 1; i*i <= n; i++){
        if (n%i == 0){
            res.push_back(i);
            if (i != n / i)res.push_back(n / i);
        }
    }
    return res;
}

ll m,n;

int main(){
    cin >> n >> m;
    ll ans = 0;
    vector<ll> d = divisor(m);
    rep(i,d.size()){
        ll num = m/d[i];
        if(num >= n)ans = max(ans,d[i]);
    }
    cout << ans << endl;
}

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

int main() {
  string S, word1, word2;
  int L, j, k, l;
  
  bool yesno;
  yesno = true; 
  cin >> S;
  L = S.size();
  j = L;
  
  for(int i = 0;i < L / 2;i++){
  word1 = S.at(i);
  word2 = S.at(j - 1);
    if(word1 == word2){
    j--;
    } 
    else{
    yesno = false;
    break;
    }
  }
  
  j = (L - 1) / 2;
  k = j;
  for(int i = 0;i < k / 2;i++){
  word1 = S.at(i);
  word2 = S.at(j - 1);
    if(word1 == word2){
    j--;
    } 
    else{
    yesno = false;
    break;
    }
  }
  
  j = (L + 3) / 2;
  k = j;
  l = L;
  for(int i = 0;i < (L - k) / 2;i++){
  word1 = S.at(l - 1);
  word2 = S.at(j - 1);
    if(word1 == word2){
    j++;
    l--;
    } 
    else{
    yesno = false;
    break;
    }
  }
  
  if(yesno){
  cout << "Yes" << endl;
  }
  else{
  cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
    int a,b,c,x;
    cin>>a>>b>>c>>x;
    int res = 0;
    for (int i = 0; i <= a; ++i)
    {
        for (int j = 0; j <= b; ++j)
        {
            for (int k = 0; k <= c; ++k)
            {
                int tot = 500*i+100*j+50*k;
                if (tot == x) ++res;
            }
        }
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
from __future__ import division
n = int(raw_input())
v = map(int,raw_input().split())
v = sorted(v)
while len(v) >= 2:
	a = v.pop(0)
	b = v.pop(0)
	v.append((a+b)/2)
	v = sorted(v)
print v[0]

Measured memory_bytes: 2692
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);
	static boolean debug = false;

	static boolean solve() {
		int n = in.nextInt();
		if (n == 0) return false;

		String[] s = new String[n];

		for (int i=0; i<n; i++) {
			s[i] = in.next();
		}

		long min = -(1L<<60), max = 1L<<60;

		for (int i=0; i<n; i++) {
			if (s[i].charAt(0) == 'x') {
				if (i != n-1 && s[i+1].charAt(0) == 'x') {
					min = 1L<<60;
					max = -min;
					break;
				}

				if (i%2 == 0) {
					if (i != 0)
						max = Math.min(max, Integer.parseInt(s[i-1])-1);
					if (i != n-1)
						max = Math.min(max, Integer.parseInt(s[i+1])-1);
				} else {
						min = Math.max(min, Integer.parseInt(s[i-1])+1);
					if (i != n-1)
						min = Math.max(min, Integer.parseInt(s[i+1])+1);
				}
			} else {
				int x = Integer.parseInt(s[i]);
				if (i%2 == 0) {
					if (i != 0 && s[i-1].charAt(0) != 'x' && Integer.parseInt(s[i-1]) < x) {
						min = 1L<<60;
						max = -min;
						break;
					}
					if (i != n-1 && s[i+1].charAt(0) != 'x' && Integer.parseInt(s[i+1]) < x) {
						min = 1L<<60;
						max = -min;
						break;
					}
				} else {
					if (i != 0 && s[i-1].charAt(0) != 'x' && Integer.parseInt(s[i-1]) > x) {
						min = 1L<<60;
						max = -min;
						break;
					}
					if (i != n-1 && s[i+1].charAt(0) != 'x' && Integer.parseInt(s[i+1]) > x) {
						min = 1L<<60;
						max = -min;
						break;
					}
				}
			}
		}

		if (min == max) {
			out.println(max);
		} else if (min > max) {
			out.println("none");
		} else {
			out.println("ambiguous");
		}

		return true;
	}

	public static void main(String[] args) {
		debug = args.length > 0;
		long start = System.nanoTime();

		while(solve());
		out.flush();

		long end = System.nanoTime();
		dump((end - start) / 1000000 + " ms");
		in.close();
		out.close();
	}

	static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}

Measured memory_bytes: 51248
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const int inf = 1000000;

int main(int argc, const char * argv[]) {
  int W, H, N;
  cin >> W >> H >> N;


  int l = 0, r = W, t = H, b = 0;
  for (int i = 0; i < N; i++) {
    int x, y, a;
    cin >> x >> y >> a;
    if (a == 1) {
      l = max(l, x);
    }
    if (a == 2) {
      r = min(r, x);
    }
    if (a == 3) {
      b = max(b, y);
    }
    if (a == 4) {
      t = min(t, y);
    }
  }
  int wide = (r - l);
  int height = (t - b);
  if (wide < 0 || height < 0) {
    cout << 0 << endl;
  } else {
    cout << wide * height << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
int a,b,c,x;
int A,B,C;
scanf("%d%d%d%d",&A,&B,&C,&x);
int cont=0;
int total;
 
for(a=0;a<A+1; a++){
 for(b=0; b<B+1; b++){
  for(c=0; c<C+1; c++){
    total=500*a+100*b+50*c;
     if(total==x){
      cont++;
     }
  }
 }
}
 printf("%d",cont);
 return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

//#pragma GCC target("avx2")
//#pragma GCC optimization("unroll-loops")
//#pragma GCC optimize("O2")
//#pragma GCC optimize("O3")

#define FOR(i,a) for (int i=0;i<(a);++i)
#define FORD(i,a) for (int i=(a)-1;i>=0;i--)
#define FORT(i,a,b) for (int i=(a);i<=(b);++i)
#define FORTD(i,b,a) for (int i=(b);i>=(a);--i)
#define trav(i,v) for (auto i : v)
#define all(v) v.begin(),v.end()
#define ad push_back
#define fr first
#define sc second
#define mpr(a,b) make_pair(a,b)
#define pir pair<int,int>
#define make_unique(v) v.erase(unique(all(v)),v.end())
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define srng mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define y1 EsiHancagorcRepa

const int N=2e5; 
const ll MOD=1e9+7;

int tv[10],zr=N-1,mk=N-2,erk=N-3;


struct oper{
	char type;
	int i,j,k;
	oper(){

	}
	oper(char _type,int _i,int _j,int _k){
		type=_type;
		i=_i;
		j=_j;
		k=_k;

	}
};

vector<oper> ans;
void add(int a,int b,int c){
	ans.ad({'+',c,b,a});
}
void harc(int a,int b,int c){
	ans.ad({'<',c,b,a});
}

void plant(int ind){
	harc(tv[0],0,zr);
	harc(tv[1],1,zr);
	add(tv[2],tv[0],tv[1]);
	harc(ind,tv[2],zr);
}
void sum(int ind,int arr[],int l,int r){
	add(ind,arr[l],zr);
	FORT(i,l+1,r){
		add(ind,arr[i],ind);
	}
}
void multp2(int ind,int pw){
	FOR(i,pw){
		add(ind,ind,ind);
	}
}

int cnt=3; //current unused index
int ba[70],bb[70]; // bin repr of a and b
int pa[70],pb[70]; // 2^i if ith bit = 1, else 0



void represent(int ind,int* bn,int* pw){
	int bsch=cnt++;
	FORD(i,32){
		pw[i]=cnt++;
		plant(pw[i]);
		multp2(pw[i],i);
		sum(bsch,pw,i,31);
		harc(pw[i],ind,bsch);
		multp2(pw[i],i);
		bn[i]=cnt++;
		harc(bn[i],pw[i],zr);
	}
}

int main(){
	srng;
	fastio;
	//freopen("output.txt","w",stdout);
	FOR(i,10){
		tv[i]=N-i-4;
	}
	plant(mk);
	add(erk,mk,mk);
	add(0,0,mk);
	add(1,1,mk);
	//1 - Binary Represantation
	represent(0,ba,pa);
	represent(1,bb,pb);

	//2 - Multiplication and Decimal representation
	FOR(i,32){
		FOR(j,32){
			add(tv[0],ba[i],bb[j]);
			harc(tv[0],tv[0],mk);
			multp2(tv[0],i+j);
			add(2,2,tv[0]);
		}
	}

	//3 - print the god damn answer
	cout<<ans.size()<<endl;
	FOR(i,ans.size()){
		cout<<ans[i].type<<" "<<ans[i].i<<" "<<ans[i].j<<" "<<ans[i].k<<endl;
	}

	return 0;
}	


Measured memory_bytes: 4196
#include <stdio.h>

int main(void) {
  int i, j, k, n, m;
  scanf("%d%d", &n, &m);
  int d[n], c[m], dp[n + 1], inf = 10e9;
  for(i = 0; i < n; ++i) scanf("%d", &d[i]);
  for(i = 0; i < m; ++i) scanf("%d", &c[i]);
  for(i = 0; i <= n; ++i) dp[i] = inf;
  dp[0] = 0;
  for(i = 0; i < m; ++i) {
    for(j = n; j > 0; --j) {
      if(dp[j - 1] != inf && dp[j] > dp[j - 1] + d[j - 1] * c[i]) dp[j] = dp[j - 1] + d[j - 1] * c[i];
    }
  }
  printf("%d\n", dp[n]);
  return 0;
}


Measured memory_bytes: 2728
using System;
namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] c = Console.ReadLine().Split();
            int a = int.Parse(c[0]);
            int b = int.Parse(c[1]);
            Console.Write(a * b + " ");
            Console.WriteLine(2 * (a + b));
        }
    }
}



Measured memory_bytes: 15904
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    for(int i=1;i<=3;i++){
        if((a*b*i)%2!=0){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
from sys import stdin
import numpy as np
N=int(stdin.readline().rstrip())
S=(stdin.readline().rstrip())
A=[0]*N ## .
B=[0]*N ## #
a_count=0
b_count=0

for ind,i in enumerate(list(S)):
    if i == ".":
        a_count+=1
        A[ind] = a_count
        B[ind] = b_count
    else:
        b_count+=1
        B[ind] = b_count
        A[ind] = a_count
A.insert(0,0)
B.insert(0,0)
dif=np.array(A) - np.array(B)
dif_ind = np.argmax(dif)
ans=B[dif_ind] + A[-1] - A[dif_ind]
print(ans)

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

typedef long long ll;


ll gcd(ll a, ll b)
{
	ll c;
	while((c=a%b))
	{
		a=b;
		b=c;
	}
	return b;
}

ll nCm(int n, int m)
{
	int i;
	ll u=1, l=1, d;

	if(m*2>n)
	{
		m=n-m;
	}

	for(i=0;i<m;i++)
	{
		d=gcd(u, l);
		u/=d;
		l/=d;

		d=gcd(l, n-i);
		u*=(n-i)/d;
		l/=d;

		d=gcd(u, m-i);
		u/=d;
		l*=(m-i)/d;
	}
	return u/l;
}


int cmp(const void *a, const void *b)
{
	const ll *pa, *pb;
	pa=a;
	pb=b;
	if(*pa>*pb) return -1;
	return (*pa<*pb);
}


int main(void)
{
	int N, A, B, i, l, r;
	ll v[50], sum, pat;
	double d;

	while(scanf("%d%d%d", &N, &A, &B)==3)
	{
		for(i=0;i<N;i++)
		{
			scanf("%lld", &v[i]);
		}
		qsort(v, N, sizeof(v[0]), cmp);

		for(l=A-1;v[l-1]==v[A-1] && l-1>=0;l--)
			;

		for(r=A-1;v[r+1]==v[A-1] && r+1<N;r++)
			;

		if(v[0]!=v[A-1]) B=A;

		sum=0;
		for(i=0;i<A;i++) sum+=v[i];
		if(sum>N*10)
		{
			d=sum-sum/(A*10)*(A*10);
			printf("%lld", sum/(A*10));
			printf("%.6f\n", d/A);
		}
		else
		{
			printf("%.6f\n", (double)sum/A);
		}

		pat=0;
		for(i=A-1;i<B && i<=r;i++)
		{
			pat+=nCm(r-l+1, i-l+1);
		}
		printf("%lld\n", pat);
	}


	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b) { return *(int *)a - *(int *)b; }                            /* 1,2,3,4.. */
int des(const void *a, const void *b) { return *(int *)b - *(int *)a; }                            /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { return *(char *)a - *(char *)b; }                     /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) { return strcmp(*(const char **)a, *(const char **)b); } /* aaa,aab.. */
#define min(a, b) (a < b ? a : b)
#define max(a, b) (a > b ? a : b)
#define rep(i, n) for (int i = 0; i < n; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

// 表の出る回数
int TableTimes(int from, int to)
{
  int count = 0;
  while (from < to)
  {
    from *= 2;
    count++;
  }
  return count;
}

int main(void)
{
  int n, k;
  scanf("%d %d", &n, &k);

  long double ans = 0;
  for (int i = 1; i <= n; i++)
  {
    int pow = TableTimes(i, k);
    ans += 1.0 / powl(2, pow);
  }

  printf("%.10Lf\n", ans / (long double)n);
  return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
int asc(const void *a, const void *b) {
  return *(int *)a - *(int *)b;
}
int main(){
  int n[3];
  scanf("%d%d%d",&n[0],&n[1],&n[2]);
  qsort(n,3,sizeof(int),asc);
  printf("%d\n",n[2]*10+n[1]+n[0]);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() 
{
	int N;
	cin >> N;
	string s;
	cin >> s;
	
	int nr = 0;
	int ng = 0;
	int nb = 0;
	
	for(int i = 0; i < N; i++){
		char c = s[i];
		if(c == 'R') nr++;
		if(c == 'G') ng++;
		if(c == 'B') nb++;
	}
	
	unsigned int v = nr * ng * nb;
	
	for(int i = 1; i <= N; i++){
		char ci = s[i-1];
		for(int k = i+2; k <= N; k++){
			char ck = s[k-1];
			if(ci == ck) continue;
			if((i + k) & 1) continue;// jが小数になるなら却下
			int j = (i + k) / 2;
			char cj = s[j-1];
			if(ci != cj && cj != ck) v--;
		}
	}
	
	cout << v;
}

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

using namespace std;

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

#define ALL(obj)	(obj).begin(),(obj).end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

//typedef pair<int,int>			P;
typedef vector<int>				V;
typedef vector<V>				VV;

template<typename T>string join(const v(T)&v)
{stringstream s;REP(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define MAX 		40010

const ll LINF = (ll)1e18+7;		//
const int INF = 1e9+7;			//2,147,483,647 (Max int)
const ll MOD = 1e9+7;
// テンプレ終了
//====================================================================//




//
int main(){
	int N;cin>>N;
	V A(N),B(N),C(N-1);
	REP(i,N)cin>>A[i];
	REP(i,N)cin>>B[i];
	REP(i,N-1)cin>>C[i];


	int suml = B[A[0]-1];

	REPS(i,1,N){
		suml += B[A[i]-1];
		if(A[i] == (A[i-1]+1))suml += C[A[i]-2];
	}

	cout << suml << endl;

	return 0;
}




Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int n,i,j,k,g,a[101][101]={0},t[101]={0};
	int ans[101]={0},ta;
	scanf("%d%d",&n,&g);
	for(j=0;j<g;j++)scanf("%d",&t[j]);
	for(i=0;i<g;i++)for(k=0;k<n;k++)scanf("%d",&a[i][k]);
	for(i=0;i<g;i++){
		ta=0;
		for(j=0;j<n;j++){
			if(a[i][j]!=t[i])++ta;
			else ++ans[j];
		}
		ans[t[i]-1]+=ta;
	}
	for(i=0;i<n;i++)printf("%d\n",ans[i]);
	return 0;
}


Measured memory_bytes: 2052
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX 21
#define EPS 1e-9
#define INF 1e9

struct Point{
  double x, y;
  Point(double x = 0,double y = 0) : x(x), y(y) {}

  Point operator + (const Point &p)const{
    return Point(x + p.x , y + p.y);
  }
 
  Point operator - (const Point &p)const{
    return Point(x - p.x , y - p.y);
  }
 
  Point operator * (const double &k)const{
    return Point(x * k , y * k);
  }
 
  Point operator / (const double &k)const{
    return Point(x / k , y / k);
  }

  bool operator < (const Point &p)const{
    return x != p.x ? x < p.x : y < p.y;
  }

  double norm(){
    return x*x + y*y;
  }
  double dot(const Point &p)const{
    return x*p.x + y*p.y;
  }
  double Abs(){
    return sqrt(norm());
  }
}; 

typedef Point Vector;
 
struct Segment{
  Vector s, t;
 
  Segment(){}
  Segment(Vector &s, Vector &t) : s(s), t(t) {}
 
  Point Projection(const Point &p){
    Vector base = t - s;
    double t = (p-s).dot(base) / base.norm();
    return s + base*t;
  }

  bool intersectSP(const Point &p){
    return (((s-p).Abs() + (t-p).Abs() - (t-s).Abs()) < EPS);
  }

  double distanceSP(const Point &p){
    Point r = Projection(p);
    if(intersectSP(r)) return (r-p).Abs();
    return min((s-p).Abs(), (t-p).Abs());
  }
};

int N;
Point h, d, crystal[MAX];
 
double dist(Point a, Point b){
  return sqrt(pow(a.x-b.x,2) + pow(a.y-b.y,2));
}

Segment s;
bool rec(int S, int v, double total_dist){
  if(S == (1 << N) - 1){
    return true;
  }
  for(int u = 0 ; u < N ; u++){
    if(!(S >> u & 1)){
      s = Segment(crystal[v], crystal[u]);
      if(s.distanceSP(d) < total_dist) return false;
      if(total_dist+dist(crystal[v],crystal[u]) >= dist(d, crystal[u])){
        return false;
      }
    }
  }
  for(int u = 0 ; u < N ; u++){
    if(!(S >> u & 1)){
      if(rec(S | 1 << u, u, total_dist + dist(crystal[v],crystal[u]))){
	return true;
      }
    }
  }
}

bool solve(){
  for(int i = 0 ; i < N ; i++){
    if(rec(0, i, dist(h, crystal[i]))){
      return true;
    }
  }  

  return false;
}
 
int main(){
  while(cin >> N >> h.x >> h.y >> d.x >> d.y, (N + h.x + h.y + d.x + d.y)){
    for(int i = 0 ; i < N ; i++){
      cin >> crystal[i].x >> crystal[i].y;
    }
    cout << (solve() ? "YES" : "NO") << endl;
  }
  
  return 0;
}

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

int main(){
  string s, t;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  reverse(t.begin(), t.end());
  if(s < t){
    cout << "Yes" << endl;
  } else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3600
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M = lr()
A = lr()
dp = [-1] * (N+1)
dp[0] = 0
for x in range(N):
    for a in A:
        y = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6][a]
        if x + y > N:
            continue
        dp[x+y] = max(dp[x+y], dp[x] * 10 + a)

answer = dp[N]
print(answer)
# 32

Measured memory_bytes: 51164
#include <bits/stdc++.h>
using namespace std;
#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(v) (v).begin(), (v).end()
#define INF 2e9
typedef long long ll;
typedef pair<int, int> P;

ll gcd(ll x, ll y)
{
  return y ? gcd(y, x % y) : x;
}
ll lcm(ll x, ll y)
{
  return x * y / gcd(x, y);
}
bool is_prime(int x)
{
  for (int i = 2; i * i <= x; i++)
  {
    if (x % i == 0)
      return 0;
  }
  return true;
}
vector<bool> prime_table(int n)
{
  vector<bool> prime(n + 1, 1);
  prime[0] = 0;
  prime[1] = 0;
  for (int i = 2; i * i <= n; i++)
  {
    if (!prime[i])
      continue;
    for (int j = i * i; j <= n; j++)
      prime[j] = 0;
  }
  return prime;
}
map<int, int> prime_factor(int n)
{
  map<int, int> res;
  for (int i = 2; i * i <= n; i++)
  {
    while (n % i == 0)
    {
      res[i]++;
      n /= i;
    }
  }
  if (n != 1)
    res[n]++;
  return res;
}
ll modpow(ll a, ll n, ll mod)
{
  ll res = 1;
  while (n > 0)
  {
    if (n & 1)
      res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
ll modinv(ll a, ll mod)
{
  return modpow(a, mod - 2, mod);
}

int main()
{
  int h,a;
  cin>>h>>a;

  cout<<(h+a-1)/a<<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;

int main() {

    int a, b;
    cin >> a >> b;
    
    cout << max({a+b, a-b, a*b}) << endl;
    
    return 0;

}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = in.nextLine();
		String sub1 = s.substring(0, 3);
		String sub2 = s.substring(4, s.length());
		
		System.out.println(sub1+"8"+sub2);
	}
}

Measured memory_bytes: 23764
N, M = map(int, input().split())

result = [-2] * N
edge_from = [[] for _ in range(N)]
edge_to = [[] for _ in range(N)]

for _ in range(N - 1 + M):
    A, B = map(int, input().split())
    edge_from[B-1].append(A-1)
    edge_to[A-1].append(B-1)

parent = []
for i in range(N):
    if len(edge_to[i]) > 0 and len(edge_from[i]) == 0:
        parent.append(i)
        result[i] = -1
        break

while True:
    next_ = []
    for p in parent:
        for child in edge_to[p]:
            edge_from[child].remove(p)
            if len(edge_from[child]) == 0:
                result[child] = p
                next_.append(child)
    if len(next_) == 0:
        break
    parent = next_.copy()

for x in result:
    print(x + 1)

Measured memory_bytes: 34644
#include <stdio.h>

int main(){
   int  n;

   scanf("%d",&n);
   n=n%10;
   if (n==3) puts("bon");
   else if (n==0 || n==1 || n==6 || n==8) puts("pon");
   else                                   puts("hon");
   return 0;
}


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

int main(){
  int N;
  int b[100] = {0};
  int ans_suretu[100] = {0};
  int idx=0;

  cin >> N;
  for (int i=0; i < N; i++){
    cin >> b[i];
  }

  for(int x = 0; x < N; x++){
    for(int n = N-1-x; n >= 0; n--){
      if(b[n] == n+1){
        ans_suretu[idx] = b[n];
        idx++;
        for(int i=n; i < 99; i++){
          b[i] = b[i+1];
        }
        break;
      }
      if(n == 0){
        cout << -1;
        return 0;
      }
    }
  }

  for(int i=N-1; i >= 0; i--){
    cout << ans_suretu[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

Alice = []
Bob = []

while 0 < len(a):
    Alice.append(a.pop(a.index(max(a))))
    if 0 < len(a):
        Bob.append(a.pop(a.index(max(a))))

print(sum(Alice) - sum(Bob))

Measured memory_bytes: 3060
#include <iostream>
#include <unordered_set>
using namespace std;
int main() {
	int n;
	unordered_set<int> a;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		int ai;
		cin >> ai;
		bool new_key;
		auto it = a.end();
		tie(it, new_key) = a.insert(ai);
		if (!new_key) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}


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

static const int MAX_WEIGHT = 50;	/* セミ地図の最大幅 */
static const int MAX_HEIGHT = 50;	/* セミ地図の最大高さ */

int ctoi(char c)
{
	return c - '0';
}

void cicada(void)
{

	/* -------------------- */
	/* 地図の幅、高さを取得 */
	/* -------------------- */
	int  weight, height;	/* input 幅、input 高さ */
	std::cin >> height >> weight;
	
	/* -------------------------- */
	/* 最小セミ遭遇数の一覧を作成 */
	/* -------------------------- */
	std::string      in_line;					/* input セミマップ 1行分 */
	std::vector<int> min_encount(weight, 0);	/* メモ用最小遭遇数 */

	/* 左上 */
	std::cin >> in_line;
	min_encount[0] = ctoi( in_line[0] );
	
	/* 一番上の一列 */
	for (int w = 1; w < weight; ++w)
	{
		min_encount[w] = min_encount[w - 1] + ctoi( in_line[w] );
	}

	/* 二列目以降 */
	for (int h = 1; h < height; ++h)
	{
		std::cin >> in_line;

		/* 一番左 */
		min_encount[0] += ctoi( in_line[0] );

		/* 左から2番目以降 */
		for (int w = 1; w < weight; ++w)
		{
			int left = min_encount[w - 1];
			int up   = min_encount[w];

			min_encount[w] = std::min(left, up) + ctoi( in_line[w] );
		}
	}

	/* -------------------------- */
	/* 出会う蝉の数の最小値を出力 */
	/* -------------------------- */
	std::cout << min_encount[weight - 1] << std::endl;

	return;
}

int main()
{
	cicada();
	return 0;
}



Measured memory_bytes: 3228
#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;

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

    int ans = s.size();
    rep(i, 0, s.size() - 1)
    if (s[i] != s[i + 1])
    {
        int cand = max(i + 1, (int)s.size() - i - 1);
        ans = min(ans, cand);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int, int> P;
const int INF = 1e18;

int gcd(int a, int b){
    if(a < b) swap(a, b);
    if(b == 0) return a;
    return gcd(b, a % b);
}

signed main(){
    int n, m;
    string s, t;
    cin >> n >> m >> s >> t;
    int l = n / gcd(n, m) * m;
    bool f = true;
    for(int i = 0; i < l; i += (l / n)){
        if(i % (l / n) == 0 && i % (l / m) == 0){
            if(s[i / (l / n)] != t[i / (l / m)]) f = false;
        }
    }
    if(f) cout << l << endl;
    else cout << -1 << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int ctoi(char c){return c - '0';}

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// TODO: write
int main() { 
  ll n,h;cin>>n>>h;
  vector<ll> a(n);
  vector<ll> b(n);
  rep(i,n)cin>>a[i]>>b[i];
  sort(all(a),greater<ll>());
  sort(all(b),greater<ll>());
  
  ll tmp = 0;
  ll bSum = 0;
  rep(i,b.size()){
    if(b[i] <= a[0] || bSum >= h)break;
    tmp++;
    bSum += b[i];
  }
  ll ans = tmp;
  h -= bSum;
  
  h = max(0ll,h);
  ans += h/a[0] + !!(h%a[0]);
  print(ans);

  return 0;
}




Measured memory_bytes: 1792
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    let v: Vec<usize> = buf.split_whitespace().map(|x| x.parse().unwrap()).collect();
    let (n, d) = (v[0], v[1]);

    println!("{}", (n - 1) / (2 * d + 1) + 1);
}


Measured memory_bytes: 4352
#include <stdio.h>
int main(void)
{
	int m, f, r;
	
	char grade;
	
	while(1){
		scanf("%d %d %d", &m, &f, &r);
		if(m == -1&&f == -1&&r == -1)break;
		
		if(m+f<30||m==-1||f==-1)
		grade = 'F';
		else if(m+f>=80)
		grade = 'A';
		else if(m+f>=65)
		grade = 'B';
		else if(m+f>=50||r>=50)
		grade = 'C';
		else if(m+f>=30)
		grade = 'D';
		
		
		printf("%c\n",grade);
	}
	
	return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int N,M;
  cin >> N >> M;
  if(N==M)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
  return 0;
}


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

using namespace std;

#define INF 2140000000
#define MOD 1000000007

int main() {
	int a, b;

	cin >> a >> b;

	if (a > b) {
		cout << 2*a - 1 << endl;
	}
	else if (b > a) {
		cout << 2*b - 1 << endl;
	}
	else {
		cout << a + b << endl;
	}
	

	return 0;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, '%d %d %d', $H, $W, $K);
$ans = array_pad(array(), $H, array_pad(array(), $W, null));
for ($i = 0; $i < $H; $i++) {
    fscanf(STDIN, '%s', $t);
    $s[$i] = str_split($t);
    for ($j = 0; $j < $W; $j++) {
        if ($s[$i][$j] === '#') {
            // printf("x:%d y:%d\n", $j, $i);
            $sb[$j][$i] = '1';
        }
    }
}
foreach ($sb as $k => $v) {
    $sb[$k][$H] = '1';
}
$sb[$W][0] = '1';
ksort($sb);
$val_x = array_keys($sb);
$cnt_x = count($val_x);
// echo "XX: " . implode(' ', $val_x) . PHP_EOL;
$r = 0;
for ($i = 0; $i < $cnt_x - 1; $i++) {
    $val_y = array_keys($sb[$val_x[$i]]);
    $cnt_y = count($val_y);
    // echo "YY: " . implode(' ', $val_y) . PHP_EOL;
    
    for ($j = 0; $j < $cnt_y - 1; $j++) {
        $sx = $i === 0 ? 0 : $val_x[$i];
        $sy = $j === 0 ? 0 : $val_y[$j];
        $ex = $val_x[$i + 1];
        $ey = $val_y[$j + 1];
        // printf("sx:%d ex:%d sy:%d ey:%d size:%d\n", $sx, $ex, $sy, $ey, ($ex - $sx) * ($ey - $sy));
        $r++;
        for ($tx = $sx; $tx < $ex; $tx++) {
            for ($ty = $sy; $ty < $ey; $ty++) {
                $ans[$tx][$ty] = $r;
            }
        }
    }
}
for ($y = 0; $y < $H; $y++) {
    $tmp = [];
    for ($x = 0; $x < $W; $x++) {
        $tmp[] = $ans[$x][$y];
    }
    echo implode(' ', $tmp) . PHP_EOL;
}


Measured memory_bytes: 27640
from collections import Counter

n, m = map(int, input().split())
MOD = 10 ** 9 + 7
SIZE = 10 ** 5 * 2
fact = [0] * SIZE
inv = [0] * SIZE
finv = [0] * SIZE
fact[0], fact[1] = 1, 1
inv[1] = 1
finv[0], finv[1] = 1, 1
for i in range(2, SIZE):
    fact[i] = fact[i - 1] * i % MOD
    inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
    finv[i] = finv[i - 1] * inv[i] % MOD


def modcomb(n, r):
    if n < 0 or r < 0 or n < r:
        return 0
    return fact[n] * (finv[r] * finv[n - r] % MOD) % MOD


def prime_factorize(n):
    res = []
    while n % 2 == 0:
        res.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            res.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        res.append(n)
    return res


counter = Counter(prime_factorize(m))
ans = 1
for v in counter.values():
    ans *= modcomb(v + n - 1, n - 1)
    ans %= MOD
print(ans)


Measured memory_bytes: 29132
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

S = int(sys.stdin.buffer.readline())

seen = [0] * 1000001

a = S
i = 0
while not seen[a]:
    seen[a] = 1
    if a % 2 == 0:
        a //= 2
    else:
        a = 3 * a + 1
    i += 1
print(i + 1)


Measured memory_bytes: 10868
use std::cmp;
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

macro_rules! chmin {
    ($base:expr, $($cmps:expr),+ $(,)*) => {{
        let cmp_min = min!($($cmps),+);
        if $base > cmp_min {
            $base = cmp_min;
            true
        } else {
            false
        }
    }};
}

macro_rules! min {
    ($a:expr $(,)*) => {{
        $a
    }};
    ($a:expr, $b:expr $(,)*) => {{
        std::cmp::min($a, $b)
    }};
    ($a:expr, $($rest:expr),+ $(,)*) => {{
        std::cmp::min($a, min!($($rest),+))
    }};
}

const N_MAX: usize = 1e5 as usize;
const INF: i32 = std::i32::MAX;

fn main() {
    input!{
        n: usize,
        k: usize,
        h: [i32; n],
    }

    let mut dp = [INF; N_MAX];
    dp[0] = 0;
    dp[1] = (h[0] - h[1]).abs();

    for i in 2..n {
        for m in 1..cmp::min(i+1, k+1) {
            chmin!(dp[i], dp[i - m] + (h[i] - h[i - m]).abs());
        }
    }

    println!("{}", dp[n-1]);
}


Measured memory_bytes: 3384
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T & a, U & ... b) { cin >> a; IN_(b ...); };
template<typename T> void OUT(T && a) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

template<typename T> istream & operator>>(istream & s, vector<T> & v) { RF(e, v) { s >> e; } return s; }
template<typename T> ostream & operator<<(ostream & s, vector<T> const & v) {
	inc(i, SI(v)) { s << (i == 0 ? "" : " ") << v[i]; }
	return s;
}

int main() {
	IN(int, n);
	vector<vector<int>> g(n);
	inc(i, n - 1) {
		IN(int, a, b);
		a--; b--;
		g[a].PB(b);
		g[b].PB(a);
	}
	
	vector<int> a, b;
	function<void(int, int, int)> dfs = [&](int v, int p, int x) {
		(x == 0 ? a : b).PB(v);
		RF(e, g[v]) {
			if(e == p) { continue; }
			dfs(e, v, x ^ 1);
		}
	};
	dfs(0, -1, 0);
	
	if_not(SI(a) >= SI(b)) { swap(a, b); }
	int A = SI(a), B = SI(b);
	vector<int> c = {
		n / 3,
		n / 3 + (n % 3 >= 1 ? 1 : 0),
		n / 3 + (n % 3 >= 2 ? 1 : 0),
	};
	
	vector<int> x;
	auto add = [&](int v) {
		inc1(i, n) { if(i % 3 == v) { x.PB(i); } }
	};
	if(c[1] <= A && c[2] <= B) {
		add(1);
		add(0);
		add(2);
	} else {
		assert(c[1] + c[2] <= A);
		add(1);
		add(2);
		add(0);
	}
	
	RF(e, b) { a.PB(e); }
	vector<int> ans(n);
	inc(i, n) { ans[a[i]] = x[i]; }
	OUT(ans);
}


Measured memory_bytes: 21356
#include<bits/stdc++.h>
using namespace std;
const int N = 505;
int mp[N][N], dp[N][N];
int main(){
    int n, m, q;
    scanf("%d%d%d", &n, &m, &q);
    for(int i = 1; i <= m; ++i){
        int a, b;
        scanf("%d%d", &a, &b);
        mp[a][b]++;
    }
    for(int i = n; i >= 1; --i){
        for(int j = 1; j <= n; ++j){
            dp[i][j] = dp[i+1][j] + dp[i][j-1] + mp[i][j] - dp[i+1][j-1];
        }
    }
    for(int i = 1; i <= q; ++i){
        int l, r;
        scanf("%d%d", &l, &r);
        printf("%d\n", dp[l][r]);
    }
    return 0;
}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;

int ans=0;
int n;
int cnt(ll b){
    int res=0;
    map<int,int>mp;
   
    while(b>0){
        mp[b%10]++;
        b/=10;
    }
    bool ok=true;
    if(mp[7]>0&&mp[5]>0&&mp[3]>0)return 1;
    else return 0;
    
}
void dfs(ll a=0){

    if(a<=n){
        ans+=cnt(a);
    }
    else return;

    for(int last=3;last<=7;last+=2){
        a=a*10+last;
        dfs(a);
        a/=10;
    }
}

int main(){
    cin>>n;
    dfs();
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256