akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>

#define PRIME_NUM 15

const int prime[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};


int main(int argc, char *argv[]) {
  int N;
  int i,j,k,p;
  int a = 0;
  int s[PRIME_NUM] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  scanf("%d",&N);

  for(i=0;i<PRIME_NUM;i++) {
    for(k=prime[i];k<=N;k*=prime[i]) {
      s[i] += N/k;
    }
  }

  // 75
  for(i=0;i<PRIME_NUM;i++) {
    if(s[i]>=74) a++;
  }

  // 25*3
  for(i=0;i<PRIME_NUM;i++) {
    if(s[i]>=24) {
      for(j=0;j<PRIME_NUM;j++) {
	if(j!=i && s[j]>=2) a++;
      }
    }
  }

  // 15*5
  for(i=0;i<PRIME_NUM;i++) {
    if(s[i]>=14) {
      for(j=0;j<PRIME_NUM;j++) {
	if(j!=i && s[j]>=4) a++;
      }
    }
  }

  // 5*5*3
  for(i=0;i<PRIME_NUM;i++) {
    for(j=i+1;j<PRIME_NUM;j++) {
      if(s[i]>=4 && s[j]>=4) {
	for(k=0;k<PRIME_NUM;k++) {
	  if(s[k]>=2 && k!=i && k!=j) a++;
	}
      }
    }
  }
  
  printf("%d\n",a);
  
  return 0;
}



Measured memory_bytes: 128
k,n = map(int,input().split(" "))
a = list(map(int,input().split(" ")))
m = a[0] + k - a[n-1]
for i in range(n-1):
  l = a[i+1] - a[i]
  if l > m:
    m = l
ans = k - m
print(ans)

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	int N=in();
	int sum=0;
	int num=N/25;
	sum+=num;
	N-=25*num;
	num=N/10;
	sum+=num;
	N-=10*num;
	num=N/5;
	sum+=num;
	N-=5*num;
	sum+=N;

	out(sum);
	return 0;
}



Measured memory_bytes: 3184
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,x,y,maxp=-2000000000,maxd=-2000000000,minp=2000000000,mind=2000000000;
    cin>>n;
    for (int i=0;i<n;i++)
    {
        cin>>x>>y;
        maxp=max(maxp,x+y);
        minp=min(minp,x+y);
        maxd=max(maxd,x-y);
        mind=min(mind,x-y);
    }
    cout<<max(maxp-minp,maxd-mind);
    return 0;
}


Measured memory_bytes: 3632
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>

using namespace std;

class Node{
public:
	int key;
	Node* right;
	Node* left;
	Node* parent;
};
Node* root;
Node* NIL;
void insert(int k){
	Node* y = NIL; // x ??????
	Node* x = root;
	Node* z;
	z = (Node*)malloc(sizeof(Node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;
	while (x != NIL){
		y = x; // ???????¨????
		if (z->key < x->key) x = x->left; // ?????????????§????
		else x = x->right; // ?????????????§????
	}
	z->parent = y;
	if (y == NIL) root = z; // T ???????????´???
	else {
		if (z->key < y->key) y->left = z; // z ??? y ?????????????????????
		else y->right = z; // z ??? y ?????????????????????
	}
}
bool find(Node* z, int k){
	if (z == NIL) return false;
	if (z->key == k) return true;
	else if (z->key < k) return find(z->right, k);
	else if (z->key > k) return find(z->left, k);
	return false;
}
void preorder(Node* z){
	if (z == NIL) return;
	cout << ' ' << z->key ;
	if (z->left != NIL) preorder(z->left);
	if (z->right != NIL) preorder(z->right);
}
void inorder(Node* z){
	if (z == NIL) return;
	if (z->left != NIL) inorder(z->left);
	cout << ' ' << z->key;
	if (z->right != NIL) inorder(z->right);
}
int main(){
	root = NIL;
	int n; scanf("%d", &n);
	for (int i = 0; i < n; ++i){
		char str[20]; scanf("%s", &str);
		if (strcmp(str, "insert") == 0){
			int tmp; scanf("%d", &tmp);
			insert(tmp);
		}
		else if (strcmp(str, "find") == 0){
			int tmp; scanf("%d", &tmp);
			if (find(root, tmp)) cout << "yes\n";
			else cout << "no\n";
		}
		else{
			inorder(root); cout << '\n';
			preorder(root); cout << '\n';
		}
	}

}

Measured memory_bytes: 19956
n=int(input())
xys=[list(map(int,input().split())) for _ in range(n)]
vec = []
pqs = []
for i in range(n):
    for j in range(i+1,n):
        pqs.append([(xys[i][0]-xys[j][0]),(xys[i][1]-xys[j][1])])
        pqs.append([-(xys[i][0]-xys[j][0]),-(xys[i][1]-xys[j][1])])
pqs.sort()
import collections

cnt = 1
cntMax = 0
for i in range(1,len(pqs)+1):
    if i == len(pqs):
        cntMax = max(cntMax,cnt)
    elif pqs[i] == pqs[i-1]:
        cnt += 1
    else:
        cntMax = max(cntMax,cnt)
        cnt = 1
print(n-cntMax)

Measured memory_bytes: 39664
#include <iostream>
#include <map>
#include <set>
#include <algorithm>
#include <vector>
#include <sstream>
#include <string>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <limits>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
#include <fstream>
#include <iterator>
#include <random>
#include <chrono>
 
 
#define forr(i,start,count) for (int i = (start); i < (start)+(count); ++i)
#define set_map_includes(set, elt) (set.find((elt)) != set.end())
#define readint(i) int i; cin >> i
#define readll(i) ll i; cin >> i
#define readdouble(i) double i; cin >> i
#define readstring(s) string s; cin >> s

typedef long long ll;
 
using namespace std;


int main()   {
    cout.precision(17);
    ll modd = 1000 * 1000 * 1000 + 7;
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    uniform_int_distribution<int> rand_gen(0, modd);   // rand_gen(rng) gets the rand no
    ll infinit = 10000000000000000;

//    auto start = chrono::steady_clock::now();

//    readint(test_cases);
    int test_cases = 1;
    forr(t, 1, test_cases) {
        readll(a); readll(b); readll(c); readll(d);

        vector<vector<ll>> ans(c+1,vector<ll>(d+1, 0));
        ans[a][b]=1;
        ll mm = 998244353;
        for(ll x = a; x <= c; ++x) {
            for(ll y = b; y <= d; ++y) {
                if ((x>a) || (y>b)) {
                   ll temp = 0;
                   temp += y*ans[x-1][y]; temp = temp % mm;
                   temp += x*ans[x][y-1]; temp = temp % mm;
                   ll t2 = (x-1)*(y-1)*ans[x-1][y-1]; t2 = t2 % mm; t2 = mm - t2;
                   temp += t2;
                   temp = temp % mm;
//                   ans[x][y] = y*ans[x-1][y]+x*ans[x][y-1]-(x-1)*(y-1)*ans[x-1][y-1];
                   ans[x][y] = temp;
                }
            }
        }

        cout << ans[c][d] << endl;
//        cout << ct_b(c,d) << endl;
//        cout << ct_w(c,d) << endl;

    }

//    auto end = chrono::steady_clock::now();
//    cout << chrono::duration_cast<chrono::milliseconds>(end - start).count() << endl;

    return 0;
}

Measured memory_bytes: 73700
// May this submission get accepted!

#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define STEP(i, is, ie, step) for (long long i=(is), i##_end=(ie), i##_step = (step); i<=i##_end; i+=i##_step)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
template<class T> bool chmax(T &a, const T &b) { if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) do { cerr << "[DEBUG] " #q ": ["; REP(DUMPALL_ITR, (q).size()) { cerr << (q)[DUMPALL_ITR] << (DUMPALL_ITR == DUMPALL_ITR_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; } while (false)
template<class T> T gcd(T a, T b) { if (a < b) std::swap(a, b); while (b) std::swap(a %= b, b); return a; }
template<class T> T lcm(const T a, const T b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    // インタラクティブ問題では除去した方がいいかも
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    string s; cin >> s;
    if (s == "SUN") {
        cout << 7 << endl;
    } else if (s == "MON") {
        cout << 6 << endl;
    } else if (s == "TUE") {
        cout << 5 << endl;
    } else if (s == "WED") {
        cout << 4 << endl;
    } else if (s == "THU") {
        cout << 3 << endl;
    } else if (s == "FRI") {
        cout << 2 << endl;
    } else if (s == "SAT") {
        cout << 1 << endl;
    } else {
        cout << 114514 << endl;
    }
    
}

Measured memory_bytes: 256
N = int(input())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
A.sort()
B.sort()

if N % 2:
    l = A[N // 2]
    r = B[N // 2]
    print(r - l + 1)
else:
    l2 = A[N // 2 - 1] + A[N // 2]
    r2 = B[N // 2 - 1] + B[N // 2]
    print(r2 - l2 + 1)


Measured memory_bytes: 25532
k, n = map(int,input().split())
a_lst = list(map(int,input().split()))
a_lst.sort()

max1 = 0
for i in range(n-1):
    a1 = a_lst[i]
    a2 = a_lst[i+1]

    max1 = max(max1, a2-a1)

max2 = k - a_lst[-1] + a_lst[0]

max = max(max1, max2)

print(k-max)

Measured memory_bytes: 25836
#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
//#include <stdbool.h>
//#include <limits.h>
//#include <math.h>

int main() {
  int n, k, ans = 1;
  scanf("%d%d", &n, &k);
  for (int i=0; i<n; i++) {
    if (ans < k)
      ans *= 2;
    else
      ans += k;
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#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;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

class State{
public:
  int cost;
  int pos;
  State(int _c,int _p): cost(_c), pos(_p){}
  bool operator<(const State& s) const{
    return cost < s.cost;
  }
  bool operator>(const State& s) const{
    return cost > s.cost;
  }
};

int main(){
  int n;
  while(~scanf("%d",&n)){
    bool nodes[101][101];
    memset(nodes,false,sizeof(nodes));
    map<string,int> goto_dst;
    vector<string> code;

    for(int i=0;i<n;i++){
      string str;
      cin >> str;
      if(str == "goto"){
	cin >> str;
	str = str.substr(0,str.size()-1);
	code.push_back(str);
      }
      else{
	str = str.substr(0,str.size()-1);
	goto_dst[str] = i;
	code.push_back("goto");
      }
    }
    
    for(int i=0;i<code.size();i++){
      if(goto_dst.find(code[i]) != goto_dst.end()){
	nodes[i][goto_dst[code[i]]] = true;
      }
    }

    priority_queue<State,vector<State>,greater<State> > que;
    que.push(State(0,0));

    int dp[101];
    memset(dp,0x3f,sizeof(dp));
    dp[0] = 0;
    while(!que.empty()){
      State s = que.top();
      int cost = s.cost;
      int from = s.pos;

      que.pop();
      bool is_goto = false;
      for(int to=0;to<=n;to++){
	if(nodes[from][to]){
	  if(dp[to] > cost){
	    que.push(State(cost,to));
	    dp[to] = cost;
	  }
	  if(dp[from+1] > cost+1){
	    que.push(State(cost+1,from+1));
	    dp[from+1] = cost+1;
	  }
	  is_goto = true;
	  break;
	}
      }

      if(!is_goto){
	if(dp[from+1] > cost){
	  que.push(State(cost,from+1));
	  dp[from+1] = cost;
	}
      }
    }

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

Measured memory_bytes: 1292
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;
	
	int MAX = 10;
	boolean[][][] map;
	
	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			int x = sc.nextInt(), y = sc.nextInt();
			if( (x|y) == 0 ) break;
			
			int n = sc.nextInt();
			map = new boolean[2][MAX][MAX];
			int s = 0;
			map[s][y][x] = true;
			for(int i=0;i<n;i++) {
				for(boolean[] a: map[1-s]) fill(a, false);
				for(int j=0;j<MAX;j++) for(int k=0;k<MAX;k++) if(map[s][j][k]) {
					jump(map[1-s], k, j);
				}
				spr(map[1-s], sc.nextInt(), sc.nextInt());
				for(boolean[] a: map[1-s]) debug(a);
				debug();
				s = 1-s;
			}
			
			boolean f = false;
			for(int i=0;i<MAX;i++) for(int j=0;j<MAX;j++)
				 f |= map[s][i][j];
			
			System.out.println((f? "OK": "NA"));
		}
	}
	
	int dx[] = {-1,0,1,2,2,2,1,0,-1,-2,-2,-2};
	int dy[] = {-2,-2,-2,-1,0,1,2,2,2,1,0,-1};
	
	void jump(boolean[][] map, int x, int y) {
		for(int i=0;i<dx.length;i++) {
			int nx = x+dx[i];
			int ny = y+dy[i];
			if( nx < 0 || ny < 0 || nx >= 10 || ny >= 10 ) continue;
			map[ny][nx] = true;
		}
	}
	
	void spr(boolean[][] map, int x, int y) {
		boolean[][] tmp = new boolean[MAX][MAX];
		for(int i=-1;i<=1;i++) for(int j=-1;j<=1;j++) {
			int nx = x + i, ny = y + j;
			if( nx < 0 || ny < 0 || nx >= 10 || ny >= 10 ) continue;
			tmp[ny][nx] = true;
		}
		
		for(int i=0;i<MAX;i++) for(int j=0;j<MAX;j++) 
			map[i][j] = map[i][j] & tmp[i][j];
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... os) {
//		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 12000
# -*- coding: utf-8 -*-
"""
AtCoder D
"""

# N = int(input())
# A = list(map(int,input().split())) # N row 1 column
# A = int(input()) for _ in range(N) # 1 row N column

# S = str(input()) # str(input()) == input() -> 'abc'
# S = list(input()) # abc -> ['a','b','c']

def main():
    # A, B = list(map(int,input().split()))
    N = int(input())
    tmp=0
    i=1
    o=min(N,2000000)
    for i in range(1,o):
        mod=(N-i)%i
        if mod==0:
            if (i>=(N-i)/i):
                break
            tmp+=int((N-i)/i)
        i+=1
    print(int(tmp))
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 39024
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    cout << a + b + c + max({a, b, c}) * ((1 << k) - 1) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef long long int ll;
 
 
 ll N = 1000005;
const ll mod = 998244353;
const long long int inf = 1e10+5;
#define pp pair<ll,ll>
 
typedef long double ld;
typedef vector<pp> vpl;
#define MP make_pair
#define endl "\n"
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<n;i++)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define repb(i,n) for(ll i=1;i<n-1;i++) 
#define trace(i,a) for(auto i=a.begin();i!=a.end();i++) 
#define mtrace(i,a) for(auto i=a.begin();i!=a.end();i++)  cout<<i->first<<" "<<i->second<<endl;   
void fastIO(void);
 
void decimal(int);
ll modmulti(ll, ll);
ll modadd(ll, ll);
ll modpower(ll, ll);
ll gcd(ll, ll );
ll modinv(ll);

 




int main(){
   
  ll a,b,c;
  cin>>a>>b;
  c = gcd(a,b);
  a = a*b;
  c = a/c;
  cout<<c<<endl;
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
void fastIO(void)
{  ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
}
 
void decimal(int n){
   cout<<fixed;
   cout<<setprecision(n);
}
ll modmulti(ll a, ll b){
   return ((a%mod)*1ll*(b%mod))%mod;
}
ll modadd(ll a, ll b){
   ll asdfgh =  ((a%mod)+(b%mod)+mod+mod)%mod;
   asdfgh = (asdfgh+mod)%mod;
   return asdfgh;
}
ll modpower(ll a, ll n){
   if(n==0) return 1;
   if(n==1) return a%mod;
   ll b = modpower(a,n/2);
   b = modmulti(b,b);
   if(n%2==0) return b;
   return modmulti(a,b);
}
ll gcd(ll a, ll b){
   if(b==0)
      return a;
   return gcd(b,a%b);
}
ll modinv(ll a){
   return modpower(a,mod-2);
}
 

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,a,n) for(int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define FI first
#define SE second
#define maxn (1<<19)
//#define mod 1000000007
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef double db;

int cnt;
int ONE;

void add(int i,int j,int k)
{
    printf("+ %d %d %d\n",i,j,k);
    cnt++;
}
void cmp(int i,int j,int k)
{
    printf("< %d %d %d\n",i,j,k);
    cnt++;
}


void makeone(int x)
{
    add(0,1,3);
    add(0,3,3);
    add(1,3,3);
    cmp(0,3,x);
}

void move(int x,int y)
{
    add(x,10000,y);
}

void makepw(int x,int k)
{
    add(10000,ONE,x);
    while(k--) add(x,x,x);
}
void makepw_base(int x,int k)
{
    while(k--) add(x,x,x);
}

void reset(int x)
{
    add(10000,10000,x);
}

int main()
{
    printf("%d\n",59526);
    ONE=4;
    int ans=2,Ap1=5,Bp1=6,it1=7,it2=8;

    makeone(ONE);
    add(0,ONE,Ap1);
    add(1,ONE,Bp1);

    per(i,0,29)
    {
        int c1=9;
        makepw(100,i);
        add(it1,100,c1);
        cmp(c1,Ap1,c1);
        
        reset(it2);
        per(j,0,29)
        {
            int c2=10;
            makepw(100,j);
            add(it2,100,c2);
            cmp(c2,Bp1,c2);
            int c=11;
            add(c1,c2,c);
            cmp(ONE,c,c);
            makepw_base(c,i+j);
            add(ans,c,ans);
            makepw_base(c2,j);
            add(it2,c2,it2);
        }
        makepw_base(c1,i);
        add(it1,c1,it1);
    }
    //printf("%d\n",cnt);
    return 0;
}

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


#define f(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define char_f(i,a) for(int i=(int)(a);(char)s[i]!='\0';i++)
#define rf(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define llf(i,a,b) for(long long int i=(long long int)(a);i<=(long long int)(b);i++)
#define llrf(i,a,b) for(long long int i=(long long int)(a);i>=(long long int)(b);i--)



#define ll long long
#define fi first
#define se second
#define pb push_back
#define pop pop_back
#define mem(ara) memset((ara),0,sizeof(ara))
#define memn(ara) memset((ara),-1,sizeof(ara))
#define bb begin()
#define ee end()
#define em emplace
#define eb emplace_back





#define si set<int>
#define sd set<double>
#define sll set<long long int>
#define ss set<string>
#define sc set<char>

#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pci pair<char,int>
#define pic pair<int,char>
#define pcl pair<char,long long int>
#define plc pair<long long int,char>

#define pss pair<string,string>
#define pcc pair<char,char>

#define pis pair<int,string>
#define psi pair<string,int>
#define pls pair<long long int,string>
#define psl pair<string,long long int>
#define pdd pair<double,double>
#define pcs pair<char,string>
#define psc pair<string,char>



#define vi  vector<int>
#define vll vector<long long int>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vii vector<pii>



#define mod 1000000007
#define mx (1<<30)-1
#define llmx (1ll<<62)
#define n_size 100005
#define g_size 10000005
double PI=acos(-1);



///unsigned int uMAX=4294967295;
///unsigned ll int ullMAX=18446744073709551615;





int arr[g_size];



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

	int n,m,T,res;

	int maxi=-mx,mini=mx,count=0;

	int i,j,k;

	bool flag;

	string s1,s2;

	char s[100000];

	ll int ara[n_size],ara2[n_size];

	cin>>n;

	ara[0]=2;
	ara[1]=1;

	f(i,2,n){
        ara[i]=ara[i-1]+ara[i-2];
	}

	cout<<ara[n]<<endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define double long double
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), end(x))
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) ((x)/gcd(x,y)*(y))
#define isin(x, l, r) ((l) <= (x) and (x) < (r))
#define fcout(n) cout << fixed << setprecision(n)
#define rcout(n) cout << right << setw(n)
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define PI (acosl(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define INF32 INT32_MAX
#define MOD 1000000007LL
using namespace std;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using PII = pair<int, int>;
using TIII = tuple<int, int, int>;
using VPII = vector<pair<int, int>>;
using VTIII = vector<tuple<int, int, int>>;
using Complex = complex<double>;
template<typename T, template<typename> typename C = less> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> inline bool chmax(T& a, const T& b, bool t = false){ if(a<b or (t and a == b)){ a=b; return true; } return false; }
template<typename T> inline bool chmin(T& a, const T& b, bool t = false){ if(a>b or (t and a == b)){ a=b; return true; } return false; }


int N;
int c[200010];


signed main(){
    cin >> N;
    rep(i, 0, N-1){
        int A;
        cin >> A;
        c[A-1]++;
    }

    rep(i, 0, N) cout << c[i] << endl;

    return 0;
}

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

int main() {
  int h,w;
  cin >> h >> w;
  int a,b;
  cin >> a >> b;
  cout << (h - a) * (w - b) << endl;
}

/*　【提出前に確認すること】
・コンパイルできるか
・テストケース試したか
・オーバーフローあるか
*/


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

#define MP make_pair
#define PB push_back
#define ST first
#define ND second

using namespace std;

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef long long LL;

void init_ios()
{
     ios_base::sync_with_stdio(0);
     cin.tie(0);
}

string s;
int n;

int main()
{
    init_ios();
    cin >> s;
    n = s.size();
    for (int i = 0; i < n-1; ++i) {
    	if (s[i] == s[i+1]) {
    		cout<<i+1<<" "<<i+2<<"\n";
    		return 0;
    	}
    	if (i+2 < n && s[i] == s[i+2]) {
    		cout<<i+1<<" "<<i+3<<"\n";
    		return 0;
    	}
    }
  	cout<<"-1 -1\n";
}

Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String str = input.readLine( );
		String[] rgb = str.split(" ");
		int g = Integer.parseInt(rgb[1]);
		int b = Integer.parseInt(rgb[2]);

		if((g*10+b)%4 == 0){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}


	}

}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

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


int main(){
    LL N;cin >> N;
    vector<LL> y = divisor(N);
    LL ans = INF;
    LL tmp = 0;
    rep(i,y.size()){
        if(N % y[i] == 0){
            tmp = N / y[i];
            tmp += y[i];
            chmin(ans,tmp);
        }
    }
    cout << ans - 2 << endl;
}



Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<queue>
using namespace std;
 
#define Y first
#define X second

#define max_size 100+10

int my[4] = {0,0,1,-1};
int mx[4] = {1,-1,0,0};

pair<int, int>now,tmp;

void chek(int map[max_size][max_size], int w, int h)
{
	int i, j;
	for(i=0;i<=h+1;i++)
	{
		for (j = 0; j <= w + 1; j++)
		{
			cout << map[i][j];
		}
		cout << endl;
	}
}


int main(void)
{
	int w, h;
	int xs, ys, xg, yg;
	int n;
	int col, d, set_x, set_y;

	int i, j,k;

	while ((cin >> w >> h), w != 0 && h != 0)
	{
		queue< pair<int, int> > QU;

		int map[max_size][max_size] = { 0 };

		cin >> xs >> ys >> xg >> yg >> n;

		for (i = 0; i < n; i++)
		{
			cin >> col >> d >> set_x >> set_y;
			if (d == 0)
			{
				for (j = 0; j < 2; j++)
				{
					for (k = 0; k < 4; k++)
					{
						map[set_y][set_x] = col;
						set_x++;
					}
					set_x -= 4;
					set_y++;
				}
			}
			else
			{
				for (j = 0; j < 4; j++)
				{
					for (k = 0; k < 2; k++)
					{
						map[set_y][set_x] = col;
						set_x++;
					}
					set_x -= 2;
					set_y++;
				}
			}
		}

		//chek(map, w, h);

		if (map[ys][xs] == 0)
		{
			cout << "NG\n";
			continue;
		}

		int s_col = map[ys][xs];

		now.Y = ys;
		now.X = xs;
		QU.push(now);

		bool goal = false;
		while (!QU.empty())
		{
			now = QU.front();
			QU.pop();

			if (map[now.Y][now.X] != -1)
			{
				map[now.Y][now.X] = -1;

				if (now.Y == yg && now.X == xg)
				{
					goal = true;
					while (!QU.empty())
					{
						QU.pop();
					}

					break;
				}

				for (i = 0; i < 4; i++)
				{
					if (map[now.Y + my[i]][now.X + mx[i]]== s_col)
					{
						tmp.Y = now.Y + my[i];
						tmp.X = now.X + mx[i];

						QU.push(tmp);
					}
				}
			}
		}

		if (goal)
		{
			cout << "OK\n";
		}
		else
		{
			cout << "NG\n";
		}

	}
	return 0;
}


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

typedef pair <int, int> ii;

int n, d;
int ans;

int main() {
	scanf("%d%d", &n, &d);
	for (int i = 0; i < n; i++) {
		long long x, y; scanf("%lld%lld", &x, &y);
		double cur = sqrt(x * x + y * y);
		if (cur <= d) ans++;
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 3768
// 2011/07/02 Tazoe

#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main()
{
	int rct = 0;
	int lzn = 0;

	while(true){
		string str;
		cin >> str;
		if(cin.eof())
			break;

		for(int i=0; i<str.size(); i++)
			if(str[i]==',')
				str[i] = ' ';

		istringstream ist(str);
		int a, b, c;
		ist >> a >> b >> c;

		if(a*a+b*b==c*c)
			rct++;
		if(a==b)
			lzn++;
	}

	cout << rct << endl;
	cout << lzn << endl;

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

int main(){
    vi in(3);
    int oe=0;
    rep(i,3){
        cin >> in[i];
        oe += in[i]%2;
    }
    sort(in.begin(),in.end());
    int ans;
    if(oe==3 || oe==0){
        ans = (in[2] - in[1] + in[2] - in[0])/2;
    }else{
        if(in[0]%2 - in[1]%2==0){
            in[0]++;
            in[1]++;
        }else if(in[1]%2 - in[2]%2==0){
            in[1]++;
            in[2]++;
        }else{
            in[2]++;
            in[0]++;
        }
        sort(in.begin(),in.end());
        ans = (in[2] - in[1] + in[2] - in[0])/2 + 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		sc.close();
		char c[] = S.toCharArray();
		int ans = 700;
		for (int i = 0; i < S.length(); i++) {
			if (c[i] == 'o') {
				ans += 100;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int,int>;
constexpr ll mod = 1000000007;
void pPRINTl(ostream& ost) { ost << endl; }
template <class T>void pPRINTL(ostream& ost,T t){ost<<t<<endl;}
template <class T, class... U>void pPRINTl(ostream& ost, T t, U... u) {ost << t << " ";pPRINTl(ost, u...);}
template <class... T>void PRINTl(T... t) { pPRINTl(cout, t...); }
//#define PRINTl
void pPRINT(ostream& ost) {}
template <class T>void pPRINT(ostream& ost, T t){ost<<t<<" ";}
template <class T, class... U>void pPRINT(ostream& ost, T t, U... u) {ost << t << " ";pPRINT(ost, u...);}
template <class... T>void PRINT(T... t) { pPRINT(cout, t...); }
//#define PRINT

//#define DEBUG PRINTl("DEBUG line:",__LINE__)
#define DEBUG 

constexpr ll MAX = 1e9;

int main(){
  
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  ll n;  cin>>n;
  ll a[n]; REP(i,n)cin>>a[i];
  
  bool f = false;
  
  REP(i,n){
    ll truev = i+1;
    if(a[i]!=truev){
      //PRINT(a[i]);DEBUG;
      if(f==false){
        ll truei = a[i]-1;
        //PRINT(a[truei]);DEBUG;
        if(a[truei]==truev){
          f=true;
          a[truei]=a[i];
          a[i]=truev;
          DEBUG;
        }
        else{
          DEBUG;
          PRINT("NO");
          return 0;
        }
      }
      else{
        DEBUG;
        PRINT("NO");
        return 0;
      }
    }
  }
  DEBUG;
  PRINT("YES");
  
  return 0;
}

Measured memory_bytes: 256
//
// Created by INCOMPETENT CODER on 25-08-2020
//https://atcoder.jp/contests/abc179/tasks/abc179_a
#include "bits/stdc++.h"

using namespace std;
typedef long long int ll;
#define debug(...) cout<< " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] " ;

ll bin_search(ll a[], ll lb, ll ub, ll item) {
    while (lb <= ub) {
        ll mid = lb + (ub - lb) / 2;
        if (a[mid] == item) return mid;
        if (a[mid] > item) lb = mid + 1;
        else ub = mid - 1;
    }
    return -1;
}

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

        y = y >> 1;
        x = x * x;
    }
    return res;
}

ll powerp(ll x, ll y, ll p) {
    ll res = 1;
    x = x % p;
    if (x == 0) return 0;
    while (y > 0) {
        if (y & 1)
            res = (res * x) % p;

        y = y >> 1; // y = y/2
        x = (x * x) % p;
    }
    return res;
}

void solve() {
}

int main() {
    ll tt=1;
//    cin >> tt;
    while (tt--) {
//        solve();
        string s;
        cin>>s;
        if(s[s.length()-1]!='s')    cout<<s+'s';
        else    cout<<s+"es";
    }
}

Measured memory_bytes: 3608
w,a,b = map(int,input().split())
if a<b:
  if a+w<b:
    print(b-(a+w))
  else:
    print(0)
elif a>b:
  if b+w<a:
    print(a-(b+w))
  else:
    print(0)
else:
  print(0)

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

int main(){
    int a,b;
    cin >> a >> b;
    long long sum_a=0;
    long long sum_b=0;
    for (int i=0;i<a;i++){
        sum_b += b*(pow(10,i));
    }
    for (int i=0;i<b;i++){
        sum_a += a*(pow(10,i));
    }
    cout << max(sum_a,sum_b) << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
	ll n;
	cin >> n;
	ll ans = 1001001001001001;
	for(ll i = 1; i * i <= n; i++){
		if(n % i != 0) continue;
		ll j = n / i;
		ans = min(ans, i+j-2);
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int main(){
  unsigned long long int l;
  cin >> l;
  unsigned long long int a = sqrt(l);
  int tmp = 1000;
  for(long long int i = 1; i <= a; i++){
    if(l % i != 0) continue;
    unsigned long long int b = l / i;
    int p = log10(i), q = log10(b);
    p++, q++;
    if(max(p, q) < tmp) tmp = max(p,q);
  }
  cout << tmp;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#define ios ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define so sizeof
#define pb push_back
#define vl vector<ll>
#define el endl;cout.flush()
#define be begin()
#define fi first
#define se second
#define br break
#define sz size()
#define en end()
#define ro return 0
#define br break
#define con continue;
#define um unordered_map<ll,ll>
#define ms(x) memset(x , 0, so x)
#define all(x) (x).be , (x).en
#define rall(x) (x).rbegin() , (x).rend()
#define acc(x) accumulate((x).be , (x).en , 0ll)
#define forn(i,a,b) for(ll i=a;i<=b;++i)
#define forr(i,a,b) for(ll i=a;i<b;++i)
#define rng_58 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define plll pair<ll,pair<ll,ll>>
#define plvl pair<pair<ll,ll> ,ll>
#define mp make_pair
int main()
{
    ios;
    string s;
    cin >> s;
    stack<char> ss ;
    for(auto &x : s){
        if(ss.empty() == true){
            ss.push(x);
            con;
        }
        else{
            if(ss.top() == 'S' and x == 'T'){
                ss.pop();
                continue;
            }
            else {
                ss.push(x);
            }
        }
    }
    cout << ss.size() << el ;
    ro ;

}























Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define pp pair<ll,ll>
#define ld long double
#define all(a) (a).begin(),(a).end()
#define mk make_pair
ll MOD=998244353;
int inf=1000001000;
ll INF=1e18+5;
ll mod=INF;


int main() {
    int n;
    cin >> n;
    map<ll,ll> m;
    ll ans=0;
    rep(i,n){
      ll f;
      cin >> f;
      ans+=f;
      m[f]++;
    }
    int q;
    cin >> q;
    rep(ii,q){
      ll f,g;
      cin >> f >> g;
      ll o=m[f];
      m[f]=0;
      m[g]+=o;
      ans+=o*(g-f);
      cout << ans << endl;
    }
}


Measured memory_bytes: 9548
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <vector>
#include <math.h>
#include <map>
#include <queue>
#include <set>
#include <stack>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define debug(x) cout<<x<<endl
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
typedef long long ll;
using namespace std;
const int MAXN=1e5+50;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
//::iterator it;
int main()
{
    std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    int a,b,n;
    int c,d;
    cin>>a>>b>>c>>d;
    int cnt=1;
    while(1){
      if(cnt&1){
        c-=b;
      }else a-=d;

      if(a<=0||c<=0)break;
      cnt++;
    }
    if(cnt&1)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}
/*

*/

 
 

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define fo(i,a,b)for(int i=a,_e=b;i<=_e;++i)
#define fd(i,a,b)for(int i=b,_e=a;i>=_e;--i)
#define ll long long
using namespace std;
const int N=1e5+5,mo=998244353;
int n,k;
char a[N];
ll ans;
int ksm(int x,int y){
	int t=1;
	for(;y;y>>=1,x=(ll)x*x%mo)if(y&1)t=(ll)t*x%mo;
	return t;
}
int main(){
	scanf("%s",a+1);
	cin>>k;
	n=strlen(a+1);
	int is=1;
	fo(i,2,n)if(a[i]!=a[1]){
		is=0;break;
	}
	if(is)ans=(ll)n*k/2;else{
		int st=0,en=0,ss=0;
		fo(i,1,n){
			++ss;
			if(i==n||a[i]!=a[i+1]){
				if(ss==i){
					st=ss;ss=0;continue;
				}
				if(i==n){
					en=ss;continue;
				}
				ans+=ss/2;
				ss=0;
			}
		}
		ans=ans*k;
		if(a[1]==a[n])ans+=st/2+en/2+(ll)(st+en)/2*(k-1);
		else ans+=(ll)(st/2+en/2)*k;
	}
	cout<<ans;
}

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

using namespace std;

int main() {
    int n;
    string s1, s2;
    cin >> n >> s1 >> s2;


    int type;
    long long h;
    int i = 1;
    if (s1[0] == s2[0]) {
        h = 3;
        type = 0;
    } else {
        h = 6;
        i = 2;
        type = 1;
    }

    for (; i < n; i++) {
        if (s1[i] == s2[i]) {
            if (type == 0) {
                h = (h * 2) % 1000000007;
            }
            type = 0;
        } else {
            if (type == 0) {
                h = (h * 2) % 1000000007;
            } else {
                h = (h * 3) % 1000000007;
            }
            type = 1;
            i++;
        }
    }
    cout << h << endl;
}


Measured memory_bytes: 256
// 154 B

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>
#include <iomanip>
#include <climits>

using namespace std;

int main(){
    int s, w;
    cin >> s >> w;
    if(s > w) cout << "safe" << endl;
    else cout << "unsafe" << endl;
    return 0;
}


Measured memory_bytes: 3640
n,y = map(int,input().split())
	
for s1 in range(n+1):
	for s2 in range(n-s1+1):
		if y== s1*10000+s2*5000+(n-s1-s2)*1000:
			print("{} {} {}".format(s1,s2,n-s1-s2))
			exit()
else:
	print("{} {} {}".format(-1,-1,-1))


Measured memory_bytes: 3060
#include <stdio.h>

#define NMAX 100

int bubbleSort(int *A, int n);

int main(){
   int j, n, A[NMAX];
   int nswitch;
   scanf("%d",&n);
   for(j=0;j<n;j++) scanf("%d",A+j);
   nswitch=bubbleSort(A,n);
   printf("%d",A[0]);
   for(j=1;j<n;j++) printf(" %d",A[j]);
   printf("\n");
   printf("%d\n",nswitch);
   return 0;
}

int bubbleSort(int *A, int n){
   int nswitch, flag, j, tmp;
   nswitch=0;
   flag=1;
   while(flag){
      flag=0;
      for(j=n-1;j>0;j--){
         if(A[j]<A[j-1]){
            tmp=A[j]; A[j]=A[j-1]; A[j-1]=tmp;
            ++nswitch;
            flag=1;
         }
      }
   }
   return nswitch;
}

Measured memory_bytes: 604
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n,y;
    cin >> n >> y;

    y/=1000;

    // cout << y << endl;

    for(ll i=0;i<=n;i++){
        for(ll j=0;j<=n;j++){
            if(n-i-j<0) continue;
            if(10*i + 5*j + (n-i-j) == y){
                cout << i << " " << j << " " << n-i-j << endl; 
                // cout << 10*i + 5*j + (tmp-j) << endl;
                // cout << now << endl;
                return 0;
            }
        }
    }

    cout << -1 << " " << -1 << " " << -1 << endl;

    return 0;
}

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

using namespace std;
using ll = long long;
using vi = vector<int>;
using ii = pair<int, int>;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int h, w, n;
	cin >> h >> w >> n;
	
	if(h >= w){
		cout << n / h + (n % h != 0); 
	}
	else{
		cout << n / w + (n % w != 0);
	}
}




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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

const int N = 3e6 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;

int n, Q;
int arr[N + 2];

#define lb(v, k) 			(lower_bound(all(v), k) - v.begin());
int lsr( vector<int> &v, int k) { return lb(v, k); };
int grt ( vector<int> &v, int k) { return (int)v.size() - lb(v, k + 1); }
void solve()
{
	int m, k;
	cin >> n >> m >> k;
	vector<int> v1(n), v2(m);
	lop(i, 0, n) cin >> v1[i];
	lop(i, 0, m) cin >> v2[i];
	lop(i, 1, m) v2[i] += v2[i - 1];

	int s1 = 0, ans = 0;
	lop(i, 0, n + 1)
	{
		if (i) s1 += v1[i - 1];
		int x = k - s1;
		if (x >= 0)
		{
			int y = lb(v2, x + 1);
			ans = max(i + y, ans);
			// if( y == m )
			// {
			// 	ans = max(ans + )
			// }
		}
	}
	cout << ans << endl;

}

int32_t main()
{
	ios_base::sync_with_stdio(0);   cin.tie(0);   cout.tie(0);

	int test = 1;
	// cin >> test;
	while (test--)solve();


}





Measured memory_bytes: 6368
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	text1, _ := reader.ReadString(' ')
	text2, _ := reader.ReadString('\n')
	text2 = strings.Replace(text2, "\n", "", -1)
	text1 = strings.Replace(text1, " ", "", -1)
	text3 := text2 + text1
	fmt.Println(text3)
}


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

using namespace std;

int main() {
  int n;
  cin >> n;
  int t[n], x[n], y[n];
  t[0] = x[0] = y[0] = 0;
  for (int i = 1; i <= n; i++) {
    cin >> t[i] >> x[i] >> y[i];
  }

  bool ok = true;
  for (int i = 1; i <= n; i++) {
    int time = t[i] - t[i -1];
    int dist = abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]);
    if (time < dist || time % 2 != dist % 2) {
      ok = false;
    }
  }

  if (ok) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 1408
antennas = [None] * 5
for i in range(5):
  antennas[i] = int(input())
k = int(input())

for i in range(5):
  for j in range(i+1, 5):
    if antennas[j] - antennas[i] > k:
      print(':(')
      exit()
print('Yay!')


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int c[3][3];

    for (unsigned i = 0; i < 3; ++i) {
        for (unsigned j = 0; j < 3; ++j) {
            cin >> c[i][j];
        }
    }

    if((c[1][0] - c[0][0] == c[1][1] - c[0][1])
       && (c[1][1] - c[0][1] == c[1][2] - c[0][2])
       && (c[1][2] - c[0][2] == c[1][0] - c[0][0])
       && (c[2][0] - c[0][0] == c[2][1] - c[0][1])
       && (c[2][1] - c[0][1] == c[2][2] - c[0][2])
       && (c[2][2] - c[0][2] == c[2][0] - c[0][0])) {
           cout << "Yes" << endl;
       } else {
           cout << "No" << endl;
       }

    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using pii = pair<int, int>;
 
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define x first
#define y second
 
const int MOD = 1e9 + 7;
 
void setIO() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
}
 
//ctrl q is comment
//ctrl b is run
//ctrl s is compile
//alt r is search & replace
//alt d is delete a line

int main(){
    setIO();
    int n; cin >> n;
    int a[n];
    int cnt = 0;
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        if((i + 1) % 2 && a[i] % 2 ) ++ cnt;
    }
    cout << cnt << "\n";
}

Measured memory_bytes: 3648
import numpy as np
H,W = map(int,input().split())
S=np.array([list(input().rstrip("\n")) for _ in range(H)]) == '.'
D = np.zeros((H,W),dtype=int)
U = np.zeros((H,W),dtype=int)
L = np.zeros((H,W),dtype=int)
R = np.zeros((H,W),dtype=int)
for i in range(H):# 上下
  U[i] = (U[i-1] + 1) * S[i]
  D[-i-1] = (D[-i] + 1) * S[-i-1]
for i in range(W):# 左右
  L[:,i] = (L[:,i-1] + 1) * S[:,i]
  R[:,-i-1] = (R[:,-i] + 1) * S[:,-i-1]
print(np.max(U+D+L+R)-3)

Measured memory_bytes: 219828
N = int(input())


def dfs(ret, cur, f1, f2, f3):
    if N < cur:
        return ret

    ret += 1 if f1 and f2 and f3 else 0

    ret = dfs(ret, cur * 10 + 7, True, f2, f3)
    ret = dfs(ret, cur * 10 + 5, f1, True, f3)
    ret = dfs(ret, cur * 10 + 3, f1, f2, True)

    return ret


def main():
    print(dfs(0, 0, False, False, False))
    return


main()


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

using namespace std;

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
const int inf = 1000000001;
const ll INF = 2e18;
const ll MOD = 1000000007;
//const ll mod = 1000000009;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p;//<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };

#define pic pair<int, char>

#define N 2010
vll dp(2 * N + 1, vl(N + 1, INF));




class Bit {
public:
	int n;
	vl bit; // 1-index

	Bit(int _n) { n = _n; bit.resize(n + 1); }

	ll sum(int i) {
		ll s = 0;
		while (i > 0) {
			s += bit[i];
			i -= i & -i;
		}
		return s;
	}

	//iは1-index
	void add(int i, ll x) {
		while (i <= n) {
			bit[i] += x;
			i += i & -i;
		}
	}

	// bitに入ってる中でx番目に小さい数を求める
	// 1番小さい数はx = 1;
	// bitに3を入れる→add(3, 1), 3を出す→add(3, -1)
	ll min_xth(int x) {
		int left = 0, right = 200000;
		while (left + 1 < right) {
			int mid = (left + right) / 2;
			int temp = sum(mid);
			if (temp < x) {
				left = mid;
			}
			else {
				right = mid;
			}
		}
		return right;
	}

};


int main() {
	int n;
	cin >> n;
	vector<pic> a(2 * n);
	rep(i, 2 * n) {
		cin >> a[i].second >> a[i].first;
	}
	dp[0][0] = 0;
	rep(i, 2 * n) {
		Bit white(n), black(n);
		
		rep(j, 2 * n) {
			//cout << i << " " << j << endl;
			if (a[j].second == 'W') {
				white.add(a[j].first, 1);
			}
			else {
				black.add(a[j].first, 1);
			}
			if (a[j].first <= i + 1) {
				int b, w;
				int cnt;
				if (a[j].second == 'W') {
					w = a[j].first - 1;
					b = i - w;
					if (b < 0 || b > n) {
						continue;
					}
					cnt = (white.sum(n) - white.sum(w + 1)) + (black.sum(n) - black.sum(b));
					//DEBUG(cnt);
					dp[i + 1][b] = min(dp[i + 1][b], dp[i][b] + cnt);
				}
				else {
					b = a[j].first - 1;
					w = i - b; 
					if (w < 0 || w > n) {
						continue;
					}
					cnt = (white.sum(n) - white.sum(w)) + (black.sum(n) - black.sum(b + 1));
					//DEBUG(cnt);
					dp[i + 1][b + 1] = min(dp[i + 1][b + 1], dp[i][b] + cnt);
				}
			}
		}
	}
	cout << dp[2 * n][n] << endl;
}

Measured memory_bytes: 63616