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

int main(){
   int N;
  scanf("%d",&N);
   
   
   if((N%10==2)||(N%10==4)||(N%10==2)||(N%10==5)||(N%10==7)||(N%10==9)){
      printf("hon\n");
   } else if((N%10==0)||(N%10==1)||(N%10==6)||(N%10==8)){
      printf("pon\n");
   } else if(N%10==3){
      printf("bon\n");
   }
   return 0;
}

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

int main() {
  int N;
  cin >> N;
  set<string> S;
  rep(i, N) {
    string s;
    cin >> s;
    S.insert(s);
  }

  cout << S.size() << endl;
}


Measured memory_bytes: 19236
import heapq
x,y,z,k = map(int, input().split()) 
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
inf = 10**18
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
h = [0]*k
heapq.heapify(h)
for i in a:
    for j in b:
        cur = i+j
        t=0
        while t<z and h[0] < cur + c[t]:
            heapq.heappushpop(h, cur + c[t])
            t += 1
r = [heapq.heappop(h) for _ in range(k)]
for _ in range(k):
    print(r.pop())

Measured memory_bytes: 3700
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

ll N;
vector<ll> vec;

void solve() {
	cin >> N;
	vec.resize(N);
	rep(i, N) cin >> vec[i];

	vector<ll> color(N,-1);

	for (ll i = 0; i < N; i++) {

		//binary search
		//最終的にL=Rはtrueの左端で止まる
		//←false→LR←true→
		ll L = 0, R = color.size();
		//全てtrueのときは普通に0が返る
		//全てfalseのとき，sizeが返る
		while (L != R) {
			ll F = (L + R) / 2;
			bool judge;

			if (vec[i] <= color[F]) {
				judge = false;
			}
			else {
				judge = true;
			}

			if (judge) { R = F; }
			else { L = F + 1; }

		}

		color[L] = vec[i];

	}
	ll ans = 0;
	rep(i, N) {
		if (color[i] != -1) ans++;
	}

	cout << ans;

}

int main() {
	solve();
	cout << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>

#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
using ll = long long;
using namespace std;

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

    ll N, Z, W;
    cin >> N >> Z >> W;
    vector<ll> a(N);
    REP(i, N) cin >> a[i];
    if (N == 1) {
        cout << abs(a[0] - W) << endl;
    } else {
        cout << max(abs(a[a.size() - 1] - W), abs(a[a.size() - 2] - a[a.size() - 1])) << endl;
    }

    return 0;
}


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

d = dict()

for i in range(N):
  s = input()
  if s in d:
    d[s]+=1
  else:
    d[s]=1

d = sorted(d.items(), key=lambda x:-x[1])
i=0
ans=[]
while i<len(d):
  ans.append(d[i][0])
  if i<len(d)-1 and d[i+1][1]==d[i][1]:
      i+=1
  else:
    break

ans = sorted(ans)

for i in range(len(ans)):
  print(ans[i])

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


template<int64_t mod>
struct modint {
    using LL = int64_t;
    LL val;
    modint(LL val=0) : val(((val % mod) + mod) % mod) {}

    const modint operator+() const { return *this; }
    const modint operator-() const { return (-val + mod) % mod; }
    const modint inv() const { return pow(mod-2); }

    modint& operator+=(const modint& rhs) {
        (val += rhs.val) %= mod;
        return *this;
    }
    modint& operator-=(const modint& rhs) {
        return *this += -rhs;
    }
    modint& operator*=(const modint& rhs) {
        (val *= rhs.val) %= mod;
        return *this;
    }
    modint& operator/=(const modint& rhs) {
        return *this *= rhs.inv();
    }

    const modint operator+(const modint& rhs) const {
        return modint(*this) += rhs;
    }
    const modint operator-(const modint& rhs) const {
        return modint(*this) -= rhs;
    }
    const modint operator*(const modint& rhs) const {
        return modint(*this) *= rhs;
    }
    const modint operator/(const modint& rhs) const {
        return modint(*this) /= rhs;
    }

    const modint pow(LL n) const {
        modint ret = 1, tmp = val;
        while (n > 0) {
            if (n & 1) ret *= tmp;
            tmp *= tmp; n >>= 1;
        }
        return ret;
    }

    bool operator==(const modint& rhs) const { return val == rhs.val; }
    bool operator!=(const modint& rhs) const { return !(*this == rhs); }

    friend const modint operator+(const LL& lhs, const modint& rhs) {
        return modint(lhs) + rhs;
    }
    friend const modint operator-(const LL& lhs, const modint& rhs) {
        return modint(lhs) - rhs;
    }
    friend const modint operator*(const LL& lhs, const modint& rhs) {
        return modint(lhs) * rhs;
    }
    friend const modint operator/(const LL& lhs, const modint& rhs) {
        return modint(lhs) / rhs;
    }

    friend bool operator==(const LL& lhs, const modint& rhs) {
        return modint(lhs) == rhs;
    }
    friend bool operator!=(const LL& lhs, const modint& rhs) {
        return modint(lhs) != rhs;
    }

    friend ostream& operator<<(ostream& os, const modint& a) {
        return os << a.val;
    }
    friend istream& operator>>(istream& is, modint& a) {
        LL tmp; is >> tmp;
        a = tmp;
        return is;
    }
};

template<typename T>
vector<T> fast_mobius_transform_prime(const vector<T>& g) {
    int n = g.size();
    vector<T> f = g;
    vector<bool> sieve(n, true);
    for (int p = 2; p < n; ++p) {
        if (!sieve[p]) continue;
        for (int i = 1; i * p < n; ++i) {
            sieve[i * p] = false;
            f[i] -= f[i * p];
        }
    }
    return f;
}

using LL = long long;
const LL MOD = 1e9+7;
using Int = modint<MOD>;


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

    vector<Int> g(K+1);
    for (int d = 1; d <= K; ++d) {
        g[d] = Int{ K / d }.pow(N);
    }

    vector<Int> f = fast_mobius_transform_prime(g);

    Int ans = 0;
    for (int d = 1; d <= K; ++d) {
        ans += f[d] * d;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4784
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define inf 1000000000
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
#define meM(y,a) memset(y,a,sizeof y)
#define sC(a) scanf("%d",&a)
#define alL(a) a.begin(),a.end()
#define prinT(a,sz)  cout<<a[0];for(int i=1;i<sz;i++)cout<<" "<<a[i];cout<<endl
#define ranD srand(chrono::steady_clock::now().time_since_epoch().count());
typedef pair<int,int>pi;
typedef pair<ll,ll>pll;
//int fx[]={0,0,1,-1};
//int fy[]={1,-1,0,0};
//int gx[]={0,0,1,1,1,-1,-1,-1};
//int gy[]={1,-1,0,1,-1,0,1,-1};
const int N=100010;
map<ll,int>mp;
int main()
{
    IOS;
    int n;cin>>n;
    ll res=0,sum=0;
    mp[0]=1;
    for(int i=0;i<n;i++)
    {
        ll a;cin>>a;
        sum+=a;
        res+=mp[sum];
        mp[sum]++;
//        cout<<sum<<" "<<mp[sum]<<endl;
    }
    cout<<res<<endl;
}








Measured memory_bytes: 16028
import java.io.*;
import java.util.ArrayDeque;

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw=new PrintWriter(System.out);
		ArrayDeque<Integer> list=new ArrayDeque<Integer>();
		int n=Integer.parseInt(br.readLine());
		for (int i=0;i<n;i++){
			String[] stmp=br.readLine().split(" ");
			switch (stmp[0]){
			case "insert":
				list.push(Integer.parseInt(stmp[1]));
				break;
			case "delete":
				list.remove((Integer)Integer.parseInt(stmp[1]));
				break;
			case "deleteFirst":
				list.removeFirst();
				break;
			case "deleteLast":
				list.removeLast();
				break;
			default: break;
			}
		}
		if (!list.isEmpty()) pw.print(list.poll());
		for (;!list.isEmpty();){
			pw.print(" "+list.poll());
		}
		pw.println();
		pw.close();
	}
}

Measured memory_bytes: 188548
global B
def check(B,x,y,c):
	if 0 < x < w+2 and 0 < y < h+2 and B[y][x] == c:
		B[y][x] = -1
		check(B,x-1,y,c);check(B,x,y-1,c);check(B,x+1,y,c);check(B,x,y+1,c)

while 1:
	w,h = map(int,raw_input().split())
	if w == 0: break
	B = [[0]*(w+2) for i in range(h+2)]
	xs,ys = map(int,raw_input().split())
	xg,yg = map(int,raw_input().split())
	for i in range(input()):
		c,d,x,y = map(int,raw_input().split())
		if d == 0:
			B[y][x:x+4] = [c]*4
			B[y+1][x:x+4] = [c]*4
		else:
			for j in range(4):
				B[y+j][x:x+2] = [c]*2
	if B[ys][xs] != B[yg][xg]:
		print "NG"
	else:
		check(B,xs,ys,B[ys][xs])
		print "OK" if B[yg][xg] == -1 else "NG"

Measured memory_bytes: 4308
#include <bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
int abs(int x){
    if(x<0) return -x;
    else return x;
}
int main() {
    string s;
    cin>>s;
    int A=0,Z=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='A'){
            A=i;
            break;
        }
    }
  
    for(int i=s.size()-1;i>0;i--){
        if(s[i]=='Z'){
            Z=i;
            break;
        }
    }
    
    cout<<Z-A+1<<endl;
}

Measured memory_bytes: 3748
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
using namespace std;

int main(){
	int n, k;
	int x, y, z;
	int s, ans;
	bool v = true;
	ans = 0;
	scanf("%d %d %d", &n,&x,&y);
	z = y - x;

	if(z%2==0)printf("Alice\n");
	else printf("Borys\n");


	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define x first
#define y second
#define PII pair < int , int >
#define PLL pair < ll , ll >
#define MOD 1000000007
#define rc(x) return cout << x, 0

using namespace std;

int n, k;
map <  int , int > P , U;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> k;
    for (int i = 1, x, y; i <= k; i++){
        cin >> x >> y;
        if (y < x) swap(x, y);
        if (x == 1){
            P[y] = 1;
            if (U[y]) return cout << "POSSIBLE", 0;
        }
        if (y == n){
            U[x] = 1;
            if (P[x]) return cout << "POSSIBLE", 0;
        }
    }
    cout << "IMPOSSIBLE";
}


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

int main(){
	string s;
	cin >> s;
	int len = s.size();
	for(char c = 'a';c <= 'z';c++){
		int ju = 0;
		for(int i = 0;i < len;i++){
			if(s[i] == c){
                ju = 1;
                break;
            }
		}
		if(!ju){
			cout << c << endl;
			return 0;
		}
	}
    cout << "None" << endl;
}

Measured memory_bytes: 512
/*
Author: Racer5x
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
 
// #pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include<bits/stdc++.h>
#define int         long long
#define double      long double
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MAX         2000000000000000000
#define M           1000000007
using namespace std;
 
signed main()
{
    tezz
    
    int a, b;
    cin>>a>>b;

    set<int> s;
    s.insert(1);

    for(int i=2;i<1000005;i++){
        if(a%i == 0 && b%i == 0){
            s.insert(i);
            while(a%i == 0) a/=i;
            while(b%i == 0) b/=i;
        }
        if(a%i == 0) while(a%i == 0) a/=i;
        if(b%i == 0) while(b%i == 0) b/=i;
    }
    // cout<<a<<' '<<b<<endl;

    if(a > 1 && b > 1 && a==b) s.insert(a);

    cout<<s.size();
} 

Measured memory_bytes: 764
#include"bits/stdc++.h"
using namespace std;

int main() {
	string s1, s2, s3;
	cin >> s1 >> s2 >> s3;
	printf("%c%c%c\n", s1[0] - 32, s2[0] - 32, s3[0] - 32);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[100005],b[100005];
int n,m;
int cmp(int a,int b){
	return a<b;
}
int cmp1(int a,int b){
	return a>b;
}
int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++)
		scanf("%d",&a[i]);
	sort(a+1,a+1+m,cmp);
	long long ans=a[m]-a[1];
	m--;
	for (int i=1;i<=m;i++)
		b[i]=a[i+1]-a[i];
	sort(b+1,b+1+m,cmp1);
	if (n>m) n=m+1;
	n-=1;
	for (int i=1;i<=n;i++)
		ans-=b[i];
	printf("%lld",ans);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int N,A,B;
    cin >> N >> A >> B;
    cout << min(A,B) << " " << max(0,N - ((N-A) + (N-B))) << endl;
}

Measured memory_bytes: 256
use io::*;

fn main() {

    let con = read_string();
    let mut sc = Scanner::new(&con);

    let n: usize = sc.next();
    let mut s: Vec<i64> = sc.next_vec(n);

    s.sort();

    let mut sa = 0;
    let mut sb = 0;
    if n % 2 == 0 {
        for i in 0..n {
            if i % 2 != 0 {
                sa += s[i as usize];
            } else {
                sb += s[i as usize];
            }
        }
    } else {
        for i in 0..n {
            if i % 2 != 0 {
                sb += s[i as usize];
            } else {
                sa += s[i as usize];
            }
        }
    }
    println!("{}", sa - sb);
}

pub mod io {

    use std;
    use std::str::FromStr;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }

        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }

        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}

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

using namespace std;

map<int,int> res;

void prime_factor(int n){
    for(int i=2;i*i<=n;i++){
        while(n%i==0){
            ++res[i];
            n/=i;
        }
    }

    if(n!=1){
        res[n]++;
    }
}

int main(){
    int N;
    cin >> N;
    for(int i=1;i<=N;i++){
        prime_factor(i);
    }

    int over2=0,over4=0,over14=0,over24=0,over74=0;

    for(int i=2;i<=N;i++){
        if(74<=res[i]){
            over2++;
            over4++;
            over14++;
            over24++;
            over74++;
        }else if(24<=res[i]){
            over2++;
            over4++;
            over14++;
            over24++;
        }else if(14<=res[i]){
            over2++;
            over4++;
            over14++;
        }else if(4<=res[i]){
            over2++;
            over4++;
        }else if(2<=res[i]){
            over2++;
        }
    }

    cout << over74 + over14*(over4-1) + over24*(over2-1) + over4*(over4-1)*(over2-2)/2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  ll N, comp=0;
  bool flag=true;
  std::cin >> N;
  vvl A = vv(N+1, N, 0, ll);
  std::vector<ll> now(N+1, 1);
  for(ll i=1;i<=N;i++) for(ll j=1;j<=N-1;j++) std::cin >> A[i][j];
  std::vector<set<ll> > vs(N+1);
  set<ll> wait;
  std::vector<ll> day(N+1, 0);
  for(int i=1;i<=N;i++) wait.insert(i);
  ll time = 0;

  while(comp<N){
    if(!flag){
      std::cout << -1 << '\n';
      return 0;
    }
    time++;
    flag = false;
    auto itr = wait.begin();
    while(itr!=wait.end()){
      ll a = *itr;
      if(now[a]==N) {
        itr++;
        continue;
      }
      ll b = A[*itr][now[*itr]];
      if(vs[*itr].find(A[*itr][now[*itr]])!=vs[*itr].end()){
        flag = true;
        if(day[a]<time && day[b]<time){
          vs[a].erase(b);
          if(wait.find(b)==wait.end()) wait.insert(A[*itr][now[*itr]]);
          day[a] = time;
          day[b] = time;
          if(now[b]==N-1) comp++;
          now[b]++;
          if(now[a]==N-1) comp++;
          now[a]++;
        }
        itr++;
      }else{
        vs[b].insert(a);
        itr++;
        if(itr==wait.end()){
          itr--;
          wait.erase(itr);
          break;
        }else{
          ll c = *itr;
          itr--;
          wait.erase(itr);
          itr = wait.find(c);
        }
      }
    }
  }
  std::cout << time << '\n';
  return 0;
}


Measured memory_bytes: 10112
#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <climits>
#include <map>

using namespace std;

int main(void)
{
    long long n,m;

    cin >>n >>m;

    map<long long, long long> mp;
    for(int i = 0; i < n; i++){
        long long tmp;
        cin >>tmp;
        map<long long, long long>::iterator it = mp.find(tmp);
        if(it == mp.end()){
            mp[tmp] = 0;
        }
        mp[tmp]++;
    }

    for(int i = 0; i < m; i++){
        long long b,c;
        cin >>b >>c;
        map<long long , long long>::iterator it = mp.find(c);
        if(it == mp.end()){
            mp[c] = 0;
        }
        mp[c] += b;
    }
    long long ans = 0;
    for(map<long long,long long>::reverse_iterator rit = mp.rbegin(); rit != mp.rend(); rit++){
        if((*rit).second > n){
            ans += (*rit).first * n;
            break;
        }else{
            ans += (*rit).first * (*rit).second;
            n -= (*rit).second;
            if(n <= 0){
                break;
            }
        }
    }
    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 12800
#include <iostream>
#include <cstdio>
#define IsDigit(x) ((x) >= '0' && (x) <= '9')
using namespace std;

int n, pos;
int last[200001], parity[200001], cross_edge[100001];
struct Edge{
    int y, prev, dir;
}edge[600000];


int Read(void)
{
    int c, ret(0);
    bool sign(false);
    
    c = getchar();
    while (!IsDigit(c) && c != '-')
        c = getchar();
    c == '-' && (sign = true, c = getchar());
    do
        ret = ret * 10 + c - '0';
    while ((c = getchar()) && IsDigit(c));
    return sign ? -ret : ret;
}


inline void AddBiEdge(const int x, const int y)
{
    edge[pos].y = y;
    edge[pos].prev = last[x];
    last[x] = pos++;
    edge[pos].y = x;
    edge[pos].prev = last[y];
    last[y] = pos++;
    return;
}


int main()
{
    int ance, root_A, root_B;
    
    n = Read();
    pos = 2;
    for (int i = 1; i <= n; ++i) {
        ance = Read();
        if (ance == -1)
            root_A = i;
        else {
            AddBiEdge(i, ance);
            ++parity[ance];
        }
    }
    for (int i = 1; i <= n; ++i) {
        ance = Read();
        if (ance == -1)
            root_B = n + i;
        else {
            AddBiEdge(n + i, n + ance);
            ++parity[n + ance];
        }
    }
    for (int i = 1; i <= n; ++i)
        if ((parity[i] & 1) ^ (parity[n + i] & 1)) {
            printf("IMPOSSIBLE\n");
            return 0;
        }
        else
            if (~parity[i] & 1) {
                AddBiEdge(i, n + i);
                cross_edge[i] = pos - 2;
            }
    AddBiEdge(root_A, root_B);
    for (register int src = 1, curr; src <= n << 1; ++src) {
        while (last[src] && edge[last[src]].dir)
            last[src] = edge[last[src]].prev;
        if (!last[src])
            continue;
        curr = src;
        do {
            while (edge[last[curr]].dir)
                last[curr] = edge[last[curr]].prev;
            edge[last[curr]].dir = 1;
            edge[last[curr] ^ 1].dir = 2;
            curr = edge[last[curr]].y;
        }
        while (curr != src);
    }
    printf("POSSIBLE\n");
    for (int i = 1; i <= n; ++i)
        if (cross_edge[i])
            printf(edge[cross_edge[i]].dir == 1 ? "-1 " : "1 ");
        else
            printf("0 ");
    printf("\n");
    return 0;
}



Measured memory_bytes: 9472
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;

unsigned long long int longAbs(unsigned long long int a,unsigned long long int b){
	if(a >= b)return (a - b);
	else return (b - a);
}

int main()
{
	unsigned long long int N,K,x,minN;
	cin>>N>>K;
	x = N;
	if( N > K){
		x = N % K;
	}
	x = min( x,longAbs(x,K));
	cout<<x<<endl;
	return 0;
}



Measured memory_bytes: 256
import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

def solve():
    n = int(input())
    a = list(map(int, input().split()))
    ruiseki = [a[0]]
    for i in range(1,n):
        ruiseki.append(a[i]+ruiseki[i-1])
    ans = 0
    for i in range(n):
        ans += a[i]*(ruiseki[-1]-ruiseki[i])
    print(ans % (10**9+7))
    return 0

if __name__ == "__main__":
    solve()


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

typedef long long int ll;
typedef long double ld;

//****************************************************                
#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define rlp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll> 
#define vpll vector<pll>
#define all(X) X.begin(),X.end()
#define endl "\n" //comment it for interactive questions
#define trace1(a) cerr << #a << ": " << a << endl;
#define trace2(a,b) cerr << #a << ": " << a << " " << #b << ": " << b << endl;
#define trace3(a,b,c) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << endl;
#define trace4(a,b,c,d) cerr << #a << ": " << a << " " << #b << ": " << b << " " << #c << ": " << c << #d << ": " << d << endl;
#define OC freopen("input.txt" , "r", stdin); freopen("output.txt" , "w", stdout) 
#define MOD (ll)1e9+7; //change it for other mods
#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
        //*******************************************************
//Some Functions

ll powmod(ll a,ll b)
{
   ll res = 1;
   while(b > 0) {
      if(b & 1) res = (res * a) % MOD;
      a = (a*a)%MOD;
      b = b >> 1; 
  }
  return res % MOD;
}

void solve()
{
    ll n,x,y;
    cin >> n >> x >> y;
    vll ans(n, 0);
    for(ll i=1;i<=n;i++) {
      for(ll j=i+1;j<=n;j++) {
        ll dis = min(j-i, abs(j-y) + abs(i-x) + 1);
        // cout << i << " " << j << " " << dis << "\n";
        ans[dis]++;
      }
    }
    for(ll i=1;i<=n-1;i++) {
      cout << ans[i] << "\n";
    }
    cout << "\n";
}

int main()
{
    // FAST_IO;
    // #ifndef ONLINE_JUDGE 
      // OC;
    // #endif
    ll t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
}

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

int main(void){
	int n;
	cin>>n;
	int a[n];
	int max=0;
	int max2=0;
	int flg=false;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(max<a[i]){
			if(max!=a[i]){
			max2=max;
			max=a[i];
				flg=false;
			}else{
				max2=max;
				max=a[i];
				flg=true;
			}
		}else if(max2<a[i]){
			max2=a[i];
		}
	}
	int tmp;
	for(int i=0;i<n;i++){
		if(a[i]!=max){
			cout<<max<<"\n";
		}else if(flg){
			cout<<max<<"\n";
		}else{
			cout<<max2<<"\n";
		}
	}
}

Measured memory_bytes: 2432
#include <stdio.h>

int main(void){
    /*配列に正の整数を格納*/
    int i = 0,n;
    scanf("%d",&n);
    int array[n];
    while(i < n){
        array[i] = i + 1;
        i++;
    }

    /*一つずつカウント*/
    int count = 0;
    i = 0;
    while(i < n){
        if((array[i] > 9999 && array[i] <100000) || (array[i] > 99 && array[i] < 1000) || array[i] < 10){
            count++;
        }
        i++;
    }
    printf("%d\n",count);

    return 0;
}

Measured memory_bytes: 512
/* You are being watched. */


//~ while (clock() <= 69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>

//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")

using namespace std;

//~ #include <ext/pb_ds/assoc_container.hpp>
//~ #include <ext/pb_ds/tree_policy.hpp>
//~ using namespace __gnu_pbds;
//~ template <typename T>
//~ using ordered_set =
  //~ tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(x) (x).begin(), (x).end()
#define show(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << "\n"
#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
//using li = __int128;
//using uli = unsigned __int128;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

double getTime() {
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

const int N = 5e5 + 5;
const ll MOD = 1e9 + 7;

ll f[N], inv[N];

ll get(ll x, ll y) {
  if(y == -1) y = MOD - 2;
  ll res = 1LL;
  while(y) {
    if(y & 1) res = (res * x) % MOD;
    y >>= 1LL;
    x = (x * x) % MOD;
  }
  return res;
}

ll ncr(ll n, ll m) {
  if(n < 0 or m < 0 or n < m) return 0ll;
  return f[n] * inv[m] % MOD * inv[n - m] % MOD;
}

void solve() {
  ll n, m; cin >> n >> m;
  ll tobe = 0ll;
  ll mul = 1ll;
  for(ll i = 0; i <= n; i++) {
    ll cur = mul * ncr(n, i) * ncr(m - i, n - i) % MOD * f[n - i] % MOD;
    tobe = (tobe + cur) % MOD;
    if(tobe < 0) tobe += MOD;
    mul = -mul;
  }
  cout << (tobe * ncr(m, n) % MOD * f[n]) % MOD << '\n';
}

int main() {
  f[0] = inv[0] = 1LL;
  for(int i = 1; i < N; i++) {
    f[i] = (i * f[i - 1]) % MOD;
    inv[i] = get(f[i], -1);
  }
  int t; t = 1;
  while(t--) solve();
}




Measured memory_bytes: 11456
#include <bits/stdc++.h>
#define int long long int
#define ll long long
#define quickie ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(i, a, b) for(int i=a; i<b; i++)
#define rep1(i, a, b) for(int i=a; i<=b; i++)
#define repp(i, a, b) for(int i=b-1; i>=a; i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bn begin()
#define en end()
#define SZ(x) ((int)(x).size())
#define db double
#define mi map<int, int>
#define vi vector<int>
#define qi queue<int>
#define MI(x) power(x, mod-2)
#define test int t; cin >> t;
#define mod 1000000007
#define pi 3.141592653589
using namespace std;

int power(int x, int y) ;
int gcd(int a, int b) ;

signed main() {
	quickie
	int n ;
	cin >> n ;
	if(n >= 30) cout << "Yes\n" ;
	else cout << "No\n" ;
}

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

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


Measured memory_bytes: 3608
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int x = sc.nextInt();
		int cnt = 0;
		int z;
		for (int i = 0; i <= a; i++) {
			z = x - 500 * i;
			// x -= 500*i;
			for (int j = 0; j <= b; j++) {
				z -= 100 * j;
				for (int k = 0; k <= c; k++) {
					// z -= 50*k;
					z = z - 50 * k;
					if (z == 0) {
						cnt++;
					}
					z = z + 50 * k;
				}
				z += 100 * j;
			}
		}
		System.out.println(cnt);
	}
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
#include <vector>
using namespace std;
int main()
{
    vector<string> result;
    vector<string> S;
    result.push_back("AC");
    result.push_back("WA");
    result.push_back("TLE");
    result.push_back("RE");
    int N;
    int a = 0, b = 0, c = 0, d = 0;
    cin >> N;
    string word;
    for(int i = 0; i < N; i++)
    {
        cin >> word;
        S.push_back(word);
    }
    //sort(S.begin(),S.end());
    vector<string>::iterator it;
    for(it = S.begin();it != S.end();it++)
    {
        if(*it == result[0])
            a++;
        if(*it == result[1])
            b++;
        if(*it == result[2])
            c++;
        if(*it == result[3])
            d++;
    }
    cout << result[0] << " x " << a << endl << result[1] << " x " << b << endl;
    cout << result[2] << " x " << c << endl << result[3] << " x " << d << endl;
   return 0;
}


Measured memory_bytes: 7468
# -*- coding: utf-8 -*-


from sys import stdin

############################################

import numpy as np
# read data for n sequences.
n = stdin.readline().split()
a = int(n[0])
b = int(n[1])
c = int(n[2])

ans = []
for i in range(1, a+1):
    if a%i==0:
        ans.append(i)
ans=sorted(ans,reverse=True)
if a == 1:
    ans=[1]
count=0

for i in ans:
    if b%i==0:
        count+=1
    if count==c:
        break
print(i)

Measured memory_bytes: 12488
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int m = Integer.parseInt(br.readLine());
		PrintWriter pw = new PrintWriter(System.out);
		pw.println(48 - m);
		pw.flush();
	}
}

Measured memory_bytes: 21076
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
    }
    let mut divisor = vec![];
    let n_sqrt = (n as f64).sqrt() as usize;
    for i in 1..n_sqrt+1 {
        if n % i == 0 {
            divisor.push(i-1);
            if i * i != n {
                divisor.push(n/i-1)
            }
        }
    }
    divisor.retain(|&x| x != 0);
    divisor.sort();

    let mut v = vec![];
    for d in divisor {
        if (n % d) == n / d {
            v.push(d)
        }
    }
    println!("{}", v.iter().sum::<usize>());
}


Measured memory_bytes: 4352
#include <iostream> 
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
#include<set>
#include<queue>
#include<deque>
#include<sstream>
#include<cmath>
#include<bitset>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i,n) for(int i = 1;i <=  n; i++)
#define rrep(i,n) for(int i = n-1;i >= 0;i--)
#define ALL(obj) begin(obj), end(obj)
#define RALL(a) rbegin(a),rend(a)
typedef long long int ll;
typedef long double ld;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
const int MAX = 510000;
const int MOD = 1000000007;
const int inf = 1<<31-1;
int dx[9] = { -1,0,1,-1,0,1,-1,0,1 }, dy[9] = { -1,-1,-1,0,0,0,1,1,1 };
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; }
int main(void) {
    int h, w,n,a,b; cin >> h >> w>>n;
    map<pair<int, int>, int> mp;
    vector<ll> ans(10, 0);
    rep(i, n) {
        cin >> a >> b; a--; b--;
        rep(j, 9) {
            int nx = b + dx[j], ny = a + dy[j];
            if (nx < 1 || ny < 1 || nx >= w - 1 || ny >= h - 1) continue;
            mp[pair<int,int>{ny, nx}]++;
        }
    }ll k = 0;
    for (auto it = mp.begin(); it != mp.end(); it++) {
        ans[it->second]++;
    }rep(i, 10) k += ans[i];
    cout <<(ll) (h-2)*(w-2) - k<<endl;
    req(i, 9) cout << ans[i]<<endl;
}

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

int main(){
  int n,k;
  cin>>n>>k;
  vector<int>pi(n);
  for(int i=0;i<n;i++){
    cin >> pi.at(i);
  }                 

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

  int x=0;
  for (int i=0;i<k;i++){
    x+=pi.at(i);
  }             

  cout<<x<<endl;        
}

Measured memory_bytes: 3584
while True :
    s = input()
    tmp = []
    if s == '.' :
        break
    ans = True
    for i in range(len(s)) :
        if s[i] == '(' :
            tmp.append(s[i])
        elif s[i] == '[' :
            tmp.append(s[i])
        elif s[i] == ')' :
            if '(' not in tmp :
                ans = False
                break
            elif tmp[-1] == '(' :
                tmp.pop(-1)
            else :
                ans = False
                break
        elif s[i] == ']' :
            if '[' not in tmp :
                ans = False
                break
            elif tmp[-1] == '[' :
                tmp.pop(-1)
            else :
                ans = False
                break
    if len(tmp) != 0 or ans == False :
        print('no')
    else :
        print('yes')




Measured memory_bytes: 5584
<?php
  
  fscanf(STDIN,"%s",$s);

//$a_li = explode(" ",trim(fgets(STDIN)));
$c=0;
$out=0;



if($s[0]=='A' && ctype_lower($s[1]) && ctype_lower($s[strlen($s)-1])){
  for($i=2;$i<strlen($s)-1;$i++){
    if($s[$i]=='C'){
      $c++;
    }elseif(ctype_upper($s[$i])){
      $out++;
    }
  }
  if($c==1&&$out==0){
    echo "AC\n";
  }else{
    echo "WA\n";
  }

}else{
  echo "WA\n";
}

Measured memory_bytes: 4604
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atc_0031
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine();

            int A = int.Parse(str.Split(' ')[0]);
            int B = int.Parse(str.Split(' ')[1]);
            int C = int.Parse(str.Split(' ')[2]);

            int result = 0;
            while (true)
            {
                B = B - A;
               
                if (B < 0 || result == C)
                {
                    break;
                }

                result++;
            }

            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 27416
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, a ,b;
  cin >> N;
  a = N % 1000;
  b = N / 10;
  
  if(a % 111 == 0 || b % 111 == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    int a[101];
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>a[i];
    }
    sort(a,a+N);
    cout<<a[N-1]-a[0]<<endl;
    return 0;
}


Measured memory_bytes: 256
PROGRAM-ID.                      ABC_103_D.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 INP     PIC X(13).
    01 N       PIC 9(6).
    01 M       PIC 9(6).
    01 ab1.
        03 ab OCCURS 100000 DEPENDING M.
            05 a       PIC 9(6).
            05 b       PIC 9(6).

    01 done    PIC 9(6) VALUE ZERO.

    01 ans     PIC X(6).

    01 ZS      PIC Z(7).
    01 DUMMY   PIC X(1).

    01 i       PIC 9(6) BINARY.
    01 cnt     PIC 9(6).

PROCEDURE                        DIVISION.
    ACCEPT INP.

    UNSTRING INP
    DELIMITED BY SPACE
    INTO N M.

    PERFORM VARYING i FROM 1 BY 1 UNTIL M < i
        ACCEPT INP

        UNSTRING INP
        DELIMITED BY SPACE
        INTO a(i) b(i)
    END-PERFORM.

    SORT ab ASCENDING b.

    MOVE ZERO TO done.

    PERFORM VARYING i FROM 1 BY 1 UNTIL M < i
        IF done < a(i) THEN
            ADD 1 TO cnt
            MOVE b(i) TO done
            SUBTRACT 1 FROM done
        END-IF
    END-PERFORM.

    MOVE cnt TO ZS.

    PERFORM UNANS.

    DISPLAY ans(1:FUNCTION STORED-CHAR-LENGTH(ans)).
    STOP RUN.

UNANS                            SECTION.
    UNSTRING
        ZS DELIMITED BY ALL SPACE
        INTO DUMMY ans
    END-UNSTRING.


Measured memory_bytes: 2684
#include <iostream>
#include <cmath>
using namespace std;
int n;
char s[15];
void dfs(int i, char a){
    if(i == n) {
        cout << s << endl;
        return;
    }
    for(char c = 'a'; c <= char(a + 1); c++)
        s[i] = c, dfs(i + 1, max(c, a));
}
int main() {
    cin >> n;
    s[0] = 'a';
    dfs(1, 'a');
    return 0;
}

Measured memory_bytes: 1536
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

x1,y1,x2,y2 = inpl()
X = x2-x1
Y = y2-y1
x3,y3 = x2-Y,y2+X
x4,y4 = x1-Y,y1+X
print(x3,y3,x4,y4)


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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve() {
  int n;
  cin >> n;
  vector<P> a(n);
  rep(i, n) {
    int j;
    cin >> j;
    a[i] = P(j, i);
  }
  sort(a.begin(), a.end());
  rep(i, n) {
    cout << a[i].second + 1 << " ";
  }
  cout << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

Measured memory_bytes: 1664
# input()
# int(input())
# map(int, input().split())
# list(map(int, input().split()))
inf = 10**9+7

n = int(input())
dp_a = [0 for i in range(n+1)]
dp_b = [0 for i in range(n+1)]
dp_c = [0 for i in range(n+1)]

for i in range(n):
    a,b,c = map(int, input().split())
    dp_a[i+1] = max(dp_b[i]+a, dp_c[i]+a)
    dp_b[i + 1] = max(dp_a[i] + b, dp_c[i] + b)
    dp_c[i + 1] = max(dp_a[i] + c, dp_b[i] + c)
print(max(dp_a[n], dp_b[n], dp_c[n]))

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

int main(){
	int N, M;
	cin >> N >> M;
	vector<int> A(N);
	for(int i = 0; i < N; i++)
		cin >> A.at(i);

	int sum = 0;
	for(int i = 0; i < N; i++)
		sum += A.at(i);

	int ans = 0;
	for(int i = 0; i < N; i++)
		if((double)sum/4/M <= (double)A.at(i))
			ans++;
	cout << (ans>=M ? "Yes" : "No") << endl;

	return 0;	
}

Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
# debug = lambda *a, **kw: print(*a, **kw, file=sys.stderr)

x = inl()


def solve():
    for i, y in enumerate(x):
        if y != i + 1:
            return i + 1
    return None


print(solve())


Measured memory_bytes: 9056
n = io.read("*n")
t = {}
for i = 1, n do
  a = io.read("*n")
  if t[a] then t[a] = t[a] + 1 else t[a] = 1 end
end
r = 0
for k, v in pairs(t) do
  if k <= v then
    r = r + v - k
  else
    r = r + v
  end
end
print(r)

Measured memory_bytes: 8468
//Radhe Radhe
#include<bits/stdc++.h>
#define godspeed  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define limit 1000000000000000000 //1e18
#define mod 1000000007 //1e9+7
#define llu long long unsigned
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i,n)    for(ll i=0; i<n; i++)
#define rep1(i,a,b)    for(ll i=a; i<b; i++)
#define repV(i,n)    for(ll i=0; i<v.size(); i++)
#define fixed cout.setf(ios::fixed);
#define Precise cout.precision(7);
#define yes cout<<"Yes"<<'\n';
#define no cout<<"No"<<'\n';
using namespace std;

int main()
{
    godspeed
    ll  i,j,num=0,k;
    string s,t;
    cin >>k;
    if(k%5==0||k%2==0)
        return   cout << -1 << endl,0;
    num=7%k;
    ll cnt=1;
    while(num)
    {
        num=((num*10)+7)%mod;
        num%=k;
        cnt++;
    }
    cout << cnt << endl,0;
    return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0; return gcd(a, b, x, y);}
ll modpow(lll a,lll n,ll m){if(a==0)return a;lll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
const int N = 0;
int a, b;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> a >> b;
  cout << ((a*b)&1 ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
#define lambda(RES_TYPE, ...) (function<RES_TYPE(__VA_ARGS__)>)[&](__VA_ARGS__) -> RES_TYPE
#define method(FUNC_NAME, RES_TYPE, ...) function<RES_TYPE(__VA_ARGS__)> FUNC_NAME = lambda(RES_TYPE, __VA_ARGS__)
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

namespace templates{
  ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
      if(b&1)res = res * x % MOD;
      x = x * x % MOD;
      b>>=1;
    }
    return res;
  }

  ll modinv(ll x){
    return modpow(x, MOD-2);
  }

  bool was_output = false;
  template<class t>
  void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
  }
  void outendl(){
    was_output = false;
    cout << endl;
  }
  ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
  }

  template<class t>
  istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
  }

  template<class t, class u>
  istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
  }

  template<class t>
  void in(t&x){
    cin >> x;
  }

  template<class t>
  t in(){
    t res; cin >> res; return res;
  }

  template<class t>
  void out(t x){
    cout << x;
  }

  template<class t>
  vector<t> sorted(vector<t> line,function<bool(t,t)> comp=[](t a,t b){return a<b;}){
    sort(line.begin(),line.end(),comp);
    return line;
  }

  template<class t>
  vector<t> reversed(vector<t> line){
    reverse(line.begin(),line.end());
    return line;
  }
}

using namespace templates;

int main(){
  int n = in();
  vector<stack<int>> lines(n);
  int q = in();
  rep(i,q){
    int kind = in();
    if(kind==0){
      int t = in();
      int x = in();
      lines[t].emplace(x);
    }else if(kind==1){
      int t = in();
      if(lines[t].size()){
        cout << lines[t].top() << endl;
      }
    }else{
      int t = in();
      if(lines[t].size()){
        lines[t].pop();
      }
    }
  }
}



Measured memory_bytes: 4404