akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 100010;
const int MAXK = 510;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
  string s, t;
  cin >> s >> t;
  if (s[0] == t[2] && s[1] == t[1] && s[2] == t[0]) cout << "YES";
  else cout << "NO";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <functional>

using namespace std;
using ll = long long;

#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define REP(i,n) for(int i = 0; i < int(n); i++)
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VL vector<ll>
#define PAIR pair<int,int>
#define MP make_pair
#define VP vector<pair<int,int>>
#define VS vector<string>
#define PQUE priority_queue<int> //5,5,4,3,3,2,...
#define REPQUE priority_queue<int, vector<int>, greater<int>> //1,1,2,3,4,4,5,...
#define SUM(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SORT(obj) ((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) ((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

const ll MOD = (ll)1e9 + 7;


int main() {
	int N;
	ll Z, W;
	cin >> N >> Z >> W;
	VL a(N);
	REP(i, N) cin >> a[i];
	if (N == 1) {
		cout << abs(W - a[N - 1]) << endl;
		return 0;	
	}
	cout << max((abs(W - a[N - 1])),(abs(a[N - 2] - a[N - 1])));
		
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        StringBuilder a = new StringBuilder(scanner.nextLine());
        int b = Integer.parseInt(scanner.nextLine());
        for (int i = 0; i < b; i++) {
            String[] c = scanner.nextLine().split(" ");
            int d = Integer.parseInt(c[1]);
            int e = Integer.parseInt(c[2]) + 1;
            if (c[0].equals("print")) {
                System.out.println(a.substring(d, e));
            } else if (c[0].equals("reverse")) {
                StringBuilder builder = new StringBuilder(a.substring(d, e))
                        .reverse();
                a.replace(d, e, builder.toString());
            } else {
                a.replace(d, e, c[3]);
            }
 
        }
    }
}



Measured memory_bytes: 28244
#include <stdio.h>
#define MAX 2000001
#define VMAX 10001

int main() {

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

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

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

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

  return 0;
}






Measured memory_bytes: 17464
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <algorithm>
#include <vector>
#define R register
#define IN inline
#define W while
#define gc getchar()
#define db long double
#define ll long long
#define MX 16
template <class T>
IN void in(T &x)
{
	x = 0; R char c = gc;
	for (; !isdigit(c); c = gc);
	for (;  isdigit(c); c = gc)
	x = (x << 1) + (x << 3) + c - 48;
}
int n, all, cnt;
int bel[MX];
std::vector <int> st;
struct INFO {int x, y, val;} dat[MX];
struct Edge {int from, to; db len;} edge[MX * MX];
IN bool operator < (const Edge &x, const Edge &y)
{return x.len < y.len;}
db res[1 << MX];
IN ll sqr(R int x) {return 1ll * x * x;}
IN db calc(R int x, R int y)
{return sqrtl(sqr(dat[x].x - dat[y].x) + sqr(dat[x].y - dat[y].y));}
int find(R int now) {return bel[now] == now ? now : bel[now] = find(bel[now]);}
IN db MST(R int stat)
{
	st.clear(); cnt = 0;
	db ret = 0;
	for (R int i = 0; i < n; ++i)
	{
		bel[i] = i;
		if ((1 << i) & stat) st.push_back(i), ret += dat[i].val;
	}
	int tot = st.size(), foo, bar, cot = 0;
	for (R int i = 0; i < tot; ++i)
	for (R int j = i + 1; j < tot; ++j)
	edge[++cnt] = {st[i], st[j], calc(st[i], st[j])};
	std::sort(edge + 1, edge + 1 + cnt);
	for (R int i = 1; i <= cnt; ++i)
	{
		foo = find(edge[i].from), bar = find(edge[i].to);
		if (foo == bar) continue;
		++cot;
		bel[foo] = bar;
		ret -= edge[i].len;
		if (cot == tot - 1) break;
	}
	return ret / tot;
}
int main(void)
{
	in(n); all = (1 << n) - 1;
	for (R int i = 0; i < n; ++i)
	in(dat[i].x), in(dat[i].y), in(dat[i].val);
	for (R int i = 1; i <= all; ++i)
	{
		res[i] = MST(i);
		for (R int s = (i - 1) & i; s; s = (s - 1) & i)
		res[i] = std::max(res[i], std::min(res[s], res[i ^ s]));
	}
	printf("%.10Lf", res[all]);
}

Measured memory_bytes: 896
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBAG = true;

int main(){

    ll N;
    cin >> N;
    vector<pll> task(N);
    for(ll i = 0; i < N; i++){
        cin >> task[i].second >> task[i].first;
    }

    sort(all(task) );
    ll t = 0;
    for(ll i = 0; i < N; i++){
        t += task[i].second;
        if(t > task[i].first){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;


}

Measured memory_bytes: 3456
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	 ll n;
	 string s;
	 cin>>n>>s;

	 if(n>=3200)
	 {
		cout<<s<<endl;
	 }
	 else
		cout<<"red"<<endl;

	 return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

//             0  1  2   3   4    5    6     7     8     9     10     11
int coins[] = {1, 6, 9, 36, 81, 216, 729, 1296, 6561, 7776, 46656, 59049};   // 使える引き出し方
int count[] = {5, 5, 8,  5,  8,   5,   8,    5,    8,    5,     2,     1};   // 上記引き出し方を最大何回使う可能性があるか

int bank(int in, int c){
	if (c == 0) return (in > count[c]) ? 10000 : in;                         // 1円で払う時専用。6枚以上払うのはおかしい。上の階層で払わなすぎたのでNGを突き返す。
	int ret = 10000;                                                         // 最小値を競わせるため、NG値を入れておく。
	for (int i = 0; i <= count[c]; i++){
		if (in - coins[c] * i < 0) break;                                    // 引き出してマイナスになるとおかしい。これ以上は今の引き出し方を増やす必要はない。
		int tmp = bank(in - coins[c] * i, c - 1);                            // 引き出した残りを次の深さの人に渡す。
		if (tmp + i < ret) ret = tmp + i;                                    // 戻り値の中で一番小さいものを選ぶ。（今階層の引き出し方を何回使ったかを足す）
	}
	return ret;
}

int main(int in){
	scanf("%d", &in)+1;
	printf("%d", bank(in, 11));

	return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

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

		for (int i = 1; i <= 1000; i++) {
			if (i * 8 / 100 == a && i * 10 / 100 == b) {
				System.out.println(i);
				return;
			}
		}
		System.out.println(-1);
	}
}


Measured memory_bytes: 23892
import numpy as np

N,M = map(int,input().split())
MOD = 1e9 + 7
S = np.array(input().split())
T = np.array(input().split())

dp = np.zeros((N+1,M+1))
dp[0] = 1

for n in range(1,N+1):
    same = (T == S[n-1])
    dp[n,1:][same] = dp[n-1,:-1][same]
    dp[n] = (dp[n].cumsum() + dp[n-1])%MOD
    
print(int(dp[N,M]))

Measured memory_bytes: 43724
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
const int DI[4] = { 0, 0, +1, -1 };
const int DJ[4] = { +1, -1, 0, 0 };
int main() {
    int N; cin >> N;
    vector<int> P(N * N); for (auto &p : P) cin >> p, p--;
    vector<vector<int>> A(N, vector<int>(N)), B(N, vector<int>(N));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            A[i][j] = min({ abs(i - 0), abs(i - (N - 1)), abs(j - 0), abs(j - (N - 1)) });
            B[i][j] = 1;
        }
    }
    Int ans = 0;
    for (int p : P) {
        int i = p / N, j = p % N;
        ans += A[i][j];
        B[i][j] = 0;
        queue<pair<int, int>> Q;
        Q.emplace(i, j);
        while (!Q.empty()) {
            auto [i, j] = Q.front(); Q.pop();
            for (int k = 0; k < 4; k++) {
                int ni = i + DI[k];
                int nj = j + DJ[k];
                if (0 <= ni && ni < N && 0 <= nj && nj < N && A[i][j] + B[i][j] < A[ni][nj]) {
                    A[ni][nj] = A[i][j] + B[i][j];
                    Q.emplace(ni, nj);
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6004
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll inf=1LL<<60;
double pi=3.141592653589793238462643383279L;
double eps=1e-10;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;cin>>n;
    int k;cin>>k;
    int ans=0;
    while(n>0){
        ans++;
        n/=k;
        
    }
    cout<<ans<<endl;
}





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

int main(){
	int a,b,c;
	cin >> a >> b >> c;
	
	int anko = 10*a+b+c;
	int maojini = 10*b+a+c;
	int manko = 10*c+a+b;
	
	cout << max(manko,max(anko,maojini)) << endl;
	return 0;
}

Measured memory_bytes: 256
S = gets
d = S.size-1
N=S.to_i
set=[3,5,7]
x=0
(d-2).times do |i|
  set.repeated_permutation(i+3) do |e|
    y=e.join.to_i
    break if y>N
    x+=1 if e.uniq.size>=3
  end
end

p x

Measured memory_bytes: 1916
#include <stdio.h>

int main(){
   char number[1001];
   int i, sum;
   while(1){
       scanf("%s", number);
       if(number[0]==48)break;
       sum=0;
       for(i=0;number[i]!='\0';i++){
           sum+=number[i]-48;
       }
       printf("%d\n", sum);
   }

   return 0;
}



Measured memory_bytes: 2704
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>

using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

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


int main() {
    string s;
    
    cin >> s;
    
    if(s == "zyxwvutsrqponmlkjihgfedcba"){
        cout << -1 << endl;
        return 0;
    }
    
    if(s.size() < 26){
        map<char, int> m;
        bool f[26] = {};
        for(auto x : s){
            f[x - 'a'] = true;
        }
        REP(i, 26){
            if(!f[i]){
                cout << s << (char)('a' + i) << endl;
                return 0;
            }
        }
    }
    else{
        bool f[26] = {}, ok[26] = {};
        REP(i, 26){
            f[s[i] - 'a'] = true;
            for(char j = s[i]; j <= 'z'; j++){
                if(!f[j - 'a']){
                    ok[i] = true;
                    break;
                }
            }
        }
        for(int i = 25; i >= 0; i--){
            REP(j, 26){
                f[j] = false;
            }
            REP(j, i){
                f[s[j] - 'a'] = true;
            }
            if(ok[i]){
                for(int j = 0; j < i; j ++){
                    cout << s[j];
                }
                for(char j = s[i] + 1; j <= 'z'; j++){
                    if(!f[j - 'a']){
                        cout << j << endl;
                        return 0;
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;

int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

static const double EPS = 1e-8;

int dp[100000];

//Square Coins
int main(){
	int n;

	while(~scanf("%d",&n)){
		if(n==0) break;

		memset(dp,0,sizeof(dp));

		dp[0] = 1;

		for(int i=1;i<=17;i++){
			for(int k=1;k<=n;k++){
				if(k-i*i<0) continue;
				dp[k] += dp[k-i*i];
			}
		}

		printf("%d\n",dp[n]);
	}
}

Measured memory_bytes: 0
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define re return
#define ll long long
#define ull unsigned ll
#define ld long double
#define f first
#define s second
#define pi acos(-1)
#define oo (ll)1e9+8
#define OO 1e18
#define EPS 1e-6
#define Endl '\n'
#define FX(n) fixed<<setprecision(n)
#define mm(o,k) memset(o,k,sizeof o)
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int maxn=200005;

int main()
{
    ll n,m;
    scanf("%lld%lld",&n,&m);
    --n;
    ll A=((((n+1)/2)&1)^((n&1)?0:n));
    ll B=((((m+1)/2)&1)^((m&1)?0:m));
    printf("%lld\n",A^B);
    re 0;
}

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

using namespace std;

typedef long long ll;
const int N = 2e5 + 10;
ll m, n;

ll sum[N];
ll a[N];
ll k;

map<ll, ll> ma;
// (sum[r] - sum[l -1]) % k == r - l + 1;

int main()
{
	scanf("%lld%lld", &n, &k);
	for (int i = 1; i <= n; i ++)
	{
		scanf("%lld", &a[i]);
		sum[i] = (sum[i - 1] % k + a[i] % k) % k;
	}
	for (int i = 1; i <= n; i ++)
	{
		sum[i] = ((sum[i] - i) % k + k) % k;
	}
	ll ans = 0;
	ma[sum[0]] ++;
	for (int i = 1; i <= n; i ++)
	{
		if(i >= k) ma[sum[i - k]]--;
		ans += ma[sum[i]];
		ma[sum[i]] ++;
	}
	cout <<ans << endl;
}


Measured memory_bytes: 16640
h, w = map(int,input().split())
a = []

for i in range(h):
    s = input()
    if s != "."*w:
        a.append(s)

l = len(a)

ans = [[] for i in range(l)]

for i in range(w):
    for j in range(l):
        if a[j][i] == "#":
            for k in range(l):
                ans[k].append(a[k][i])
            break
for i in range(l):
    print("".join(ans[i]))

Measured memory_bytes: 9252
import heapq

N,HP = map(int,input().split())
Katana = [list(map(int,input().split())) for i in range(N)]

Wield,Throw = map(list,zip(*Katana))

Throw = list(map(lambda t:(-t,t),Throw))
heapq.heapify(Throw)

MaxW = max(Wield)

count = 0
while Throw:
  MaxT = heapq.heappop(Throw)[1]
  if MaxT >= MaxW:
    HP -= MaxT
    count += 1
    if HP <= 0:
      print(count)
      exit()

print(-(-HP//MaxW)+count)

Measured memory_bytes: 39348
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
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; }
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second) return a.second < b.second;
    else return a.first < b.first;
}
std::uint32_t euclidean_gcd(std::uint32_t a, std::uint32_t b){return b != 0 ? euclidean_gcd(b, a % b) : a;}
void solve(std::string S, std::string T){
    int n = S.length();
    int res =0;
    rep(i, n){
        if(S[i]!=T[i])res++;
    }
    cout<<res<<endl;
}
int main(){
    std::string S;
    std::cin >> S;
    std::string T;
    std::cin >> T;
    solve(S, T);
    return 0;
}


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

int main() {
  int n;cin>>n;
  vector<int> a(n);
  rep(i,n)cin>>a[i];
  vector<int> ans(n);
  rep(i,n)ans[a[i]-1]=i+1;
  rep(i,n)cout<<ans[i]<<" ";
  cout<<endl;
}

Measured memory_bytes: 3960
#include <bits/stdc++.h>  // ver2.1.4
    #define int long long
    #define endl "\n"
    #define ALL(v) (v).begin(),(v).end()
    #define Vi vector<int>
    #define Pii pair<int,int>
    #define Tiii tuple<int,int,int>
    #define PQi priority_queue<int>
    #define PQir priority_queue<int, vector<int>, greater<int>>
    #define pb push_back
    #define mp make_pair
    #define mt make_tuple
    #define cYES cout<<"YES"<<endl
    #define cNO cout<<"NO"<<endl
    #define cYes cout<<"Yes"<<endl
    #define cNo cout<<"No"<<endl
    #define sortr(v) sort(v,greater<>())
    #define rep(i,a,b) for(int i=a;i<b;i++)
    #define repeq(i,a,b) for(int i=a;i<=b;i++)
    #define repr(i,a,b) for(int i=a;i>b;i--)
    #define repreq(i,a,b) for(int i=a;i>=b;i--)
    #define leng(n) (int)(log10(n)+1)
    #define dem(a,b) ((a+b-1)/(b))
    #define Vout(a) rep(i,0,a.size()-1)cout<<a[i]<<' ';cout<<a.back()<<endl
    #define INF 9000000000000000000  //  9.0 * 10^18
    #define MOD 1000000007  //  10^9 + 7
    using namespace std;
     
    int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
    int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm
     
    int mypow(int x, int n, int m){  //  高速累乗x^n(mod m)  O(log(n))
    if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
     
    bool prime(int n){  //  素数判定
    if(n<2)return false;else if(n==2)return true;else if(n%2==0)return false;
    double s=sqrt(n);for(int i=3;i<=s;i+=2){if(n%i==0){return false;}}return true;}
     
    #define N 1000000
    int arr[N];
     
    Vi Eratosthenes(){
      Vi a(0);
    	for(int i = 0; i < N; i++){
    		arr[i] = 1;
    	}
    	for(int i = 2; i < sqrt(N); i++){
    		if(arr[i]){
    			for(int j = 0; i * (j + 2) < N; j++){
    				arr[i *(j + 2)] = 0;
    			}
    		}
    	}
     
    	for(int i = 2; i < N; i++){
    		if(arr[i]){
    			a.pb(i);//cout << i << endl;
    		}
    	}
      return a;
    }
     
    signed main() {
      cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
      int n,m;
      cin >> n >> m;
      int now = gcd(n,m);
      
      /*Vi so(0);
      repeq(i,2,1000000){
        if(prime(i)) so.pb(i);
      }*/
      Vi so;
      so = Eratosthenes();
      int ans = 1;
      rep(i,0,so.size()){
        if(now%so[i]==0) {
          ans++;
          while(now%so[i]==0) now /= so[i];
        }
      }
      
      if(prime(now)) ans++;
      
      cout << ans << endl;
      
      return 0;
    }

Measured memory_bytes: 9208
#include<stdio.h>
#include<string.h>
#include<math.h>
#define Max (int)1e3*4
#define MAX_INT (int)1e15+2
using namespace std;

int dp[Max][Max],path[Max][Max];

int solve(int p1,int p2,char s1[],char s2[]){
	//printf("Yes %d %d\n",p1,p2);
	if(p1 == -1 || p2 == -1)
		return 0;
	if(dp[p1][p2] != -1){
		//printf("Ex %d",dp[p1][p2]);
		return dp[p1][p2];
	}
	int max = solve(p1-1,p2,s1,s2);
	path[p1][p2] = 2;
	if(max < solve(p1,p2-1,s1,s2)){
		max = solve(p1,p2-1,s1,s2);
		path[p1][p2] = 3;
	}
	
	//printf("2Yes %d %d\n",p1,p2);
	if(s1[p1] == s2[p2]){
		int x = 1+solve(p1-1,p2-1,s1,s2);
		//printf("%d %d %c\n",p1,p2,s1[p1]);
		if(max < x){
			max = x;
			path[p1][p2] = 1;
		}
	}
	return dp[p1][p2] = max;
}

void go(int p1,int p2,char s1[]){
	if(p1 == -1 || p2 == -1)
		return;
	if(path[p1][p2] == 1){
		go(p1-1,p2-1,s1);
		printf("%c",s1[p1]);
	}else if(path[p1][p2] == 2){
		go(p1-1,p2,s1);
	}else if(path[p1][p2] == 3){
		go(p1,p2-1,s1);
	}
}

void init(){
	int i,j;
	for(i=0;i<Max;i++)
		for(j=0;j<Max;j++)
			dp[i][j] = -1;
}

int main(){
	char s1[Max],s2[Max];
	init();
	scanf("%s",s1);
	scanf("%s",s2);
	int l1 = strlen(s1);
	int l2 = strlen(s2);
	int tmp = solve(l1-1,l2-1,s1,s2);
	//printf("Tmp1 %d\n",tmp);
	go(l1-1,l2-1,s1);
	printf("\n");
	return 0;
}


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

int main() {
    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(a.begin(), a.end());
    cout << a[0] << " " << a[1] << " " << a[2] << endl;
}



Measured memory_bytes: 3092
#include <cstdio>
#include <vector>
using namespace std;
int n,cnt;
void insertion(int a[],int g){
	for(int i=g;i<n;i++){
		int v=a[i];
		int j=i-g;
		for(;j>=0&&a[j]>v;){
			a[j+g]=a[j];
			j-=g;
			cnt++;
		}
		a[j+g]=v;
	}
}
void shell(int a[]){
	cnt=0;
	int m=0,tem=1;
	vector<int> g;
	while(1){
		g.push_back(tem);
		m++;
		tem=tem*3+1;
		if(tem>=n)	break;
	}
	printf("%d\n",m);
	for(int i=m-1;i>=0;i--){
		insertion(a,g[i]);
		if(i!=m-1)	printf(" ");
		printf("%d",g[i]);
	}
	printf("\n%d\n",cnt);
}
int main(){
	scanf("%d",&n);
	int a[n];
	for(int i=0;i<n;i++)	scanf("%d",&a[i]);
	shell(a);
	for(int i=0;i<n;i++)	printf("%d\n",a[i]);
	printf("\n");
	return 0;
}

Measured memory_bytes: 4960
N, M = map(int, input().split())
XYs = [list(map(int, input().split())) for _ in range(M)]

flag = [0]*(N+1)
flag2 = [0]*(N+1)
flag[1] = 1
flag2[1] = 1
num = [1]*(N+1)

for xy in XYs:
  if flag2[xy[0]]==1 and flag[xy[0]]==1:
    flag[xy[0]]=0
    flag[xy[1]]=1
  elif flag[xy[0]]==1:
    flag[xy[1]]=1
  
  if flag2[xy[0]]==1 and num[xy[1]] == 0:
    flag2[xy[0]]=0
    flag2[xy[1]]=1
  else:
    flag2[xy[0]]=0
    flag2[xy[1]]=0
  num[xy[0]] -= 1
  num[xy[1]] += 1
  if num[xy[0]] == 0:
    flag[xy[0]] = 0
  
print(sum(flag))

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

s = []

for i in range(h):
    s.append(input())

_h = [[0 for i in range(w)] for j in range(h)]
_w = [[0 for i in range(w)] for j in range(h)]
_h2 = [[0 for i in range(w)] for j in range(h)]
_w2 = [[0 for i in range(w)] for j in range(h)]

for i in range(h):
    _h[i][0] = 1 if s[i][0] == "." else 0

for i in range(w):
    _w[0][i] = 1 if s[0][i] == "." else 0

for i in range(h):
    for j in range(1, w):
        _h[i][j] = _h[i][j - 1] + 1 if s[i][j] == "." else 0

for i in range(1, h):
    for j in range(w):
        _w[i][j] = _w[i - 1][j] + 1 if s[i][j] == "." else 0

for i in range(h):
    _h2[i][w - 1] = 1 if s[i][w - 1] == "." else 0

for i in range(w):
    _w2[h - 1][i] = 1 if s[h - 1][i] == "." else 0

for i in range(h):
    for j in range(w - 2, -1, -1):
        _h2[i][j] = _h2[i][j + 1] + 1 if s[i][j] == "." else 0

for i in range(h - 2, -1, -1):
    for j in range(w):
        _w2[i][j] = _w2[i + 1][j] + 1 if s[i][j] == "." else 0

maximum = 0

for i in range(h):
    for j in range(w):
        ans = _h[i][j] + _h2[i][j] + _w[i][j] + _w2[i][j] - 3
        if ans >= maximum:
            maximum = ans

print(maximum)

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

int main(){
    int N, Q;  cin >> N >> Q;
    vector<ll> A(N), X(Q);
    for(int i=0; i<N; i++) cin >> A[i];
    for(int i=0; i<Q; i++) cin >> X[i];
    vector<ll> sumA(N), evenSumA(N);
    sumA[0] = A[0];  evenSumA[0] = A[0];
    for(int i=1; i<N; i++){
        sumA[i] = sumA[i-1] + A[i];
        evenSumA[i] = evenSumA[i-1];
        if(i%2==0) evenSumA[i]+=A[i];
    }

    int P = N/2+1;
    vector<ll> B(P+1);
    if(N%2==1) B[P] = A[N-P] + A[N-2*P+1];
    else B[P] = 0;
    for(int p=1; p<P; p++){
        B[p] = A[N-p] + A[N-2*p+1];
    }

    for(int i=0; i<Q; i++){
        ll x = X[i];
        if(2*x > B[1]){
            if(N%2==0) cout << sumA[N-1] - evenSumA[N-1] << endl;
            else cout << evenSumA[N-1] << endl;
        }else if(2*x <= B[P]){
            cout << sumA[N-1] - sumA[P-2] << endl;
        }else{
            int l = 1, r = P-1;
            int p = l + (r-l)/2;
            while(!(B[p+1] < 2*x && 2*x <= B[p])){
                if(B[p+1] >= 2*x) l = p + 1;
                else r = p;
                p = l + (r-l)/2;
            }

            if(N%2==0){
                cout << sumA[N-1] - sumA[N-p-1] + sumA[N-2*p-1] - evenSumA[N-2*p-1] << endl;
            }else{
                cout << sumA[N-1] - sumA[N-p-1] + evenSumA[N-2*p-1] << endl;
            }
        }
    }
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)a;i<(int)b;++i)
int main(){
    int n;cin>>n;
    map<string,int> mpa;
    rep(i,n){
        string s;cin>>s;
        mpa[s]++;
    }
    int m;cin>>m;
    map<string,int> mpb;
    rep(i,m){
        string s;cin>>s;
        mpb[s]++;
    }
    
    int maxv=0;
    for(auto m:mpa){
        string s=m.first;
        int c=m.second;
        auto itr=mpb.find(s);
        int d=0;
        if(itr!=mpb.end()){
            auto tmp=*itr;
            d=tmp.second;
        }
        maxv=max(maxv,c-d);
    }

    cout<<maxv<<endl;
    return 0;
}

Measured memory_bytes: 384
import sys
input = sys.stdin.readline

def main():
    a = int(input())
    # N, K = map(int, input().split())
    # a = list(map(int, input().split()))
    s = input().strip()
    
    if a >= 3200:
        print(s)
    else:
        print("red")

if __name__ == "__main__":
    main()

Measured memory_bytes: 3316
import java.util.*;
 
class Main{
  public static void main(String args[]){
    Scanner scan=new Scanner(System.in);
    int num=scan.nextInt();
    int disall=scan.nextInt();
    int x,y;
    int ans=0;
    for(int a=0; a<num; a++){
      x=scan.nextInt();
      y=scan.nextInt();
      if(Math.sqrt((long)x*(long)x+(long)y*(long)y)<=disall){
        ans++;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 59124
import java.util.Scanner;
public class Main{
public static void main(String[] args){
try(Scanner sc = new Scanner(System.in)){
int w = sc.nextInt();
int n = sc.nextInt();
int[] values = new int[w];
for(int i = 0; i < values.length; i++){
values[i] = i + 1;
}
sc.useDelimiter(",|\n");
for(int i = 0; i<n; i++){
int a = sc.nextInt();
int b = sc.nextInt();
int temp = values[a-1];
values[a-1] = values[b-1];
values[b-1] = temp;
}
for(int i = 0; i<values.length; i++){
System.out.println(values[i]);
}
sc.close();
}
}
}


Measured memory_bytes: 25912
N=int(input())
H=[[int(x) for x in input().split()] for y in range(N)]

dp=[[0,0,0] for i in range(N)]

dp[0][0]=H[0][0]
dp[0][1]=H[0][1]
dp[0][2]=H[0][2]

for i in range(1,N):
    dp[i][0]=max(dp[i-1][1],dp[i-1][2])+H[i][0]
    dp[i][1]=max(dp[i-1][0],dp[i-1][2])+H[i][1]
    dp[i][2]=max(dp[i-1][0],dp[i-1][1])+H[i][2]

print(max(dp[-1]))

Measured memory_bytes: 77016
#include <stdio.h>
#include <math.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    long int a;
    long int b;
    long int c;
    long int e;
    long int d;
    scanf("%ld",&a);
    scanf("%ld",&b);
   scanf("%ld",&c);
e=a;    
d=0;
    if(e<=b){
        printf("%ld",a+1);
    }
    else if(e>b){
if(b>=c-1){
d=a+1;
printf("%ld",d);
}
else if(b<c-1){
a=a-b-1;
d=c;
while(a>0){
if(a==1){
d++;
a=0;
}
else{
d=d+c-b;
a=a-2;
}
}
printf("%ld",d);
}
}
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    string S;
    cin >> S;
    S[3] = '8';
    cout << S << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll M =1000000007;
//MOD??
long long mod(long long val, long long m) {
  long long res = val % m;
  if (res < 0) res += m;
  return res;
}
ll mpow(ll x, ll n){ //x^n(mod M) ????pow(x,n)?????????????mod??
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}
int main (){
  int i;
  int a,b,k,f=0;
  cin>>k>>a>>b;
  for(i=a;i<=b;i++){
    if(i % k == 0){
      f++;
      break;
    }
    
  }
  if(f>0)
  cout<<"OK"<<endl;
  else
  {
    cout<<"NG"<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <string>

using namespace std;

int main() {
	string a;
	cin >> a;
	int kk = a.size();
	if (a[0] == a[kk-1] && a[0] == 'x') {
		cout << 'x' << endl;
	} else {
		cout << 'o' << endl;
	}
	return 0;
}

Measured memory_bytes: 1172
#include <iostream>                                                      
#include <cstdio>                                                        
#include <cmath>                                                         
#define USE_MATH_DEFINES                                                 
using namespace std;                                                     
                                                                         
int main() {                                                             
  double r;                                                              
  cin >> r;                                                              
  double S = M_PI*pow(r,2);                                              
  double R = 2*M_PI*r;                                                   
  printf("%.6f %.6f\n", S, R);                                           
  return 0;                                                              
}                                                                        
                                                                         
                                                                         
                                                                         
                                                                         
                                                                         
      

Measured memory_bytes: 3136
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)

def main():
    rr = []

    def f(n,m,l):
        e = collections.defaultdict(list)
        for _ in range(m):
            a,b,x,y = LI()
            e[a].append((b,x,y))
            e[b].append((a,x,y))

        d = collections.defaultdict(lambda: inf)
        d[(1, 0)] = 0
        q = []
        heapq.heappush(q, (0, 0, 1))
        v = collections.defaultdict(bool)
        mi = inf
        while len(q):
            c, k, u = heapq.heappop(q)
            if v[(u,k)]:
                continue
            v[(u,k)] = True
            if u == n and mi > c:
                mi = c

            for uv, ud, ue in e[u]:
                vk = k + ud
                vv = (uv, vk)
                if not v[vv] and vk <= l:
                    vd = c
                    if d[vv] > vd:
                        d[vv] = vd
                        heapq.heappush(q, (vd, vk, uv))
                vv = (uv, k)
                if not v[vv]:
                    vd = c + ue
                    if d[vv] > vd:
                        d[vv] = vd
                        heapq.heappush(q, (vd, k, uv))


        return mi

    while True:
        n,m,l = LI()
        if n == 0 and m == 0:
            break
        rr.append(f(n,m,l))

    return '\n'.join(map(str, rr))



print(main())



Measured memory_bytes: 13956
import java.util.Scanner;

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

		for(int i=0; i<s.length();i++) {
			if(s.charAt(i)=='+') {
				ans++;
			}else {
				ans--;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21716
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
using namespace std;

int n, m;
int a[50], b[50], c[50], d[50];

int main(void)
{
	cin >> n >> m;
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i] >> b[i];
	}
	for (int j = 0; j < m; ++j)
	{
		cin >> c[j] >> d[j];
	}
	for (int i = 0; i < n; ++i)
	{
		int small = INT_MAX;
		int id = -1;
		for (int j = 0; j < m; ++j)
		{
			if (small > abs(a[i] - c[j]) + abs(b[i] - d[j]))
			{
				small = abs(a[i] - c[j]) + abs(b[i] - d[j]);
				id = j;
			}
		}
		cout << id + 1 << endl;
	}
	return 0;
}


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

long long GetGreatestCommonDivisor(long long a, long long b)
{
	long long m = a;
	long long n = b;
	long long temp;
	while (m % n != 0) {
		temp = n;
		n = m % n;
		m = temp;
	}
	return n;
}

vector<pair<long long, long long> > prime_factorize(long long N) {
	vector<pair<long long, long long> > res;
	for (long long a = 2; a * a <= N; ++a) {
		if (N % a != 0) continue;
		long long ex = 0; // 指数

		 // 割れる限り割り続ける
		while (N % a == 0) {
			++ex;
			N /= a;
		}

		// その結果を push
		res.push_back({ a, ex });
	}

	// 最後に残った数について
	if (N != 1) res.push_back({ N, 1 });
	return res;
}

int main() {

	ll a, b; cin >> a >> b;
	ll gcd = GetGreatestCommonDivisor(a, b);
	vector<pair<long long, long long>> a_prime;  // a^x ならば { a, x }
	a_prime = prime_factorize(gcd);
	cout << a_prime.size() + 1 << endl;
	return 0;
}

Measured memory_bytes: 3600
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

    public void solve() {
        char[] s = in.next().toCharArray();
        int n = s.length;
        int score = 0;
        int paper = 0;
        int rock = 0;
        for (int i = 0; i < n; i++) {
            if (s[i] == 'g') {
                if (paper < rock) {
                    paper++;
                    score++;
                } else {
                    rock++;
                }
            } else {
                if (paper < rock) {
                    paper++;
                } else {
                    rock++;
                    score--;
                }
            }
        }
        out.println(score);
    }

    public static void main(String[] args)throws IOException {
        FastScanner in;
        boolean isLocalRun = args.length >= 1 && "local_run".equals(args[0]);
        if (isLocalRun)
            in = new FastScanner(new FileInputStream("input"));
        else
            in = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int testsCount = 1;
        for (int testNum = 0; testNum < testsCount; testNum++)
            new Main(in, out).solve();
        in.close();
        out.close();
    }

    final PrintWriter out;
    final FastScanner in;

    public Main(FastScanner in, PrintWriter out) {
        this.in = in;
        this.out = out;
    }
}

class FastScanner {
    private StringTokenizer tokenizer;
    private BufferedReader reader;

    public FastScanner(InputStream inputStream) {
        reader = new BufferedReader(new InputStreamReader(inputStream));
    }

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

    public int nextInt() {
        return Integer.parseInt(next());
    }

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

    public double nextDouble() {
        return Double.parseDouble(next());
    }

    public String nextLine() {
        String line;
        try {
            line = reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        tokenizer = null;
        return line;
    }

    public void close() {
        try {
            reader.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}



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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
#define pb push_back
const ll mod = 1000000007;

void sayNo() {
	cout << "No" << endl;
}

void sayYes() {
	cout << "Yes" << endl;
}

vector<int> enum_div(int n)//nの約数を列挙
{
	vector<int> ret;
	for (int i = 1; i*i <= n; ++i)
	{
		if (n%i == 0)
		{
			ret.push_back(i);
			if (i != 1 && i*i != n)
			{
				ret.push_back(n / i);
			}
		}
	}
	return ret;
}

int main() {
	 int N;
	 cin >> N;
	 vector<int> A;

	 for (int i = 0; i < N; i++) {
		 int a;
		 cin >> a;
		 A.push_back(a);
	 }

	 vector<int> ans;
	 vector<bool> odd(N, false);
	 int count = 0;
	 for (int i = N - 1; i >= 0; i--) {
		 if (A[i] ^ odd[i]) {
			 ans.push_back(i + 1);
			 count++;

			 auto div = enum_div(i + 1);
			 for (auto r : div) {
				 odd[r-1] = !odd[r-1];
			 }
		 }
	 }

	 cout << count << endl;
	 for (auto a : ans) {
		 cout << a << " ";
	 }
	 cout << endl;

	 return 0;
}

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

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

    if(N&1){
        cout << (((N+1)/2 >= K) ? "YES" : "NO") << endl;
    }else{
        cout << ((N/2 >= K) ? "YES" : "NO") << endl;
    }
}

Measured memory_bytes: 256
def fight(p1, p2):
    p2['hp'] -= p1['attack']
    return p2['hp']

items = list(map(lambda x: int(x), input().split()))
takahashi = {
    'hp': items[0],
    'attack': items[1]
}
aoki = {
    'hp': items[2],
    'attack': items[3]
}
i = 0
while True:
    if i % 2 == 0:
        hp = fight(takahashi, aoki)
    else:
        hp = fight(aoki, takahashi)
    #print(i, takahashi, aoki)
    if hp <= 0:
        print('Yes' if i % 2 == 0 else 'No')
        break
    i += 1

Measured memory_bytes: 9212
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
#include<numeric>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
const ll MOD = 1000000007;
const ll MAX = 1e6;
ll beki[MAX];
void init(){
  beki[0] = 1;
  for(int i=1;i<MAX;i++){
    beki[i] = beki[i-1]*2;
    beki[i] %= MOD;
  }
}
ll modinv(ll a, ll m){
  ll b=m,u=1,v=0;
  while(b){
    ll t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  u%=m;
  if(u<0) u+=m;
  return u;
}
signed main(){
  init_io();
  init();
  ll n,ans=1,abz=0,az=0,bz=0;
  cin >> n;
  vector<ll> a(n),b(n);
  vector<P> vset;
  map<P,ll> mp;
  for(int i=0;i<n;i++){
    cin >> a[i] >> b[i];
  }
  for(int i=0;i<n;i++){
    if(a[i]==0&&b[i]==0){
      abz++; }else if(a[i]==0){ az++;
    }else if(b[i]==0){
      bz++;
    }else{
      ll gc = gcd(a[i],b[i]);
      a[i] /= gc;
      b[i] /= gc;
      if(a[i]<0){
        b[i] *= -1;
        a[i] *= -1;
      }
      mp[P(a[i],b[i])]++;
    }
  }
  for(auto &[p,x]:mp){
    if(x!=-1){
      ll pf = p.first,ps=p.second;
      pf *= -1;
      if(ps<0){
        ps *= -1;
        pf *= -1;
      }
      auto itr = mp.find(P(ps,pf));
      if(itr==mp.end()){
        ans *= beki[x];
      }else{
        ans += (ans*(beki[x]-1))%MOD + (ans*(beki[itr->second]-1))%MOD;
        itr->second = -1;
      }
      ans %= MOD;
      x = -1;
    }
  }
  ans += ((ans*(beki[az]-1))%MOD + (ans*(beki[bz]-1))%MOD)%MOD;
  ans += abz;
  ans = (ans-1+MOD)%MOD;
  cout << ans << endl;
}


Measured memory_bytes: 26604
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int a;
  a = N%10;
  if (a==2||a==4||a==5||a==7||a==9) {
    cout << "hon" << endl;
  }
  if (a==3) {
    cout << "bon" << endl;
  }
  if (a==1||a==6||a==8||a==0) {
    cout << "pon" << endl;
  }
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> P;
map <int,int> mp;
vector<int> V;
#define INF (1<<29)
#define INFLL (1ll<<58)
#define EPS (1e-10)
static const int MAX=1e5;
static const int MOD=1e9+7;
static const int NMAX=50;
static const int MMAX=50;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};
int N,M,R;
int d[201][201];
int r[9];
int A,B,C;
int res;
bool used [9];

void dfs(int c,int las,int dist) {
    if(c==R+1) {
        if(res>dist)res=dist; return;
    }
    for(int i=1;i<=R;i++)if(!used[i]) {
        used[i]=true;
        if(las==-1)dfs(c+1,i,0);
        else dfs(c+1,i,dist+d[r[las]][r[i]]);
        used[i]=false;
    }
}
int main () {
    cin>>N>>M>>R;
    for(int i=1;i<=N;i++){
        for(int j=1;j<=N;j++){
            if(i!=j)d[i][j]=INF;
            
        }
    }
    for(int i=1;i<=R;i++)cin>>r[i];
    
    for(int i=1;i<=M;i++)
    {
        cin>>A>>B>>C;
        d[A][B]=d[B][A]=C;
    }
    for(int k=1;k<=N;k++){
        for(int i=1;i<=N;i++){
            for(int j=1;j<=N;j++){
                if(d[i][j]>d[i][k]+d[k][j]) d[i][j]=d[i][k]+d[k][j];
            }
        }
    }
    res=INF;
    dfs(1,-1,0);
    printf("%d\n",res);
}


Measured memory_bytes: 384
#include <stdio.h>

 int main( void )
 {

int a, b;

scanf("%d %d", &a,&b );

 if ( a > b ){
printf( "a > b\n");
}
else if( a < b ){
printf( "a < b\n");
}
else{
printf( "a == b\n");
}

return 0;
 }






Measured memory_bytes: 2104
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef queue<P> Q;

#define _CRT_SECURE_NO_WARNINGS

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

int N = 0;
int main() {
	scanf("%d",&N);
	LL a, b, c,d;
	for (int i = 0; i < N;i++) {
		scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
		if (a<b) {
			printf("No\n");
			continue;
		}
		if (b>d) {
			printf("No\n");
			continue;
		}
		if (b <= c + 1) {
			printf("Yes\n");
			continue;
		}
		if (a%b>c) {
			printf("No\n");
			continue;
		}
		if ( b-gcd(b,gcd(b,d-b)) <=c) {
			printf("Yes\n");
		}
		else {
			printf("No\n");
		}
	}
	return 0;
}

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

int main()
{
    int h,w;
    cin >> h >> w;
    vector<string> a(h);
    for(int i = 0; i < h; i++) cin >> a[i];

    for(int i = 0; i < h;){
        int cnt = 0;
        for(int j = 0; j < w; j++) if(a[i][j] == '.') cnt++;
        if(cnt == w){
            a.erase(a.begin()+i);
            h--;
        }else i++;
    }
    for(int i = 0; i < w;){
        int cnt = 0;
        for(int j = 0; j < h; j++) if(a[j][i] == '.') cnt++;
        if(cnt == h){
            for(int k = 0; k < h; k++) a[k].erase(a[k].begin()+i);
            w--;
        }else i++;
    }

    for(auto i : a) cout << i << endl;

    return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif


void Main() {
    string S; cin >> S;
    ll cnt_r = 0;
    rep(i, S.size()){if (S[i] == '0'){cnt_r += 1;}}
    ll cnt_l = S.size() - cnt_r;
    cout << S.size() - abs(cnt_l - cnt_r) << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 512