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

using namespace std;

#define int long long
#define endl '\n'
#define MOD 1000000007
#define maxn 100010

void solve() {
    int a, b;
    char ch;
    cin >> a >> ch >> b;

    if (ch == '+')
        cout << a + b;
    else
        cout << a - b << endl;
}

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

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>

#define INF 1000000000
#define MOD 1000000007
#define rep(i,a,b) for(uint32 i = (a); i < (b); ++i)
#define bitget(a,b) (((a) >> (b)) & 1)
#define ALL(x) (x).begin(),(x).end()
#define C(x) std::cout << #x << " : " << x << std::endl
#define scanf scanf_s

using int32 = std::int_fast32_t;
using int64 = std::int_fast64_t;
using uint32 = std::uint_fast32_t;
using uint64 = std::uint_fast64_t;

template<typename T>
class hashmap64 {
	std::vector<std::pair<uint64, T>> map;
	uint64 mask, count, temp;
	uint64 hash64(uint64 key) {
		key = ~key;
		key ^= key << 13;
		key ^= key >> 19;
		return key ^ (key << 17);
	}
public:
	hashmap64() :map(8192, std::make_pair(~static_cast<std::uint_fast64_t>(0), T())) {
		mask = 8191; count = 0;
	}
	hashmap64(size_t s) {
		s |= s << 1;
		s |= s >> 2;
		s |= s >> 4;
		s |= s >> 8;
		s |= s >> 16;
		s |= s >> 32;
		mask = s;
		count = 0;
		map.resize(s + 1, std::make_pair(~static_cast<std::uint_fast64_t>(0), T()));
	}
	T &operator[](uint64 suf) {
		temp = mask&hash64(suf);
		while (map[temp].first != suf) {
			temp = mask&(temp + 1);
		}
		return map[temp].second;
	}
	void insert(uint64 key, const T &value) {
		temp = mask&hash64(key);
		while (~map[temp].first) {
			if (map[temp].first == key) {
				map[temp].second = value;
				return;
			}
			temp = mask&(temp + 1);
		}
		map[temp] = std::make_pair(key, value);
		++count;
		if ((count << 1) > mask) {
			std::pair<uint64, T> mkey;
			mask = mask << 1 | 1;
			map.resize(mask + 1, std::make_pair(~static_cast<std::uint_fast64_t>(0), T()));
			for (uint64 t = 0;t <= mask >> 1;++t) {
				if (~map[t].first) {
					mkey = map[t];
					map[t].first = ~static_cast<std::uint_fast64_t>(0);
					temp = mask&hash64(mkey.first);
					while (~map[temp].first) {
						temp = mask&(temp + 1);
					}
					map[temp] = mkey;
				}
			}
		}
		return;
	}
	bool find(uint64 key) {
		temp = mask&hash64(key);
		while (~map[temp].first) {
			if (map[temp].first == key) {
				return true;
			}
			temp = mask&(temp + 1);
		}
		return false;
	}
	bool empty(void) {
		return !count;
	}
	size_t size(void) {
		return count;
	}
};

int main(void) {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	hashmap64<uint32> map(1000);
	uint32 n;
	std::cin >> n;
	int64 a, sum = 1e15;
	uint32 ans = 0;
	map.insert(sum, 0);
	rep(i, 0, n) {
		std::cin >> a;
		sum += a;
		if (map.find(sum)) {
			ans = std::max(ans, i + 1 - map[sum]);
		}
		else {
			map.insert(sum, i + 1);
		}
	}
	std::cout << ans << "\n";
	return 0;
}

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


def main():
    N, M = map(int, input().split())

    ans = 1
    i = 1
    while i**2<=M:
        if M%i==0:
            if i<=M//N:
                ans = max(ans, i)
            if M//i<=M//N:
                ans = max(ans, M//i)
        i += 1
    
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 38640
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100010
#define INF 10000000000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 1000000;
const int MOD = 1000000007;
int main(){
    int n,d;
    cin>>n>>d;
    vector<vector<int>>x(n,vector<int>(d));
    REP(i,n){
        REP(j,d){
            IN(x[i][j]);
        }
    }
    int cnt=0;
    REP(i,n-1){
        for(int j=i+1;j<n;j++){
            int tmp=0;
            REP(k,d){
                tmp+=pow((x[i][k]-x[j][k]),2);
            }
            int p=1;
            while(p*p<=tmp){
                if(p*p==tmp){
                    cnt++;
                    break;
                }else{
                    p++;
                }
            }
        }
    }
    OUT(cnt);
	return 0;
}

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

#遇奇判定
def isALLEven(arr):
    for i in arr:
        if i % 2 != 0:
            return False
    return True

#2で割る関数
def devide(i):
    return i / 2

def main():
    count = 0
    #N入力
    n = int(input())
    #整数入力
    lists = list(map(int, input().split()))

    #rリストの中身が偶数ならカウンタを1進めて，配列の中身を2で割る
    while isALLEven(lists):
        count += 1
        lists = list(map(devide, lists))
    
    print("{}".format(count))
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
def  main():
    N,W = map(int,input().split(" "))
    V = []
    dp = [0 for _ in range(W+1)]
    for _ in range(N):
        V.append(tuple(map(int,input().split(" "))))
    V =  tuple(V)
    for i in range(N):
        tmp = list(dp)
        v,w = V[i]
        for j in range(W+1):
            if 0 <= j+w <= W:
                tmp[j+w] = max(dp[j+w],dp[j]+v)
        dp = list(tmp)
    print(dp[-1])
if __name__ == "__main__":
    main()


Measured memory_bytes: 6636
#include <cstdio>

template<typename T>
T gcd(T a, T b)
{
	if (a < b) return gcd(b, a);
	T r;
	while (r = a % b)
	{
		a = b;
		b = r;
	}
	return b;
}

int main()
{
	int n;
	long long m;
	scanf("%d%lld", &n, &m);
	long long a[100000];
	for (int i = 0; i < n; ++i)
	{
		scanf("%lld", a + i);
		a[i] /= 2;
	}
	bool potest = true;
	long long lcm = a[0];
	for (int i = 1; i < n; ++i)
	{
		long long g = gcd(lcm, a[i]);
		lcm = lcm / g * a[i];
		if (lcm > m || (a[i - 1] & (-a[i - 1])) != (a[i] & (-a[i])))
		{
			puts("0");
			return 0;
		}
	}
	printf("%lld\n", (m / lcm + 1) / 2);
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
struct Fast {Fast(){std::cin.tie(0);std::ios::sync_with_stdio(false);}} fast;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define repR(i, n) for(ll i = n; i >= 0; i--)
#define For(i, m, n) for(ll i = m; i < n; i++)

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) v.begin(), v.end()

using namespace std;

ll mod = 1e9+7;
inline ll gcd(ll a, ll b){
    ll r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

inline ll lcm(ll x, ll y)
{
    if(x == 0 || y == 0) {
        return -1;
    }
    
    return (x * y / gcd(x, y));
}

inline ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

inline ll nCr(ll n, ll r) {
    if ( r * 2 > n ) r = n - r;
    ll dividend = 1;
    ll divisor  = 1;
    for ( ll i = 1; i <= r; ++i ) {
        dividend *= (n-i+1);
        divisor  *= i;
    }
    return (dividend / divisor);
}

// 因数分解
inline vector<pair<ll, int>>factorize(ll n){
    vector<pair<ll, int>> res;
    for(ll i = 2; i * i <= n; ++i){
        if(n % i) continue;
        res.emplace_back(i, 0);
        while(n % i == 0){
            n /= i;
            res.back().second++;
        }
    }
    if(n != 1) res.emplace_back(n, 1);
    return res;
}

inline bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

//階乗
inline ll factorialMethod(ll k){
    ll sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

inline ll vector_finder(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
    if (index != vec.size()) { // 発見できたとき
        return 1;
        
        
    }
    else { // 発見できなかったとき
        return 0;
    }
}

void recursive_comb(ll *indexes, ll s, ll rest, std::function<void(ll *)> f) {
    if (rest == 0) {
        f(indexes);
    } else {
        if (s < 0) return;
        recursive_comb(indexes, s - 1, rest, f);
        indexes[rest - 1] = s;
        recursive_comb(indexes, s - 1, rest - 1, f);
    }
}

void foreach_permutation(int n, std::function<void(int *)> f) {
    int indexes[n];
    for (int i = 0; i < n; i++) indexes[i] = i;
    do {
        f(indexes);
    } while (std::next_permutation(indexes, indexes + n));
}

int main(){
    string s;
    cin >> s;
    
    if(s[1] == 'R'){
        cout << "ABC" << endl;
    } else {
        cout << "ARC" << endl;
    }
    
    return 0;
}


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

int main(){
    int n,k; cin >> n >> k;
    if((n-1)*(n-2)/2 -k<0){
        printf("%d\n",-1);
        return 0;
    }
    printf("%d\n",n-1+(n-1)*(n-2)/2 -k);
    rep(i,n-1){
        printf("%d %d\n",1,i+2);
    }
    int res=1;
    for(int i=2;i<n;++i){
        for(int j=i+1;j<=n;++j){
            if(res>(n-1)*(n-2)/2 -k) break;
            printf("%d %d\n",i,j);
            res++;
        }
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.math.*;
 
class Main {
    public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    public static PrintWriter pw = new PrintWriter(System.out);
    public static String line;
    public static StringTokenizer st;
    public static ArrayList<ArrayList<Integer>> adjList;
    public static int[] dx = {-1, 0, 1, 0, -1, 1, 1, -1, 0};
    public static int[] dy = {0, 1, 0, -1, 1, 1, -1, -1, 0};
    public static int INF = 0x3f3f3f3f;
    public static int MOD = 1000000007;
    public static long LINF = 0x3f3f3f3f3f3f3f3fL;

    public static void main(String[] args) throws Exception {
        int[] out = new int[4];

        for (int i = 0; i < 3; i++) {
            st = new StringTokenizer(br.readLine());
            int a = Integer.parseInt(st.nextToken()) - 1;
            int b = Integer.parseInt(st.nextToken()) - 1;
            // int b =
            out[a]++;
            out[b]++;
        }

        int cnt = 0;
        for (int i = 0; i < 4; i++) {
            if (out[i] % 2 != 0) {
                cnt++;
            }
        }

        pw.println(cnt <= 2 ? "YES" : "NO");
        // }


        pw.close(); 
        br.close();
    }
}

class Pair implements Comparable<Pair>{
    public long x;
    public int y;
 
    Pair(long _x, int _y){
        x = _x;
        y = _y;
    }
 
    public String toString(){
        return x + " " + y;
    }

    public int compareTo(Pair p){
        if (x != p.x) return x < p.x ? -1 : 1;
        if (y != p.y) return y < p.y ? -1 : 1;
        return 0;
    }
} 

Measured memory_bytes: 21332
#include<stdio.h>
int main(void)
{
	int a,b,c,s,z,w,x;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	if(a<b){
		if(b-1>a){
			x=b+(b-1);
		}
		else{
			x=b+a;
		}
	}
	else{
		if(a-1>b){
			x=a+(a-1);
		}
		else{
			x=a+b;
		}
	}
	printf("%d\n",x);
	return 0;
}

Measured memory_bytes: 128
#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>
    
    
using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define REV(v) reverse(v.begin(),v.end())
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)
#define dout(n) cout<<# n<<" = "<<n<<endl;
#define v1out(v) FOR(j,0,v.size()){cout<<v[j]; if(j!=(ll)v.size()-1)cout<<" ";else cout<<endl; }
#define v2out(v) FOR(i,0,v.size())v1out(v[i]);

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll k,a,b;
    cin>>k>>a>>b;
    FOR(i,a,b+1){
        if(i%k == 0){
            cout<<"OK"<<endl;
            return 0;
        }
    }
    cout<<"NG"<<endl;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
typedef pair< int , int> P;
int num[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
bool uru(int checkyear){
  if(checkyear%4==0){
    if(checkyear%100!=0||checkyear%400==0)
    return true;
  }
  return false;
}
int gcd( int x, int y ){return y ? gcd(y, x%y) : x;}
bool pairCompare(const P& firstElof, const P& secondElof)
{
  if(firstElof.second!= secondElof.second)    return firstElof.second> secondElof.second;
  else return firstElof.first< secondElof.first;
}
signed main() {
int x=0,y=0,z=0,w=0,n=0,m=0;
int a=0,b=0;
std::cin >> x>>y>>z;
if(z>=x-y)std::cout << z-(x-y) << '\n';
else std::cout << 0 << '\n';
}


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

int main() {
  int A,B;
  cin >>A >>B;
  vector<int> V={0,1,3,1,2,1,2,1,1,2,1,2,1};
  if(V.at(A)==V.at(B)){
    cout <<"Yes" <<endl;
  }
  else{
    cout <<"No" <<endl;
  }
  return 0;
}


Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))
mod = 10**9+7

ans = 0

for i in range(61):
    cnt0 = 0
    cnt1 = 0
    for a in A:
        if (a>>i) & 1 == 0:
            cnt0 += 1
        else:
            cnt1 += 1
    ans += cnt0 * cnt1 * (2 ** i)
    ans %= mod

print(ans)

Measured memory_bytes: 124424
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#define pi 2*acos(0.0)
int main()
{
    int rad;
    double circum;

    scanf("%d",&rad);

    circum=2*pi*rad;

    printf("%lf\n",circum);

    return 0;
}


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

int main() {
    int N, M, A, B;
    cin >> N >> M;
    vector<int> vec(N);
        for (int i = 0; i < M; i++) {
            cin >> A >> B;
            vec.at(A - 1) += 1;
            vec.at(B - 1) += 1;
        }
    for (int j = 0; j < N; j++)
        cout << vec.at(j) << endl;
}

Measured memory_bytes: 3568
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.util.Comparator;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.ni(), m = in.ni();
            Store[] stores = new Store[n];
            for (int i = 0; i < n; i++) {
                stores[i] = new Store(in.ni(), in.ni());
            }
            Arrays.sort(stores, Comparator.comparingLong(o -> o.price));
            long ans = 0;
            for (Store store : stores) {
                if (store.cnt < m) {
                    ans += store.cnt * store.price;
                    m -= store.cnt;
                } else {
                    ans += m * store.price;
                    m = 0;
                    break;
                }
            }
            if (m > 0)
                throw new RuntimeException("not enough minerals");
            out.println(ans);

        }

        class Store {
            long cnt;
            long price;

            public Store(int price, int cnt) {
                this.cnt = cnt;
                this.price = price;
            }

        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String ns() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int ni() {
            return Integer.parseInt(ns());
        }

    }
}



Measured memory_bytes: 44776
#include <iostream>
#include <map>

using namespace std;

int main() {
  map<int, int> map;
  int n, in, buf;
  cin>>n;
  for (int i=1; i<n; i++) {
    cin>>in;
    buf = map[in] + 1;
    map[in] = buf;
  }
  for (int i=1; i<n+1; i++) {
    cout<<map[i]<<endl;
  }

  return 0;
}

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

using namespace std;

typedef long long ll;

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

    //freopen("AtCoder6/input.txt", "r", stdin);
    //freopen("AtCoder6/output.txt", "w", stdout);

    int n;
    cin >> n;
    ll hist[100001] = {0};
    ll summ = 0;
    for (int i = 0; i < n; i ++) {
      int t;
      cin >> t;
      summ += t;
      hist[t] ++;
    }
    ll q;
    cin >> q;
    for (int i = 0; i < q; i ++) {
      ll b, c;
      cin >> b >> c;
      if (b != c){
        summ -= hist[b] * b;
        summ += hist[b] * c;
        hist[c] += hist[b];
        hist[b] = 0;
      }
      cout << summ << endl;
    }

    return 0;
}

Measured memory_bytes: 4448
#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include<cmath>
#include<cstring>
#define pb push_back
#define ll long long
#define ull unsigned long long
#define deb(x) cerr<<#x<<" "<<x<<"\n"
#define debi cerr<<"hey sparky\n"
#define x first
#define y second
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define eps (double)1e-9
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> pdbs;
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
//void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
// look for  all edge cases
//search for a pattern




signed main() {	
	
	ios::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);
	
	int tar , n;
	cin >> tar >> n;
	
	set<int> s;
	for(int i =0 ; i < n; i++){
		int temp;
		cin >> temp;
		s.insert(temp);
	}
	int ans = tar;
	for(int i = 0; i < 101 ; i++){
		int val1 = tar + i;
		int val2 = tar - i;
		if(s.find(val2) == s.end()){
			//debug("hi");
			ans = val2;
			break;
		}
		if(s.find(val1) == s.end()){
			ans = val1;
			break;
		}
	}
	
	cout<<ans;
	
	
	
	
	return 0;
}


Measured memory_bytes: 3528
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;  //no of students
  cin>>n;
  map<int,int> l;
  for(int i=1;i<=n;i++)
  {
    int c;
    cin>>c;
    l[c]=i;
  }
  map<int,int>::iterator it;
  for(it=l.begin();it!=l.end();it++)
  {
    cout<<it->second<<" ";
  }
}
  
    

Measured memory_bytes: 5504
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    print(len(set(list(map(int, input().split())))))


if __name__ == '__main__':
    main()


Measured memory_bytes: 4584
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    string s;
    bool ok=true;
    int a=0,b=0,c=0;
    cin >> s;
    rep(i,s.size()){
        if(s[i] == 'a') a++;
        else if(s[i] == 'b')b++;
        else c++;
    }
    if(abs(a-b)>1 || abs(a-c)>1 || abs(b-c)>1) ok=false;
    if(ok) cout << "YES" <<endl;
    else cout << "NO" <<endl;
}

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

int main() {
  int N;
  int s1,s2,s3,s4;
  
  cin >> N;
  
  s1 = N % 10;
  s2 = N % 100 / 10;
  s3 = N % 1000 / 100;
  s4 = N / 1000;
  
  if ((s1 == s2 && s2== s3) || ((s2 == s3) && (s3 == s4)))
    //(s1 == s2 == s3 || s2 == s3 == s4)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <queue>
#include <numeric>
#include <ctime>
using namespace std;

// n の最大値
const int MAX_N = 10;
// used[i] := v[i] を選んだかどうか
bool used[MAX_N];
int s, k, ans;

// v の先頭 n 個の要素 から k 個選ぶ組合せの列挙
template<class T>
void comb(const vector<T>& v, vector<T>& c, int n, int k, int pos = 0, int last = -1){
    // 初期化
    if( pos == 0 ) fill(used, used+MAX_N, false);
    
    if( pos == k ){
        // 組合せ c に対する操作
        int sum = 0;
        for(int i=0 ; i < c.size() ; i++ ) sum += c[i];
        if( s == sum ) ans++;
        return ;
    }
    for(int i = last+1 ; i < n ; i++ ){
        if( !used[i] ){
            c.push_back( v[i] );
            used[i] = true;
            comb( v , c , n , k , pos+1 , i );
            c.pop_back();
            used[i] = false;
        }
    }
}

int main(){
    while( cin >> k >> s , k || s ){
        ans = 0;
        vector<int> v(MAX_N), c;
        for(int i=0 ; i < MAX_N ; i++ ) v[i] = i;
        comb( v , c , MAX_N , k );
        cout << ans << endl;
    }
}

Measured memory_bytes: 1212
use proconio::input;
use std::collections::HashSet;
fn main() {
    input! {
        n:usize,
        k:usize,
    }

    let mut set = HashSet::new();
    for _ in 0..k {
        input! {
            d:usize,
            a:[usize;d],
        }
        for i in a {
            set.insert(i);
        }
    }

    let ret = n - set.len();
    println!("{}", ret);
}


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

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  REP(i, n) cin >> v[i];
  vector<ll> a(n + 1);
  REP(i, n) a[i + 1] = a[i] + v[i];
  REP(i, n + 1) a[i] = (a[i] - i + k) % k;
  map<int, int> mp;
  mp[0]++;
  ll ans = 0;
  REP(i, n) {
    if (i >= k - 1) mp[a[i - k + 1]]--;
    ans += mp[a[i + 1]];
    mp[a[i + 1]]++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 11904
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define repc(i, s, t) for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.setf(ios_base::fixed);
    cout.precision(12);

    var(string, s);
    sort(all(s));
    print((s.front() != s.back()) ? "Yes" : "No");

    return 0;
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;

namespace atcorder
{
    class Program
    {
        static void Main(string[] args)
        {
            string N = Console.ReadLine();
            if (N.Contains("7"))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

//文字配列の取得
//string[] strArray = Console.ReadLine().Split(' ').ToArray();
//string S = strArray[0];
//string T = strArray[1];

//文字列の取得
//string s = Console.ReadLine();

//数字配列の取得
//int[] intArray = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
//int H = intArray[0];
//int W = intArray[1];

//数字の取得
//int N = int.Parse(Console.ReadLine());

//リスト型(int)の取得
//List<int> A = new List<int>(Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray());

//出力
//Console.WriteLine(ans);
//Console.WriteLine("Yes");
//Console.WriteLine("No");
//Console.WriteLine(cnt);



Measured memory_bytes: 25884
#include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
typedef long long ll;

int main() {
    #ifndef LOCAL
        fastIO;
    #endif
    int n,l,menor=1000,indice,sabor=0;
    cin >> n >> l;
    int manzanas[n];
    for(int i=0;i<n;i++){
        manzanas[i]=i+l;
    }
    for(int i=0;i<n;i++){
        if(abs(manzanas[i])<menor){
            indice=i;
            menor=abs(manzanas[i]);
        }
    }
    manzanas[indice]=0;
    for(int i=0;i<n;i++){
        sabor+=manzanas[i];
    }
    cout << sabor << endl;
    return 0;
}


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

int main() {
	int n, i;
	cin >> n;
	for (i = 1; i < 10; i++) {
		if (111 * (i - 1) < n && n <= 111 * i)
			break;
	}
	cout << 111 * i << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

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

int ans[1100][1100];
int a[1100][1100];

int bi(int x){
  if(x==0)return 0;
  if(x%2==0)return bi(x/2);
  return 1-bi(x/2);
}
signed main(){
  int n,m;cin>>n>>m;
  int N=max(n,m);
  rep(i,1<<N){
    rep(j,1<<N){
      a[i][j]=bi(i&j);
    }
  }
  
  for(int i=1;i<(1<<N);i++)
    for(int j=1;j<(1<<N);j++)
      ans[i][j]=(a[i][j]+a[i][j-1]+a[i-1][j]+a[i-1][j-1])%2;
  
  for(int i=1;i<(1<<n);i++){
    for(int j=1;j<(1<<m);j++){
      cout<<ans[i][j];
    }
    cout<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 21224
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
#include <stack>
using namespace std;

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

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};
int dx9[9]={0,1,0,-1,1,-1,1,0,-1};
int dy9[9]={0,1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;
typedef pair<ll, ll> PLL;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
ll n, a, b;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> a >> b >> n;

  ll x = min(n, b - 1);

  cout << (a * x / b) - (a * (x / b)) << endl;
}


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

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define SafeDeleteArray(pData) { try { delete [] pData; } catch (...) { assert(false); } pData=NULL; }
int a[10000]={0};
int b[100][100]={0};
int main()
{
    int H , W, n;
    cin >>H >>W;
    cin >>n;
    for(int i=1;i<=n;i++)
        cin >>a[i];
    int k=1;
    for(int j=1;j<=H;j+=2){
        for(int i=1;i<=W;i++){
            while(a[k]==0&&k<n)
                k++;
            b[j][i]=k;
            a[k]--;
        }
        if(j+1>H)
            break;
        for(int i=W;i>=1;i--){
            while(a[k]==0&&k<n)
                k++;
            b[j+1][i]=k;
            a[k]--;
        }
    }
    //SafeDeleteArray(a);
    for(int i=1;i<=H;i++){
        for(int j=1;j<W;j++)
            cout<<b[i][j]<<" ";
        cout<<b[i][W]<<endl;
    }

    return 0;
}


Measured memory_bytes: 384
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod(ll a){
  return (a % 1000000007);
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}

ll nCr(ll n,ll r){
  if(r == 1) return n;
  else if(r == 0) return 1;
  else return nCr(n-1,r-1)*n/r;
}

int main(){
  ll sum = 0;
  
  rep(i,5){
    ll x; cin >> x;
    sum += x;
  }
  
  cout << 15 -sum << endl;
  
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10, p = 1e9 + 7;
char s[N];

int pw(int a, int b) {
    int r = 1;
    for( ; b ; b >>= 1, a = (long long) a * a % p) if(b & 1) r = (long long) r * a % p;
    return r;
}

int pre[N][4]; // 0:A 1:B 2:C 3:?
int sub[N][4];

int main() {
    scanf("%s", s + 1);
    int n = strlen(s + 1);
    for(int i = 1 ; i <= n ; ++ i) {
        memcpy(pre[i], pre[i - 1], sizeof pre[i]);
        pre[i][s[i] == '?' ? 3 : s[i] - 'A'] ++;
    }
    for(int i = n ; i ; -- i) {
        memcpy(sub[i], sub[i + 1], sizeof sub[i]);
        sub[i][s[i] == '?' ? 3 : s[i] - 'A'] ++;
    }
    long long ans = 0;
    for(int i = 1 ; i <= n ; ++ i) {
        // cout << pre[i][0] << ' ' << pre[i][1] << ' ' << pre[i][2] << ' ' << pre[i][3] << endl;
        if(s[i] == 'B' || s[i] == '?') {
            
            // cout << "count in: " << i << endl;
            
            long long x = 0;
            long long y = 0;
            x = (long long) pre[i - 1][0] * pw(3, pre[i - 1][3]) % p;
            if(pre[i - 1][3]) y = (long long) pre[i - 1][3] * pw(3, pre[i - 1][3] - 1) % p;
            
            long long z = x + y;
            
            x = y = 0;
            x = (long long) sub[i + 1][2] * pw(3, sub[i + 1][3]) % p;
            if(sub[i + 1][3]) y = (long long) sub[i + 1][3] * pw(3, sub[i + 1][3] - 1) % p;
                        
            ans = (ans + z * (x + y) % p) % p;
            
        }
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 3456
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		double x = sc.nextInt();
		double y = sc.nextInt();
		sc.close();



		if(y > x * 4 || y < x * 2) {
			System.out.println("No");
		}else {
			for(int i=0; i<=100; i++) {
				if( ( y - 2 * x )/2 == i ) {
					System.out.println("Yes");
					return;
				}
			}
			System.out.println("No");
		}




	}

}


Measured memory_bytes: 35772
N, M = map(int, input().split())
ac = set()
pena = 0
walen = [0]*N

for i in range(M):
    p, S = map(str, input().split())
    p = int(p) - 1
    if p in ac:
        continue
    elif S == 'AC':
        ac.add(p)
        pena += walen[p]
    else:
        walen[p] += 1

print(len(ac), pena)

Measured memory_bytes: 18192
import collections 
N,M=map(int,input().split())
L=[]
for i in range(M):
	X,Y=map(int,input().split())
	L.append(X)
	L.append(Y)
S=collections.Counter(L)
for i,j in S.items():
	if j%2==1:
		print("NO")
		exit()
print("YES")


Measured memory_bytes: 16000
#include <iostream>
#include <vector>
#include <array>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <complex>
#include <bitset>
#include <functional>

using namespace std;
using ll=long long int;

int main() {
    int n;
    cin >> n;

    set<string> s;
    s.insert("a");

    auto it = s.begin();
    while (it != s.end()) {
        if (it->length() == n) {
            cout << *it << "\n";
        } else {
            char m = 'a';
            for (auto &c: *it) m = max(m, c);
            for (char c = 'a'; c <= m+1; ++c) {
                s.insert(*it + c);
            }
        }
        it = s.erase(it);
    }

    return 0;
}


Measured memory_bytes: 1536
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});

reader.on('close', () => {
  var a = Number(lines[0]);
  var s = lines[1];

  if(a < 3200){
    console.log('red')
  }else{
    console.log(s)
  }

});


Measured memory_bytes: 7628
#!python3

# input
N, K, C = list(map(int, input().split()))
S = input()


def main():
    L = [None] * K
    for i in range(N):
        if S[i] == "o":
            L[0] = i
            break            
    for i in range(1, K):
        j = L[i-1] + C + 1
        while S[j] == "x":
            j += 1
        L[i] = j
    
    R = [None] * K
    for i in range(N - 1, -1, -1):
        if S[i] == "o":
            R[-1] = i
            break
    for i in range(K - 2, -1, -1):
        j = R[i+1] - C - 1
        while S[j] == "x":
            j -= 1
        R[i] = j
    
    for i in range(K):
        if L[i] == R[i]:
            print(L[i] + 1)


if __name__ == "__main__":
    main()


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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define Task ""

using namespace std;
typedef long long ll;

const int maxn = 2e5 + 5;

int a[maxn];
ll sum[maxn];

ll rsum(int l, int r)
{
    return sum[r] - sum[l-1];
}

signed main(void)
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    if (fopen("A.INP", "r")){
        freopen("A.INP", "r", stdin);
        freopen("A.OUT", "w", stdout);
    }
    if (fopen(Task".INP", "r")){
        freopen(Task".INP", "r", stdin);
        freopen(Task".OUT", "w", stdout);
    }
    int N; cin >> N;
    for (int i=1; i<=N; ++i){
        cin >> a[i];
        sum[i] = sum[i-1] + a[i];
    }
    int l=1, r=3;
    ll ret = 1e18;
    for (int i=2; i<=N-2; ++i){
        r = max(r, i+1);
        while (l<i-1 && rsum(1, l) < rsum(l+1, i)) ++l;
        if (l > 1 && abs(rsum(1, l-1) - rsum(l, i)) < abs(rsum(1, l) - rsum(l+1, i))) --l;
        while (r<N-1 && rsum(i+1, r) < rsum(r+1, N)) ++r;
        if (r > i + 1 && abs(rsum(i+1, r-1) - rsum(r, N)) < abs(rsum(i+1, r) - rsum(r+1, N))) --r;
        vector<ll> vi;
        vi.pb(rsum(1, l)); vi.pb(rsum(l+1, i)); vi.pb(rsum(i+1, r)); vi.pb(rsum(r+1, N));
        sort(vi.begin(), vi.end());
        ret = min(ret, vi[3] - vi[0]);
    }
    cout << ret << '\n';
}


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

int main()
{ 
  int n, ans;
  
  cin >> n;
  if (n < 10)
    ans = n;
  else if (n < 100)
    ans = 9;
  else if (n < 1000)
    ans = 9 + n - 99;
  else if (n < 10000)
    ans = 909;
  else if (n == 100000)
    ans = 90909;
  else
    ans = 909 + n - 9999;
  cout << ans << endl;
}

Measured memory_bytes: 256
//Author - Sanket Mundra
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define IIITA ios::sync_with_stdio(0)
#define sanket cin.tie(0)
#define mundra cout.tie(0)
ll M = 1000000007;

int main()
{
	IIITA; sanket; mundra;
	ll t,i,j,n,m,l,k,r,sum,ans,mx,mn,x,y,z; cin>>t;
	string s,f;
	cin>>s>>f;
	for(i=0;i<2*t;i++)
	{
		if(i%2==0) cout<<s[i/2];
		else cout<<f[i/2];
	}
	return 0;
}

Measured memory_bytes: 256
// 23
#include <bits/stdc++.h>
using namespace std;
#define coutc "\033[48;5;196m\033[38;5;15m"
#define endc "\033[0m"
#define endl '\n'
#define M(_1, _2, _3, _4, NAME, ...) NAME
#define rep(...) M(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rep4(_, x, n, s) for (int _ = x; (s < 0) ? _ > n : _ < n; _ += s)
#define rep3(_, x, n) rep4(_, x, n, (x < n ? 1 : -1))
#define rep2(_, n) rep3(_, 0, n)
#define rep1(n) rep2(i, n)
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define all(x) x.begin(), x.end()
#define len(x) int(x.size())
#define lli __int128_t
#define li long long int
#define ld long double
#ifdef DEBUG
// 3
ostream &operator<<(ostream &o, pair<auto, auto> p) {
  return o << "(" << p.fi << ", " << p.se << ")";
}
// 4
ostream &operator<<(ostream &o, vector<auto> v) {
  rep(i, len(v)) o << setw(7) << right << v[i];
  return o << endc << endl << coutc;
}
// 4
ostream &operator<<(ostream &o, map<auto, auto> m) {
  for (auto &kv : m) o << kv;
  return o;
}
// 7
void debug(const auto &e, const auto &... r) {
  cerr << coutc << e;
  ((cerr << " " << r), ..., (cerr << endc << endl));
}
#else
#define debug(...)
#endif
// 3

void _main(int tc) {
  bool isPossible = 0;
  int n, m, x;
  cin >> n >> m >> x;
  vector<vector<int>> mat(n, vector<int>(m));
  vector<int> cost(n);
  rep(n) {
    cin >> cost[i];
    rep(j, m) { cin >> mat[i][j]; }
  }

  int limit = 1 << n;
  int costAns = 1e9;
  rep(limit) {
    vector<int> knowledge(m);
    int currcost = 0;
    rep(j, n) {
      if (i & (1 << j)) {
        currcost += cost[j];
        rep(k, m) { knowledge[k] += mat[j][k]; }
      }
    }
    bool flag = 1;
    rep(j, m) {
      if (knowledge[j] < x) {
        flag = 0;
        break;
      }
    }
    if (flag) {
      isPossible = 1;
      costAns = min(currcost, costAns);
    }
  }
  if (isPossible)
    cout << costAns << endl;
  else
    cout << -1 << endl;
}
// 7
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  _main(0), exit(0);
  int tc;
  cin >> tc;
  rep(i, tc) _main(i + 1);
}

Measured memory_bytes: 3572
import sys
# sys.setrecursionlimit(100000)
from collections import defaultdict


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


class UnionFind:
    def __init__(self, n: int):
        self.nodes = n
        self.parents = [-1] * n
        self.rank = [0] * n

    # retrun the root of element x
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    # unite the group include element x and group include element y
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.rank[x] < self.rank[y]:
            self.parents[y] += self.parents[x]
            self.parents[x] = y
        else:
            self.parents[x] += self.parents[y]
            self.parents[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # get size of the gourp which element x belongs
    def get_size(self, x):
        return -self.parents[self.find(x)]

    # check if element x and element y is same group
    def same(self, x, y):
        return self.find(x) == self.find(y)


def main():
    n, m, k = input_int_list()
    union = UnionFind(n + 1)
    friends = defaultdict(set)
    blocks = defaultdict(set)

    for i in range(m):
        a, b = input_int_list()
        friends[a].add(b)
        friends[b].add(a)
        union.unite(a, b)

    for j in range(k):
        a, b = input_int_list()
        # 同一グループでブロックしている人のみ記録する。
        if union.same(a, b):
            blocks[a].add(b)
            blocks[b].add(a)
    ans = []
    for i in range(1, n + 1):
        ans.append(union.get_size(i) - len(friends[i]) - len(blocks[i]) - 1)

    print(*ans)
    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 163732
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <math.h>
#include <cmath>
using namespace std;

#define int long long
#define endl "\n"
#define all(v)  v.begin(),v.end()
#define fir first
#define sec second
#define fro front
#define m_p make_pair
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];

int mod;
const int INF = 2000000015;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}
int krag(double xx) {
	return INF - (int)(INF - xx);
}


int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res=res* a% mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}


signed main() {
	int n;
	cin >> n;
	vector<int>vec1(n);
	vector<int>vec2(n);
	vecin(vec1);
	vecin(vec2);
	vec2[0] += vec1[0];
	rep(i, n-1) {
		vec1[i + 1] += vec1[i];
		vec2[i+1] = max(vec1[i+1], vec2[i]) + vec2[i+1];
	}
	cout << vec2[n - 1] << endl;
}

Measured memory_bytes: 256
import copy
N,M,X=map(int,input().split())
A=[0]*(N)
for i in range(N):
  A[i]=[int(x) for x in input().split()]
def nap(p,q):
  if q==N:
    if min(p[1:M+1])>=X:
      lity[-1]=min(lity[-1],p[0])
    return
  nap(copy.copy(p),q+1)
  for i in range(M+1):
    p[i]=p[i]+A[q][i]
  nap(copy.copy(p),q+1)
lity=[]
lity.append(10**9)
r=[0]*(M+1)
nap(r,0)
if lity[-1]==10**9:
  print(-1)
else:
  print(lity[-1])

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

int main()
{
    int H,W;

    while(cin>>H>>W)
    {
        if(H==0 && W==0)
            break;
        for(int i=0; i<H; i++)
        {
            for(int j=0; j<W; j++)
            {
                if((i%2 && j%2) || (i%2==0 && j%2==0))
                    cout<<"#";
                else
                    cout<<".";
            }
            cout<<"\n";
        }
        cout<<"\n";
    }

    return 0;
}



Measured memory_bytes: 3092
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

vector<int> compute_lps(string s,int m,vector<int> lps){
	int len = 0;
	lps[0] = 0;
	int i = 1;
	while(i < m){
		if(s[i] == s[len]){
			len++;
			lps[i] = len;
			i++;
		}else{
			if(len != 0) len = lps[len-1];
			else{
				lps[i] = 0;
				i++;
			}
		}
	}

	return lps;
}

void kmp_search(string pat,string txt){
	int m = pat.length();
	int n = txt.length();

	vector<int> lps(m);
	lps = compute_lps(pat,m,lps);

	int i = 0,j = 0;
	while(i < n){
		if(pat[j] == txt[i]){
			i++;
			j++;
		}

		if(j == m){
			cout << i - j << endl;
			j = lps[j-1];
		}else if(i < n & pat[j] != txt[i]){
			if(j != 0) j = lps[j-1];
			else i++;
		}
	}
}

int main()
{
	string t,p;
	cin >> t >> p;
	kmp_search(p,t);

	return 0;
}


Measured memory_bytes: 5064
/*
the top of the losers
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define    Lcm(a,b)  ((a*b)/(__gcd(a,b)))
#define    X            real()
#define    Y            imag()
#define    clr(v,d)      memset( v, d ,sizeof(v))
#define     point        complex<ll>
#define    cp(a,b)          (((conj(a))*(b)).imag())
typedef  long long     ll ;
typedef  unsigned long long     ull ;
const double eps= (1e-9);
using namespace std;
using namespace __gnu_pbds;
int dcmp(long double a,long double b){   return fabsl(a-b)<=eps ? 0: (a>b)? 1:-1  ;}
int countNumBit1(int mask) {int ret=0; while (mask) 	{mask &= (mask-1);++ret;	}return ret;}
void GO(){ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}

int main(){
    GO();
    ll a,b;
    cin>>a>>b;
    cout<<max(0ll,a-2*b)<<endl;
}



Measured memory_bytes: 256