akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;
#define rep(i,a,b) for(int i=(a); i<(b); i++)
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define pai 3.14159265358979323846
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 * b / gcd(a, b);}
/* map<string,int> */
/* 大文字を小文字に変換 tolower*/
/* 小文字を大文字に変換 toupper*/
/* 辞書順 next_permutation(a.begin(),a.end()) */
 
char change (int);
int main() {
    ll n;
    cin >> n;
    string a = "";
    while (n) {
        n--;
        a += change(n%26);
        n /= 26;
    
    }
    reverse(a.begin(), a.end());
    cout << a << endl;
}

char change (int a) {
    if (a == 0) return 'a';
    else if (a == 1) return 'b';
    else if (a == 2) return 'c';
    else if (a == 3) return 'd';
    else if (a == 4) return 'e';
    else if (a == 5) return 'f';
    else if (a == 6) return 'g';
    else if (a == 7) return 'h';
    else if (a == 8) return 'i';
    else if (a == 9) return 'j';
    else if (a == 10) return 'k';
    else if (a == 11) return 'l';
    else if (a == 12) return 'm';
    else if (a == 13) return 'n';
    else if (a == 14) return 'o';
    else if (a == 15) return 'p';
    else if (a == 16) return 'q';
    else if (a == 17) return 'r';
    else if (a == 18) return 's';
    else if (a == 19) return 't';
    else if (a == 20) return 'u';
    else if (a == 21) return 'v';
    else if (a == 22) return 'w';
    else if (a == 23) return 'x';
    else if (a == 24) return 'y';
    else if (a == 25) return 'z';
    else return ' ';
}

Measured memory_bytes: 3104
#include <stdio.h>
int djs[10010];
int height[10010];
int djsUnion(int x,int y){
	if(height[x]>height[y]){
		djs[y]=x;
	}
	else if(height[x]<height[y]){
		djs[x]=y;
	}
	else{
		djs[x]=y;
		height[y]++;
	}
	return 0;
}
int find (int x){
	if(djs[x]==-1)return x;
	else{
		//djs[x]=find(djs[x]);
		//return djs[x];
		return find(djs[x]);
	}
}
int main(){
	int i,n,m,x,y,z;
	scanf("%d %d",&n,&m);
	for(i=0;i<n;i++){
		djs[i]=-1;
		height[i]=1;
	}
	for(i=0;i<m;i++){
		scanf("%d %d %d",&x,&y,&z);
		if(x==1){
			if(find(y)==find(z)){
				printf("1\n");
			}
			else{
				printf("0\n");
			}
		}
		else{
			if(find(y)!=find(z)){
				djsUnion(find(y),find(z));
			}
		}	
	}
	return 0;
}

Measured memory_bytes: 1088
using System;

namespace B___Addition_and_Multiplication
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var k = int.Parse(Console.ReadLine());
            var a = 1;
            for(var i=0; i<n; i++)
            {
                a = Math.Min(2 * a, a + k);
            }
            Console.WriteLine(a);
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

signed main(){
	int n;scanf("%d",&n);
	unordered_map<ll,int>mp;
	mp[0]++;
	ll sum=0;
	ll ans=0;
	rep(i,n){
		int a;scanf("%d",&a);
		sum+=a;
		ans+=mp[sum];
		mp[sum]++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 8520
defmodule Main do
  def main do
    n = IO.read(:line) |> String.trim
    a = IO.read(:line) |> String.trim
    n = String.to_integer(n)
    a = String.to_integer(a)
    if rem(n, 500) <= a do
      IO.puts("Yes")
    else
      IO.puts("No")
    end
  end
end


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

int n,b,c,cnt[19][19];
ll aa,ans;
long double a;

int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    b=0;c=0;
    cin>>a;
    aa=a*1e9+0.5;
    while(aa%2==0){
      aa/=2;
      b++;
    }
    b=min(b,18);
    while(aa%5==0){
      aa/=5;
      c++;
    }
    c=min(c,18);
    for(int j=18;j>=18-b;j--)for(int k=18;k>=18-c;k--)ans+=cnt[j][k];
    cnt[b][c]++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3756
#include <stdio.h>
#include <stdlib.h>
#include "time.h"
#include "unistd.h"
#include "string.h"

int main(int argc, char* argv[]){
    int count = 0;
    char text[10];
    scanf("%s", text);
    for(int i=0;i<strlen(text);i++,i++){
        if(text[i]!='h'||text[i+1]!='i'){
            count++;
        }
    }
    if(count >= 1){
        printf("No");
    }else{
        printf("Yes");
    }
}

Measured memory_bytes: 128
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int K = in.nextInt();
            int[] x = new int[N + 1];
            for (int i = 0; i < N; i++) {
                x[i] = in.nextInt();
            }
            x[N] = 0;
            Arrays.sort(x);

            int index0 = 0;
            for (int i = 0; i < N + 1; i++) {
                if (x[i] == 0) {
                    index0 = i;
                    break;
                }
            }

            int min = (int) 1e9;
            for (int i = 0; i <= K; i++) {
                if (index0 - i >= 0 && index0 + (K - i) < x.length) {
                    min = Math.min(min, 2 * Math.abs(x[index0 - i]) + Math.abs(x[index0 + (K - i)]));
                }
                if (index0 - (K - i) >= 0 && index0 + i < x.length) {
                    min = Math.min(min, Math.abs(x[index0 - (K - i)]) + 2 * Math.abs(x[index0 + i]));
                }
            }

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


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

 
int main() {
    string s;
    cin>>s;
    long int q;
    cin>>q;
    int re=0;
    string first;
    
    rep(i,q){
        int a;
        cin>>a;
        if(a==1){
            re++;
        }else{
            int b;
            string c;
            cin>>b;
            cin>>c;
            if(b==1){
                if(re%2==0){
                first=first+c;  
                }else{
                    s=s+c;
                }
            }else{
                if(re%2==0){
                s=s+c;
                }else{
                    first+=c;
                    
                }
                
            }
            
        }
    }

    if(re%2==0){
        reverse(first.begin(),first.end());
        string ans=first+s;
    cout<<ans<<endl;
    }else{
        reverse(s.begin(),s.end());
        string ans=s+first;
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 1744
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define MAXCHAR 200000

int main(void)
{
    int c;
    int i = 0;
    char forecast[MAXCHAR];
    char result[MAXCHAR];
    int truenum=0;

    while ((c = getchar()) != '\n')
    {
        forecast[i] = c;
        i=i+1;
    }
    forecast[i] = '\0';

    i = 0;
    while ((c = getchar()) != EOF)
    {
        result[i] = c;
        i=i+1;
    }
    result[i] = '\0';

    for(int j=0; j < 3; j++)
    {
        if(result[j]==forecast[j]) truenum=truenum + 1;
    }

    printf("%d", truenum);
    return 0;
}


Measured memory_bytes: 128
using System.Linq;
using System;

public class Hello
{
    public static void Main()
    {
        var r = new int[101];
        var s = new int[101];
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        r[a[0]] = 1; r[a[2]]++;
        r[a[1]]--; r[a[3]] --;
        s[0] = r[0];
        for (int i = 1; i <= 100; i++)
            s[i] = s[i - 1] + r[i];
        Console.WriteLine(s.Count(x => x == 2));
    }
}

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

using namespace std;
#define MOD 1000000007
#define pi 3.1415926535897932384626433832795028841971693993751058209749445923078164062
#define ll long long
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define popb pop_back()
#define popf pop_front()
#define ff first
#define ss second
#define vl vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vll vector< pair<ll,ll> >
#define vii vector< pair<int,int> >
#define viii vector< tuple <int,int,int> >
#define vlll vector< tuple <ll,ll,ll> >
#define vvl vector<vector<ll>>
#define vv vector<vector<int>>
#define all(v) v.begin(),v.end()
#define sqrt sqrtl
#define cbrt cbrtl
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mapcl map<char,ll>
#define mapci map<char,int>
#define mapll map<ll,ll>
#define mapii map<int,int>
#define seti set<int>
ifstream fin("input.txt");
ofstream fout("output.txt");

int gcd(int a,int b){while (a&&b)a>b?a%=b:b%=a;return a+b;}
ll pows(int a , int b){ll res=1;for(int i=0; i<b; ++i){res*=a;}return res;}
ll logx(ll base, ll num){int cnt=0;while(num!=1){num/=base; ++cnt;}return cnt;}

vi vis(100001,0);
vi adj[100001];

int main()
{	
    std::ios::sync_with_stdio(false);
    //cin.tie(NULL);
    //cout.tie(NULL);
    string x;
    cin>>x;
    if(x[0]=='S')
    	cout<<"Cloudy"<<"\n";
    else if(x[0]=='C')
    	cout<<"Rainy"<<"\n";
     else if(x[0]=='R')
    	cout<<"Sunny"<<"\n";
}

Measured memory_bytes: 3072
#include <stdio.h>

int main () {
   int a, b, c, d;
   scanf("%d%d%d%d", &a, &b, &c, &d);
   int flag = 1;
   while (1) {
       if (a <= 0) {
           printf("No");
           break;
       }
       if(c <= 0) {
          printf("Yes");
          break;
       }
       if(flag == 0) {
          a -= d;
          flag = 1;
       }
       else if(flag == 1) {
           c -= b;
           flag = 0;
       }      
   }
   printf("\n");
   return 0;
}


Measured memory_bytes: 1708
#include <stdio.h>
#define N 2000005

int A[N], B[N], C[N];
int n;

void countingsort(int *, int *, int);

main() {
  int i, k = 0;

  scanf("%d", &n);

  for(i = 1; i < n + 1; i++) {
    scanf("%d", &A[i]);
  }
  for(i = 1; i < n + 1; i++) {
    if(A[i] > k) {
      k = A[i];
    }
  }
  k = k + 1;

  countingsort(A, B, k);

  for(i = 1; i < n + 1; i++) {
    if(i == n) {
      printf("%d\n", B[i]);
    }
    else {
      printf("%d ", B[i]);
    }
  }
  return 0;
}

void countingsort(int *A, int *B, int k) {
  int i, j;

  for(i = 0; i < k; i++) {
    C[i] = 0;
  }

  for(j = 1; j < n + 1; j++) {
    C[A[j]]++;
  }

  for(i = 1; i < k; i++) {
    C[i] = C[i] + C[i - 1];
  }

  for(j = n; j >= 1; j--) {
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
}

Measured memory_bytes: 17892
a = ["R", "U", "D"]
b = ["L", "U", "D"]
s = input()
iscan = True
for i in range(len(s)):
    if i%2 == 0:
        if s[i] not in a:
            iscan = False
    else:
        if s[i] not in b:
            iscan = False
print("Yes" if iscan else "No")


Measured memory_bytes: 38384
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use itertools::Itertools;
use num_traits::clamp;
use ordered_float::OrderedFloat;
use proconio::{input, marker::*, fastout};
use superslice::*;

#[fastout()]
fn main() {
    input! {
        n: usize, k: usize,
        a: [i64; n],
    }

    let mut cum = vec![0; n+1];
    for i in 0..n {
        cum[i+1] = cum[i] + a[i];
    }
    
    let mut beauty = Vec::new();
    for i in 0..n {
        for j in i..n {
            beauty.push(cum[j+1] - cum[i]);
        }
    }
    
    let mut ans = 0i64;
    for bit in (0..50).rev() {
        let mask = ans + (1<<bit);
        if beauty.iter().filter(|v| **v & mask == mask).count() >= k {
            ans = mask;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 6152
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x ,n) for(int i = x; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main(){
    string az="abcdefghijklmnopqrstuvwxyz";
    string s;
    cin >> s;
    sort(s.begin(),s.end());
    
    int i=0,j=0;
    rep(j,s.size()){
        if(az[i]==s[j])i++;
        if(i==26){cout << "None" << endl;return 0;}
    }
    
    cout << az[i];
    
	return 0;
}

Measured memory_bytes: 3732
n=int(input())

mat=[[0 for i in range(n)] for j in range(n)]
data=[[0 for i in range(n)] for j in range(n)]
for _ in range(n):
    x=list(map(int,input().split()))
    for j in range(n):
        mat[_][j]=x[j]
        data[_][j]=x[j]
def warshall_floyd(d):
    #d[i][j]=i番目の頂点からj番目の頂点までの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

newmat=warshall_floyd(mat)
if newmat==data:
    ans=0
    for i in range(n):
        for j in range(i+1,n):
            ans+=data[i][j]*int(all(data[i][j]<data[i][k]+data[k][j] for k in range(i))&all(data[i][j]<data[i][k]+data[k][j] for k in range(i+1,j))&all(data[i][j]<data[i][k]+data[k][j] for k in range(j+1,n)))     
    print(ans)      
else:
    print(-1)

Measured memory_bytes: 56284
/*
ID: y1197771
PROG: test
LANG: C++
*/
#include<bits/stdc++.h>
#define pb push_back
#define FOR(i, n) for (int i = 0; i < (int)n; ++i)
#define dbg(x) cout << #x << " at line " << __LINE__ << " is: " << x << endl
typedef long long ll;
using namespace std;
typedef pair<int, int> pii;
const int maxn = 1e5 + 10;
int n;
ll a[maxn];
ll s[maxn];
void solve() {
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    sort(a, a + n);
    s[0] = a[0];
    for (int i = 1; i < n; i++) {
        s[i] += s[i - 1] + a[i];
    }
    int res = 1;
    for (int i = n - 2; i >= 0; i--) {
        if(s[i] * 2 >= a[i + 1]) res++;
        else break;
        //cout << i << " " << res << endl;
    }
    cout << res << endl;
}
int main() {
   // freopen("test.in", "r", stdin);
    //freopen("test.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
#define ALL(x) x.begin(),x.end()

void solve(){
  int a, b; cin >> a >> b; int t=1; int ans = 0;
  //while(t<b) { ans++; t += (a-1);}
  //cout << ans << endl;
  cout << (b+a-3)/(a-1) << endl;
}

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

Measured memory_bytes: 384
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>
#include <string.h>
#include <bitset>

using namespace std;
typedef long long ll;

ll C[51][51];

void comb_table(int N) {
  for (int i = 0; i <= N; i++) {
    for (int j = 0; j <= i; j++) {
      if (j == 0 || j == i) {
        C[i][j] = 1LL;
      } else {
        C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]);
      }
    }
  }
}

int main() {
  int n, a, b;
  cin >> n >> a >> b;
  comb_table(n);
  vector<ll> list(n);
  map<ll, int> num;
  for (int i = 0; i < n; i++) {
    cin >> list[i];
    num[list[i]]++;
  }
  sort(list.rbegin(), list.rend());
  
  double ave = 0.0;
  ll lv;
  for (int i = 0; i < a; i++) {
    ave += list[i];
    lv = list[i];
  }
  ave /= a;
  
  cout.precision(20);
  cout << fixed << ave << endl;
  
  ll res = 0;
  if (list[0] == lv) {
    for (int i = a; i <= b; i++) {
      res += C[num[lv]][i];
    }
  } else {
    ll lcnt = 0;
    for (int i = 0; i < a; i++) {
      if (list[i] == lv) {
        lcnt++;
      }
    }
    res = C[num[lv]][lcnt];
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
s = input()

aFlag = False
cFlag = False
otherFlag = False
if s[0] == 'A':
    aFlag = True
ccount = 0
for x in s[2:-1]:
    if x == 'C':
        ccount += 1
if ccount == 1:
    cFlag = True

s = s.replace('A', '')
s = s.replace('C', '')
if s.islower():
    otherFlag = True
if aFlag and cFlag and otherFlag:
    print('AC')
else:
    print('WA')


Measured memory_bytes: 3060
#include <stdio.h>

int main(void)
{
	int x, y, a;

	while (1)
	{
		scanf("%d%d", &x, &y);

		if (x == 0 && y == 0)
			break;

		if (x > y)
		{
			a = x;
			x = y;
			y = a;
		}

		printf("%d %d\n", x, y);
	}
	
	return 0;
}

Measured memory_bytes: 600
N, W = map(int, input().split())
w, v = [0] * N, [0] * N
for i in range(N):
	w[i], v[i] = map(int, input().split())

V = sum(v)
# dp[i][j]:i番目までの品物から価値がj以上になるよう選んだときの重さの総和の最小値
dp = [[float("inf")] * (V + 1) for _ in range(N + 1)]
dp[0][0] = 0
for i in range(N):
	for j in range(V + 1):
		# i+1番目を選ぶ場合
		if j - v[i] >= 0:
			dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - v[i]] + w[i])
		# i+1番目を選ばない場合
		dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])

# dp[N][j]がW以下であるようなjの最大値が答えになる
ans = 0
for j in range(V + 1):
	if dp[N][j] <= W:
		ans = j

print(ans)

Measured memory_bytes: 311888
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    int N, h[102];
    cin >> N;
    for(int i = 1; i <= N; i++){
        cin >> h[i];
    }
    h[0] = 0;
    int ans = 0;
    for(int i = 1; i <= N; i++){
        if(h[i-1] < h[i]){
            ans += h[i] - h[i-1];
        }
    }
    cout << ans <<"\n";
}

Measured memory_bytes: 256
a, b, c = map(int, input().split())

max_num = max(a, b, c)
min_num = min(a, b, c)
mid_num = a+b+c-max_num - min_num

ans  = max_num - min_num + max_num - mid_num
if(ans%2==0):
    print(int(ans/2))
else:
    print(int(ans/2)+2)

Measured memory_bytes: 3060
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <utility>

using namespace std;

int main() {
char a,b;
cin >> a >> b;
if(a==b){
  cout << "H" << endl;
}
else{
  cout << "D" << endl;
}

  return 0;
}


Measured memory_bytes: 256
n = gets.to_i
pys = []
n.times do
  pys << gets.to_i
end

res = pys.sort {|a, b| b <=> a }

i = 0
cont = 0

while i < n
	if i ==0 || res[i-1] > res[i]
		cont += 1
	end
	i += 1
end

puts cont

Measured memory_bytes: 1788
def main():
    n = int(input())
    S = list(map(int,input().split()))
    q = int(input())
    T = list(map(int,input().split()))

    cnt = 0
    S.sort()
    for i in range(n):
        if i == 0:
            if S[i] in T:
                cnt += 1
                continue
        if (S[i] in T) and (S[i] != S[i-1]):
            cnt += 1

    return cnt

print(main())



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

using i64 = int64_t;

int main(){
    int n;
    cin >> n;
    if(n%2){
        printf("%.8lf\n", (n/2+1)/(double)n);
    }else{
        cout << 0.5 << endl;
    }

    return 0;
}


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

#define rep(i, N) for(int i = 0; i < N; ++i)

using namespace std;

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

    vector<int> dist;
    rep(i, n)
    {
        int a;
        cin >> a;
        dist.push_back(a);
    }

    int maxDist = 0;
    rep(i, n)
    {
        int distTmp = 0;
        if (i == 0)
        {
            distTmp = (k - dist[n-1]) + dist[i];
        }
        else
        {
            distTmp = dist[i] - dist[i-1];
        }
        if (maxDist < distTmp) maxDist = distTmp;
    }
    cout << k - maxDist << endl;
    
    return 0;
}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
    int n, h;
    cin >> n >> h;
    vector<pair<int, int>> ab;
    for(int i = 0; i < n; i++)
    {
        int a, b;
        cin >> a >> b;
        ab.push_back(make_pair(a, 0));
        ab.push_back(make_pair(b, 1));
    }
    sort(ab.begin(), ab.end(), greater<pair<int, int>>());
    ll cnt=0;
    while(h>0){
        if(ab[cnt].second==0){
            cnt += (h+ab[cnt].first-1)/ab[cnt].first;
            break;
        }
        else if(ab[cnt].second==1){
            h -= ab[cnt].first;
        }
        cnt++;
    }
    cout << cnt << endl;   
}


Measured memory_bytes: 2420
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(long long x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl

#define all(x) x.begin(),x.end()
typedef pair<long long,long long> P;
typedef pair<long long,P> PP;

long long h,w;
long long p;
int main()
{
	cin>>h>>w;
	if(h==1||w==1)
	{
		cout<<1<<endl;
		return 0;
	}
	if(h%2==0)
	{
		cout<<h*w/2<<endl;
	}
	else if(w%2==0)
	{
		cout<<h*w/2<<endl;
	}
	else
	{
		w=w+1;
		p=h*w/2;
		long long q=h/2;
		cout<<p-q<<endl;
	}
	return 0;
}

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

using namespace std;

template <typename T>
T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }

int64_t modpow(int64_t a, int64_t b, int64_t MOD) {
	int64_t ret = 1;
	while (b > 0) {
		if (b & 1) { (ret *= a) %= MOD; }
		(a *= a) %= MOD;
		b >>= 1;
	}
	return ret % MOD;
}

int main() {
	constexpr Int MOD = 1e9 + 7;
	int N;
	cin >> N;
	vector<Int> A(N), B(N);
	Int zero = 0, zeroA = 0, zeroB = 0;
	map<pair<Int, Int>, Int> mp;
	for (int i = 0; i < N; ++i) {
		cin >> A[i] >> B[i];

		if (A[i] == 0 && B[i] == 0) { ++zero; }
		else if (A[i] == 0) { ++zeroA; }
		else if (B[i] == 0) { ++zeroB; }
		else {
			Int g = gcd(abs(A[i]), abs(B[i]));
			if (B[i] < 0) { g *= -1; }
			++mp[{ A[i] / g, B[i] / g }];
		}
	}

	Int ans = modpow(2, zeroA, MOD) + modpow(2, zeroB, MOD) - 1;
	for (auto it = mp.begin(); it != mp.end(); ++it) {
		if (it->second <= 0) { continue; }
		auto p = it->first;
		Int a = p.first, b = p.second;
		Int X = modpow(2, it->second, MOD);
		mp[p] = 0;
		Int Y = 1;
		if (mp.count({ b, -a })) {
			Y = modpow(2, mp[{ b, -a }], MOD);
			mp[{ b, -a }] = 0;
		}
		(ans *= (X + Y - 1 + MOD)) %= MOD;
	}
	cout << (ans + zero - 1 + MOD) % MOD << endl;

	return 0;
}


Measured memory_bytes: 18824
N,M = map(int,input().split())
x = set()
y = set()
 
for m in range(M):
    a,b = map(int,input().split())
    if a==1:
        x.add(b)
    if b==N:
        y.add(a)

if x&y:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Measured memory_bytes: 23912
# ABC141a
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n = int(input())
odd = 0
even = 0
for i in range(1, n + 1):
    if (i % 2 == 0):
        even += 1
    else:
        odd += 1
print(odd/(odd+even))

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define ll long long
#define REV(v) reverse(v.begin(), v.end());
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (ll i = n; i >= 0; i--)
#define FOR(i, start, stop) for (ll i = start; i < stop; i++)
#define FORR(i, start, stop) for (ll i = start; i > stop; i--)
#define SORT(v, n) sort(v, v + n);
#define SORTR(v, n) sort(v, v + n,greater<ll>());
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.begin(), v.end(),greater<ll>());
#define REMOVE(v,n) remove(vector<ll> v,v+v.size(),ll n)
#define ERASE(v,n) v.erase(v.begin()+n);
#define ull unsigned long long
#define pb(a) push_back(a)
#define INF 999999999
#define V(v,i,j) vector(v.begin() + i, v.begin() + j)
#define INSERT(va,vb) va.insert(va.end(), vb.begin(), vb.end())
using namespace std;
typedef vector<ll> vll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
const int MOD = 1000000007;
void chmin(int &a, int b) { if (a > b) a = b; }
//string al="abcdefghijklmnopqrstuvwxyz";
//vector< vector<int> > v (size1, vector<int>(size2) );

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;cin>>N;
    vector<ll> dv=divisor(N);
    ll ans=0;
    ll m;
    ll l;

    FOR(i,0,dv.size()){
        //cout<<dv[i]<<endl;
        m=dv[i];m--;
        if(m!=0 && N==(m+1)*(N%m)) ans+=m;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define base 1000000007LL
#define ll long long
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define CLR(a) memset(a,0,sizeof(a))
#define FOR(i,a,b) for(ll i=(a),_b=(b); i<=_b; i++)
#define FORE(i,a,b) for(ll i=(a),_b=(b); i>=_b; i--)

using namespace std;

typedef pair<int, int> II;
typedef vector<II> vi;

string s;
ll n;

int main()
{
    ios::sync_with_stdio(0);
    //freopen("inp.txt", "r", stdin);
    cin >> s;
    n = s.length();
    ll res = 0;
    FOR(i,0LL,(1LL<<(n-1))-1) {
        ll e = s[0]-'0';
        FOR(j,1,n-1)
            if (i & (1LL<<(j-1))) {
                res += e;
                e = s[j]-'0';
            }
            else e = e * 10 + s[j]-'0';
        res += e;
    }
    cout << res;
    return 0;
}


Measured memory_bytes: 256
/*Code by Codercjh*/
#include<bits/stdc++.h>
#define fr(i,a,b) for(int i=(a);i<=(b);++i)
#define rf(i,a,b) for(int i=(a);i>=(b);--i)
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
using namespace std;
typedef long long ll;
template<typename T>
inline void read(T &x){
	char c=getchar();T fh=0;bool f=false;
	while(!isdigit(c))f|=(c=='-'),c=getchar();
	while(isdigit(c))fh=(fh<<1)+(fh<<3)+(c^48),c=getchar();
	x=f?-fh:fh;
	return;
}
char s[105];
bool solve(int x,int y){
	if(x>y)return false;
	int i=x,j=y;
	while(i<j&&s[i]==s[j])++i,--j;
	return i>=j;
}
int main(){
    scanf("%s",s+1);
    int n=strlen(s+1);
    if(solve(1,(n-1)/2)&&solve((n+3)/2,n)&&solve(1,n))puts("Yes");
    else puts("No");
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long

const string YES = "Yes";
const string NO = "No";

void solve(std::string S){
	sort(ALL(S));
	if (S[0] == S[1] && S[2] == S[3] && S[0] != S[2]) {
		cout << YES << endl;
	} else {
		cout << NO << endl;
	}
}

signed main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
H = list(map(int, input().split()))
L = [1 for i in range(N)]
for i in range(M):
  A, B = map(int, input().split())
  HA = H[A-1]
  HB = H[B-1]
  if HA >= HB:
    L[B-1] = 0
  if HB >= HA:
    L[A-1] = 0
print(sum(L))

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

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

    for (int i = 0; i < w + 2; i++) {
        cout << "#";
    }
    cout << endl;
    for (int i = 0; i < h; i++) {
        string s;
        cin >> s;
        cout << "#" << s << "#" << endl;
    }
    for (int i = 0; i < w + 2; i++) {
        cout << "#";
    }
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll A, B, K; cin >> A >> B >> K;

    ll dK = min(A, K);
    A -= dK, K -= dK;

    B = max(0LL, B - K);

    cout << A << " " << B << endl;

    return 0;
}


Measured memory_bytes: 256
/** "Ever tried.
         Ever failed.
               No matter.
                   Try Again.
                        Fail again.
                             Fail better.**/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define bp  __builtin_popcount
#define pb push_back
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define sz(s) (int)(s.size())
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define setdp memset(dp,-1,sizeof(dp))
#define fr first
#define sc second
#define NumofDigits(n)   ((long long)log10(n)+1)
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const int maxn=1e5+5;
const  double EPS = 1e-9;
const int MOD = 1e9+7;
/*
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll fastpow(ll b, ll p)
{if(!p)return 1;ll ret = fastpow(b, p >> 1);ret *= ret;if(p&1)ret*= b;return ret;}
int dx[] = {- 1, 0, 0, 1, 0 };
int dy[] = { 0,- 1, 1, 0, 0 };*/
inline void File()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
}

ll calc(string s)
{
    string x="";
    ll res=0;
    for(int i=0; i<sz(s); i++)
    {
        if(s[i]=='+')
            res+=stoll(x),x="";
        else
            x+=s[i];
    }
    res+=stoll(x);
    return res;
}

int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    string s;
    cin>>s;
    ll ans=0;
    for(int msk=0; msk<(1<<sz(s)-1); msk++)
    {
        string cur="";
        for(int i=0; i<sz(s)-1; i++)
        {
            cur+=s[i];
            if(msk&(1<<i))
                cur+='+';
        }
        cur+=s[sz(s)-1];
        ans+=calc(cur);
    }
    cout<<ans;
}


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

ll calc(ll s, ll w, ll h) {
  if(w % 2 == 0 || h % 2 == 0) {
    return abs(s - (ll(h*w)) /2);
  } else {
    ll diff = min(h,w);
    ll s2 = (h*w + diff) / 2;
    ll s3 = (h*w - diff) / 2;
    return max(max(abs(s - s2), abs(s - s3)), abs(s2 - s3));
  }
}

int main () {
  ll H, W;
  cin >> H >> W;
  ll res = H*W;
  REP(i,H) res = min(res, calc(i*W, W, H - i));
  REP(i,W) res = min(res, calc(i*H, W - i, H));
  cout << res << endl;
  return 0;
}


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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code

int main(int argc, char const* argv[])
{
	int a,b,c;
	cin >> a >> b >> c;
	cout << min(c, b/a) << endl;

	return 0;
}


Measured memory_bytes: 256
def f(a, b):
    a_len = len(str(a))
    b_len = len(str(b))
    if a_len > b_len:
        return a_len
    else:
        return b_len


def get_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors


def main():
    n = int(input())

    f_min = 11
    divisors = get_divisors(n)
    for i in divisors:
        for j in divisors:
            if i * j == n:
                f_min = min(f_min, f(i, j))
    print(f_min)


if __name__ == "__main__":
    main()


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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = 10e15;
const ll MINF = -10e10;
const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//typedef priority_queue<P, vector<P>, greater<P>> PQ_ASK;
const int mod = 1000000007;
//typedef pair<int, int> P;

struct Program {
    int start, end, channel;

    bool operator<(const Program &another) const {
        return start < another.start;
    };
};

typedef pair<int, char> P;

int main() {


    int n, c;
    cin >> n >> c;
    vector<vector<Program>> tmp_programs(c);

    rep(i, n) {
        int si, ti, ci;
        cin >> si >> ti >> ci;
        ci--;
//        si--;
//        ti--;
        Program p = {si, ti, ci};
        tmp_programs[ci].push_back(p);
    }
    vector<vector<Program>> programs(c);

    rep(ci, c) {
        if (tmp_programs[ci].empty()) continue;
        sort(tmp_programs[ci].begin(), tmp_programs[ci].end());

        programs[ci].push_back(tmp_programs[ci][0]);

        for (int i = 1; i < tmp_programs[ci].size(); i++) {
            if ((tmp_programs[ci][i].start - programs[ci].back().end) <= 1) {
                programs[ci].back().end = tmp_programs[ci][i].end;
            } else {
                programs[ci].push_back(tmp_programs[ci][i]);
            }
        }
    }
    vector<P> all;
    rep(ci, c) {
        for (Program p : programs[ci]) {
            // 重複の場合は2台いるからSが先
            all.push_back(P(p.start, 'S'));
            all.push_back(P(p.end, 'T'));
        }
    }

    sort(all.begin(), all.end());

    int ans = 0;
    int now = 0;

    for (P p : all) {
        if (p.second == 'T') {
            now--;
        } else {
            now++;
            cmax(ans, now);
        }

    }

    cout << ans << endl;

}


Measured memory_bytes: 5364
import java.util.Scanner;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int window = sc.nextInt();
    int curtain = sc.nextInt();
    int width = window-(curtain*2);

    if(width<=0){
      System.out.println(0);
    }else{
      System.out.println(width);
    }
  }
}


Measured memory_bytes: 25300
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int c=sc.nextInt();
		int x=sc.nextInt();
		int count=0;
		for(int i=0;i<=a;i++){
			for(int j=0;j<=b;j++){
				for(int k=0;k<=c;k++){
					if(i*500+j*100+k*50==x){
						count++;
					}
				}
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 22100
import sys
from collections import deque
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,M = IL()
print(((N-M)*100 + M*1900)*2**M)

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

int main () {
    int A , B , K ; cin >> A >> B >> K ;
    for ( int i = min (A , B ); i >= 1; --i ) {
        if ( A % i == 0 && B % i == 0) {
            --K ;
            if ( K == 0) {
                cout << i << endl ;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 3556
n = int(input())
A = list(map(int, input().split()))
mod = 10**9+7

from collections import Counter
C = Counter(A)
for k, v in C.items():
    if v == 2:
        t = k

flag = False
for i in range(n+1):
    if not flag:
        if A[i] == t:
            l = i
            flag = True
    else:
        if A[i] == t:
            r = i

r = n-r

#print(l, r)

N = 10**5+50
fac = [1]*(N+1)
finv = [1]*(N+1)
for i in range(N):
    fac[i+1] = fac[i] * (i+1) % mod
finv[-1] = pow(fac[-1], mod-2, mod)
for i in reversed(range(N)):
    finv[i] = finv[i+1] * (i+1) % mod

def cmb1(n, r, mod):
    if r <0 or r > n:
        return 0
    r = min(r, n-r)
    return fac[n] * finv[r] * finv[n-r] % mod

for k in range(1, n+2):
    ans = cmb1(n+1, k, mod)-cmb1(l+r, k-1, mod)
    print(ans%mod)


Measured memory_bytes: 101468
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
struct node{
	int v,c;
	node *pre,*nxt;
	node(int V,bool C){v=V;c=C;pre=nxt=0;}
}*head,*tail;
int n,k,tag;
char s[N];
void work(){
	int tp=head->c^tag;
	if (head->v>1) head->v--;
	else head=head->nxt,head->pre=0;
	if (tp){
		tag^=1;
		if (!(tail->c^tag)) tail->v++;
		else{
			node *x=new node(1,tag);
			x->pre=tail;
			tail=tail->nxt=x;
		}
	}
	else{
		if (head->c^tag) head->v++;
		else{
			node *x=new node(1,tag^1);
			x->nxt=head;
			head=head->pre=x;
		}
	}
}
int main()
{
	scanf("%d%d%s",&n,&k,s);
	head=tail=new node(1,s[0]=='B');
	for (int i=1;i<n;i++)
	if (s[i]==s[i-1]) tail->v++;
	else{
		node *x=new node(1,s[i]=='B');
		x->pre=tail;
		tail=tail->nxt=x;
	}
	for (int i=1;i<=6*n&&i<=k;i++) work();
	if (k>6*n&&(k&1)) work();
	for (node *x=head;x;x=x->nxt)
	for (int i=1;i<=x->v;i++)
		putchar(x->c^tag?'B':'A');
	return 0;
}

Measured memory_bytes: 39680
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main(){
	double r0,w,r;
	double c;
	double node1;
	double min;
	double mins;

	int x;

	while(1){
		cin >> r0;
		cin >> w;
		cin >> c;
		cin >> r;

		if(r0 == 0 && w == 0 && c == 0 && r == 0){
			break;
		}

		x = 0;
		while(1){
			node1 = (r0 + r*x)/w;
			//cout << " node1 = " << node1 << endl;
			if( c - node1 > 0){	
			}else{
				break;
			}
			x++;
		}
		cout << x << endl;
	}
}

Measured memory_bytes: 3184
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <map>
using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

int main(){
    int N, K, Q, cor;
    cin >> N >> K >> Q;
    int A[Q], ans[N];
    REP(i, N){
        ans[i]=0;
    }
    REP(i, Q){
        cin >> cor;
        ans[cor-1] += 1;
    }
    REP(i, N){
        if(K-Q+ans[i] > 0){
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }

    return 0;
}


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

int main() {
    char a;
    char ret;
    char largeA = 'A';
    char smallA = 'a';

    cin >> a;

    if(a >= 'a' && a <= 'z') {
        ret = smallA;
    } else {
        ret = largeA;
    }

    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n-1; i >= 0; i--)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using pii = pair<int, int>;
const int mod = 1e9+7;
const int INF = 1e9;
const int MAX = 1e6;

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

int main() {
    // input
    int k, n;
    cin >> k >> n;
    int a[n];
    rep(i, n) {
        cin >> a[i];
    }
    // solve
    int d = 0;
    rep(i, n) {
        if (i != n-1) chmax(d, a[i+1]-a[i]);
        else chmax(d, a[0]+(k-a[i]));
    }
    // output
    cout << k-d << endl;
}

Measured memory_bytes: 4372
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CRemainderMinimization2019 solver = new CRemainderMinimization2019();
        solver.solve(1, in, out);
        out.close();
    }

    static class CRemainderMinimization2019 {
        static final int M = 2019;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long l = in.nextLong(), r = in.nextLong();

            r = Math.min(r, l + 2100);

            long answer = Integer.MAX_VALUE;
            for (long i = l; i <= r; i++) {
                for (long j = i + 1; j <= r; j++) {
                    long c = ((i % M) * (j % M)) % M;
                    answer = Math.min(answer, c);
                }
            }

            out.println(answer);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

    }
}



Measured memory_bytes: 21460
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

  int n, h, w;
  cin >> n >> h >> w;

  vector<int> hv(n), wv(n);
  for (int i = 0; i < n; i++) {
    cin >> hv[i] >> wv[i];
  }

  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (hv[i] >= h && wv[i] >= w) {
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}

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

using namespace std;
typedef long long ll;
typedef double dd;
#define all(v) v.begin(),v.end()
#define endl "\n"
#define clr(n, r) memset(n,r,sizeof(n));

void fast() {

    cin.tie(0);
    cin.sync_with_stdio(0);
}

const int N = 1e5 + 9;
int n, h[N], dp[N];

int sol(int i){
    if(i<0) return 1e9;
    if(i==0) return 0;

    if(~dp[i]) return dp[i];

    return dp[i] = min(abs(h[i]-h[i-1]) + sol(i-1), abs(h[i]-h[i-2]) + sol(i-2));
}


int main() {

    cin >> n;

    for(int i = 0;i < n;i++)    cin >> h[i];

    memset(dp, -1, sizeof dp);

    cout << sol(n - 1);
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,k,a[N];
int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    int ans=1e9;
    for(int i=k;i<=n;i++)
    {
        if(a[i]>=0&&a[i-k+1]<=0)
            ans=min(ans,a[i]-a[i-k+1]+min(a[i],-a[i-k+1]));
        else if(a[i]>=0&&a[i-k+1]>=0) ans=min(ans,a[i]);
        else if(a[i]<=0&&a[i-k+1]<=0) ans=min(ans,-a[i-k+1]);
    }
    printf("%d\n",ans);
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;

int main()
{
	string s;
	cin>>s;
	int n=s.size();
	int bi=-1,en=-1;
	if(n==2){
		if(s[0]==s[1]){
			bi=1;en=2;
		}
	}else{
		rep(i,n-2){
			string t=s.substr(i,3);
			if(t[0]==t[1] or t[1]==t[2] or t[0]==t[2]){
				bi=i+1; en=i+3;
				break;
			}
		}
	}
	cout<<bi<<" "<<en<<endl;
}


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

using namespace std;
const int nax = 2e5 + 5;
int a[nax];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  for(int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  int L = 0, R = 1e9 + 1, ans = a[n - 1];
  while(R - L > 1) {
    int mid = L + (R - L)/2;
    long long reqd = 0;
    for(int i = 0; i < n; i++) {
      if(reqd > k) break;
      reqd += ((a[i] + mid - 1)/mid) - 1;
    }
    if(reqd <= k) {
      ans = mid;
      R = mid;
    } else {
      L = mid;
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 4360
#include<stdio.h>
int main()
{
    int q,r,a,b,sum,cnt;
    while(scanf("%d%d",&a,&b)==2)
    {
        cnt=0;
        sum=a+b;
        q=sum;
        while(q!=0)
        {
             r=q%10;
             cnt++;
             q=q/10;
        }
        printf("%d\n",cnt);
    }
    return 0;
}


Measured memory_bytes: 2080
#include<cstdio>

int n, k, x;
bool forbid[11];

bool chk(int n) {
	for(;n;n/=10)
		if(forbid[n%10]) return false;
	return true;
}

int main() {
	scanf("%d%d", &n, &k);
	for(int i=0;i<10;i++) forbid[i] = false;
	for(int i=0;i<k;i++) {
		scanf("%d", &x);
		forbid[x] = true;
	}
	for(;!chk(n);n++);
	printf("%d\n", n);
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define INF 100000000
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define rep(i, n) for (int i = 0; i < n; ++i)
#define out(x) cout << x << endl;
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(v) v.begin(), v.end()

using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;


int main() {

	int N, D;
	cin >> N >> D;

	int ans = ceil((double)N/(double)(D*2+1));
	out(ans);


	return 0;
}

Measured memory_bytes: 256
D,G = gets.split.map &:to_i
ct = (0...D).map{ gets.split.map &:to_i }
tds = (1..D).to_a.reverse
p (0..D).map{ |n|
  tds.combination(n).map{ |ds|
    m = ds.map{ |d| ct[d-1][0] }.inject(0,:+)
    x = ds.map{ |d| 100*d*ct[d-1][0] + ct[d-1][1] }.inject(0,:+)
    tds.reject{ |d| ds.include?(d) }.each{ |d|
      break if x >= G
      l = ct[d-1][0]
      ll = [(G-x-1)/100/d+1, l-1].min
      m += ll
      x += 100*d*ll
    }
    x >= G ? m : nil
  }
}.flatten.compact.min


Measured memory_bytes: 1916
n,m = map(int, input().split())
state = [0]*n
ac = 0
wa = 0
for i in range(m):
    p,s = input().split()
    p = int(p)-1
    if state[p]>0:
        continue
    elif s == "WA":
        state[p] -= 1
    else:
        wa -= state[p]
        ac += 1
        state[p] = 1
print(ac, wa)

Measured memory_bytes: 51416