akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	#ifndef _GLIBCXX_DEBUG
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	constexpr char endl='\n';
	#endif

	for(int n,m,k;cin>>n>>m>>k&&n|m|k;){
		bool res=false;
		rep(i,n+1) rep(j,m+1)
			res|=i*(m-j)+j*(n-i)==k;
		cout<<(res?"Yes":"No")<<endl;
	}
}


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

int main(void)
{
    ll L, R;
    cin >> L >> R;
    ll modL = L%2019;
    ll modR = R%2019;

    if(R - L > 2019 - modL) {
        cout << 0 << endl;
        return 0;
    }
    ll minimum = 2020;
    for(ll i = L; i < R; i++){
        for(ll j = i+1; j <= R; j++){
            ll val = ( (i % 2019) * (j%2019) )% 2019;
            if(val < minimum) minimum = val;
            if(val == 0) {
                minimum = 0;
                break;
            }
        }
    }
    
    cout << minimum << endl;
    return 0;
}


Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;typedef long long lint;typedef vector<lint> liv;
//#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(),v.end()
#define linf 1152921504606846976
#define MAXN 100010
#define md 1000000007//998244353

#define _vcppunko4(tuple) _getname4 tuple
#define _getname4(_1,_2,_3,_4,name,...) name
#define _getname3(_1,_2,_3,name,...) name
#define _trep2(tuple) _rep2 tuple
#define _trep3(tuple) _rep3 tuple
#define _trep4(tuple) _rep4 tuple
#define _rep1(n) for(lint i=0;i<n;++i)
#define _rep2(i,n) for(lint i=0;i<n;++i)
#define _rep3(i,a,b) for(lint i=a;i<b;++i)
#define _rep4(i,a,b,c) for(lint i=a;i<b;i+=c)
#define _trrep2(tuple) _rrep2 tuple
#define _trrep3(tuple) _rrep3 tuple
#define _trrep4(tuple) _rrep4 tuple
#define _rrep1(n) for(lint i=n-1;i>=0;i--)
#define _rrep2(i,n) for(lint i=n-1;i>=0;i--)
#define _rrep3(i,a,b) for(lint i=b-1;i>=a;i--)
#define _rrep4(i,a,b,c) for(lint i=a+(b-a-1)/c*c;i>=a;i-=c)
template<class T>
istream& operator>>(istream& is,vector<T>& vec);
template<class T,size_t size>
istream& operator>>(istream& is,array<T,size>& vec);
template<class T,class L>
istream& operator>>(istream& is,pair<T,L>& p);
template<class T>
ostream& operator<<(ostream& os,vector<T>& vec);
template<class T,class L>
ostream& operator<<(ostream& os,pair<T,L>& p);
template<class T>
istream& operator>>(istream& is,vector<T>& vec){ for(T& x: vec) is>>x;return is; }
template<class T,class L>
istream& operator>>(istream& is,pair<T,L>& p){ is>>p.first;is>>p.second;return is; }
//template<class T>
//ostream& operator<<(ostream& os,vector<T>& vec){ os<<vec[0];rep(i,1,vec.size())os<<' '<<vec[i];return os; }
//template<class T>
//ostream& operator<<(ostream& os,deque<T>& deq){ os<<deq[0];rep(i,1,deq.size())os<<' '<<deq[i];return os; }
template<class T,class L>
ostream& operator<<(ostream& os,pair<T,L>& p){ os<<p.first<<" "<<p.second;return os; }

inline void in(){}
template <class Head,class... Tail>
inline void in(Head&& head,Tail&&... tail){ cin>>head;in(move(tail)...); }
template <class T>
inline bool out(T t){ cout<<t<<'\n';return 0; }
inline bool out(){ cout<<'\n';return 0; }
template <class Head,class... Tail>
inline bool out(Head head,Tail... tail){ cout<<head<<' ';out(move(tail)...);return 0; }

#define rep(...) _vcppunko4((__VA_ARGS__,_trep4,_trep3,_trep2,_rep1))((__VA_ARGS__))
#define rrep(...) _vcppunko4((__VA_ARGS__,_trrep4,_trrep3,_trrep2,_trrep1))((__VA_ARGS__))
#define lin(...) lint __VA_ARGS__;in(__VA_ARGS__)
#define stin(...) string __VA_ARGS__;in(__VA_ARGS__)
#define vin(type,name,size) vector<type> name(size);in(name)

int main(){
	stin(s);lint n=s.size();
	lint l=0,r=0,ans=0;
	string a="ACGT";
	while(r<n){         
		if(!count(all(a),s[r])){
			l=r+1;
		}++r;
		ans=max(ans,r-l);
	}cout<<ans<<endl;
}

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

using namespace std;
using ll = int64_t;

struct agc023_a{
  int N;
  vector<ll> A;
  map<ll, ll> M;
  void init(){
    cin >> N;
    A.resize(N);
    for(auto&& x:A)cin >> x;
  }
  
  void solve(){
    init();
    ll ans = 0LL;
    M[0] = 1;
    ll t = 0;
    for(auto&& x:A){
      t += x;
      M[t]++;
    }
    for(auto&& x:M){
      auto y = x.second;
      ans += y * (y - 1) / 2;
    }
    cout << ans << endl;
  }
  
};

int main(){
  agc023_a ins;
  ins.solve();
}


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

p=list(map(int, input().split()))

A=0

for i in range(1,n-1):
    if p[i-1]<p[i]<p[i+1] :
        A=A+1
    elif p[i-1]>p[i]>p[i+1]:
        A=A+1

print(A)

Measured memory_bytes: 2940
#include <stdio.h>
int main(void){
    int a, b, c, add=0;
    scanf("%d%d%d", &a, &b, &c);
    for(int i=1; i<=b; i++){
        if((a*i)%b==c){
            puts("YES");
            return 0;
        }
    }
    for(int i=1;i<=b;i++){
        if((a*i+add) % b == c){
            puts("YES");
            return 0;
        }
        else add += a*i;
    }
    puts("NO");
    return 0;
}

Measured memory_bytes: 1624
left_string = "qwertasdfgzxcvb"
while True:
    s = input()
    if s == "#":
        break
    ans = 0
    is_left = None
    if s[0] in left_string:
        is_left = True
    else:
        is_left = False

    for i in range(1, len(s)):
        if is_left and s[i] not in left_string:
            ans += 1
            is_left = False
        elif not is_left and s[i] in left_string:
            ans += 1
            is_left = True
    print(ans)


Measured memory_bytes: 5560
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define RREPALL(i,v) for (int i = v.size()-1; i >= 0; i--)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

int t = 0;

ll GCD(ll a, ll b)
{
    t++;
    if (a == b || b == 0) {
        return a;
    } else if (a < b) {
        return GCD(b, a);
    } else {
        return GCD(b, a % b);
    }
}


vector<int> x;

int main()
{
    int n, X;
    cin>>n>>X;
    REP(i,n) {
        int tmp;
        cin>>tmp;
        x.push_back(tmp);
    }
    int ans = abs(X - x[0]);
    REP(i,n-1) {
        ans = GCD(ans, abs(x[i+1] - x[i]));
    }
    cout<<ans<<endl;

    return 0;
}


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

int main(){

  int W, H, x, y, r;

  cin >> W >> H >> x >> y >> r;

  if(((x-r)<0 || (x+r)>W) || (y-r)<0 || (y+r)>H) cout << "No" << endl;
  else cout << "Yes" << endl;


}



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

bool hum[1000001];

int main(void)
{
	hum[1] = true;
	for(int i = 2; i <= 1000000; i *= 2)
		hum[i] = true;
	for(int i = 3; i <= 1000000; i *= 3)
		hum[i] = true;
	for(int i = 5; i <= 1000000; i *= 5)
		hum[i] = true;

	for(int i = 0; i <= 1000000; i++){
		if(hum[i]){
			for(int j = i; j <= 1000000; j *= 3)
				hum[j] = true;
			for(int j = i; j <= 1000000; j *= 5)
				hum[j] = true;
			for(int j = i; j <= 1000000; j *= 2)
				hum[j] = true;
		}
	}
	int n,m;
	while(cin >> n, n){
		cin >> m;
		int c = 0;
		for(int i = n; i <= m; i++)
			if(hum[i])
				c++;
		cout << c << endl;
	}


	return 0;
}

Measured memory_bytes: 1816
#include<bits/stdc++.h>
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define pii pair<int,int>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
#define RREP(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
#define REP2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;

using namespace std;
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int X;
  cin >> X;
  if(X<100){
    cout <<"0" << endl;
    return 0;
  }else if(X <= 105){
    cout << "1" << endl;
    return 0;
  }
  bool ok = false;
  REP2(i,1,10000){
    if(X>=100*i && X<= 105*i) ok = true;
  }
  if(ok) cout << "1";
  else cout << "0";
  

  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
class Program{
	const int mod=1000000007;
	static void Main(){
		int[] s=Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
		Array.Sort(s);
		Console.WriteLine("{0}",(s[0]==1&&s[1]==4&&s[2]==7&&s[3]==9)?"YES":"NO");
	}
}

Measured memory_bytes: 13268
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<functional>
#include <bitset>
#include<algorithm>
#include<fstream>
#include<string>
#include <cstring>
#include<stdio.h>
#include<iomanip>
#include<sstream>
#include<cmath>
#include<vector>
#include<assert.h>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
// never lose hope ..
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define eps 1e-8
using namespace std;
double const  PI = 3.141592653;
const int OO = 1000000000 + 9;

void fast() {
	ios_base::sync_with_stdio(0);
	cin.tie(NULL), cout.tie(NULL);
}
struct s {
	int x, y, z;
};

int n;
int v[(int)1e5][4];
int dp[(int)1e5][4];

int solve(int i = 0, int pre = 4) {
	if (i >= n)return 0;
	if (dp[i][pre] != -1)return dp[i][pre];
	int ch1, ch2, ch3;
	ch1 = ch2 = ch3 = 0;
	if (pre != 1) {
		ch1 += solve(i + 1, 1) + v[i][1];
	}
	if (pre != 2) {
		ch2 += solve(i + 1, 2) + v[i][2];
	}
	if (pre != 3) {
		ch3 += solve(i + 1, 3) + v[i][3];
	}
	return dp[i][pre] = max({ ch1,ch2,ch3 });
}


int main()
{
	fast();

	cin >> n;
	for (int i = 0;i < n;i++) {
		cin >> v[i][1] >> v[i][2] >> v[i][3];
	}
	memset(dp, -1, sizeof(dp));
	cout << solve();

	return 0;
}

Measured memory_bytes: 9600
n=gets.chomp.to_i
h=gets.chomp.split.map(&:to_i)
miz = 0
loop do
  100.times do
   begin;h.shift if h[0] == 0 ||h[0].negative?;rescue;end
   begin;h.pop if h[-1] == 0 ||h[-1].negative?;rescue;end
  end
  if h.size==0
   break
  else
   miz+=h.join(",").scan(/(,0|,-\d+){1,}/).size+1
  end
  h.map!{|a|a-1}
end
puts miz

Measured memory_bytes: 1916
from math import sqrt

N = 10 ** 6
p = [True] * (N + 1)
p[0] = False
p[1] = False
n = int(sqrt(N) + 1)

for i in range(4, N+1, 2):
  p[i] = False
for j in range(3, n+1, 2):
  if p[j]:
    for k in range(j+j, N+1, j):
      p[k] = False

x = int(input())
for l in range(x, N+1):
  if p[l]:
    print(l)
    break

Measured memory_bytes: 10868
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iterator>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

const double EPS=1e-10;

struct Square{
	double x,y,d,n;
	Square(){}
	Square(double x,double y,double d,int n):x(x),y(y),d(d),n(n){}
	bool operator<(const Square& s)const{return n<s.n;}
	bool operator>(const Square& s)const{return n>s.n;}
};

inline double myhypot(double x,double y)
{
	return sqrt(x*x+y*y);
}

int main()
{
	for(int n;cin>>n,n;){
		vd xs(n),ys(n);
		rep(i,n)
			cin>>xs[i]>>ys[i];
		double xmin=*min_element(allof(xs));
		double xmax=*max_element(allof(xs));
		double ymin=*min_element(allof(ys));
		double ymax=*max_element(allof(ys));
		priority_queue<Square> pq;
		pq.push(Square((xmin+xmax)/2,(ymin+ymax)/2,max(xmax-xmin,ymax-ymin)/2,n));
		int res=1;
		while(!pq.empty()){
			Square s=pq.top(); pq.pop();
			if(s.n<=res)
				continue;
			
			int temp=0;
			rep(i,n)
				if(myhypot(xs[i]-s.x,ys[i]-s.y)<1+EPS)
					temp++;
			res=max(res,temp);
			
			if(s.d<1e-5)
				continue;
			
			double nd=s.d/2;
			double nx[]={s.x-nd,s.x-nd,s.x+nd,s.x+nd};
			double ny[]={s.y-nd,s.y+nd,s.y-nd,s.y+nd};
			rep(k,4){
				double x=nx[k],y=ny[k];
				temp=0;
				rep(i,n){
					if(myhypot(x-xs[i],y-ys[i])<nd*sqrt(2)+1+EPS)
						temp++;
				}
				if(temp>res)
					pq.push(Square(x,y,nd,temp));
			}
		}
		cout<<res<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 984
# include <bits/stdc++.h>
# define rr register
const int N=2010,INF=0x3f3f3f3f;
int n,X,Y;
int p[N];
inline int read(void){
	int res,f=1;
	char c;
	while((c=getchar())<'0'||c>'9')
		if(c=='-')f=-1;
	res=c-48;
	while((c=getchar())>='0'&&c<='9')
		res=res*10+c-48;
	return res*f;
}
int main(void){
	n=read();
	X=read(),Y=read();
	for(rr int i=1;i<=n;++i){
		for(rr int j=i+1;j<=n;++j){
			int ret=std::min(j-i,abs(i-X)+abs(j-Y)+1);
			++p[ret];
		}
	}
	for(rr int i=1;i<=n-1;++i){
		printf("%d\n",p[i]);
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int count(string s) {
    int n = s.size();
    int res = 0;
    rep(i, n) {
        char c = s[i];
        bool flag = false;
        for (auto x : {'A','C','G','T'}) {
            if (c == x) {
                res++;
                flag = true;
            }
        }
        if (!flag) return 0;
    }
    return res;
}

int main(){
    string s;
    cin >> s;
    int n = s.size();
    int mx = 0;
    rep(i,n){
        rep(j,n-i){
            int num = count(s.substr(i,j+1));
            chmax(mx, num);
        }
    }
    cout << mx << endl;
}


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

int main(){
  long long n,m;cin >> n >> m;
  long long ans=0;
  if(n*2<=m){
    ans+=n;
    m-=n*2;
    ans+=m/4;
  }else{
    ans+=m/2;
  }
  cout << ans << endl;
}

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

int	main() {
	long N;
	cin >>N;
	long i=sqrt(N);
	while (i!=1) {
		if (0==N%i) {
			break;
		} else {
			i--;
		}
	}
	long NNN=max(i, N/i);
	long F;
	if (NNN>=10000000000)
		F=11;
	else if (NNN>=1000000000)
		F=10;
	else if (NNN>=100000000)
		F=9;
	else if (NNN>=10000000)
		F=8;
	else if (NNN>=1000000)
		F=7;
	else if (NNN>=100000)
		F=6;
	else if (NNN>=10000)
		F=5;
	else if (NNN>=1000)
		F=4;
	else if (NNN>=100)
		F=3;
	else if (NNN>=10)
		F=2;
	else
		F=1;
	cout <<F <<endl;
	return 0;
};


Measured memory_bytes: 256
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

H,W = LI()
N = I()
a = LI()

ANS = []
for i in range(N):
    ANS += [i+1]*(a[i])

for i in range(H):
    if i % 2 == 0:
        print(*ANS[W*i:W*(i+1)])
    else:
        print(*reversed(ANS[W*i:W*(i+1)]))

Measured memory_bytes: 74416
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

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

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
template<class T>bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if(a>b){a=b;return 1;}return 0;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

ll n,x;
vll bn(51), an(51);

ll dp(ll l, ll d){
    if(l==0)return (d>=1?1ll:0);
    if(d<=1)return 0;
    if(d>=(an[l]-1)/2+1){
        return bn[l-1]+dp(l-1, min(d-(an[l]-1)/2-1, an[l-1]))+1ll;
    }else{
        return dp(l-1, d-1);
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    debug("debug test\n");
    cin>>n>>x;
    ll sta = 1, stb = 1;

    rep(i, 51){
        bn[i] = stb;
        an[i] = sta;
        sta = 2*sta+3;
        stb = 2*stb+1;
    }
    cout << dp(n, x) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <cmath>
#include <map>
#include <string>
#include "boost/multiprecision/cpp_int.hpp"
#define debug(var) std::cout << #var << " : " << var << " , ";

int main() {


	std::cin.tie(nullptr); std::ios::sync_with_stdio(false);

	std::string S; std::cin >> S;

	std::string first_S = "";
	first_S += S[0];
	first_S += S[1];

	std::string second_S = "";
	second_S += S[2];
	second_S += S[3];

	int first = std::stoi(first_S);
	int second = std::stoi(second_S);

	if (first >= 1 && first <= 12 && second >= 1 && second <= 12)std::cout << "AMBIGUOUS";
	else if (first >= 1 && first <= 12)std::cout << "MMYY";
	else if (second >= 1 && second <= 12)std::cout << "YYMM";
	else std::cout << "NA";


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

int main(){
  int n;
  cin >> n;
  repd(i, 1, n+1){
    if((int)floor(i*1.08) == n){
      cout << i << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
  return 0;
}


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

int main()
{
    long long a, b, c;
    cin >> a >> b >> c;
    if (a == b && c != a )
        cout << "Yes" << endl;
    else if (a == c && b != a )
        cout << "Yes" << endl;
    else if (b == c && a != c )
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
#define lpin(a,i,n) for(int i=0;i<n;i++){cin>>a[i];}


int main(){
  while(1){
    int n;
    cin>>n;
    if(n==0) break;
    string x;
    int count=0,check=0,mode=0;
    lp(i,n){
      cin>>x;
      if(x=="lu"){
	if(check==0) check=1;
	else if(check=2){
	  check=3;
	  if(mode==0){
	    count++;
	    mode=1;
	  }
	}
      }
      if(x=="ru"){
	if(check==0) check=2;
	if(check==1){
	  check=3;
	  if(mode==0){
	    count++;
	    mode=1;
	  }
	}
      }
      if(x=="ld"){
	if(check==3) check=2;
	if(check==1){
	  check=0;
	  if(mode==1){
	    count++;
	    mode=0;
	  }
	}
      }
      if(x=="rd"){
	if(check==3) check=1;
	if(check==2){
	  check=0;
	  if(mode==1){
	    count++;
	    mode=0;
	  }
	}
      }
    }
    cout<<count<<endl;
  }
  return 0;
}



Measured memory_bytes: 3072
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
template<class T> ostream& operator<<(ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }

int main() {
    int n; cin >> n;
    long long k = 1;
    while (k * (k + 1) / 2 < n) k++;
    if (k * (k + 1) / 2 != n) return !(cout << "No" << endl);
    cout << "Yes" << endl << k + 1 << endl;
    vector<vector<int>> res(k + 1, vector<int>(k));
    for (int i = 0, cnt = 1; i < k; i++) {
        for (int j = i; j < k; j++) {
            if (j == i) res[k][i] = res[i][i] = cnt++;
            else res[j][i] = res[i][j] = cnt++;
        }
    }
    for (auto &v: res) cout << k << " " << v << endl;
    return 0;
}


Measured memory_bytes: 2176
#include<iostream>
using namespace std;
const int N=1e5+5;
int a[N];
int main(){
	int n;
	scanf("%d",&n);
	int b;
	while(n--){
		scanf("%d",&b);
		a[b]++; 
		a[b-1]++;
		a[b+1]++;
	}
	int max=0;
	for(int i=0;i<N-1;i++){
	if(max<a[i])
		max=a[i];
	}
	printf("%d\n",max);
	return 0;
}

Measured memory_bytes: 640
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int [] Dish = new int [5];
        int time = 0;
        int max = 0;

        for(int i =0; i<5;i++){
            Dish[i] = scanner.nextInt();
            if(Dish[i]%10 == 0){
                time += Dish[i];
            }
            
            else{
                time += (10-(Dish[i]%10)) + Dish[i];
                
                if(10-(Dish[i]%10)>max){
                    max = 10-(Dish[i]%10);
                }
            }
        }
        
        System.out.println(time-max);
        
    }    
}

Measured memory_bytes: 19924
#include<stdio.h>
int main()
{
  int n;
  int i, j;
  int div;
  int ans;
  
  // 整数の入力
  scanf("%d", &n);
  
  ans = 0;
  for(j = 1; j <= n; j = j + 2){
    div = 1;
    for(i = 2; i < j / 2; i++){
      if(j % i == 0){
        div = div + 1;
      }
    }
    div = div + 1;
    if(div == 8){
      ans = ans + 1;
    }
  }
  
  // 出力
  printf("%d\n", ans);
  
  return 0;
}




Measured memory_bytes: 128
N = int(input())
a = list(map(int, input().split()))


def cnt_2(num):
    cnt = 0
    while num % 2 == 0:
        num //= 2
        cnt += 1
    return cnt

_cnt=0
for i in range(N):
    _cnt+=cnt_2(a[i])
print(_cnt)

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

#define rep(i, n) for (int i=0; i<(n); ++i)
using ll = long long;
using P = pair<int, int>;

vector<pair<char, int>> selectionSort(vector<pair<char, int>> a, int n){
  for (int i=0; i<n; i++) {
    int minj = i;
    for (int j=i; j<n; j++) {
      if (a[j].second < a[minj].second) {
	minj = j;
      }
    }
    if (a[i].second == a[minj].second) continue;
    pair<char, int>  tmp = a[i];
    a[i] = a[minj];
    a[minj] = tmp;
  }
  return a;
}

vector<pair<char, int>> bubbleSort(vector<pair<char, int>> a, int n) {
  for (int i=0; i<n; i++) {
    for (int j=n-1; j>=i+1; j--) {
      if (a[j].second < a[j-1].second) {
	pair<char, int> tmp = a[j];
	a[j] = a[j-1];
	a[j-1] = tmp;
      }
    }
  }
  return a;
}

void printAns(vector<pair<char, int>> a,vector<pair<char, int>> ans, int n) {
  rep(i, n) printf("%c%d%c", ans[i].first, ans[i].second, i == n-1 ? '\n' : ' ');
  rep(i, n-1) {
    if (ans[i].second == ans[i+1].second) {
      int left, right;
      rep(j, n-1) {
	if (a[j] ==  ans[i]) left = j;
	if (a[j] ==  ans[i+1]) right = j;
      }
      if (left > right) {
	cout << "Not stable" << endl;
	return;
      }
    }
  }
  cout << "Stable" << endl;
}

int main() {
  int n;
  cin >> n;
  vector<pair<char, int>> a(n);
  rep(i, n) {
    string tmp;
    cin >> tmp;
    a[i].first = tmp[0];
    a[i].second = tmp[1] - '0';
  }

  vector<pair<char, int>> ans;
  ans = bubbleSort(a, n);
  printAns(a, ans, n);

  ans = selectionSort(a, n);
  printAns(a, ans, n);
  return 0;
}



Measured memory_bytes: 3304
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	static class Pair{
		char c;
		long len;
		Pair(char c , int l){
			this.c = c;
			this.len = l;
		}
		@Override
		public String toString() {
			return c +" " + len;
		}
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		char c = S.charAt(0);
		int seq = 1;
		List<Pair> ps = new ArrayList<Pair>();
		for(int i = 1 ; i < S.length() ; ++i) {
			if(S.charAt(i) == c) {
				++seq;
			}else {
				ps.add(new Pair(c, seq));
				c = S.charAt(i);
				seq = 1;
			}			
		}
		ps.add(new Pair(c, seq));
//		System.out.println(ps);
		long sum = 0;
		for(int i = 0 ; i < ps.size() ; ++i) {
			Pair p = ps.get(i);
			long s = p.len;
			if(p.c == '>') {
				sum += s * (s + 1) / 2;
				if(i > 0) {
					Pair prev = ps.get(i - 1);
					if(prev.len > p.len) {
						sum += prev.len - p.len;
					}
				}
			}else {
				sum += s * (s - 1) / 2;				
			}
		}
		if(ps.get(ps.size() - 1).c == '<') {
			long s = ps.get(ps.size() - 1).len;
//			sum += s * (s + 1) / 2;
			sum += s;
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 38356
#include<iostream>
#include<string>
using namespace std;
int main(void){
	string s;
		cin >> s;
	int a=0,b=0;
	for(int i=0;i<s.size();i++)
		(s[i]=='1'?a++:b++);
	cout << min(a,b)*2 << endl;
	return 0;
	
}

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

#define MOD 1000000007
#define MAXN 200010

typedef long long ll;

int n;
ll dp[MAXN];
ll sum[MAXN];
int c[MAXN];

int main() {
	cin >> n;
  	for (int i = 0; i < n; i++) cin >> c[i];
  
    dp[0] = 1;
    sum[c[0]] = 1;
    for (int i = 1; i < n; i++) {
      if (c[i] != c[i-1]) sum[c[i]] = (sum[c[i]]+dp[i-1])%MOD;
      
      dp[i] += sum[c[i]];
      
    }
  cout << (dp[n-1])%MOD << endl;
}


Measured memory_bytes: 4096
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from collections import Counter
def resolve():
    S=input()
    N=len(S)
    s1="01"*(N//2)+"0"*(N%2)
    s2="10"*(N//2)+"1"*(N%2)
    #print(s1,s2)
    ans1,ans2=0,0
    for s in range(N):
        if S[s]!=s1[s]:ans1+=1
        if S[s]!=s2[s]:ans2+=1
    print(min(ans1,ans2))
#%%submit!    
resolve()

Measured memory_bytes: 41072
#include <bits/stdc++.h>
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)

using namespace std;

int i,j,k;

int main(){
    string s,ans;
    ans="No";
    cin >>s;
    if(s[2]==s[3]&&s[4]==s[5]){
        ans="Yes";
    }
    
    
    cout<<ans<<endl;
    

    
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string a,b;
  cin >> a >> b;
  string c(a.size() + b.size(),'a');
  for(int i=0; i<c.size(); i++){
    if(i%2==0) c[i] = a[i/2];
    else c[i] = b[(i-1)/2];
  }
  cout << c << endl;;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n ; i++)
using namespace std;
typedef long long ll;
int main(){
	int a,b;
	cin >> a >> b;
	int k;
	k = a + b;
	if(k%2==0) cout << k/2 << endl;
	else cout << "IMPOSSIBLE" <<endl;
	return 0;
}



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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll P,Q,R,ans;
  cin >> P>> Q>> R;
  ans = min(P+Q,P+R);
  ans = min(ans,Q+R);
  cout << ans<< endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;

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

ll LCM(ll a,ll b){
    return a / GCD(a,b) * b;
}

const int MOD = 1000000007;

int main() {
    int r,d,x; cin >> r >> d >> x;
    for(int i = 0;i < 10;i++){
        cout << r * x - d << endl;
        x = r * x-d;
    }
}


Measured memory_bytes: 3624
#include <iostream>
#include <stdint.h>
#include <limits.h>
#include <utility>
#include <map>

using namespace std;
 
int main()
{
  unsigned N, M;
  cin >> N >> M;
 
  multimap<unsigned,unsigned> A;
 
  for (unsigned n=0; n<N; ++n) {
    unsigned a;
    cin >> a;

      A.emplace(make_pair(a,1));
  }

  for (unsigned m=0; m<M; ++m) {
    unsigned B, C;
    cin >> B >> C;


      A.emplace(make_pair(C,B));
  }
 
  uint64_t sum = 0;
  unsigned count = 0;
  for (auto itr=A.rbegin(); itr!=A.rend() && count<N; ++itr) {
    sum += (uint64_t)itr->first * min(N-count, itr->second);
    count += itr->second;
  }
 
  cout << sum << endl;
  
  return 0;
}

Measured memory_bytes: 9600
// sol1
#include<stdio.h>

int a[1001][1001];
int w, h, x, y, t, n;

void f(int x, int y, int mode)
{
    if(mode==1)
    {
        for(int i=1; i<=h; i++)
            for(int j=1; j<=x; j++)
                a[i][j]=1;
    }
    else if(mode==2)
    {
        for(int i=1; i<=h; i++)
            for(int j=x+1;j<=w; j++)
                a[i][j]=1;
    }
    
    else if(mode==3)
    {
        for(int i=1; i<=y ; i++)
            for(int j=1; j<=w; j++)
                a[i][j]=1;
    }
    
    else{
        for(int i=y+1; i<=h; i++)
            for(int j=1; j<=w; j++)
                a[i][j]=1;
    }
}

int main()
{
    scanf("%d %d %d",&w, &h, &n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d %d %d",&x, &y, &t);
        f(x, y, t);
    }
    int cnt=0;
    for(int i=1; i<=h; i++)
        for(int j=1; j<=w; j++)
            if(a[i][j]==0)
                cnt++;
    printf("%d",cnt);
}


// sol2
/*
#include<iostream>
using namespace std;
int main()
{
    int w, h, n, a, b, c, d;
    cin>>w>>h>>n;
    a =0, b = w, c =0, d = h;
    while( n--)
    {
        int x, y, m;
        cin>>x>>y>>m;
        if( m ==1) a = max( a, x );
        if( m ==2) b = min( b, x );
        if( m ==3) c = max( c, y );
        if( m ==4) d = min( d, y );
    }
    w =(b-a<0?0:b-a);
    h =(d-c<0?0:d-c);
    cout<<w*h<<endl;
    return 0;
}
*/

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

int main() {
	int N;
	long long p;
	long long k;

	cin >> N;

	p=0;
	for (long long i = 1; i <= N; i++) {
		k=N/i;
		p+=k*(k+1)/2*i;
	}
	cout << p << endl;
	return 0;
}


Measured memory_bytes: 3580
import java.util.*;
class Main{
    Scanner sc=new Scanner(System.in);
    void main(){
	int sum=0;
	for(int i=0;i<10;i++){
	    sum+=sc.nextInt();
	}
	System.out.println(sum);
	
    }
    public static void main(String[]ag){
	new Main().main();
    }
}

Measured memory_bytes: 26352
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
 
#define pb push_back
#define mp make_pair

typedef long long ll; 

#define fi first
#define se second
 
#define all(x) (x).begin(), (x).end()
 
using namespace std;             
//using namespace __gnu_pbds;
 
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void solve() {       

int n;
cin >> n;

double t = n - (n / 2);

cout.precision(6);

cout << fixed << t / n;

}           
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int tt = 1;
 
    while (tt--) {
        solve();
    }
 
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9+7;
int main(){
	
	int n; cin>>n;
	vector<int> a(n);
	for(auto &i:a) cin>>i;
	vector<int> b(3,-1);
	ll sum{1};
	for(int i=0; i<n; i++){
		bool flg{};
		int cnt{};
		for(int j=2; j>=0; j--){
			if(a.at(i)==b.at(j)+1){
				cnt++;
				if(!flg){
					flg=1;
					b.at(j)++;
				}
			}
		}
		(sum *= cnt) %= MOD;
	}
	cout << sum << endl;
	
}


Measured memory_bytes: 640
s = input()
alp = "abcdefghijklmnopqrstuvwxyz"

if len(s) < 26:
    for i in alp:
        if not i in s:
            ans = s + i
            break

else:
    tmp = []
    ss = list(s)
    for i in range(len(ss)):
        if i == 0:
            tmp.append(ss.pop())
            continue

        if alp.index(ss[-1]) > alp.index(tmp[-1]):
            tmp.append(ss.pop())
            continue
        else:
            remove = ss.pop()
            tmp.sort()
            for j in tmp:
                if j > remove:
                    renew = j
                    break
            ans = "".join(ss) + renew
            break
    else:
        ans = -1

print(ans)


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

ll inputValue(){
    ll a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    REP(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    REP(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

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

int main()
{
  ll A = inputValue();
  ll B = inputValue();
  ll g = gcd(max(A,B), min(A,B));
  vector<ll> soinsu;
  ll x = 2;
  ll c = g;
  while(x<=sqrt(g)){
    if(c % x == 0){
      soinsu.push_back(x);
      while(c % x == 0){
        c /= x;
      }
    }
    x++;
  }
  if(c>1)
	  soinsu.push_back(c);
  int ans = soinsu.size() + 1;
  cout << ans << endl;
}


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

typedef struct Node {
	int key;
	Node *prev, *next;
} Node;

Node* nil;
void init() {
	nil = (Node*) malloc(sizeof(Node));
	nil->next = nil->prev = nil;
}

void insertFirst(int key) {
	Node* x = (Node*) malloc(sizeof(Node));
	x->key = key;
	x->next = nil->next;
	x->prev = nil;
	nil->next->prev = x;
	nil->next = x;
}

Node* searchKey(int key) {
	Node* cur = nil->next;
	while (cur != nil && cur->key != key) {
		cur = cur->next;
	}
	return cur;
}

void deleteNode(Node *l) {
	if (l == nil) {
		return;
	}
	l->prev->next = l->next;
	l->next->prev = l->prev;
	free(l);
}

void deleteFirst() {
	deleteNode(nil->next);
}

void deleteLast() {
	deleteNode(nil->prev);
}

void deleteKey(int key) {
	deleteNode(searchKey(key));
}

int n, v;
string com;
int main() {
	init();
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> com;
		if (com.length() == 6) {
			cin >> v;
			if (com[0] == 'i') {
				insertFirst(v);
			} else {
				deleteKey(v);
			}
		} else {
			if (com[6] == 'F') {
				deleteFirst();
			} else {
				deleteLast();
			}
		}
	}
	for (Node* cur = nil->next; cur != nil; cur = cur->next) {
		if (cur != nil->next) {
			cout << " ";
		}
		cout << cur->key;
	}
	cout << endl;
}



Measured memory_bytes: 34284
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const int MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int a, b;
    scanf("%d %d", &a, &b);
    int ans = ((b / a >= 1) ? a : (a-1));
    cout << ans << "\n";
    return 0;
}

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

int main(){
    string x;
    cin>>x;
    while(x!="0"){
        int sum=0;
        for(int i=0; i<x.size(); ++i){
            sum+=x[i]-'0';
        }
        cout<<sum<<endl;
        cin>>x;
    }
    return 0;
}


Measured memory_bytes: 3180
import sys

x, n = map(int, input().split())

if n == 0:
    print(x)
    sys.exit()

p = [int(x) for x in input().split()]

for i in range(101):
    if not (x - i in p):
        print(x - i)
        break
    
    if not (x + i in p):
        print(x + i)
        break

Measured memory_bytes: 9208
#include <algorithm>
#include <iostream>
#include <string>
int main(){
	int a=0;
	std::string s,x;
	for(;std::cin>>s;){
		x=s;
		reverse(x.begin(),x.end());
		if (x==s) a++;
	}
	std::cout<<a<<"\n";
}

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

int main(){
  ll x;
  cin >> x;

  ll m = 100;
  int ans = 0;
  while(1){
    ans++;
    m = m + m * 0.01;
    if(m>=x) break;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3608
// -- telegram @rentixous --
// -- keep calm and slava ukraini --
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 2e5+1488;

signed main(){
    cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
    ll a, b;
    cin >> a >>b;
    if((b-a-a)<0||(b-a-a)%2==1) cout << "No\n";
    else{
        ll y= (b-a-a)/2;
        if(a-y<0) cout<<"No\n";
        else cout<<"Yes\n";
    }
}

Measured memory_bytes: 3600
from collections import defaultdict, deque
import sys


INF = float('inf')
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


ns = LI()
print(sum(sorted(ns)[:2]))


Measured memory_bytes: 3316
#include<stdio.h>
#include<stdlib.h>
#define MAX 100
#define N 100
int bubbleSort(int *,int n);
int main(){
  int A[MAX];
  int n,j,cnt=0,l;
  scanf("%d",&n);
  if(n>N){
    end(1);
  }
  for(j=0;j<n;j++){
    scanf("%d",&A[j]);
  }
  cnt=bubbleSort(A,n);
  for(j=0;j<n;j++){
    printf("%d",A[j]);
    if(j!=n-1){
      printf(" ");
    }
    if(j==n-1){
      printf("\n");
    }
  }
  printf("%d\n",cnt);
  return 0;
}

int bubbleSort(int *A, int n){
  int minj,i,j,t,l,cnt=0;
  for(i=0;i<n-1;i++){
    minj=i;
    for(j=i;j<n;j++){
      if(A[j]<A[minj]) minj=j;
    }     
    t=A[i];
    A[i]=A[minj];
    A[minj]=t;
    if(i!=minj)cnt++;
  }
  return cnt;
}

  



Measured memory_bytes: 2128
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>prime_factorize(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}
int main() {
  int X;
  cin>>X;
  if(X>=400&&X<600){cout<<8<<endl;}
  if(X>=600&&X<800){cout<<7<<endl;}
  if(X>=800&&X<1000){cout<<6<<endl;}
  if(X>=1000&&X<1200){cout<<5<<endl;}
  if(X>=1200&&X<1400){cout<<4<<endl;}
  if(X>=1400&&X<1600){cout<<3<<endl;}
  if(X>=1600&&X<1800){cout<<2<<endl;}
  if(X>=1800&&X<2000){cout<<1<<endl;}
  return 0;
}

Measured memory_bytes: 3628
#include <cstdio>  
using namespace std;  
int main() { 	
	int a,b,c,d,e; 	
	scanf("%d %d %d", &a, &b, &c); 	
	if(a*b<=c){
		printf("%d", a*b);
	}
	else{
		printf("%d",c);
	}

} 


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main() {
  int N, A, B, C, l[8];
  cin >> N >> A >> B >> C;
  for (int i = 0;i < N;++ i) cin >> l[i];
  int ans = 1e9;
  for (int i = 0;i < 1 << (N << 1);++ i) {
    int b[4] = {3, 0, 0, 0};
    for (int j = 0, k;j < N;++ j) b[k = (i >> (j << 1) & 3)] += k ? l[j] : 1;
    if (b[1] && b[2] && b[3]) ans = min(ans, abs(A - b[1]) + abs(B - b[2]) + abs(C - b[3]) + 10 * (N - b[0]));
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
# じょえチャンネルおもしろいよ～～～
# https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ

n=int(input())
a=[]
for i in range(n):
  aa,b=map(int,input().split())
  if aa==b:a.append("1")
  else:a.append("0")
if "111" in "".join(a):print('Yes')
else:print('No')

Measured memory_bytes: 9172
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String res = (s.nextInt() * 100 + s.nextInt() * 10 + s.nextInt()) % 4 == 0 ? "YES" : "NO";
        System.out.println(res);
    }
}


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

const int MAXN = 2003;

int n;
int a[MAXN];

int main() {
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	sort(a, a + n);
	int res = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			// we choose the maximum k where k > j, and a[k] < a[i] + a[j]
			int k = lower_bound(a + j, a + n, a[i] + a[j]) - a - 1;
			res += k - j;
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
n = int(input())
S, T = [], []
for _ in range(n):
    s, t = map(str, input().split())
    S.append(s)
    T.append(int(t))
X = str(input())

ind = S.index(X)
if ind < n-1:
    ans = sum(T[ind+1:])
if ind == n-1:
    ans = 0

print(ans)

Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <algorithm>
#define ri rd<int>
#define rep(i, a, b) for (int i = (a), _ = (b); i <= _; ++ i)
#define For(i, a, b) for (int i = (a), _ = (b); i < _; ++ i)
#define per(i, a, b) for (int i = (a), _ = (b); i >= _; -- i)
using namespace std;
typedef long long LL;
const int O = 1e9 + 7;
const int INF = 1e9 + 7;
const int maxN = 107;

template<class T> T rd() {
	bool f = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == '-') f = 0;
	T x = 0; for (; isdigit(c); c = getchar()) x = x * 10 + c - 48; return f ? x : -x;
}

template<class T> inline void apadd(int &x, T y) { x = (x + y) % O; }
inline void apmax(int &x, int y) { if (x < y) x = y; }
inline void apmin(int &x, int y) { if (x > y) x = y; }

int pwr(int x, int t) {
	int res = 1;
	for (; t; t >>= 1, x = 1LL * x * x % O)
		if (t & 1) res = 1LL * res * x % O;
	return res;
}

struct Node {
	int f[2][2][2][2];
	Node() { memset(f, 0, sizeof f); }

	Node flow(int t) const {
		if (t == 0) return *this;
		Node res;
		int tmp = pwr(2, t-1);
		rep (l, 0, 1) rep (r, 0, 1) rep (a, 0, 1) rep (b, 0, 1) {
			if (a || b) {
				if (t & 1) apadd(res.f[l^1][r^1][b][a], f[l][r][a][b]);
				else apadd(res.f[l][r][a][b], f[l][r][a][b]);
			}
			else {
				apadd(res.f[l^1][r^1][0][0], 1LL * f[l][r][0][0] * tmp);
				apadd(res.f[l][r][0][0], 1LL * f[l][r][0][0] * tmp);
			}
		}
		return res;
	}

	Node operator + (const Node &v) const {
		Node res;
		rep (l, 0, 1) rep (r, 0, 1) rep (a, 0, 1) rep (b, 0, 1) 
		rep (ll, 0, 1) rep (rr, 0, 1) rep (aa, 0, 1) rep (bb, 0, 1) 
			apadd(res.f[l][rr][a || aa || (r==0&&ll==0)][b || bb || (r==1&&ll==1)], 1LL * f[l][r][a][b] * v.f[ll][rr][aa][bb]);
		return res;
	}
}a[maxN];

int n;
int h[maxN];

Node solve(int l, int r, int dw) {
	int m1 = INF;
	rep (i, l, r) apmin(m1, h[i]);
	Node res;
	for (int i = l, j = i; i <= r; i = j + 1, j = i) {
		if (h[i] == m1) {
			Node tmp; tmp.f[0][0][0][0] = tmp.f[1][1][0][0] = 1;
			if (i == l) res = tmp;
			else res = res + tmp;
		}
		else {
			for (; j <= r && h[j] > m1; ++j); --j;
			Node tmp = solve(i, j, m1);
			if (i == l) res = tmp;
			else res = res + tmp;
		}
	}
	return res.flow(m1 - dw);
}

int main() {

	n = ri();
	rep (i, 1, n) h[i] = ri();
	
	Node res = solve(1, n, 1);
	LL ans = 0;
	rep (l, 0, 1) rep (r, 0, 1) rep (a, 0, 1) rep (b, 0, 1) ans += res.f[l][r][a][b];
	printf("%lld\n", (ans % O + O) % O);

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repa(i,arr,n) for(int i=arr;i<=n;i++)
#define repd(i,arr,n) for(int i=arr;i>=n;i--)
#define trav(arr,x) for(auto& arr:x)
#define all(c) c.begin(), c.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(arr) arr.size()
#define pi 3.14159265358979323846
#define MAX (1000*1000*1000+7)
#define inf (1000*1000*1000+9)
#define vi vector<int>
#define pii pair<int,int>
#define pqueue priority_queue<int>
#define pdqueue priority_queue<int,vi,greater<int> >

int32_t main()
{
  fast;
  
  int t;
  t=1;
  //cin>>t;
  while(t--)
  {
    int x,y,z,ans=0;
    cin>>x>>y>>z;
    vi v;
    v.pb(x);
    v.pb(y);
    v.pb(z);

    sort(all(v));

    ans+=((v[2]-v[0])/2);
    v[0]+=(2*((v[2]-v[0])/2));
    ans+=((v[2]-v[1])/2);
    v[1]+=(2*((v[2]-v[1])/2));

    sort(all(v));
    if(v[0]==v[1] && v[1]==v[2])
      cout<<ans<<endl;
    else
    {
      if(v[0]==v[1])
        cout<<ans+1<<endl;
      else
        cout<<ans+2<<endl;
    }

  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;

bool is_prime(int p){
    if(p <= 1) return false;
    for(int i = 2; i * i <= p; i++){
        if(p % i == 0) return false;
    }
    return true;
}
int main(){
    int x;
    cin >> x;
    int p = x;
    while(!is_prime(p)) p++;
    cout << p;
}

Measured memory_bytes: 256