akhauriyash/Code-Regression huggingface dataset:
import fractions

A, B, C, D = map(int, input().split())

s = B - A + 1

if A % C == 0 or A % D == 0:
    A -= 1

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

E = lcm(C, D)

val1 = A // C
val2 = B // C
val3 = A // D
val4 = B // D
val5 = A // E
val6 = B // E

print(s - (val2 - val1 + val4 - val3 - (val6 - val5)))


Measured memory_bytes: 5076
import java.util.*;
public class Main{
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int[] p=new int[n];
        for(int i=0;i<n;i++){
            p[i]=sc.nextInt();
        }
        int j,cnt=0;
        int min=999999999;
        for(int i=0;i<n;i++){
            min=Math.min(min,p[i]);
            if(min==p[i]) cnt++;
        }
        System.out.println(cnt);
    }
}

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

typedef struct Restaurant 
{
  string name;
  int point;
  int id;

  Restaurant(string _name, int _p, int _id) {
    name = _name;
    point = _p;
    id = _id;
  }

}restaurant_t;

bool cmp(restaurant_t a, restaurant_t b){
  if (a.name != b.name) {
    return a.name < b.name;
  } else {
    return a.point > b.point;
  }
}

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

  vector<restaurant_t> rest;

  for (int i=0; i<n; i++) {
    string tmp;
    int p;
    cin >> tmp;
    cin >> p;
    rest.push_back(Restaurant(tmp, p, i+1));
  }

  sort(rest.begin(), rest.end(), cmp);

  for (int i=0; i<n; i++) {
    cout << rest[i].id << endl;;
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main(void) {
	int n, m;
	cin >> n >> m;
	int l[m], r[m];
	rep (i, m) cin >> l[i] >> r[i];

	vector<ll> sum(n + 1, 0);
	rep (i, m) {
		sum[l[i] - 1]++;
		sum[r[i]]--;
	}

	rep (i, n) {
		sum[i + 1] += sum[i];
	}

	int cnt = 0;
	rep (i, n) if (sum[i] == m) cnt++;
	
	cout <<  cnt << endl;
	return 0;
}

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

int main(void){
    int a,b;
    cin >> a >> b;
    if (a < b) swap(a,b);
    if (b+2 <= a) cout << a+a-1 << endl;
    else cout << a+b << endl;
    return 0;
}


Measured memory_bytes: 256
S = input().strip()
N = len(S)
K = int(input())
A = []
for k in range(1,min(6,N+1)):
    for i in range(N-k+1):
        x = S[i:i+k]
        if x not in A:
            A.append(x)
A = sorted(A)
print(A[K-1])

Measured memory_bytes: 68884
#include<bits/stdc++.h>
using namespace std;
int a[100005],b[100005];
int main()
{
    int n,i,j,k,sum,tmp,x,y,z;
    int h,c,d,e;
    cin>>n>>h;
    for(i=0;i<n;i++)
    {
        scanf("%d%d",&a[i],&b[i]);
    }
    sort(a,a+n);
    sort(b,b+n);
    for(i=n-1,sum=0;i>=0;i--){
        if(b[i]<a[n-1]){
            break;
        }
        if(h<=0){
            break;
        }
        h-=b[i];
        sum++;
    }
    if(h>0){
        //cout<<"sum="<<sum<<endl;
        tmp=h/a[n-1];
        if(h%a[n-1]!=0)
            tmp++;
        sum+=tmp;
    }
    printf("%d\n",sum);
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const int mod = 1000000007;

int main() {
    string s;
    cin >> s;
    int n = s.size();

    vector<int> dp0(n+1);
    vector<int> dp1(n+1);

    dp0[0] = 1;
    rep(i, n) {
        // a+b = 0
        if(s[i] == '0') {
            dp0[i+1] = dp0[i];
            dp1[i+1] = dp1[i];
        }
        else if(s[i] == '1') {
            dp1[i+1] = (dp0[i] + dp1[i])%mod;
        } 
        // a+b = 1
        if(s[i] == '0') {
            dp1[i+1] += dp1[i]*2%mod;
            dp1[i+1] %= mod;
        }
        else if(s[i] == '1') {
            dp0[i+1] += dp0[i]*2%mod;
            dp1[i+1] += dp1[i]*2%mod;
            dp0[i+1] %= mod;
            dp1[i+1] %= mod;
        }
    }

    cout << (dp0[n] + dp1[n])%mod << endl;
    return 0;
}

Measured memory_bytes: 1280
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rrep(i,n) REP(i,1,n+1)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> PII;
typedef vector<ll> Vl;
typedef vector<int> VI;
typedef tuple<int, int, int> TT;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
const int MAX = 500000;
const int inf = 1000000007;
const ll mod = 1000000007;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };


string s;

int main() {

	cin >> s;
	cout << s[0] << s[1] << s[2] << endl;

	return 0;
}


Measured memory_bytes: 3620
#int(input())
#int(x) for x in input().split()
#map(int,input().split())
def ad(l,x):
	for i in range(1,len(l)+1):
		l[i-1]+=x[i]
from itertools import combinations
n,m,X=map(int,input().split())
l=[]
for i in range(n):
	l.append([int(x) for x in input().split()])
l.sort()
comb=[i for i in range(n)]
ml=[0]*m
cost=10**9
for i in range(1,n+1):
	coco=list(combinations(comb,i))
	for j in range(len(coco)):
		ml=[0]*m
		c=0
		for k in range(len(coco[j])):
			c+=l[coco[j][k]][0]
			ad(ml,l[coco[j][k]])
			#print(ml)
			if min(ml)>=X:
				cost=min(c,cost)
				break
		if min(ml)>=X:
			cost=min(c,cost)

if cost==10**9:
	print(-1)
else:
	print(cost)







		
		




Measured memory_bytes: 68752
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll getint()
{
    ll i=0,f=1;char c;
    for(c=getchar();(c!='-')&&(c<'0'||c>'9');c=getchar());
    if(c=='-')c=getchar(),f=-1;
    for(;c>='0'&&c<='9';c=getchar())i=(i<<3)+(i<<1)+c-'0';
    return i*f;
}
const int N=100005,mod=1e9+7;
int n,ans,f[N],g[N];
ll a[N],A,B;
int main()
{
	//freopen("lx.in","r",stdin);
	n=getint(),A=getint(),B=getint();
	if(A>B)swap(A,B);
	for(int i=1;i<=n;i++)a[i]=getint();
	sort(a+1,a+n+1);
	for(int i=3;i<=n;i++)if(a[i]-a[i-2]<A){puts("0");return 0;}
	f[0]=g[0]=1;int l=0,r=0;
	for(int i=1;i<=n;i++)
	{
		while(r<i-1&&a[i]-a[r+1]>=B)++r;
		if(l<=r)f[i]=(g[r]+mod-(l?g[l-1]:0))%mod;
		g[i]=(g[i-1]+f[i])%mod;
		if(i>1&&a[i]-a[i-1]<A)l=i-1;
	}
	for(int i=n;i>=0;i--)
	{
		ans=(ans+f[i])%mod;
		if(i<n&&a[i+1]-a[i]<A)break;
	}
	cout<<ans<<'\n';
	return 0;
}

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

int main() {
  int n,T;
  cin >> n >> T;
  vector<int> c(n),t(n);
  
  int i,j=1001;
  for(i=0; i<n; i++){
    cin >> c[i] >> t[i];
    if(t[i]<=T){
      j=min(j,c[i]);
    }
  }
  
  if(j==1001){
    cout << "TLE";
  }else{
    cout << j;
  }
}

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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int ans = 0;
    int N, K; cin >> N >> K;
    vector<int> A(N); rep(i, N) cin >> A[i];
    sort(A.rbegin(), A.rend());
    rep(i, K) ans += A[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    if (a<b){
        printf("a < b\n");
    }else if (a>b){
        printf("a > b\n");
    }else if (a==b){
        printf("a == b\n");
    }
    
    return 0;
}


Measured memory_bytes: 2612
#include <stdio.h>

int main()
{
    int n,p;
    scanf("%d%d",&n,&p);
    printf("%d\n",n+1-p);
//fbdsfusagfuahfgfiusgfjsbfjsffgjfvshfbjfvjhfishfjksfbshfsvgfshdfuhyfhsfvsdbhfbsfvgsefhbh
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int main() {
    vector<int> v(3);
    rep(i,3) cin >> v[i];
    sort(RALL(v));
    int ans= 0;
    ans += v[0] - v[1];
    v[2] +=  v[0] - v[1];
    if(v[0]-v[2]!=0) {
        ans += (v[0] - v[2] - 1)/2 + 1;
        if((v[0]-v[2])%2!=0) ans += 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define int ll
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define INF 0x3f3f3f3f
#define lowbit(x) (x&(-x))
#define mid ((l+r)>>1)
using namespace std;
template<class T>il read(T &x){
	x=0;int f=1;char k=getchar();
	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;
	for(;k>='0'&&k<='9';k=getchar()) x=x*10+k-'0';
	x*=f;
}
template<class T>il _print(T x){
	if(x>9) _print(x/10);
	putchar(x%10+'0');
}
template<class T>il print(T x){
	if(x<0) putchar('-'),x=-x;
	_print(x);
}
ill qpow(int x,int m){
	ll res=1,bas=x;
	while(m){
		if(m&1) res=res*bas;
		bas=bas*bas,m>>=1;
	}
	return res;
}
const int N = 55;
int n,m,u,v,x[N],y[N],c[N];
ll ans;
char vis[N];
vector<int> G[N];
il add_edge(int u,int v){
	G[u].push_back(v);
	G[v].push_back(u);
}
int son[N],f[N],top[N],sz[N],dep[N];
il DFS1(int u,int fa){
	f[u]=fa,dep[u]=dep[fa]+1,sz[u]=1;
	for(auto v:G[u]){
		if(v==fa) continue;
		DFS1(v,u),sz[u]+=sz[v];
		if(sz[v]>sz[son[u]]) son[u]=v;
	}
}
il DFS2(int u,int t){
	top[u]=t;
	if(son[u]) DFS2(son[u],t);
	for(auto v:G[u]){
		if(v==f[u]||v==son[u]) continue;
		DFS2(v,v);
	}
}
it LCA(int u,int v){
	while(top[u]^top[v]){
		if(dep[top[u]]<dep[top[v]]) swap(u,v);
		u=f[top[u]];
	}
	return dep[u]<dep[v]?u:v;
}
il DFS(int u,int fa){
	for(auto v:G[u]){
		if(v==fa) continue;
		DFS(v,u),c[u]+=c[v];
	}
	vis[u]=c[u]>0;
}
signed main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	read(n);
	for(ri i=1;i<n;++i)
		read(u),read(v),add_edge(u,v);
	DFS1(1,0),DFS2(1,1),read(m);
	for(ri i=1;i<=m;++i)
		read(x[i]),read(y[i]);
	int S=1<<m;
	for(ri T=0;T<S;++T){
		int upd=1;
		for(ri i=1;i<=n;++i) vis[i]=0,c[i]=0;
		for(ri i=1;i<=m;++i) if(T&(1<<(i-1))) {
			int lca=LCA(x[i],y[i]);upd=-upd;
			++c[x[i]],++c[y[i]],c[lca]-=2;
		}
		DFS(1,0);
		int num=n-1;
		for(ri i=1;i<=n;++i)
			num-=vis[i];
		ans+=upd*qpow(2,num);
	}
	print(ans);
	return 0;
}

Measured memory_bytes: 256
(* Vicfred
 * https://atcoder.jp/contests/abc126/tasks/abc126_b
 * implementation
 * *)
let a, b = Scanf.scanf " %2d%2d" @@ fun a b -> a, b
let f x = x = 0 || x > 12
let main = print_endline @@
match f a, f b with
true, true -> "NA" |
true, false -> "YYMM" |
false, true -> "MMYY" |
_ -> "AMBIGUOUS"



Measured memory_bytes: 3748
#include<stdio.h>

main(){

  int x,y,r;

  scanf("%d%d",&x,&y);
/*
  if (x < y){
    swap(x, y);
  }
  */
  while (y > 0){
    r = x % y;
    x = y;
    y = r;
  }
printf("%d\n",x);
  return 0;
}

Measured memory_bytes: 1020
#include <iostream>

int main()
{
    char buf;
    std::cin >> buf;
    bool flag = (buf == 'B');
    unsigned int counter = 0;
    while(std::cin >> buf)
    {
        bool newFlag = (buf == 'B');
        if(newFlag != flag)
        {
            ++counter;
            flag = newFlag;
        }
    }
    std::cout << counter << std::endl;
}


Measured memory_bytes: 256
def count_five(n):
    res = 0
    i = 1
    while n//pow(5,i) - n//pow(10,i)> 0:
        res += n//pow(5,i) - n//(2*pow(5,i))
        i += 1
    return res

def main(N):
    if N%2:
        return 0
    M = list(str(N))
    L = len(M)
    temp = 0
    temp2 = 0
    res = 0
    for i, n in enumerate(M[:-1], start=1):
        temp *= 10
        temp += int(n)
        res += (temp - temp2)*(L-i)
        res += count_five(temp)
        temp2 = temp
    return res

N = int(input())
print(main(N))



Measured memory_bytes: 62356
#include "bits/stdc++.h"

#define all_of(x) std::begin(x), std::end(x)
#ifdef _GLIBCXX_DEBUG
    #define debug(x) cerr << #x << ": " << x << endl
#else
    #define debug(x) 
#endif

using namespace std;

using LL = long long;

template<typename T>
ostream& operator << (ostream& out, const vector<T>& v) {
    out << "[";
    for(const auto& x : v) {
        out << x << ", ";
    }
    return out << "]";
}
template<typename T>
istream& operator >> (istream& in, vector<T>& v) {
    for(auto& x : v) {
        in >> x;
    }
    return in;
}

template<typename S, typename T>
ostream& operator << (ostream& out, const pair<S, T>& p) {
    return out << "{" << p.first << ", " << p.second << "}";
}

struct point_t {
    LL x, y;
};


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int N;
    cin >> N;
    vector<point_t> P(N);
    for(auto& p : P) {
        cin >> p.x >> p.y;
    }
    sort(all_of(P), [&](auto p, auto q) { return p.x < q.x; });
    LL max_mm = -(1LL << 60), max_mp = -(1LL << 60);
    LL ans = 0;
    for(auto [x, y] : P) {
        ans = max({ans, x + y + max_mm, x - y + max_mp});
        max_mm = max(max_mm, -x - y);
        max_mp = max(max_mp, -x + y);
    }
    cout << ans << "\n";
    
    return 0;
}


Measured memory_bytes: 6360
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	n := nextInt()
	s := nextStr()

	if n%2 == 1 {
		fmt.Println("No")
		return
	}

	for i := 0; i < n/2; i++ {
		if s[i] != s[i+n/2] {
			fmt.Println("No")
			return
		}
	}

	fmt.Println("Yes")
}

// ---- readfunc
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1768
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<bitset>
#define MAX_C 10000
#define MAX_N 10
using namespace std;
bitset<MAX_C> b[MAX_N];
int main()
{
    int n,c;
    int ans,res;
    res=0;
    scanf("%d %d",&n,&c);
    while(n!=0||c!=0)
    {
    for(int i=0;i<n;i++)
        for(int j=0;j<c;j++)
        {
          bool x;
          cin>>x;
          b[i][j]=x;
        }
    for(int i=0;i<(1<<n);i++)
    {
        for(int j=0;j<n;j++)
            if(i&(1<<j))
              b[j].flip();
    int sum=0;
    for(int j=0;j<c;j++)
    {
        int cnt=0;
        for(int k=0;k<n;k++)
            if(b[k][j]) cnt++;
        ans=max(cnt,n-cnt);
        sum+=ans;
    }
    res=max(sum,res);
    for(int j=0;j<n;j++)
            if(i&(1<<j))
              b[j].flip();
    }
    printf("%d\n",res);
    scanf("%d %d",&n,&c);
    }
    return 0;
}

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

int main() {
  int N, M, X;
  cin >> N >> M >> X;

  int x = 0, y = 0;

  for (int i = 0; i < M; i++) {
    int A;
    cin >> A;
    if (A < X) x++;
    else y++;
  }

  cout << min(x, y) << "\n";
}

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

bool check(ll x){
  ll cnt=0;
  while(x/k)x=x-(x+k-1)/k,cnt++;
  cnt+=x;
  return cnt >= n;
}

ll search(){
  if( n <= k ) return n-1;
  ll L = n,M,R = (1e18)+10;
  while(L<R){
    M = (L+R)/2;
    if(check(M)) R = M;
    else L = M+1;
  }
  return L - 1;
}

int main(){
  cin>>n>>k;
  cout<<search()<<endl;
  return 0;
}

Measured memory_bytes: 3112
def selectionSort(nums,n):
    k=0
    for i in range(n):
        minj=i
        for j in range(i,n):
            if nums[j]<nums[minj]:
                minj=j
        if nums[i]!=nums[minj]:
            nums[i],nums[minj]=nums[minj],nums[i]
            #print(nums)
            k+=1
    return nums,k
    
n=int(input())
nums=list(map(int,input().split()))

nums,k=selectionSort(nums,n)
print(*nums)
print(k)

Measured memory_bytes: 7728
#!/bin/bash
read a b
SUM=$(( a + b ))
DIF=$(( a - b ))
VOL=$(( a * b ))

if [[ $SUM -ge $DIF ]] && [[ $SUM -ge $VOL ]]; then
    echo $SUM
elif [[ $VOL -gt $DIF ]] && [[ $VOL -gt $SUM ]]; then
    echo $VOL
else
    echo $DIF
fi

Measured memory_bytes: 376
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

void Main()
{
  int n;
  cin >> n;
  
  if(n%10==2 || n%10==4 || n%10==5 || n%10==7 || n%10==9){
    printf("hon");
  }
  else if(n%10==0 || n%10==1 || n%10==6 || n%10==8){
    printf("pon");
  }
  else{
    printf("bon");
  }
}

int main()
{
  std::cout << std::fixed << std::setprecision(15);
  Main();
}



Measured memory_bytes: 3684
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
const int maxn=2e5+10;
int n;
int a[maxn],b[maxn];
int main()
{
	ios::sync_with_stdio(false);cin.tie(0);
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		int x,y;
		cin>>x>>y;
		a[i]=x+y,b[i]=x-y;
	}
	sort(a+1,a+n+1);sort(b+1,b+n+1);
	cout<<max(a[n]-a[1],b[n]-b[1])<<endl;
	return 0;
}



Measured memory_bytes: 5184
import java.util.Scanner;

public class Main {

	public static final long MOD = 1000000007L;

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		long ans = 1;
		for(long i=1;i<=N;i++) {
			ans *= i;
			ans %= MOD;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21844
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		String in = scanner.nextLine();
		String out = "";
		for(int i=0; i<in.length(); i++)
		{
			char c = in.charAt(i);
			if('a'<=c && c<='z')
			{
				c &= 0xdf;
			}
			else if('A'<=c && c<='Z')
			{
				c |= 0x20;
			}
			out += String.valueOf(c);
		}
		
		System.out.println(out);
	}
}

Measured memory_bytes: 31080
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;
  int a, b, c;
  int aa;
  set<int> st;
  for(c =0; c<=100000; c++){
    a = X - c;
    b = Y - c;
    st.insert(max(0, a)*A + max(0, b)*B + 2*c*C);
  }
 
  auto ans = st.begin();
  cout << *ans << endl;
  return 0;
}

Measured memory_bytes: 4992
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int x1 = sc.nextInt();
		int y1 = sc.nextInt();
		int x2 = sc.nextInt();
		int y2 = sc.nextInt();

		int dx = x2 - x1;
		int dy = y2 - y1;

		StringBuilder sb = new StringBuilder();
		sb.append(x2 - dy);
		sb.append(" ");
		sb.append(y2 + dx);
		sb.append(" ");
		sb.append(x1 - dy);
		sb.append(" ");
		sb.append(y1 + dx);
		System.out.println(sb.toString());
	}
}




Measured memory_bytes: 23636
x,n=map(int,input().split())
if n==0:
  print(x)
  exit()
l=list(map(int,input().split()))
l=set(l)
k=0
a=x
b=x
while True:
  if a-k not in l:
    print(a-k)
    exit()
  if a+k not in l:
    print(a+k)
    exit()
  k+=1

Measured memory_bytes: 9188
N = int(input())
P = list(map(int, input().split()))

success = True
change = 0

for i in range(N):
  if P[i] == i+1:
    continue

  else:
    if P[P[i]-1] == i+1:
      change  += 1
    else:
      success = False
      break

if success:
  if change <= 2:
    print('YES')
  else:
    print('NO')
else:
  print('NO')

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

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

#define mp make_pair
#define pb push_back
#define pf push_front
#define ss second
#define ff first
#define sz(x) (int)x.size()
#define newl "\n"
#define mem(x, val) memset(x, val, sizeof(x))
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL)
#define all(v) (v).begin(), (v).end()

const ld pi = 3.14159265359;
ll INF = 1e18 + 10;
ll MOD = 998244353;
ll mod = 1e9 + 7;

inline ll add(ll a, ll b, ll m)
{
    if ((a + b) >= m)
        return (a + b) % m;
    return a + b;
}

inline ll mul(ll a, ll b, ll m)
{
    if ((a * b) < m)
        return a * b;
    return (a * b) % m;
}

ll power(ll x,ll y,ll m) {
    ll res = 1; 
    x = x % m;                
    if (x == 0)
        return 0; 
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % m;
        y = y >> 1;
        x = (x * x) % m;
    }
    return res;
}

void solve()
{
    int n;
    cin>>n;
    set<string> a;
    for(int i=0;i<n;i++) {
        string s;
        cin>>s;
        a.insert(s);
    }
    cout<<sz(a);
}

int main()
{
    fastio;
    int t=1;
    //cin >> t;
    while (t-- > 0)
    {
        solve();
    }

    return 0;
}

Measured memory_bytes: 19248
#include<algorithm>
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

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

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

    int N;
    cin >> N;

    vll a(N);
    rep(i, N) cin >> a[i];

    ll cum = 0;
    rep(i, N) cum ^= a[i];

    rep(i, N)
    {
        cout << (cum ^ a[i]) << endl;
    }


    return 0;
}

Measured memory_bytes: 4724
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, _s, n) for(int i = _s, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;

#define repi(itr, ds) for(auto itr = ds.begin(); itr != ds.end(); itr++)
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for(T &x : vec) is >> x;
  return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
  os << "(" << pair_var.first << ", " << pair_var.second << ")";
  return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "{";
  for(int i = 0; i < vec.size(); i++) {
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  }
  os << "}\n   ";
  return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
  os << "{";
  repi(itr, map_var) {
    os << *itr;
    itr++;
    if(itr != map_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
  os << "{";
  repi(itr, set_var) {
    os << *itr;
    itr++;
    if(itr != set_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}

#define DUMPOUT cerr

void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
  DUMPOUT << head;
  if(sizeof...(Tail) > 0) {
    DUMPOUT << ", ";
  }
  dump_func(std::move(tail)...);
}
#ifdef DEBUG_
#define DEB
#define dump(...)                                                             \
  DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                             \
          << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl \
          << "    ",                                                          \
      dump_func(__VA_ARGS__)
#else
#define DEB if(false)
#define dump(...)
#endif

typedef long long int ll;

int main() {
  int N, K;
  cin >> N >> K;
  int cnt = 0;
  REP(i, N) {
    int h;
    cin >> h;
    if(h >= K) {
      cnt++;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
xy=[list(map(int,input().split())) for i in range(n)]
x,y=[[xy[i][0],i] for i in range(n)],[[xy[i][1],i] for i in range(n)]
x.sort()
y.sort()
ans=10**18*4
for i1 in range(n):
    i1_sub=n-i1
    x_sub1=x[i1][0]
    for l1 in range(i1_sub,1,-1):
        x_sub2=x[i1+l1-1][0]
        for i2 in range(n):
            i2_sub=n-i2
            y_sub1=y[i2][0]
            x_subsub=x_sub2-x_sub1
            for l2 in range(i2_sub,1,-1):
                y_sub2=y[i2+l2-1][0]
                z=0
                for i in range(n):
                    if x_sub1<=xy[i][0]<=x_sub2 and y_sub1<=xy[i][1]<=y_sub2:
                        z+=1
                    if z>=k:
                        ans=min(x_subsub*(y_sub2-y_sub1),ans)
                        break
                else:
                    break
print(ans)


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

constexpr int64_t INF = 1e18;
constexpr int D = 365;
constexpr int N = 26;
int c[N];
int s[D][N];
int last[N];
int t[D];

void input() {
	int _d; cin >> _d;
	for(int i = 0; i < N; ++i) {
		cin >> c[i];
		last[i] = -1;
	}
	for(int i = 0; i < D; ++i) {
		for(int j = 0; j < N; ++j) {
			cin >> s[i][j];
		}
	}
}

void greedy() {
	for(int i = 0; i < D; ++i) {
		int64_t loss = 0;
		for(int j = 0; j < N; ++j) {
			loss += c[j] * (i - last[j]);
		}
		int64_t maxi = -INF;
		int midx = 0;
		for(int j = 0; j < N; ++j) {
			int64_t los = loss - c[j] * (i - last[j]);
			if(s[i][j] - los > maxi) {
				maxi = s[i][j] - los;
				midx = j;
			}
		}
		last[midx] = i;
		t[i] = midx;
	}
}

int64_t calc() {
	for(int i = 0; i < D; ++i) {
		cin >> t[i];
		--t[i];
	}
	int64_t ans = 0;
	for(int i = 0; i < D; ++i) {
		last[t[i]] = i;
		ans += s[i][t[i]];
		for(int j = 0; j < N; ++j) {
			int64_t loss = c[j] * (i - last[j]);
			ans -= loss;
		}
		cout << ans << '\n';
	}
	return ans;
}

void output() {
	for(int i = 0; i < D; ++i) {
		cout << t[i] + 1 << '\n';
	}
}

int main() {
	input();
	calc();
	// greedy();
	// output();
	return 0;
}


Measured memory_bytes: 3620
#!/usr/bin/env python
# coding: utf-8

def no():
    print("No")
    return

def main():
    s = input()
    x, y = list(map(int, input().split()))
    x_start = 0
    f_count = 0
    x_dirs = []
    y_dirs = []
    is_x = True # xを向いてるか
    t_exist = False
    for c in s:
        if c == "F":
            f_count += 1
            continue
        # T
        if f_count > 0:
            if is_x:
                if t_exist:
                    x_dirs.append(f_count)
                else:
                    x_start = f_count
            else:
                y_dirs.append(f_count)
        t_exist = True
        is_x = not is_x
        f_count = 0
        continue
    if f_count > 0:
        if is_x:
            if t_exist:
                x_dirs.append(f_count)
            else:
                x_start = f_count
        else:
            y_dirs.append(f_count)

    memo_x = [{} for _ in range(len(x_dirs)+1)]
    memo_y = [{} for _ in range(len(y_dirs)+1)]
    memo_x[0][x_start] = True
    memo_y[0][0] = True

    for i, dx in enumerate(x_dirs):
        for j in memo_x[i]:
            memo_x[i+1][j-dx] = True
            memo_x[i+1][j+dx] = True
    for i, dy in enumerate(y_dirs):
        for j in memo_y[i]:
            memo_y[i+1][j-dy] = True
            memo_y[i+1][j+dy] = True

    # print(x_dirs, y_dirs)
    # print(memo_x)
    # print(memo_y)

    if x not in memo_x[len(x_dirs)]:
        return no()
    if y not in memo_y[len(y_dirs)]:
        return no()
    print("Yes")


if __name__ == '__main__':
    main()


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

int main() {
	int n; cin >> n;
	set<string> s;
	for (int i = 0; i < n; i++)
	{
		string t; cin >> t;
		s.insert(t);
	}
	cout << s.size() << endl;
	return 0;
}


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

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//#pragma GCC optimize("Ofast")
//1.0 * clock() / CLOCKS_PER_SEC

#define fi first
#define se second
#define ll long long
#define dl double long

using namespace std;

const ll NN = 1e10 + 7;
const int N = 1e5 + 7;
const int M = 11;
const ll mod = 1e9 + 7;

void solve1()
{
	int n, t = 0;
	cin >> n;
	int ar[n];
	for(int i = 0; i < n; i++)
		cin >> ar[i];
	sort(ar, ar + n);
	for(int i = 0; i < n; i++){
		for(int j = i + 1; j < n; j++){
			for(int q = j + 1; q < n; q++){
				if(ar[i] != ar[j] && ar[i] != ar[q] && ar[j] != ar[q] && ar[i] + ar[j] > ar[q]){
					t++;
				}
			}
		}
	}
	cout << t;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0); srand(time(0));
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );

    int cghf = 1;//cin >> cghf;
    while( cghf-- ){
        solve1();
    }
}


Measured memory_bytes: 3628
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  string S;
  cin>>S;
  int temp=0;
  for(auto c:S)if(c=='.')temp++;
  int ans=temp;
  for(auto c:S){
    if(c=='.')temp--;
    else temp++;
    ans=min(ans,temp);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 640
H, W, K = gets.chomp.split.map(&:to_i)
s = []

ans = Array.new(H).map{Array.new(W, 0)}

H.times do
  s << gets.chomp.chars
end

k = 1

head = true


empty_rows = []

H.times do |i|
  # 次の行はflag==falseから始まる
  flag = false
  k += 1 if i != 0

  W.times do |j|
    # 現在の値を代入しつづける
    ans[i][j] = k
    if s[i][j] == '#'
      head = false

      if flag
        # 現在の値をkからk+1に変更
        k += 1
        ans[i][j] = k
      else
        flag = true
      end
    end
  end

  # その行に全く1がなかったときかつすでにk=1以上（すでに出てる）とき
  if flag == false && k >= 2
    W.times do |j|
      ans[i][j] = ans[i-1][j]
    end
    k -= 1
  end


  if flag == false && k == 1 && head == true
    k -= 1
    empty_rows << i
  end
end

empty_rows.reverse.each do |i|
  W.times do |j|
    ans[i][j] = ans[i+1][j]
  end
end

ans.each do |row|
  puts row.join(' ')
end


Measured memory_bytes: 11004
h,w=map(int,input().split())

if (h==1 or w==1):
  print(1)
elif (h%2==0 and w%2==0):
  print(h*w//2)
elif (h%2==0 and w%2==1):
  print(h*(w-1)//2+h//2)
elif (h%2==1 and w%2==0):
  print((h-1)*w//2+w//2)
else:
  print(h*(w-1)//2+(h-1)//2+1)

Measured memory_bytes: 3064
#pragma comment(linker, "/stack:200000000")
 #pragma GCC optimize("Ofast")
 #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define int long long
using namespace std;

int mod=1000000007;
signed main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
//  #ifndef ONLINE_JUDGE
//     freopen ("INPUT.txt" , "r" , stdin);
//     freopen ("OUTPUT.txt" , "w" , stdout);
//  #endif
    

// -------------------------------------Code starts here--------------------------------------------------------------------- 

    int n;
    cin>>n;
    int a[n];
    for (int i = 0; i < n; i++)
    {
        cin>>a[i];
    }
    int ind1=0,ind2=0,ind3=0;
    int ans=1;
    for(int i=0;i<n;i++)
    {
        if(ind1==a[i] && ind2==a[i] && ind3==a[i])
            ans=(ans*3)%mod;
        else if((ind1==a[i] && ind2==a[i])||(ind1==a[i] && ind3==a[i])||(ind2==a[i] && ind3==a[i]))
            ans=(ans*2)%mod;
        if(a[i]==ind1)
            ind1++;
        else if(a[i]==ind2)
            ind2++;
        else if(a[i]==ind3)
            ind3++;
        else
        {
            cout<<0;
            return 0;
        }
    }

    cout<<ans;

// -------------------------------------Code ends here------------------------------------------------------
     clock_t clk;
 	clk = clock();
 
     clk = clock() - clk;
 	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
 	return 0;
 }

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  int num,ans,box = 0;
  cin >> num;
  ans = num;
  while(num > 0){
    box = box + num % 10;
    num = num / 10;
  }
  if (ans % box == 0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 380
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    int tmp = min(n, m / 2);
    int ans = tmp;
    n -= tmp;
    m -= tmp * 2;
    ans += m / 4;
    cout << ans << endl;

    return 0;
}


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

int main(){
    char b, c[128];
    c['A'] = 'T';
    c['G'] = 'C';
    c['C'] = 'G';
    c['T'] = 'A';

    cin >> b;
    cout << c[b] << endl; 

 }

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

a = int(n / 11)


if(n <= 6):
    print(1)
elif(n <= 11):
    print(2)
elif(n%11 == 0):
    print(a*2)
elif(n%11 <=6):
    print(a*2+1)
else:
    print((a+1)*2)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
 
 
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,ans=0;
    cin>>n;
    if(n%2==0){
        n/=2;
        while(n){
          n/=5;
          ans+=n; 
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 384
using System;
using System.Collections.Generic;

class AOJ2424
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        for (int i = 0; i < n; i++)
        {
            int input = int.Parse(Console.ReadLine());
            HashSet<int> apd=new HashSet<int>();
            apd.Add(input);
            int crt = input;
            int cnt = 0;
            while(true){
                if (crt < 10)
                {
                    Console.WriteLine(cnt);
                    break;
                }
                crt = subr(crt);
                cnt++;
                if (apd.Contains(crt))
                {
                    Console.WriteLine(input);
                    break;
                }
            }

        }
    }
    static int subr(int tgt)
    {
        int max = 0;
        int len=tgt.ToString().Length;
        for(int i=1;i<len;i++){
            string ds = tgt.ToString();
            int f = int.Parse(ds.Substring(0, i));
            int b = int.Parse(ds.Substring(i));
            int r = f * b;
            if (r > max) max = r;
        }
        return max;
    }
}

Measured memory_bytes: 6404
#include<bits/stdc++.h>
#define int long long
#define dd second
#define mp make_pair
#define pb push_back
#define ff first
#define dd second
#define pp pair<int,int>
using namespace std;
int A,B,C,D,E,F;
int ww = 1; int suger = 0;
main()
{
    ios_base::sync_with_stdio(false);
    cin >> A >> B >> C >> D >> E >> F;
    for(int a = 0; a*A*100 <= F; ++a)
    {
        for(int b = 0; a*A*100+b*B*100 <= F; ++b)
        {
            if(a == 0 and b == 0) continue;
            int water = a*A*100+b*B*100;
            for(int c = 0; c*C <= F-water; ++c)
            {
                for(int d = 0; d*D+c*C <= F-water; ++d)
                {
                    if(water + c*C+d*D <= F and (c*C+d*D) <= E*(a*A+b*B) )
                    {
                        if(suger*(water+c*C+d*D) <= (ww+suger)*(c*C+d*D))
                        {
                            ww = water; suger = c*C+d*D;
                        }
                    }
                }
            }
        }
    }
    cout << ww+suger << " " << suger << endl;
}



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

using namespace std;

typedef long long  ll;

int main()
{
    int N, m;

    cin >> N >> m;
    vector<bool> select(m, true);
    vector<pair<int, int>> cd(m);

    for (int i = 0; i < m; ++i)
        cin >> cd[i].first >> cd[i].second;
    sort(cd.begin(), cd.end());

    for (int i = 0; i < m; ++i) {
        if (cd[i].second <= cd[i].first)
            select[i] = false;
    }

    for (int i = 0; i < m; ++i) {
        if (!select[i])
            continue;
        bool isIN = false;
        for (int j = 0; j < m; ++j) {
            if (i == j || !select[j])
                continue;
            if (cd[j].first <= cd[i].first && cd[i].second <= cd[j].second) {
                isIN = true;
                break;
            }
        }
        if (isIN)
            select[i] = false;
    }

    for (int i = 0; i < m; ++i) {
        if (!select[i])
            continue;
        for (int j = i + 1; j < m; ++j) {
            if (!select[j])
                continue;
            if (cd[i].first <= cd[j].first && cd[j].first < cd[i].second) {
                select[j] = false;
                cd[i].second = cd[j].second;
            }
        }
    }

    int ans = N + 1;
    for (int i = 0; i < m; ++i)
        if (select[i])
            ans += 2 * (cd[i].second - cd[i].first);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1204
l,r = map(int,input().split())
ans = 2019
for i in range(l,r):
    for j in range(i+1,r+1):
        p = (i * j) % 2019
        ans = min(p,ans)
        if ans == 0:
            break
    else:
        continue
    break
print(ans)

Measured memory_bytes: 3060
#include <stdio.h>

#define int64 long long

int main()
{
  int64 xx, tmp = 100, nen = 0;
  scanf("%lld", &xx);
  while(tmp < xx)
  {
    nen++;
    tmp += tmp * 0.01; 
  }
  printf("%lld\n", nen);
  return 0;
}

Measured memory_bytes: 1732
import java.util.ArrayDeque

fun main(args: Array<String>) {
    val queue = ArrayDeque<Char>(200000)
    val S = readInputLine().toCharArray().forEach { queue.addLast(it) }
    val Q = readInputLine().toInt()

    var former = true

    repeat(Q) {
        val query = readInputLine().split(" ")
        when (query[0]) {
            "1" -> {
                former = !former
            }
            else -> {
                val F = query[1]
                val C = query[2]
                val addFirst = (F == "1" && former) || (F == "2" && !former)
                if (addFirst) {
                    queue.addFirst(C.first())
                } else {
                    queue.addLast(C.first())
                }
            }
        }
    }

    while (queue.isNotEmpty()) {
        print(if (former) queue.pollFirst()!! else queue.pollLast()!!)
    }
    println()
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 79336
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll INF = (ll)1e18 *4 +9;

int f(vector<int> v, int k){//ソート済みの配列からk個取る時の差の最小値を返す
  int n = v.size();
  int ans = v[k-1] - v[0];
  for(int i=k; i<n; ++i){
    ans = min(ans, v[i] - v[i-k+1]);
  }
  return ans;
}

int main(){
  int n, k;
  cin >> n >> k;
  vector<P> v(n);
  for(int i=0; i<n; ++i) cin >> v[i].first >> v[i].second;
  sort(v.begin(),v.end());
  ll ans = INF;
  for(int i=0; i<n-k+1; ++i){
    vector<int> v2;
    for(int i2=i; i2<i+k-1; ++i2) v2.push_back(v[i2].second);
    for(int j=i+k-1; j<n; ++j){
      int disx = v[j].first - v[i].first;
      v2.push_back(v[j].second);
      sort(v2.begin(),v2.end());
      int disy = f(v2,k);
      ans = min(ans, (ll)disx * disy);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3580
#include<stdio.h>
int main(void)
{
    int fib[44],i,n;
    scanf("%d",&n);
    fib[0]=1;
    fib[1]=1;
    for(i=2;i<=n;i++){
        fib[i]=fib[i-1]+fib[i-2];
    }
    printf("%d\n",fib[n]);
    return 0;
}

Measured memory_bytes: 596
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(long long i=0;i<n;++i)
#define REPR(i,n) for(long long i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(long long i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(v) {for(long long sitr=0;sitr<v.size();++sitr){cin>>v[sitr];}}

int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

using namespace std;

typedef pair<int,int> pii;

int main(){

  llong a, b, n;
  cin >> a >> b >> n;

  llong x = min(n, b-1);
  cout << (a * x) / b - (x / b) * a << endl;
  return 0;
}



Measured memory_bytes: 3572
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(0);
    int a,b;
    cin>>a>>b;
    int c=abs(a-b);
    if(c%2)cout<<"IMPOSSIBLE";
    else cout<<abs(c/2-max(a,b));
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>

using namespace std;

int gcd_euclid(int u, int v)
{
    if (u <= 0 || v <= 0)
        return max(u, v);
    int r;
    while (0 != v)
    {
        r = u % v;
        u = v;
        v = r; /* swap */
    }
    return u;
}

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

    int n;
    cin >> n;
    vector<int> a(n), cf(n + 1), cb(n + 1);
    for (int i = 0; i < n; i++)
        cin >> a[i];

    int now_gcd;

    for (int i = 0; i < n; i++)
    {
        if (i == 0)
            now_gcd = a[0];
        now_gcd = gcd_euclid(now_gcd, a[i]);
        cf[i + 1] = now_gcd;
    }

    for (int i = 0; i < n; i++)
    {
        if (i == 0)
            now_gcd = a[n - 1];
        now_gcd = gcd_euclid(now_gcd, a[n - 1 - i]);
        cb[i + 1] = now_gcd;
    }

    int max_gcd = -1;
    for (int i = 0; i < n; i++)
    {
        int now_gcd = gcd_euclid(cf[i], cb[n - 1 - i]);
        max_gcd = max(now_gcd, max_gcd);
    }

    cout << max_gcd << endl;

    return 0;
}


Measured memory_bytes: 1408
print([1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51][
          int(input()) - 1])


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

typedef long long ll;

ll gcd( ll x, ll y );
ll lcm( ll x, ll y );

int main()
{
    int x, y;

    for ( int i = 0; i < 7; ++i ) {
        cin >> x >> y;
        cout << x - y << endl;
    }

    return 0;
}

ll gcd( ll x, ll y )
{
    if ( y == 0 ) return x;
    return gcd( y, x % y );
}

ll lcm( ll x, ll y )
{
    return x / gcd( x, y ) * y;
}




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

int main(){
    int a, b;
    cin >> a >> b;
    string s1;
    string s2;
    rep(i, a){
        s1 += to_string(b);
    }
    rep(i, b){
        s2 += to_string(a);
    }
    vector<string> li;
    li.push_back(s1);
    li.push_back(s2);
    sort(li.begin(), li.end());
    cout << li.at(0) << endl;
}


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

 
class ModInt{
private:
  long long val;
  static const int default_mod = 1e9 + 7;
  static int mod;
  static vector<ModInt> facts;
public:
  ModInt(long long val)
  {
    if(mod == 0){
      mod = default_mod;
    }
    this->val = ((val % mod) + mod) % mod;
  }
  ModInt()
    : ModInt(0)
  {
  }
  static void setMod(int mod){
    if(ModInt::mod != 0){
      throw "The modulo is already set.";
    }
    ModInt::mod = mod;
  }

  const ModInt operator* (const ModInt& another) const{
    return ModInt(val * another.val);
  }
  ModInt operator+ (const ModInt& another){
    return ModInt(val + another.val);
  }
  ModInt operator- (const ModInt & another){
    return ModInt(val - another.val + mod);
  }
  ModInt operator/(const ModInt& rhs){
    return (*this) * rhs.inv();
  }
  ModInt& operator*=(const ModInt& rhs){
    (*this) = (*this) * rhs;
    return *this;
  }
  ModInt& operator+=(const ModInt& rhs){
    (*this) = (*this) + rhs;
    return *this;
  }
  ModInt& operator-=(const ModInt& rhs){
    (*this) = (*this) - rhs;
    return *this;
  }
  ModInt pow(long long exponent) const{
    exponent %= mod;
    if(exponent == 0){
      return ModInt(1);
    }else{
      if(exponent % 2){
        return ((*this) * (*this)).pow(exponent / 2) * (*this);
      }else{
        return ((*this) * (*this)).pow(exponent / 2);
      }
    }
  }
  ModInt inv() const{
    return this->pow(mod - 2);
  }
  static ModInt fact(long long n){
    if(n >= mod){
      return 0;
    }
    if(facts.size() < static_cast<size_t>(n + 1)){
      if(facts.size() == 0){
        facts.push_back(1);
      }
      for(int i = facts.size(); i <= n; i++){
        facts.push_back(facts[i - 1] * i);
      }
    }
    return facts[n];
  }
  static ModInt comb(long long n, long long r){
    if(r > n){
      return 0;
    }
    return ModInt::fact(n) * ModInt::fact(r).inv() * ModInt::fact(n - r).inv();
  }
 
  friend ostream& operator<< (ostream& os, const ModInt& modint){
    os << modint.val;
    return os;
  }
  friend istream& operator>>(istream& is, ModInt& modint){
    long long val;
    is >> val;
    modint.val = val % modint.mod;
    return is;
  }
};
int ModInt::mod = 0;
vector<ModInt> ModInt::facts;
const ModInt operator* (const long long lhs, const ModInt& rhs){
  return ModInt(lhs) * rhs;
}




int main(){
  int N, K;
  cin >> N >> K;

  vector<int> A(N);
  for(int i = 0; i < N; i++){
    cin >> A[i];
  }
  sort(A.begin(), A.end());

  ModInt ans = 0;
  for(int i = K - 1; i < N; i++){
    ans += A[i] * ModInt::comb(i, K - 1);
  }
  for(int i = 0; i <= N - K; i++){
    ans -= ModInt::comb(N - i - 1, K - 1) * A[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 2416