akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define show(x) cout << #x << " = " << (x) << endl;
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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 () {
  ll n;
  cin >> n;

  auto d = [&](ll x) {
    ll res = 0;
    while (x > 0) {
      x /= 10;
      res++;
    }
    return res;
  };
  auto f = [&](ll a, ll b) {
    return max(d(a), d(b));
  };

  ll ans = INFLL;
  for (ll a = 1; a*a <= n; ++a) {
    if (n%a == 0) {
      ll b = n/a;
      ans = min(ans, f(a,b));
    }
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(b); i>=((int)(a)); i--)
#define all(a) a.begin(),a.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define sz(a) ((int)a.size())
#define pow2(x) (1ll<<(x))
#define print0(a) cout << (a) << ' '
#define print1(a) cout << (a) << '\n'
#define print2(a,b) cout << (a) << ' ',print1(b)
#define print3(a,b,c) cout << (a) << ' ',print2(b,c)
#define print4(a,b,c,d) cout << (a) << ' ',print3(b,c,d)
#ifdef i_am_noob
#define debug(a) print2(#a,a)
#else
#define debug(a) 
#endif
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
 
using namespace std;
using namespace __gnu_pbds;
 
const int Mod=1000000007,Mod2=998244353;
const int MOD=Mod2;
 
inline int add(int a, int b){return (a+b>=MOD?a+b-MOD:a+b);}
inline int sub(int a, int b){return (a+MOD-b>=MOD?a-b:a+MOD-b);}
int Pow(int a, int b){
	if(!b) return 1;
	int tmp=Pow(a*a%MOD,b>>1);
	return (b&1?tmp*a%MOD:tmp);
}
inline int inverse(int n){return Pow(n,MOD-2);}
 
const int maxn=100005;
//i_am_noob
int n,r;
 
signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	cin >> n >> r;
	print1(r+100*(10-min(n,10ll)));
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <climits>
#include "set"
#include "map"
#include "unordered_map"
#include <string>
#include <iomanip>
#include <numeric>
#include "cmath"

using namespace std;
#define double long double
#define int long long
#define all(a) a.begin(), a.end()
const int N = 3e5 + 50;

int T[4 * N];

void upd(int v, int tl, int tr, int pos, int val) {
	if (tl == tr) {
		T[v] = val;
		return;
	}
	int mid = (tl + tr) >> 1;

	if (pos <= mid)
		upd(v << 1, tl, mid, pos, val);
	if (pos > mid)
		upd(v << 1 | 1, mid + 1, tr, pos, val);

	T[v] = max(T[v<<1], T[v << 1 | 1]);
}

int getMax(int v, int tl, int tr, int l, int r) {
	if (tl == l && tr == r)
		return T[v];
	int mid = (tl + tr) >> 1;
	int ret = 0;
	if (l <= mid)
		ret = max(ret, getMax(v << 1, tl, mid, l, min(r, mid)));
	if (r > mid)
		ret = max(ret, getMax(v << 1 | 1, mid + 1, tr, max(l, mid + 1), r));

	return ret;
}

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

	int n, k; cin >> n >> k;

	vector<int> a(n);
	int maxx = 0;
	for (int i = 0; i < n; i++)
		cin >> a[i], maxx = max(maxx, a[i]);

	vector<int> dp(n);
	int ans = 0;
	for (int i = 0; i < n; i++) {
		int l = max(0ll, a[i] - k);
		int r = min(maxx, a[i] + k);

		int updVal = getMax(1, 0, maxx, l, r);

		dp[i] = updVal + 1;
		ans = max(ans, dp[i]);

		upd(1, 0, maxx, a[i], dp[i]);
	}

	cout << ans << '\n';



}

Measured memory_bytes: 16180
#include <iostream>
#include <array>
#include <queue>
#include <map>
#include <list>
#include <vector>
#include <string>
#include <limits>
#include <cassert>
#include <fstream>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <ciso646>
#include <cmath>

using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

#define inf INT_MAX/3
#define INF INT_MAX/3
#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define SET(a,c) memset(a,c,sizeof a)
#define CLR(a) memset(a,0,sizeof a)
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 2*acos(0.0)
#define INFILE() freopen("in0.txt","r",stdin)
#define OUTFILE()freopen("out0.txt","w",stdout)
#define in scanf
#define out printf
#define ll long long
#define ull unsigned long long
#define eps 1e-14
#define FST first
#define SEC second

ull f(ull n,ull b){
	if(n < b) return n;
	ull res = 0;
	while(n >= 1){
		res += n%b;
		n /= b;
	}
	return res;
}

signed main(void) {
	ull N; cin >> N;
	ull S; cin >> S;
	if(N==S){
		cout << N+1 << endl;
		return 0;
	}
	ull cut = sqrt(N)+1;
	if(N < S){
		cout << -1 << endl;
		return 0;
	}
	FOR(b,2,cut){
		if(f(N,b) == S){
			cout << b << endl;
			return 0;
		}
	}
	RFOR(p,1,cut+1){
		ull b = (N-S)/p + 1;
		if(b <= 1) continue;
		if(f(N,b) == S){
			cout << b << endl;
			return 0;
		}
	}
	cout << -1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <deque>
#include <numeric>
#include <sstream>
#include <iomanip>
#define ALL(X) X.begin(), X.end()
using lint = long long;
template <typename T>
void print_container(std::vector<T> vec)
{
    for (auto iter = vec.begin(); iter != vec.end(); ++iter)
    {
        std::cout << *iter << " ";
    }
    std::cout << std::endl;
}

int main()
{
    lint n, a;
    scanf("%lld", &n);
    scanf("%lld", &a);
    std::vector<lint> x(n);
    for (int i = 0; i < n; ++i)
    {
        lint x_e;
        scanf("%lld", &x_e);
        x[i] = x_e - a;
    }

    std::vector<std::vector<lint>> dp(n, std::vector<lint>(6000, 0));

    dp[0][x[0] + 3000] += 1;
    dp[0][3000] += 1;

    for (int i = 1; i < n; ++i)
    {
        for (int j = 100; j < 5900; ++j)
        {
            dp[i][j] = dp[i - 1][j - x[i]] + dp[i - 1][j];
        }
    }

    std::cout << dp[n - 1][3000] - 1 << "\n";

    return 0;
}


Measured memory_bytes: 5508
#include <iostream>

using namespace std;

int main() {
    int n, m;
    int taro[101], hanako[101];
    int taro_sum, hanako_sum;

    while (cin >> n >> m) {
        if (!n && !m) { break; }
        taro_sum = 0; hanako_sum = 0;
        for (int i = 0; i < n; i++) {
            cin >> taro[i];
            taro_sum += taro[i];
        }
        for (int i = 0; i < m; i++) {
            cin >> hanako[i];
            hanako_sum += hanako[i];
        }
        int diff = taro_sum - hanako_sum;
        int ans[2] = {101, 101};
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if ((taro[i] - hanako[j]) * 2 == diff && (taro[i] + hanako[j]) < (ans[0] + ans[1])) {
                    ans[0] = taro[i];
                    ans[1] = hanako[j];
                }
            }
        }
        if (ans[0] == 101 || ans[1] == 101) {
            cout << -1 << endl;
        }
        else {
            cout << ans[0] << " " << ans[1] << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3000
def make_max(xs)
  rs = []
  ac = xs[0]
  xs.each do |x|
    ac = [ac, x].max
    rs << ac
  end
  rs
end

n, c = gets.split.map(&:to_i)
xs = []
vs = []
vsum = 0
n.times {
  x, v = gets.split.map(&:to_i)
  xs << x
  vs << v
  vsum += v
}

cw = []
ccw = []

ac = 0
cur = 0
n.times do |i|
  x = xs[i]
  v = vs[i]
  ac += v - (x - cur)
  cur = x
  cw << ac
end

ac = 0
cur = 0
n.times do |i|
  x = c - xs[n - 1 - i]
  v = vs[n - 1 - i]
  ac += v - (x - cur)
  cur = x
  ccw << ac
end

cw_max = make_max(cw)
ccw_max = make_max(ccw)

ans = [0, cw.max, ccw.max].max

(n - 1).times do |i|
  ans = [ans, cw[i] - xs[i] + ccw_max[n-i-2]].max
  ans = [ans, ccw[i] - (c - xs[n-1-i]) + cw_max[n-i-2]].max
end

p ans


Measured memory_bytes: 6744
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,sum=0,cnt=0,cnt2=0,a[2000],i,j;
    string s;
    cin>>s;
    for(i=0;i<s.length();i++){
        if(s[i]=='0'&&i%2==0)
            cnt++;
        if(s[i]=='1'&&i%2)
            cnt++;
    }
    for(i=0;i<s.length();i++){
        if(s[i]=='1'&&i%2==0)
            cnt2++;
        if(s[i]=='0'&&i%2)
            cnt2++;
    }
    cout<<min(cnt,cnt2);
    
}


Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

/* define */
#define Yes(X) puts ( X ? "Yes" : "No")
#define YES(X) puts ( X ? "YES" : "NO")
#define FOR(i, a, b) for ( int i = a; i < b ; i++)
#define REP(i, n) for ( int i = 0; i < n ; i++)
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c))
#define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c))

/* const */
const int MOD = (int)1e9 + 7;

/* alias */
typedef long long ll;
typedef unsigned  u;

/* function */
int cmp(const void *a, const void *b) {
	return *(int*)a - *(int*)b;
}
int cmp2(const void *a, const void *b) {
	return *(int*)b - *(int*)a;
}
int gcd(int a, int b) {
	if (b != 0)return gcd(b, a % b);
	return a;
}
ll Lgcd(ll a, ll b) {
	if (b != 0) return Lgcd(b, a % b); 
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}
ll Llcm(ll a, ll b) {
	return a / Lgcd(a, b) * b;
}

/* main */


int main() {
	int a, b, c, d;
	scanf("%1d%1d%1d%1d", &a, &b, &c, &d);
	if (a + b + c + d == 7)printf("%d+%d+%d+%d=7\n",a, b, c, d);
	else if (a - b + c + d == 7)printf("%d-%d+%d+%d=7\n",a, b, c, d);
	else if (a - b - c + d == 7)printf("%d-%d-%d+%d=7\n",a, b, c, d);
	else if (a - b + c - d == 7)printf("%d-%d+%d-%d=7\n",a, b, c, d);
	else if (a - b - c - d == 7)printf("%d-%d-%d-%d=7\n",a, b, c, d);
	else if (a + b - c + d == 7)printf("%d+%d-%d+%d=7\n",a, b, c, d);
	else if (a + b - c - d == 7)printf("%d+%d-%d-%d=7\n",a, b, c, d);
	else if (a + b + c - d == 7)printf("%d+%d+%d-%d=7\n",a, b, c, d);
	return 0;
}

Measured memory_bytes: 128
#include<cmath>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
using namespace std;

const int inf = 0x3f3f3f3f;
typedef long long ll;
const double pi=4*atan(1.0);
int main()
{
    double r;
    scanf("%lf",&r);
    printf("%lf\n",2*pi*r);

    return 0;
}


Measured memory_bytes: 3812
#include <stdio.h>
#include <string.h>
int main(void){
  char ring[101],p[101],cpy[201];
  scanf("%s %s",ring,p);
  strcpy(cpy,ring);
  strcat(cpy,ring);
  if(strstr(cpy,p))
    puts("Yes");
  else
    puts("No");
  return 0;
}


Measured memory_bytes: 2108
N, K, Q = list(map(int, input().split()))
Alist = [int(input()) for i in range(Q)] 
Slist=[0]*N
for i in Alist:
  Slist[i-1]+=1
L=Q-K
for i in range(N):
  if Slist[i]>L:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 8636
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <iomanip>
#include <cmath>
#include <queue>
#include <deque>
#include <stack>
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2")
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long double ld;
typedef long long ll;
typedef double db;
#define endl '\n'
#define pb push_back
#define pii pair<ll, ll>
#define ff first
#define ss second
#define sz(x) (ll)(x).size()
#define optimize1() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#pragma warning(disable:4996)

using namespace std;
const ll MX = 1e5 + 10;
ll lead[MX], rang[MX], w[MX], n, m, res[MX], used[MX], ans = 0;
vector<pii> g[MX];
pair<ll, pii> edg[MX];

ll find(ll x) {
	//cout << x << endl;
	if (lead[x] == x)
		return x;
	return lead[x] = find(lead[x]);
}

void unite(ll a, ll b) {
	ll x = find(a);
	ll y = find(b);
	if (x == y)
		return;
	lead[x] = y;
	w[y] += w[x];
}


void dfs(ll v, ll val) {
	for (auto c : g[v]) {
		if (c.ff <= val && used[c.ff] == 0) {
			used[c.ff] = 1;
			dfs(c.ss, val);
			ans++;
		}
	}
}



signed main() {
    optimize1();
	cin >> n >> m;
	for (ll i = 1; i <= n; ++i) {
		cin >> w[i];
		lead[i] = i;
	}
	for (ll i = 0; i < m; ++i) {
		ll j, x, y;
		cin >> x >> y >> j;
		edg[i] = { j, {x, y} };
	}
	sort(edg, edg + m);

	for (ll i = 0; i < m; ++i) {
		ll x = edg[i].ss.ff, y = edg[i].ss.ss;
		g[x].push_back({ i, y });
		g[y].push_back({ i, x });
	}

	for (ll i = 0; i < m; ++i) {
		unite(edg[i].ss.ff, edg[i].ss.ss);
		res[i] = (w[lead[edg[i].ss.ss]] >= edg[i].ff);
	}
	for (ll i = m - 1; i >= 0; --i) {
		if (res[i] == 1)
			dfs(edg[i].ss.ff, i);
	}
	cout << m - ans << endl;
    return 0;
}


Measured memory_bytes: 20684
#include<iostream>

using namespace std;

int main()
{
	int n, N[100];
	cin >> n;
	for (int i = 0; i < n; i++)cin >> N[i];
	int i = 0, j;
	int flag = 1, v, count = 0;
	while (flag)
	{
		flag = 0;
		for (j = n - 1; j > i; j--)
		{
			if (N[j] < N[j - 1])
			{
				v = N[j];
				N[j] = N[j - 1];
				N[j - 1] = v;
				flag = 1;
				count++;
			}
		}
		i++;
	}
	for (j = 0; j < n - 1; j++)cout << N[j] << " ";
	cout << N[n - 1] << endl << count << endl;
    return 0;
}

Measured memory_bytes: 1160
const t={input:require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/),n:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.n())}return a}else{const a=t.input[0];t.input.shift();return Number(a)}},s:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.s())}return a}else{const a=t.input[0];t.input.shift();return String(a)}},c:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.c())}return a}else{let a=t.input[0].split('');const b=a[0];a.shift();if(a.length>0){t.input[0]=a.join('')}else{t.input.shift()}return String(b)}},o:(...arg)=>{console.log(...arg)},abs:(a)=>{return Math.abs(a)},min:(...a)=>{return Math.min(...a)},max:(...a)=>{return Math.max(...a)},floor:(a)=>{return Math.floor(a)},asc:(ar:number[])=>{return ar.sort((a,b)=>{return a-b})},desc:(ar:number[])=>{return ar.sort((a,b)=>{return b-a})},sw:(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1];}return arr[arr.length-1]}};
const main=()=>{
  let [a,b,k]=t.n(3),c=0,i=t.min(a,b)+1
  while(c!=k){
    i--
    if(a%i==0&&b%i==0)c++
  }
  t.o(i)
}
main()

Measured memory_bytes: 9420
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int n;
  cin >> n;
  vector<int>t(n+1);
  vector<int>x(n+1);
  vector<int>y(n+1);
  for(int i = 1;i<n+1;i++){
  cin >> t.at(i) >> x.at(i) >> y.at(i);
  }
  int flag=0;
  int kyori = 0;
  int time = 0;
  for(int i = 1;i<n+1;i++){
    kyori = abs(x.at(i)-x.at(i-1))+abs(y.at(i)-y.at(i-1));
    time =  abs(t.at(i)-t.at(i-1));
    if(kyori > time){
      flag = 1;
      break;
    }
    if(kyori%2==0&&time%2==0 || kyori%2!=0&&time%2!=0);
    else{
      flag = 1;
      break;
    }
  }
  if(flag==1) cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
}

Measured memory_bytes: 1408
#include<iostream>

using namespace std;

int main(){
int x,y;
cin >> x;
cin >> y;

if(x>y){
cout << "a > b" <<endl;
}
else if(x<y){
cout << "a < b" <<endl;
}
else{
cout << "a == b" <<endl;
}


return 0;
}


Measured memory_bytes: 3120
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		String input = sc.nextLine();
		input = sc.nextLine();
		
		
		
		int b = sc.nextInt();
		
		StringBuilder s =new StringBuilder();
		s.append(input);
		
		String t = s.substring(b-1,b);
		
		
		
		for(int i = 1; i <= a; i++) {
			if(t.equals(s.substring(i-1,i)) != true) {
				s.replace(i-1, i,"*");
			}
		}
		
	
		System.out.println(s);
		
	}

}


Measured memory_bytes: 21844
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int f(ll n) {
    int x = 0;
    
    while(1) {
        if(n == 0) {
            break;
        }
        n /= 10;
        x++;
    }

    return x;
}

int main() {
    ll N, A, B;
    cin >> N;
    int ans = 20;

    for(A = 1; A*A <= N; A++) {
        if(N % A == 0) {
            B = N/A;
            ans = min(ans, f(B));
        }
    }

    cout << ans;

    cout << endl;
    return 0;
}

Measured memory_bytes: 256
x = int(input())
s=list(input())
tmp1 = s[0]
tmp2 = s[1]
tmp3 = s[2]
c = 0
if tmp1+tmp2+tmp3 == 'ABC':
        c += 1
for i in range(len(s)-3):
    tmp1 = tmp2
    tmp2 = tmp3
    tmp3 = s[i+3]
    if tmp1+tmp2+tmp3 == 'ABC':
        c += 1
    else:
        continue
print(c)

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int i = 1;
    while(a > 0 && c > 0)
    {
        if (i % 2 != 0) c -= b;
        else a -= d;
        i++;
    }
    if (c <= 0) cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 3628
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
using namespace std;
int za[1002][1002],suu[1002][1002];
int main(void)
{
	int i,j,h,w,n,x,y;
	while(1) {
		scanf("%d %d %d",&h,&w,&n);
		if(h==0 && w==0 && n==0) break;
		for(i=1;i<=h;i++) {
			for(j=1;j<=w;j++) {
				scanf("%d",&za[i][j]);
			}
		}
		for(i=1;i<=h;i++) {
			for(j=1;j<=w;j++) {
				suu[i][j]=0;
			}
		}
		suu[1][1]=n-1;
		for(i=1;i<=h;i++) {
			for(j=1;j<=w;j++) {
				if(suu[i][j]%2==0) {
					suu[i+1][j]+=suu[i][j]/2;
					suu[i][j+1]+=suu[i][j]/2;
				}
				else if(suu[i][j]%2==1) {
					if(za[i][j]==0) {
						suu[i+1][j]+=suu[i][j]/2+1;
						suu[i][j+1]+=suu[i][j]/2;
						za[i][j]=1;
					}
					else {
						suu[i][j+1]+=suu[i][j]/2+1;
						suu[i+1][j]+=suu[i][j]/2;
						za[i][j]=0;
					}
				}		
			}
		}
		x=1;
		y=1;
		while(1) {
			if(za[x][y]==1) y++;
			else x++;
			if(x==h+1 || y==w+1) break;
		}
		printf("%d %d\n",x,y);
	}
	return 0;
}

Measured memory_bytes: 8868
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

int main(void){
    long n;
    cin >> n;
    vector<long> a;
    a.reserve(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }
    long ret = 0, mul = a[0];
    for(int i = 1; i < n; ++i){
        ret = (ret + (a[i] * mul) % 1000000007) % 1000000007;
        mul = (mul + a[i]) % 1000000007;
    }
    cout << ret << endl;
    return 0;
}

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

int main(){
    string n;
    cin >> n;
    int K;
    cin >> K;
    int size = n.length();
    int dp[105][4][2] = {0};
    dp[0][0][0] = 1;
    rep(i, size) rep(j, 4) rep(k, 2){
        int nd = n[i] - '0';
        rep(d, 10) {
            int ni = i+1, nj = j, nk = k;
            if ( d != 0 ) ++nj;
            if ( nj > K ) continue;
            if ( k == 0 ) {
                if ( d > nd ) continue;
                if ( d < nd ) nk = 1;
            }
            dp[ni][nj][nk] += dp[i][j][k];
        }
    }
    cout << dp[size][K][0] + dp[size][K][1] << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

        int n = Integer.parseInt(sc.nextLine());
        int[] array = new int[n];
        String[] input = sc.nextLine().split(" ");
        
        for(int i = 0; i < n; i++){
            array[i] = Integer.parseInt(input[i]);
        }

        int count = 0;
        int k = 0;
        while(k < n-1){
            for(int i = n-1; i > k; i--){
                if(array[i] < array[i-1]){
                    int tmp = array[i];
                    array[i] = array[i-1];
                    array[i-1] = tmp;
                    count++;
                }
            }
            k++;
        }

        StringBuilder sb = new StringBuilder();

        for(int i : array)
            sb.append(i + " ");
        
        sb.deleteCharAt(sb.length()-1);

        System.out.println(sb);
        System.out.println(count);
    }
}


Measured memory_bytes: 26192
#include<iostream>
#include<cmath>
#include<stdio.h>
using namespace std;

int main(){
    double x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    //cout<<sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))<<endl;
    printf("%.5f\n",sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));
    return 0;
}


Measured memory_bytes: 3208
#include <stdint.h>
#include <algorithm>
#include <bitset>
#include <functional>
#include <iostream>
#include <string>
#include <vector>

int main(int argc, char *argv[]) {
  int n, odds = 0, evens = 0, podds = 0, pevens = 0, tmp;
  std::cin >> n;
  for (int i = 0; i < n; i++) {
    std::cin >> tmp;
    if (tmp & 1)
      odds++;
    else
      evens++;
  }
  int count = 1;
  for (int i = 0; i < n; i++) count *= 3;
  int count1 = 1;
  if (evens) count1 <<= evens;
  std::cout << count - count1 << std::endl;
  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;

struct UnionFind {
        int n;
        vector<int> parent;
        vector<int> rank;
        vector<int> num;
        int find(int x) {
                if (parent[x] == x) return  x;
                return parent[x] = find(parent[x]);
        }
        UnionFind(int n_) {
                n = n_;
                parent.resize(n);
                for (int i = 0; i < n; i ++) parent[i] = i;
                rank.assign(n, 0);
                num.assign(n, 1);
        }
        void unite(int x, int y) {
                if ((x = find(x)) != (y = find(y))) {
                        if (rank[x] < rank[y]) {
                                parent[x] = y;
                                num[y] += num[x];
                        } else {
                                parent[y] = x;
                                if (rank[x] == rank[y]) rank[x] ++;
                                num[x] += num[y];
                        }
                        n --;
                }
        }
        bool same(int x, int y) { return find(x) == find(y); }
        int get() { return n; }
        int get(int x) { return num[find(x)]; }
};

int main() {
	int n;
	scanf("%d", &n);
	vector<int> a(n);
	rep(i, n) {
		scanf("%d", &a[i]);
		a[i] --;
	}
	vector<int> pos(n, -1);
	UnionFind uf(n);
	rep(i, n) {
		pos[a[i]] = i;
		if (a[i] > 0 && pos[a[i] - 1] >= 0) {
			uf.unite(i, pos[a[i] - 1]);
		}
	}
	int ma = 0;
	rep(i, n) {
		ma = max(ma, uf.get(i));
	}
	printf("%d\n", n - ma);
        return 0;
}


Measured memory_bytes: 4224
def BubbleSort(A, N):
    cnt = 0 # swap???????????£????????°????¨???????????????°
    flag = 1 # flag = 1????????????????????????????????£??????????????¨?????????

    while flag:
        flag = 0

        for j in range(N - 1, 0, -1):
            if A[j] < A[j - 1]:
                A[j] , A[j - 1] = A[j - 1], A[j]
                cnt += 1
                flag = 1

    # swap???????????£????????°?????????
    return cnt


N = int(input())
A = [int(a) for a in input().split()]

cnt = BubbleSort(A, N)

print(*A)
print(cnt)

Measured memory_bytes: 7744
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<stack>
#include<queue>
using namespace std;
typedef long long ll;

const int maxn = 200010;

int n,m;
int cnt[maxn];

ll read(){ ll s=0,f=1; char ch=getchar(); while(ch<'0' || ch>'9'){ if(ch=='-') f=-1; ch=getchar(); } while(ch>='0' && ch<='9'){ s=s*10+ch-'0'; ch=getchar(); } return s*f; }

int main(){
	int u,v;
	n = read() ,m = read();
	for(int i=1;i<=m;i++){
		u = read(), v = read();
		++cnt[u],++cnt[v];
	}
	for(int i=1;i<=n;i++){
		printf("%d\n",cnt[i]);
	}
	
	return 0;
}

Measured memory_bytes: 3732
/*
    Auther: ghoshashis545 Ashis Ghosh
    College: jalpaiguri Govt Enggineerin College
    Date:17/03/2020
*/
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define ll long long 
#define ld long double
#define ff first
#define ss string 
#define se second
#define alt(v) v.begin(),v.end()
#define pb emplace_back
#define mp make_pair
#define tc(t) cin>>t;while(t--)
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define fab(i,a,b) for(ll i=(a);i<(b);i++)
#define fba(i,a,b) for(ll i=(b);i>=(a);i--)
#define arr(i,n) fab(i,0,n)
ll max(ll a,ll b){if(a>b)return a;else return b;} 
ll min(ll a,ll b){if(a<b)return a;else return b;}
const ll inf=0x3f3f3f3f;

vector<int>primeFactorization(int n)
{
    vector<int>prime_fact;
    for(int i=2;i<=sqrt(n);++i)
    {
        while(n%i==0)
        {
            prime_fact.push_back(i);
            n/=i;
        }
    }
    if(n!=1)
    prime_fact.push_back(n);
    return prime_fact;
}

vector<int>sieve(int n)
{
    bool primes[n+5];
    memset(primes,true,sizeof(primes));
    vector<int>res;//res vector all the prime no between 1 to n
    for(int i=2;i<=sqrt(n);++i)
    {
        if(primes[i]==true)
        {
            res.push_back(i);
            for(int j=i*2;j<=n;j+=i)
            primes[j]=false;
        }
    }
    return res;
}








ll const Mxn=1e5;
bool test=0;
void solve()
{
    ll n,x,f=0,q,c,ans=0,i,m;
    cin>>n;
    vector<ll>h(n),dp(n);
    for(auto &x:h)
    cin>>x;
    dp[0]=0;
    dp[1]=abs(h[1]-h[0]);
    fab(i,2,n)
        dp[i]=min((dp[i-1]+abs(h[i]-h[i-1])),(dp[i-2]+abs(h[i]-h[i-2])));
    cout<<dp[n-1];
}





























int main()
{
    fio;
    ll t=1,s;
    if(test)
    cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int a,b,c,n[4];
    while(cin>>a>>b>>c)
    {
        n[0]=a;
        n[1]=b;
        n[2]=c;
        sort(n,n+3);
        if(n[0]!=n[1])
            cout<<n[0]<<endl;
        else
            cout<<n[2]<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)
#define setp(X,Y) cout<<fixed<<setprecision(Y)<<X;
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

signed main(){
	string S,T;
	cin>>S>>T;
	cout<<T<<S<<endl;
	return 0;
}


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

black = [0 for _ in range(len(s) + 1)]
white = [0 for _ in range(len(s) + 1)]
for i in range(len(s)):
    if s[i] == ".":
        white[i] = 1
    else:
        black[i] = 1
for i in reversed(range(len(black)-1)):
    black[i] += black[i + 1]
    white[i] += white[i + 1]
# print(black)
# print(white)
cost = 0
_min = 10**10
for i in range(len(black)-1):
    if s[i] == "#":
        _min = min(_min, cost + white[i])
        cost += 1
    # print("i:{} cost:{} _min:{}".format(i, cost, _min))
print(min(cost, _min))

Measured memory_bytes: 19364
from heapq import heappush, heappop

N, K = map(int, input().split())
A = [int(i) for i in input().split()]

while K and sum(A) < N * N :
  l = [0] * N
  h = []
  for i in range(N) :
    while h and h[0] < i :
      heappop(h)
    l[i] = len(h)
    heappush(h, (i + A[i]))
    
  r = [0] * N
  h = []
  for i in range(N - 1, -1, -1) :
    while h and h[0] < -i :
      heappop(h)
    r[i] = len(h)
    heappush(h, (-(i - A[i])))
    
  for i in range(N) :
    A[i] = l[i] + r[i] + 1
    
  K -= 1
  
print(*A)

Measured memory_bytes: 185284
#!/usr/bin/env python3
import sys
from itertools import combinations


def make_deletables(n):
    return list(combinations(range(1, n), 2))


def delete_2len(edges, n, n_delete):
    candidates = make_deletables(n)
    for k, v in candidates[:n_delete]:
        edges[k].append(v)
    return edges


def make_ball(n):
    return {i: [n] for i in range(1, n)}


def is_possible(n, k):
    return k <= ((n - 1) * (n - 2) // 2)


def calc_n_delete(n, k):
    return ((n - 1) * (n - 2) // 2) - k


def list_dict_to_tpls(dic):
    tpls = []
    for k, lis in dic.items():
        tpls += [(k, l) for l in lis]
    return tpls


def solve(N: int, K: int):
    if not is_possible(N, K):
        print(-1)
        return
    edges_dict = make_ball(N)
    n_delete = calc_n_delete(N, K)
    edges_dict = delete_2len(edges_dict, N, n_delete)
    edges_tpls = list_dict_to_tpls(edges_dict) 
    print(len(edges_tpls))
    for i, j in edges_tpls:
        print(i, j)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 4116
import fnmatch
S = input()
T = input()
 
def str_match(s, pattern):
  return fnmatch.fnmatch(pattern, s)

def build_ans(start, s, t):
  res = list(s.replace("?", "a"))
  res[start:start + len(t)] = t
  return "".join(res)

ans = []
for i in range(len(S)):
  if(i + len(T) <= len(S)):
    if(str_match(S[i:i + len(T)], T)):
      ans.append(build_ans(i,S,T))
ans.sort()
if(len(ans) > 0):
  print(ans[0])
else:
  print("UNRESTORABLE")



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

int main()
{
    int n; cin>>n;
    char c;
    set<char> s;
    string arr[]={"","","","Three","Four"};
    for(int i=0 ; i < n; ++i){
        cin>>c;
        s.insert(c);
    }
    puts(arr[s.size()].c_str());
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int n, q; cin >> n >> q;
	vi v(300001, -1);
	rep(i, n){ int x; cin >> x; v[x] = x; }
	for(int i = 1; i < v.size(); i++) v[i] = max(v[i], v[i - 1]);
	
	while(q--){
		int x, ans = 0; cin >> x;
		for(int i = x - 1, m = 0; i < v.size(); i += x, m += x){
			ans = max(ans, v[i] - m);
		}
		cout << ans << endl;
	}
	return 0;
}


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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod (ll)(1e9 +7);

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef string ss;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}

ll digsum(ll n){
    ll sum = 0;
    while(n > 0){
        sum += n % 10;
        n /= 10;
    }

    return sum;
}

int main()
{
    ll n,m,c;
    cin >> n >> m >> c;
    vll b(m);
    ll a[n][m];
    rep(i,m)cin >> b[i];

    ll ans = 0;
    rep(i,n){
        ll sum = 0;
        rep(j,m){
            cin >> a[i][j];
            sum += a[i][j] * b[j];
        }
        sum += c;
        //cout << sum << endl;

        if(sum > 0)ans++;
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int N, a[100000];
int flag[100000] = { 0 };
int ans = 0;

int main() {
	scanf("%d", &N);
	for (int i = 0; i < N; ++i) { scanf("%d", &a[i]); }

	// TLE解法
	/*for (int i = 0; i < N - 1; ++i) {
		for (int j = i; j < N; ++j) {
			if (i+1 == a[j] && a[i] == j+1) { ans++; }
		}
	}*/

	for (int i = 0; i < N; ++i) {
		if (i + 1 == a[a[i] - 1]) {
			if (flag[i] == 0 && flag[a[i] - 1] == 0) {
				ans++;
				flag[i] = 1;
				flag[a[i] - 1] = 1;
			}
		}
	}

	printf("%d", ans);

	return 0;
}

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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

// repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) for (long long i = 0; i < (n); ++i)

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

  string first;
  string last;

  int q;
  cin >> q;

  bool is_reverse = false;

  REP(i, q) {
    int t;
    cin >> t;

    if (t == 1) {
      is_reverse = !is_reverse;
    } else if (t == 2) {
      int f;
      char ch;
      cin >> f >> ch;
      if (f == 1 && !is_reverse) {
        first.push_back(ch);
      } else if (f == 2 && !is_reverse) {
        last.push_back(ch);
      } else if (f == 1 && is_reverse) {
        last.push_back(ch);
      } else if (f == 2 && is_reverse) {
        first.push_back(ch);
      }
    }
  }

  string ans;
  if (is_reverse) {
    reverse(last.begin(), last.end());
    reverse(s.begin(), s.end());
    ans = last + s + first;
  } else {
    reverse(first.begin(), first.end());
    ans = first + s + last;
  }
  ANS(ans);
  return 0;
}


Measured memory_bytes: 1348
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <cassert>

using namespace std;

const int mod = 1000000007;

int gcd(int a, int b){
    if (a)
        return gcd(b % a, a);
    return b;
}

char c[105][105];
int num[30];

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n, m, k;
    cin >> n >> m ;
    for (int  i= 0 ; i< n; i++)
        for (int j = 0; j < m; j++){
            cin >> c[i][j];
            num[c[i][j] - 'a']++;
        }
    bool is = 0;
    int sum = 0;
    for (int i = 0; i < 26; i++){
        if (num[i] % 2 != 0){
            if ((n % 2 == 0 || m % 2 == 0 || is)){
                cout << "No";
                return 0;
            }
            is = true;
            if ((num[i] - 1) % 4 == 2)
                sum += 2;
        }else
        if (num[i] != 0){
            if (num[i] % 4 == 2)
                sum += 2;
        }
    }
    int nm = 0;
    if (n % 2 == 1 && m % 2 == 1){
        nm = n - 1 + m - 1;
    }else
    if (n % 2 == 1 || m % 2 == 1){
        nm = (n % 2 == 1 ? m : n);
    }else
        nm = 0;
    if (nm < sum)
        cout << "No";
    else
        cout << "Yes";
    return 0;
}


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

int main() {
  int x = 0, a = 0, b = 0, c = 0;
  cin >> x;
  a = x/100;
  c = x%2;
  b = x/10 % 2;
  cout << a+b+c << endl;
}

Measured memory_bytes: 3636
N = int(input())
A = list(map(int,input().split()))

D = [0] * (10**6 + 1)
A.sort()
for i in range(N):
    D[A[i]] += 1
    
ans = 0
for i in range(1, 10**6+1):
    if D[i]:
        if D[i]==1:
            ans += 1
        for j in range(i,A[-1]+1,i):
            D[j] = 0
print(ans)

Measured memory_bytes: 103336
S = input()
s1 = int(S[:2])
s2 = int(S[2:])

if 1 <= s1 <= 12:
    if 1 <= s2 <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif 1 <= s2 <= 12:
    print('YYMM')
else:
    print('NA')

Measured memory_bytes: 38256
#include <iostream>
#define llint long long
#define mod 1000000007

using namespace std;

const int FACT_MAX = 200005;
llint fact[FACT_MAX], fact_inv[FACT_MAX];

llint modpow(llint a, llint n)
{
	if(n == 0) return 1;
	if(n % 2){
		return ((a%mod) * (modpow(a, n-1)%mod)) % mod;
	}
	else{
		return modpow((a*a)%mod, n/2) % mod;
	}
}

void make_fact()
{
	llint val = 1;
	fact[0] = 1;
	for(int i = 1; i < FACT_MAX; i++){
		val *= i;
		val %= mod;
		fact[i] = val;
	}
	fact_inv[FACT_MAX-1] = modpow(fact[FACT_MAX-1], mod-2);
	for(int i = FACT_MAX-2; i >= 0; i--){
		fact_inv[i] = fact_inv[i+1] * (i+1) % mod;
	}
}

llint comb(llint n, llint k)
{
	llint ret = 1;
	ret *= fact[n];
	ret *= fact_inv[k], ret %= mod;
	ret *= fact_inv[n-k], ret %= mod;
	return ret;
}

llint n, a, b, c;

int main(void)
{
  cin >> n >> a >> b >> c;
  make_fact();
  a *= modpow(100, mod-2), a %= mod;
  b *= modpow(100, mod-2), b %= mod;
  c *= modpow(100, mod-2), c %= mod;

  llint ans = 0;
  llint A = a * modpow((a+b)%mod, mod-2) % mod, B = b * modpow((a+b)%mod, mod-2) % mod;
  for(int i = n; i <= 2*n-1; i++){
    llint tmp = comb(i-1, n-1) * modpow(A, n) % mod * modpow(B, i-n) % mod;
    tmp += comb(i-1, n-1) * modpow(B, n) % mod * modpow(A, i-n) % mod, tmp %= mod;
    tmp *= i, tmp %= mod;
    ans += tmp, ans %= mod;
  }
  ans *= modpow((a+b)%mod, mod-2), ans %= mod;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3328
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<cstdio>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ppi pair<pii,int>
#define pip pair<int,pii>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define inf 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}

void solve(){
	string s;
	cin>>s;
	int ans=0;
	for(char ch:s){
		if(ch=='+')ans++;
		else ans--;
	}
	cout<<ans;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 3184
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <set>
#include <map>
#include <queue>

using namespace std;

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

const ll MOD = 1000000007;
const ll inf = (ll) 1e18;

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

  int n;
  cin >> n;
  vector<int> l(n);
  for (auto &x: l) cin >> x;

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

  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i+1; j < n; j++) {
      for (int k = j+1; k < n; k++) {
        if (l[i] + l[j] > l[k] && l[j] + l[k] > l[i] && l[k] + l[i] > l[j]) ans++;
      }
    }
  }

  cout << ans << endl;

  return 0;
}


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

int main(){
  int P;
  cin >> P;
  int Q;
  cin >> Q;
  int R;
  cin >> R;
  
  if(P>=Q && P>=R){
    cout << Q+R << endl;
  }
  
  else if (Q>=P && Q>=R){
    cout << P+R << endl;
  }
  
  else if(R>=P && R>=Q){
    cout << P+Q << endl;
  }
}

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

const int N = 3;

class Puzzle {
public:

	int p[N][N];
	pair<int, int> space;
	int count;

	bool operator < (const Puzzle &a) const {
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < N; ++j) {
				if (p[i][j] == a.p[i][j])
					continue;
				return p[i][j] < a.p[i][j];
			}

		}
		return false;
	}
};


void printPuzzle(const Puzzle &a) {

	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N; ++j) {
			cout << a.p[i][j] << " ";
		}
		cout << endl;
	}

	int x;
	cin >> x;
}


bool isSolve(const Puzzle &p) {

	int count = 1;
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N; ++j) {
			if (p.p[i][j] != count)
				return false;
			count++;
		}
	}

	return true;
}

int bfs(Puzzle &p) {

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

	queue<Puzzle> Q;
	map<Puzzle, bool> M;
	Q.push(p);
	int count = 0;
	M[p] = true;

	while (!Q.empty()) {
		Puzzle nowPuzzle = Q.front();
		Q.pop();

		if (isSolve(nowPuzzle))
			return nowPuzzle.count;

		for (int i = 0; i < 4; ++i) {
			int nextX = nowPuzzle.space.first + dx[i];
			int nextY = nowPuzzle.space.second + dy[i];

			if (nextX < 0 || N <= nextX || nextY < 0 || N <= nextY)
				continue;

			Puzzle nextPuzzle = nowPuzzle;
			nextPuzzle.space = make_pair(nextX, nextY);
			swap(nextPuzzle.p[nextX][nextY], nextPuzzle.p[nowPuzzle.space.first][nowPuzzle.space.second]);
			if (!M[nextPuzzle]) {
				M[nextPuzzle] = true;
				nextPuzzle.count++;
				Q.push(nextPuzzle);
				// cout << nextPuzzle.count << endl;
				// printPuzzle(nextPuzzle);
			}

		}
	}

	return -1;
}

int main() {

	Puzzle puzzle;

	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N; ++j) {
			cin >> puzzle.p[i][j];

			if (puzzle.p[i][j] == 0) {
				puzzle.p[i][j] = 9;
				puzzle.space = make_pair(i, j);
				puzzle.count = 0;
			}

		}
	}

	cout << bfs(puzzle) << endl;

	return 0;

}


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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    bool ans = true;
    rep(i,n-1){
        if(a[i]==a[i+1]) ans = false;
    } 
    if(ans) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 4008
import java.util.Scanner;

/**
 * https://atcoder.jp/contests/abc136/tasks/abc136_b
 */
public class Main {

  private static int answer(int n) {
    int count = 0;
    count += Math.min(n, 9);
    if (n >= 100) {
      count += Math.min(n, 999) - 99;
    }
    if (n >= 10000) {
      count += Math.min(n, 99999) - 9999;
    }

    return count;
  }

  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    scan.close();

    System.out.println(answer(n));
  }
}


Measured memory_bytes: 21588
#include<stdio.h>
int table[10001];
int main(){
	for(int i=2;i<10001;i++){
		if(table[i]==0){
			table[i]=1;
			for(int j=i*2;j<10001;j+=i)table[j]=2;
		}
	}
	int a;
	while(scanf("%d",&a),a){
		int max=0;
		for(int i=5;i<=a;i++)if(table[i]==1&&table[i-2]==1)max=i;
		printf("%d %d\n",max-2,max);
	}
}

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

int main() {
  int N;
  int res=0;
  vector<int>V(55);
  vector<int>C(55);
  vector<int>P(55);
  vector<int>Q(55);
  cin >> N;
  for(int i=0; i<N; i++) {
  cin >> V.at(i);
}
  for(int i=0; i<N; i++) {
  cin >> C.at(i);
}
  for(int i=0; i<N; i++) {
  P.at(i) = V.at(i)-C.at(i);
}
  int k=0;
  for(int i=0; i<N; i++) {
    if(P.at(i)>0){
      Q.at(k) = P.at(i);
      k++;
    }
}
   for(int i=0; i<k; i++) {
    res += Q.at(i);
}
  cout << res << endl;
}

Measured memory_bytes: 256
s = list(input())
n = len(s)
s_r = list(reversed(s))

cnt0 = 0
ss0 = False
for a,b in zip(s,s_r):
    if a == b:
        cnt0 += 1
    if cnt0 == len(s):
        ss0 = True

cnt1 = 0
ss1 = False
s1 =s[0:(n-1)//2]
s1_r = list(reversed(s1))
for a,b in zip(s1,s1_r):
    if a == b:
        cnt1 += 1
    if cnt1 == len(s1):
        ss1 = True
        
cnt2 = 0
ss2 = False
s2 =s[(n+3)//2-1:n]
s2_r = list(reversed(s2))
for a,b in zip(s2,s2_r):
    if a == b:
        cnt2 += 1
    if cnt2 == len(s2):
        ss2 = True
        
if ss0 and ss1 and ss2:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 9112