akhauriyash/Code-Regression huggingface dataset:
// nomura2020_a
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

template <typename A, typename B> bool cmin(A &a, const B &b) {
  return a > b ? (a = b, true) : false;
}
template <typename A, typename B> bool cmax(A &a, const B &b) {
  return a < b ? (a = b, true) : false;
}
const double PI = acos(-1);
const double EPS = 1e-9;
int inf = sizeof(int) == sizeof(long long) ? 2e18 : 1e9 + 10;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  cout << (h2 - h1) * 60 + (m2 - m1) - k << endl;

  return 0;
}


Measured memory_bytes: 3652
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
struct node
{
	ll inx,p;
}b[4];

bool cmp(node a, node b)
{
	if (a.p != b.p) return a.p < b.p;
	return a.inx < b.inx;
}

int main()
{
	ll a[4];
	int n;
	for (int i = 0; i < 4; i++)
		scanf("%lld",&a[i]);
	scanf("%d",&n);
	for (int i = 0; i < 4; i++)
	{
		b[i].inx = i;
		b[i].p = (1 << (3 - i)) * a[i];
	}
	sort(b,b+4,cmp);
	ll ans = 0;
	if (b[0].inx == 3)
	{
		ans = n/2*a[3]+n%2*b[1].p/2;
	//	printf("Hi!!!\n");
	}
	else
		ans = n * b[0].p / 2;
	printf("%lld\n",ans);
	
	
}

Measured memory_bytes: 128
// $%U%$ $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	int n;
	cin>>n;
	vector<ll> v(n);
	vector<ll> f(n+1,0);
	for(auto &i:v){
		cin>>i;
		++f[i];
	}
	ll res = 0;
	for(auto &i:f)res+=(i*(i-1))/2;
	for(auto &i:v){
		ll ans = res-(f[i]*(f[i]-1))/2 + ((f[i]-1)*(f[i]-2))/2;
		cout<<ans<<'\n';
	}
	return 0;
}



Measured memory_bytes: 5760
n, m = map(int, raw_input().split())
x = [raw_input() for i in xrange(n)]

y = [[0] * m for i in xrange(n)]
for i in range(n):
	k = -1
	for j in xrange(m):
		if x[i][j] == 'c':
			k = 0
		y[i][j] = k
		k += k != -1

for i in xrange(n):
	print ' '.join(map(str, y[i]))

Measured memory_bytes: 6448
#include <iostream>
using namespace std;
int A[105];
int main() {
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  int S = 0;
  for (int i=0; i<N; i++) {
    cin >> A[i];
    S += A[i];
  }
  int c = 0;
  S = S / (4 * M) + (S % (4 * M) > 0);
  for (int i=0; i<N; i++) {
    if (A[i] >= S) {
      c++;
    }
  }
  if (c >= M) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define M 1000000
#define L 14
char H[M][L];
int getChar(char ch){
  if ( ch == 'A'){
    return 1;
  }
  else if ( ch == 'C'){
    return 2;
  }
  else if ( ch == 'G'){
    return 3;
  }
  else if( ch == 'T'){
    return 4;
  }
}
  
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}
  
int h1(int key){ return key % M;}
int h2(int key){ return 1 + key % (M - 1);}
  
int find(char str[]){
  long long trip;
  int i = 0;
  long long sum = getKey(str);
  while(1){
    trip = (h1(sum)+ i * h2(sum)) % M;
    if(strcmp(H[trip], str) == 0){
      return 1;
    }
    if(H[trip][0] == '\0'){
      return 0;
    }
    i++;
  }
  return 0;
}
  
void insert(char str[]){
  int  i = 0;
  long long ago;
  long long sum = getKey(str); 
  while(1){
    ago = (h1(sum)+ i * h2(sum)) % M;
    if(H[ago][0] == '\0' || strcmp(H[ago],str) == 0){
      strcpy(H[ago], str);
      break;
    }
    i++;
  }
}
  
int main(){
  int i, n, h;
  char str[L], com[9];
  for ( i = 0; i < M; i++ ){
    H[i][0] = '\0';
  }
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ){
    scanf("%s %s", com, str);
    if ( com[0] == 'i' ){
      insert(str);
    }
    else {
      if (find(str)){
	printf("yes\n");
      }
      else {
	printf("no\n");
      }
    }
  }
  return 0;
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e2 + 5);

int n;
ll w[MAX_N];

ll ans = INF;

int main(void) {
  // Here your code !
  scanf("%d", &n);

  for (int i = 0; i < n; ++i) {
    scanf("%lld", &(w[i]));
  }

  ll whole = 0;

  for (int i = 0; i < n; ++i) {
    whole += w[i];
  }

  ll cur = w[0];

  ans = min(ans, abs(whole - cur - cur));

  for (int i = 1; i < n; ++i) {
    cur += w[i];
    ans = min(ans, abs(whole - cur - cur));
  }

  printf("%lld\n", ans);

  return 0;
}


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

int main(void){
  int x[5];
  int answer = 0;
  for(int i=0;i<5;i++){
    cin >> x[i];
    if(x[i]==0) answer = i+1;
  }
  printf("%d\n",answer);
  return 0;
}

Measured memory_bytes: 3700
str_list = ["dream","dreamer","erase","eraser"]

class stringJudge():
    def __init__(self,string,string_list):
        self.string = string
        self.string_list = string_list
        
    def isNextMatch(self):
        for str_val in self.string_list:
            if self.string.endswith(str_val):
                self.string = self.string.rsplit(str_val,1)[0]
                return True
        return False
               
                    
                    
           
    
instance = stringJudge(input(),str_list)
check = True
while check and len(instance.string) > 0:
    check = instance.isNextMatch()

print('YES' if check else 'NO')

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0; i<n; i++){
    cin >> a[i];
  }
  
  vector<int> dp(n,0);
  dp[0] = 0;
  dp[1] = abs(a[1] - a[0]);

  for(int i=2; i<n; i++){
    dp[i] = min(dp[i-1]+abs(a[i]-a[i-1]), dp[i-2]+abs(a[i]-a[i-2]));
  }

  cout << dp[n-1];
  cout << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    string temp;
    cin >> N;

    map<std::string, int> mp;
    mp["AC"] = 0;
    mp["WA"] = 0;
    mp["TLE"] = 0;
    mp["RE"] = 0;


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

    printf("AC x %d\n", mp["AC"]);
    printf("WA x %d\n", mp["WA"]);
    printf("TLE x %d\n", mp["TLE"]);
    printf("RE x %d\n", mp["RE"]);




    return 0;
}

Measured memory_bytes: 3728
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		var a = sc.nextInt();
		var b = sc.nextInt();
		var c = sc.nextInt();
		var d = sc.nextInt();
		sc.close();

		var max = Long.MIN_VALUE;
		var list = new ArrayList<Long>();
		list.add((long)a * c);
		list.add((long)a * d);
		list.add((long)b * c);
		list.add((long)b * d);
		for(var x : list) {
			max = Math.max(max, x);
		}

		System.out.println(max);
	}
}


Measured memory_bytes: 35876
n, c, k = map(int, input().split())
t = [int(input()) for i in range(n)]
t = sorted(t)

i = 0
ans = 0
while True:
    r = t[i] + k
    tmp = 0
    for j in range(i, i + c):
        if j >= n:
            break
        if t[j] <= r:
            tmp += 1
        else:
            break
    i += tmp
    ans += 1
    if i== n:
        break
print(ans)

Measured memory_bytes: 8280
using System;

namespace abc124_a
{
    class Program
    {
        static void Main(string[] args)
        {
            int max = 0;
            String[] array = Console.ReadLine().Split(' ');
            int btnA = int.Parse(array[0]);
            int btnB = int.Parse(array[1]);
            for (int i = 0; i < 2; i++)
            {
                if (btnA < btnB)
                {
                    max += btnB;
                    btnB--;
                }
                else if (btnA > btnB)
                {
                    max += btnA;
                    btnA--;
                }
                else
                {
                    max += btnA;
                }
            }
            Console.WriteLine(max);
        }
    }
}


Measured memory_bytes: 11092
n = int(input())
s1 = set()
s2 = set()
a = 1
b = 1
while a <= n:
    if a % 3 == 0:
        s1.add(a)
    a += 1
while b <= n:
    if b % 5 == 0:
        s2.add(b)
    b += 1
s3 = set(range(1,n + 1))
s12 = s1 | s2
s4 = s3 - s12
c = 0
for x in s4:
    c += x
print(c)


Measured memory_bytes: 162520
using System;
using System.Linq;
using System.Collections.Generic;

namespace AtCoder.Grand016
{
    public class AGC016B_ColorfulHats
    {
        public static void Main(string[] args)
        {

            // 整数の入力
            int catNum = int.Parse( Console.ReadLine() );

            // スペース区切りの整数の入力
            string[] hatNumText = Console.ReadLine().Split( ' ' );

            int[] hatNum = new int[catNum];
            for ( int i = 0; i < catNum; i++ )
            {
                hatNum[i] = int.Parse( hatNumText[i] );
            }


            Array.Sort( hatNum );
            
            int minHatTypeNum = hatNum[0];
            int maxHatTypeNum = hatNum[hatNum.Length - 1];

            int minCatCnt = hatNum.Count( val => val == minHatTypeNum);
            int maxCatCnt = hatNum.Count( val => val == maxHatTypeNum );
            

            string result = "Yes";

            // 色数に2以上の差が付くことはありえない
            if ( maxHatTypeNum - minHatTypeNum > 1 )
            {
                result = "No";
            }

            if ( minHatTypeNum == maxHatTypeNum )
            {
                // 全員が同じ値
                // 各色に1匹、もしくは各色に２匹以上

                // 各色に２匹以上(x!=N-1)であれば、種類数がN/2を上回ることはない
                if ( minHatTypeNum != catNum - 1 && minHatTypeNum > catNum / 2  )
                {
                    result = "No";
                }

            }
            else
            {
                // xとx-1が混在
                // １匹しかいないのが1～x-1組、残りは２匹以上のグループ
                // ２匹以上のペアはx-単独数できるため、ペアに属する猫は(x-単独数)*2匹以上になる

                // １匹しかいない色数（＝x-1の数）は、1～x-1の範囲内でないとおかしい
                if ( minCatCnt > minHatTypeNum )
                {
                    result = "No";
                }

                // ２匹以上グループの猫数は、(x-単独数)*2匹以上でないとおかしい
                if ( maxCatCnt < (maxHatTypeNum - minCatCnt) * 2 )
                {
                    result = "No";
                }

            }
            
            // 結果出力
            Console.WriteLine( result );
            
        }
        
    }
}

Measured memory_bytes: 17888
#include<bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define per(i,n) for(int i=n-1;i>=0;++i)
#define rep1(i,n) for(int i=1; i<=n; ++i)
#define per1(i,n) for(int i=n; i>=1; ++i)
#define debug cout << "line : " << __LINE__ << " debug" << endl
#define Dcout(N) cout << setprecision(20) << N << endl
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define INF 1e9
const int mod = 1000000007;
typedef long long ll;
//------------------------------------------------------------------------

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s,t;
  cin >> s >> t;
  cout << t << s;
  
  return 0;
}



Measured memory_bytes: 256
# def merge(arr, l, mid, r):
#     L = [arr[i] for i in range(l, mid)]
#     R = [arr[i] for i in range(mid, r)]
#     L.append(int(1e9 + 10))
#     R.append(int(1e9 + 10))
#     i, j = 0, 0
#     cnt = 0
#     for k in range(l, r):
#         if L[i] <= R[j]:
#             arr[k] = L[i]
#             i += 1
#         else:
#             arr[k] = R[j]
#             j += 1
#         cnt += 1
#     return cnt

# def mergeSort(arr, l, r):
#     cnt = 0
#     if l + 1 < r:
#         mid = (l + r) >> 1
#         cnt += mergeSort(arr, l, mid)
#         cnt += mergeSort(arr, mid, r)
#         cnt += merge(arr, l, mid, r)
#     return cnt

# triky

def count(l, r):
    cnt = 0
    if l + 1 < r:
        mid = (l + r) >> 1
        cnt += count(l, mid)
        cnt += count(mid, r)
        cnt += r - l
    return cnt

cnt = count(0, int(input()))
arr = list(map(int, input().split()))
arr.sort()
print(*arr)
print(cnt)


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

#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        998244353
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
int f[3003][3003];
void solve(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    rep(i,a,c+1){
        rep(j,b,d+1){
            if(i>a and j>b){
                f[i][j]=(f[i-1][j]*j%hell+f[i][j-1]*i%hell)%hell;
                f[i][j]=(f[i][j]-f[i-1][j-1]*(i-1)*(j-1)%hell+hell)%hell;
            }
            else if(i>a) f[i][j]=f[i-1][j]*j%hell;
            else if(j>b) f[i][j]=f[i][j-1]*i%hell;
            else f[i][j]=1;
        }
    }
    cout<<f[c][d]<<endl;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 73916
#include <cstdio>

using namespace std;

unsigned int sum_of_digits(unsigned int target);

unsigned int sum_of_digits(const unsigned int target){
    unsigned int t{target};
    unsigned int sum{0};
    while (t){
        sum += t % 10;
        t = t /10;
    }
    return sum;
}

int main() {
    unsigned int n, a, b;
    unsigned int sum{0}, s;
    scanf("%5u %2u %2u", &n, &a, &b);;

//    printf("%u %u %u\n", n, a, b);

    for (unsigned int i{1}; i <= n; ++i) {
        s = sum_of_digits(i);
        if (s >=  a && s <= b){
            sum += i;
        }
    }
    printf("%u", sum);
    return 0;
}


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

#define ll long long
#define ar array

const int mxN=1e5;
int n, m;
vector<int> adj[mxN];
bool vis[mxN];

void dfs(int u) {
	vis[u]=1;
	for(int v : adj[u]) {
		if(vis[v])
			continue;
		dfs(v);
	}
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> m;
	for(int i=0; i<m; ++i) {
		int u, v;
		cin >> u >> v, --u, --v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	int c=0;
	for(int i=0; i<n; ++i) {
		if(!vis[i])
			dfs(i), ++c;
	}
	cout << c-1;
}


Measured memory_bytes: 9708
#include<bits/stdc++.h>
using namespace std;
int main(){
    int h,w;
    cin>>h>>w;
    vector<vector<char> > g(h,vector<char>(w));
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>g[i][j];
        }
    }

    vector<vector<int> > dp(h+1,vector<int>(w+1,0));
    dp[1][1]=1;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            if(i==1 && j==1)
            continue;
            if(g[i-1][j-1]!='#')
            dp[i][j]=(dp[i-1][j]+dp[i][j-1])%1000000007;
        }
    }
    /*for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++)
        cout<<dp[i][j]<<" ";

        cout<<endl;
    }*/
    cout<<dp[h][w]%1000000007;
    return 0;
}

Measured memory_bytes: 5248
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        new Program();
    }


    Program()
    {
        var nk = Console.ReadLine().Split(' ');
        var n = long.Parse(nk[0]);
        var k = long.Parse(nk[1]);

        var a = (from x in Console.ReadLine().Split(' ') select long.Parse(x)).ToArray();

        var dic = new long[n];

        for (var i = 0; i < n; i++)
        {
            dic[i] = -1;
        }

        var idx = 0L;
        var st = -1L;
        var ed = -1L;

        for (var i = 0; i < k; i++)
        {
            dic[idx] = i; // 何回目に呼ばれたか
            idx = a[idx] - 1;

            if (dic[idx] != -1)
            {
                st = dic[idx];
                ed = i + 1;
                break;
            }
        }

        if (st == -1 && ed == -1)
        {
            Console.WriteLine(idx + 1);
            return;
        }

        var t = (k - st) / (ed - st);
        k -= t * (ed - st);

        idx = 0;

        for (var i = 0; i < k; i++)
        {
            idx = a[idx] - 1;
        }

        Console.WriteLine(idx + 1);
    }
}


Measured memory_bytes: 38788
#######################################
import numpy as np
import math
import copy
import re
import sys
#sys.exit(0)

inf = float("inf")
prime = 1

def check_print(check_flag, text, end="\n"):
  if check_flag:
    print(text, end=end)

def c2i(x):
    if str.isdecimal(x):
        return int(x)
    else:
        return x

def cout(*args):
  arglist = []
  for arg in args:
    if hasattr(arg, "__iter__"):
      arglist.extend(arg)
    else:
      arglist.append(arg)
      
  arglist = list(map(str, arglist))
  print(" ".join(arglist))
  
def count2(num):
  count=0
  while num%2==0:
    num/=2
    count+=1
  return count

def ketasum(num):
  nums = [int(s) for s in str(num)]
  return sum(nums)

#math
def gcd(a, b): #最大公約数
  while b:
    a, b = b, a % b
  return a

def lcm(a, b): #最小公倍数
  return a * b // gcd (a, b)

def gcd3(lis): #最大公約数(3over)
  ans = lis[0]
  for li in lis:
    ans = gcd(ans,li)

def lcm3(lis): #最小公倍数(3over)
  ans = lis[0]
  for li in lis:
    ans = lcm(ans,li)

def divisor(n): #nの約数を全て求める
  i = 1
  table = []
  while i * i <= n:
    if n%i == 0:
      table.append(i)
      table.append(n//i)
    i += 1
  table = list(set(table))
  return table

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

def is_prime(n):
  for i in range(2, n + 1):
    if i * i > n:
      break
    if n % i == 0:
      return False
  return n != 1

#input stock
"""
n = int(input())

#list
a = map(int, input().split())
a,b = map(int, input().split())

d=[]
for i in range(n):
  d[i]=int(input())

#2dim-list
a = [list(map(int, input().split())) for i in range(n)]

s = input()
ss =  [int(si) for si in s]
"""

#processing stock
"""
a = sorted(a)
a = sorted(a, reverse=True)

"""

#regex
"""
pattern = ""
result = re.search(pattern, s)

result = re.fullmatch(pattern, s)

result = re.finditer(pattern, s)
for res in result:
    print res.group()   # 1回目: ca      2回目: ca   
    print res.start()   # 1回目: 0       2回目: 6      
    print res.end()     # 1回目: 2       2回目: 8      
    print res.span()    # 1回目: (0, 2)  2回目: (6, 8)
"""

#######################################
k,x = map(int, input().split())
ret = list(range(x-k+1,x+k))

cout(ret)

Measured memory_bytes: 21808
import java.util.Scanner;

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

	while(true){
        int H=sc.nextInt();
	int W=sc.nextInt();
	if(H==0 && W==0) break;	 
	
	for(i=0;i<H;i++){
	    for(j=0;j<W;j++){
		if((i+j)%2==0){
		    System.out.print("#");
		}else{
		    System.out.print(".");
		}
	    }
	    System.out.print("\n");
	}
	System.out.print("\n");
	}
    }
}

Measured memory_bytes: 35200
N, K = map(int, input().split())
A = [int(input()) for _ in range(N)]

B = [0] * (N + 1)
B[1] = A[0] - K
for i in range(1, N):
    A[i] += A[i - 1]
    B[i + 1] = A[i] - K * (i + 1)

tmp = sorted(B)

dic = dict()
for index, x in enumerate(tmp):
    dic[x] = index


N = len(B)
bit = [0] * (N + 1)
def total(i):
    s = 0
    while i > 0:
        s += bit[i]
        i -= i & -i
    return s

def add(i, x):
    while i <= N:
        bit[i] += x
        i += i & -i
    return

ans = 0
for b in B:
    # print (b)
    n = dic[b]
    ans += total(n + 1)
    # print (b, ans)
    # print ()
    add(n + 1, 1)

print (ans)
# print (B)
# print (dic)
# print (bit)

Measured memory_bytes: 88664
package main

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

func main() {
	scanner := makeWordScanner()
	n := eGetInt(scanner)
	a := eGetInt(scanner)
	b := eGetInt(scanner)

	if n*a < b {
		fmt.Println(n * a)
	} else {
		fmt.Println(b)
	}
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}

func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetInt64(r *bufio.Scanner) int64 {
	line := eGetLine(r)
	return eAtoInt64(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetInt64s(r *bufio.Scanner) []int64 {
	fields := eGetFields(r)
	ints := make([]int64, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoInt64(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func eAtoInt64(s string) int64 {
	n, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return n
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>

#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;

const ll MOD = 1000000007;
const long double EPS = 1e-10;
const int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    std::ios::sync_with_stdio(0); cin.tie(0);
    int a, b, c;
    cin >>a >> b >> c;
    cout << (((a == b) && (b == c))?"Yes":"No") << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
using namespace std;struct tring{string g;tring() {};tring(string a) {g=a;}};map<tring,int>RB;bool operator <(tring a, tring b) {if (a.g.size()!=b.g.size()) return a.g.size()<b.g.size();return a.g<b.g;}
int main() {string T;int N,M;cin>>N;while (N--) {cin>>T>>M;RB[tring(T)]+=M;}for (map<tring,int>::iterator it=RB.begin();it!=RB.end();it++) cout<<it->first.g<<" "<<it->second<<endl;return 0;}

Measured memory_bytes: 1228
n, m = map(int, input().split())
d = dict(zip(range(n), [0]*n))
for i in range(m):
  a, b = map(int, input().split())
  d[a-1] = d[a-1] +1
  d[b-1] = d[b-1] +1
for j in range(n):
  print(d[j])

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000;

struct F{
	int f,s;
};

bool com(F a,F b){
	return a.s<b.s;
}

int main(){
	static int n,m,ans=0,t=0;
	F p[100010];
	cin>>n>>m;
	REP(i,m){
		int a,b;
		cin>>a>>b;
		p[i].f=a,p[i].s=b;
	}
	sort(p,p+m,com);
	REP(i,m){
		if(p[i].f>=t){
			t=p[i].s;
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front
#define pb2 pop_back
#define pf2 pop_front
#define line printf("\n")
#define pq priority_queue
#define rep(k,i,j) for(int k = (int)i;k<(int)j;k++)
#define repd(k,i,j) for(int k = (int)i;k>=(int)j;k--)
#define ll long long

using namespace std;

double EPS = 1e-9;
int INF = 1e9+7;;
long long INFLL = 1e17;
double pi = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};

inline void OPEN (string s) {
  freopen ((s + ".in").c_str (), "r", stdin);
  freopen ((s + ".out").c_str (), "w", stdout);
}

//end of template

ll n;

ll dig(ll a){
	if(a==0)return 0;
	return dig(a/10)+1;
}
ll f(ll a,ll b){
	return max(dig(a),dig(b));
}
int main(){
	cin>>n;
	
	ll ret = INF;
	for(ll ki = 1;ki*ki<=n;ki++)if(n%ki==0){
		ll ka = n/ki;
		
		ret = min(ret,f(ki,ka));
	}
	cout<<ret<<endl;
	
	return 0;
}


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

int main(){
    string s; cin >> s;
    ll n = s.size();
    ll k; cin >> k;
    set<string> st;
    for(ll i=0;i<26;i++){
        char c = 'a' + i;
        //cout << c << endl;
        for(ll j=0;j<n;j++){
            string t = "";
            for(ll l=j;l<=min(j+5,n-1);l++){
                t = t + s.at(l);
                st.insert(t);
                //cout << l << endl;
            }    
        }
        if(st.size()>=k) break;
    }
    auto it = st.begin();
    int a=k-1;
    while(a--) it++;
    cout << *it << endl;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007

using namespace std;

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

  if (s.size() % 2 == 1){
    cout << "No" << endl;
    return 0;
  }

  int ok = 1;
  for (int i = 0; i < s.size()/2; i++){
    if (s[i] != s[i + s.size()/2])
      ok = 0;
  }

  if (ok)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
//24
#include<iostream>
#include<sstream>
#include<string>

using namespace std;

int main(){
  string s;
  getline(cin,s);
  for(int i=0;i<s.size();i++){
    if(s[i]==','||s[i]=='.'){
      s[i]=' ';
    }
  }
  stringstream ss(s);
  bool sec=false;
  for(string t;ss>>t;){
    if(3<=t.size()&&t.size()<=6){
      if(sec){
	cout<<' ';
      }
      cout<<t;
      sec=true;
    }
  }
  cout<<endl;
  return 0;
}

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

int main(){
	int N;
	cin >> N;
	string s[N];
	set<string> st;
	rep(i,N) {
		cin >> s[i];
		sort(s[i].begin(), s[i].end());
		st.insert(s[i]);
	}

	map<string, int> mp;
	for ( string p : st) mp[p] = 0;

	rep(i,N) mp[s[i]]++;
	ll ans = 0;
	for (string p : st) ans += (ll)mp[p]*(mp[p]-1)/2;
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 22344
def resolve():
  n = int(input())
  a = list(map(int, input().split()))
  b = list(map(int, input().split()))

  if sum(a) < sum(b):
    print(-1)
    return

  more = []
  less = []

  for i in range(n):
    if a[i] > b[i]:
      more.append(a[i]-b[i])
    elif a[i] < b[i]:
      less.append(b[i]-a[i])

  if len(less) == 0:
    print(0)
    return

  ans = len(less)

  v = sum(less)
  more.sort(reverse=True)
  for i in range(len(more)):
    if v <= 0:
      break
    v -= more[i]
    ans += 1

  print(ans)

  return

if __name__ == "__main__":
  resolve()


Measured memory_bytes: 23972
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long int
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define pci pair<char,int
#define mii map<int,int>
#define mll map<long long int,long long int>
#define mci map<char,int>
#define umii unordered_map<int,int>
#define umll unordered_map<long long int,long long int>
#define umci unordered_map<char,int>
#define F first
#define S second
#define pb push_back
#define endl '\n'
#define mod 1000000007
using namespace std;
#define maxval 10003000
ll power(ll x,ll n,ll m)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=(result * x)%m;
        x=(x*x)%m;
        n=n/2;
    }
    return result%m;
}

int main(){
   IOS;
//ll t;t=1;//cin>>t;
ll n;cin>>n;
ll x=power(10,n,mod);
ll y=power(8,n,mod);
ll z=power(9,n,mod);
z=(2*z)%mod;
cout<<(mod+x+y-z)%mod<<"\n";
    
return 0;    
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define ii pair<int, int>
using namespace std;
const int N = 1e6+6;

int n;
vector<ii> pos, neg;

bool cmp_pos(ii lhs, ii rhs) {
    return lhs.second < rhs.second;
}
bool cmp_neg(ii lhs, ii rhs) {
    return lhs.first > rhs.first;
}
int main() {
//    freopen("in.txt", "r", stdin);
    cin >> n;
    for(int i=0; i<n; i++) {
        string s; cin >> s;
        int m = s.length();
        int r = 0, l = 0;
        for(int j=0; j<m; j++) {
            if(s[j]==')') {
                if(l)   l--;
                else    r++;
            } else  l++;
        }
        if(l-r>=0)  pos.push_back({l, r});
        else        neg.push_back({l, r});
    }
    sort(pos.begin(), pos.end(), cmp_pos);
    sort(neg.begin(), neg.end(), cmp_neg);
    int S = 0;
    for(ii p : pos) {
        if(S - p.second < 0) {
            cout << "No";
            exit(0);
        }
        S += p.first - p.second;
    }
    if(!neg.empty() && neg.back().first > 0) {
        cout << "No";
        exit(0);
    }
    for(ii p : neg) {
        if(S - p.second < 0) {
            cout << "No";
            exit(0);
        }
        S += p.first - p.second;
    }
    if(S != 0)  cout << "No";
    else        cout << "Yes";
    return 0;
}


Measured memory_bytes: 11108
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();

    for(int i = 1 ; i <= b ; ++i){
      int aa = a*i;
      if(aa%b == c){
        System.out.println("YES");
        return;
      }
    }
    System.out.println("NO");
  }
}

Measured memory_bytes: 35736
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;

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

    // Get tree
    int a, b;
    vector<vector<int>> edge(n, vector<int>{});
    for(int i=0; i<m; i++){
        cin >> a >> b; a--; b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }

    // Get all paint query at the fisrt for reverse
    vector<vector<int>> paint_query;
    int q; cin >> q;
    int v, d, c;
    for(int i=0; i<q; i++){
        cin >> v >> d >> c; v--;
        paint_query.push_back(vector<int>{v, d, c});
    }
    reverse(paint_query.begin(), paint_query.end());

    // 0-10 depth BFS
    vector<int> colors(n, 0);
    vector<int> paint_depth(n, -1);
    for(int i=0; i<q; i++){
        v = paint_query[i][0];
        d = paint_query[i][1]; 
        c = paint_query[i][2];
        queue<vector<int>> que;
        // vector{from, now, distance}
        que.push(vector<int>{-1, v, d});
        while(!que.empty()){
            vector<int> val = que.front(); que.pop();
            int from = val[0];
            int now = val[1];
            int depth = val[2];
            if(depth <= paint_depth[now]){continue;}
            paint_depth[now] = max(paint_depth[now] ,depth);
            if(colors[now] == 0){
                colors[now] = c;
            }
            for(int j=0; j<(int)edge[now].size(); j++){
                int to = edge[now][j];
                if(from == to){continue;}
                if(depth <= 0){continue;}
                que.push(vector<int>{now, to, depth-1});
            }
        }
    }
    for(auto& v:colors){
        cout << v << endl;
    }
    return 0;
}

Measured memory_bytes: 18640
//#include<iostream>
//#include<cstdio>
//#include<string>
//#include<string>
//#include<algorithm>
//#include<ctime> printf("\n%lldms",clock());
//#include<cmath>
//#include<vector>
//#include<queue>
#include <bits/stdc++.h>
#define lijyya 300010
#define oo 0x3f3f3f3f
#define emmm 100003
#define f1(i,a,b) for (register int i=a;i<=b;++i)
#define f2(i,a,b) for (register int i=a;i<b;++i)
#define f3(i,a,b) for (register int i=a;i>=b;--i)
#define f4(i,a,b) for (register int i=a;i>b;--i)
using namespace std;
typedef long long ll;
template<typename T> inline void checkmax(T &x,T y){x=max(x,y);}
template<typename T> inline void checkmin(T &x,T y){x=min(x,y);}
inline int read(){
    int f=1,x=0;char ch;
    do{
        ch=getchar();if(ch=='-') f=-1;
    }while(ch<'0'||ch>'9');
    do{
        x=x*10+ch-'0';ch=getchar();
    }while(ch>='0'&&ch<='9');
    return f*x;
}

int n,a;
int main(){
    n=read();
    a=read();
    if(n*a%2==0) printf("Even");
    else printf("Odd");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
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; }
// template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    ll ans = 0;
    map<int, int> ma_x, ma_x_mod, ma_mod;
    rep (i, n) {
        int x; cin >> x; ma_x[x]++;
    }
    for (auto p : ma_x) {
        ma_x_mod[p.first % m] += p.second / 2;
        ma_mod[p.first % m] += p.second;
    }
    for (int i = 0; (2 * i) <= m; i++) {
        int j = (m - i) % m;
        if (i == j) {
            ans += ma_mod[i] / 2;
            ma_mod[i] -= (ma_mod[i] / 2) * 2;
        } else {
            int k = min(ma_mod[i], ma_mod[j]);
            ans += k;
            ma_mod[i] -= k; ma_mod[j] -= k;
        }
    }
    eprintf("%lld ", ans);
    rep (i, m) {
        ans += min(ma_x_mod[i], ma_mod[i] / 2);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 14336
#pragma comment(linker,"/stack:16777216")
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<functional>
#include<utility>
#include<algorithm>
#include<sstream>
#include<cstring>
#include<cmath>
#include<cctype>
#include<exception>
#include<climits>
#include<cfloat>
#include<iomanip>
#include<bitset>
#include<streambuf>
#include<cstdlib>
#include<ctime>
//#include"functions.h"
//#include"highprecision.h"
#define pb push_back
#define pf push_front
#define ppb pop_back
#define mp make_pair
#define np next_permutation
#define fi first
#define sc second
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int> >
#define vpi vector<pair<int,int> >
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pff pair<float,float>
#define pdd pair<double,double>
#define psi pair<string,int>
#define pis pair<int,string>
#define ppi pair<pii,int>
#define pdi pair<pii,pii>
#define LN 84757
#define INF 1e9
#define LLINF 1e18
#define MAXINT 0x7fffffff
#define MAXLL 0x7fffffffffffffff
#define EPS 1e-5
#define DEPS 1e-9
#define LDEPS 1e-13
#define MOD 1000000007
#define E 2.7182818284
#define PI 3.1415926535
#define rep(a,b) for(int a=0;a<b;a++)
#define rep(a,b) for(int a=0;a<b;a++)
#define forn(a,n) for(int a=1;a<=n;a++)
#define forr(a,n) for(int a=n;a>=1;a--)
#define repn(a,n,p) for(int a=0;a<n;a+=p)
#define repr(a,n) for(int a=n-1;a>=0;a--)
#define foreach(a,b) for(__typeof(b.begin())a=b.begin();a!=b.end();a++)
#define fillemp(a) memset(a,0,sizeof(a))
#define fillinf(a) memset(a,0x3f,sizeof(a))
#define frestream freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define stdf(a,b) freopen(a,"r",stdin);freopen(b,"w",stdout);
#define inputf(a) freopen(a,"r",stdin);
#define outputf(a) freopen(a,"w",stdout);
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define MOD 1000000007
typedef long long ll;
typedef long double ld;
using namespace std;

int main(int argc,char** argv){
	ll x,k,d;
	cin>>x>>k>>d;
	x=abs(x);
	ll a=x-(x/d)*d;
	ll b=x-(x/d+1ll)*d;
	if(abs(a)>abs(b)){
		swap(a,b);
	}
	ll al=abs(x-a)/d;
	ll bl=abs(x-b)/d;
	if(k<min(al,bl)){
		cout<<x-k*d<<endl;
		return 0;
	}
	if((k-al)%2==0){
		cout<<abs(a)<<endl;
	}
	else{
		cout<<abs(b)<<endl;
	}
	return 0;
}

Measured memory_bytes: 3616
InputData=[]
while True:
    try:
        in1,in2 = map(int,raw_input().split(" "))  # Python2
        if in1==0 and in2==0 : break
        InputData.append([in1,in2])
    except EOFError:
        break

for i in range(len(InputData)):
    in1,in2 = InputData[i]
    print(str(in1 * in2) + " " + str((in1 + in2) * 2))

Measured memory_bytes: 6452
n = int(input())
x_l = [int(x) for x in input().split()]
ans = float('INF')
for p in range(1,101):
    sumn = 0
    for j in range(n):
        sumn += (x_l[j]-p)**2
        if(ans<sumn):
            break
    
    if(ans>sumn):
        ans = sumn

print(ans)


Measured memory_bytes: 3060
# include <bits/stdc++.h>
# define ll int64_t
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl

using namespace std;

bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

ll factorial(ll n){
    ll x=1;
    rrep(i,n) (x*=i)%=mod;
    return x;
}

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

ll lcm(ll a,ll b)
{
   return a/gcd(a,b)*b;
}

//累乗だってさ
ll modpow(ll a,ll n,ll mod1) {
    ll res=1;
    while(n>0){
        if(n&1) res=res*a%mod1;
        a = a*a%mod1;
        n >>= 1;
    }
    return res;
}

ll combination(ll n,ll r){
    ll sum=1;
    rrep(i,min(r,n-r)) (sum*=(n-i+1))%=mod;
    return sum;
}

//逆元だってさ
ll modinv(ll a,ll mod1) {
    return modpow(a, mod1 - 2, mod1);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string a;
    cin>>a;
    deque<string> s(a.size());
    rep(i,a.size()) s[i]=a[i];
    ll q,r=0;
    cin>>q;
    rep(i,q){
        ll query;
        cin>>query;
        if(query==1) r++;
        if(query==2) {
            ll f;
            string c;
            cin>>f>>c;
            if(f==1) {
                if(r%2==0) s.push_front(c);
                else s.push_back(c);
            }
            else if(f==2) {
                if(r%2==0) s.push_back(c);
                else s.push_front(c);
        }
      }
    }
    if(r%2!=0) reverse(ALL(s));
    rep(i,s.size()-1) cout<<s[i];
    cout<<s[s.size()-1]<<endl;
    return 0;
}

Measured memory_bytes: 17232
#include<iostream>
using namespace std;
int main() {
	int n,a,m,b;
	cin>>n>>a>>m>>b;
	while (1) {
		m-=a;
		if (m <= 0) break;
		n-=b;
		if (n <= 0) break;
	}
	if (m <= 0) cout<<"Yes";
	else cout<<"No";
	return 0;
} 

Measured memory_bytes: 3588
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#include <algorithm>
#include <functional>
#include <complex>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl;
typedef double D;
typedef complex<D> P;
typedef pair<P,P> L;
D eps=1e-9,inf=1e50;
bool eq(D a,D b){
	return abs(a-b)<eps;
}
bool compxy (const P& l, const P& r){		//sort x -> y
	return eq(l.real(),r.real()) ? l.imag()<r.imag() : l.real() < r.real();
}
inline D cro(P a,P b){
	return imag(conj(a)*b);
}
inline bool iLS(L l,L s){
	return cro(l.sc-l.fs,s.fs-l.fs)*cro(l.sc-l.fs,s.sc-l.fs)<eps;
}
inline P intLL(L a,L b){
	D t=cro(a.sc-a.fs,a.sc-b.fs)/cro(a.sc-a.fs,b.sc-b.fs);
	return b.fs+t*(b.sc-b.fs);
}
vector<P> points;
vector<P> vc;
vector<D> lefts,leftsc;
int main(){
	while(true){
		int W,H,N;
		cin>>W>>H>>N;
		if(N==0) break;
		points.clear();
		lefts.clear();
		vc.clear();
		leftsc.clear();
		L s=L(P(0,0),P(0,H));
		rep(i,2*N){
			int x,y;
			cin>>x>>y;
			vc.pb(P(x,y));
			points.pb(P(x,y));
		}
		points.pb(P(0,0));
		points.pb(P(0,H));
		points.pb(P(W,0));
		points.pb(P(W,H));
		sort(all(points),compxy);
		points.erase(unique(all(points)),points.end());
		int sz=points.size();
//		rep(i,sz) show(points[i]);
		rep(i,sz){
			rep(j,sz){
//				cout<<i<<" "<<j<<endl;
				if(points[i].real()==points[j].real()) continue;
				L l=L(points[i],points[j]);
				P p=intLL(l,s);
				if(iLS(l,s)) lefts.pb(intLL(l,s).imag());
			}
		}
		sort(all(lefts));
		int m=lefts.size();
		D now=lefts[0];
/*		rep(i,m){
			if(lefts[i]-now<eps) continue;
			leftsc.pb(lefts[i]);
			now=lefts[i];
		}
		lefts=leftsc;
		m=lefts.size();*/
		L r=L(P(W,0),P(W,H));
		D ans=0;
		rep(i,m-1){
			P m=P(0,(lefts[i]+lefts[i+1])/2);
			vector<D> rights;
			rep(j,2*N){
				if(vc[j].real()==0){
					if(vc[j].imag()>m.imag()) rights.pb(inf);
					else rights.pb(-inf);
				}else{
					rights.pb(intLL(r,L(m,vc[j])).imag());
				}
			}
			sort(all(rights));
			D ub=rights[N],lb=rights[N-1];
			ub=min(ub,(double)H),lb=max(lb,0.0);
//			show(lefts[i]);
//			show(lefts[i+1]);
//			show(ub-lb);
//			cout<<endl;
			if(ub>lb) ans+=(lefts[i+1]-lefts[i])*(ub-lb);
		}
		ans/=H*H;
		printf("%.12f\n",ans);
	}
}

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

int main() {
	int N;
  	cin >> N;
  
  	long long a = 2,b = 1,c;
  
  	if(N == 1) {
    	cout << 1 << endl;
    }else {
      	for(int i = 0; i < N - 1; i++) {
        	 c = a + b;
          	 a = b;
          	 b = c;
        }
      cout << c << endl;
    }
  
  	
}


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

int main(){
  string a,b;
  cin >> a >> b;
  
  if (a.length()>b.length()) cout << "GREATER" << endl;
  else if (a.length()<b.length()) cout << "LESS" << endl;
  else {
    for (int i=0;i<a.length();++i){
      if (a[i]<b[i]) {
          cout << "LESS" << endl;
          return 0;
      }
      else if (a[i]>b[i]) {
          cout << "GREATER" << endl;
          return 0;
    }
  }
    cout << "EQUAL" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
typedef long long ll;
typedef pair<int64_t,int64_t> pll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
#define sz(s) (s).size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second


void solve()
{
    string s;cin>>s;
    int k;cin>>k;
    vector<string> ans(0);
    for(int x=1;x<=k;x++)
        REP(i,s.size())ans.pb(s.substr(i,x));

    
    sort(ALL(ans));
    ans.erase(unique(ALL(ans)),ans.end());
    cout<<ans[k-1]<<endl;
}

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

Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N,A,B;
    cin >>N>>A>>B;
    cout << min(B,A*N) << endl;



}


Measured memory_bytes: 256
W,H,N=map(int,input().split())
white=[[1 for _ in range(H)] for _ in range(W)]

for i in range(N):
    x,y,a=map(int,input().split())
    if a==1:
        for i in range(x):
            for j in range(H):
                white[i][j]=0
    elif a==2:
        for i in range(x,W):
            for j in range(H):
                white[i][j]=0
    elif a==3:
        for i in range(W):
            for j in range(y):
                white[i][j]=0
    else:
        for i in range(W):
            for j in range(y,H):
                white[i][j]=0
print(sum(sum(x) for x in white))


Measured memory_bytes: 9204
import os
import numpy as np

class getStdin(object):
    @classmethod
    def get_int(cls):
        return int(input())

    @classmethod
    def get_str(cls):
        return str(input())


if __name__ == '__main__':
    n = getStdin.get_int()
    s = getStdin.get_str()
    ss = ''
    for i in range(len(s)):
        x = ord(s[i]) + n
        if x >= 91:
            x = x - 26

        ss += chr(x)

    print(ss)

    os.sys.exit(0)

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

const int N=100007;
int dp[N][3];
int a[N][3];
int n;

int solve(int n2,int g)
{
    if(n2>n)
    return 0;
    int h=dp[n2][g];
    if(h!=-1)
    return h;
    for(int i=0;i<3;i++)
    {
        if(i!=g)
        dp[n2][g]=max(dp[n2][g],solve(n2+1,i)+a[n2][i]);
    }
    return dp[n2][g];
}


int main()
{
	memset(dp,-1,sizeof(dp));
	cin>>n;
	for(int i=1;i<=n;i++)
	{
	    for(int j=0;j<3;j++)
	    cin>>a[i][j];
	}
	
	int k=-1;
	for(int i=0;i<3;i++)
	k=max(k,solve(2,i)+a[1][i]);
	cout<<k<<"\n";
}
	
	

Measured memory_bytes: 10368
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	int r,n,i,j,k=0;
	string str;
	cin>>n;
	cin>>str;
	if(n%2==1)
	{cout<<"No";
	}
	else
	{
		for(i=0;i<n/2;i++)
		{
			if(str[i]!=str[n/2+i])
			{k=1;break;
			}
		}
		if(k==1)
		{cout<<"No";
		}
		else
		{cout<<"Yes";
		}
	}
	
	
}

Measured memory_bytes: 256
#include<stdio.h>

double a(double A,double a,double B,double b,double x,double y)
{
if(A!=B){
return ((a-b)/(A-B))*(x-A)+a-y;
} else {
return x-A;
}
}

int main(void)
{
double x1,y1,x2,y2,x3,y3,xp,yp;
int i,j;

while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3,&xp,&yp)!=EOF){


if((a(x1,y1,x2,y2,xp,yp)*a(x1,y1,x2,y2,x3,y3)<0)||(a(x3,y3,x2,y2,xp,yp)*a(x3,y3,x2,y2,x1,y1)<0)||(a(x1,y1,x3,y3,xp,yp)*a(x1,y1,x3,y3,x2,y2)<0)){
printf("NO\n");
} else {
printf("YES\n");
}
}



return 0;
}

Measured memory_bytes: 608