akhauriyash/Code-Regression huggingface dataset:
/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                       O\  =  /O
                    ____/`---'\____
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <bitset>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <chrono>
#include <random>

using namespace std;

using int64 = long long;
using uint64 = unsigned long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define print2(x, y) cout << (x) << ' ' << (y) << '\n'
#define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n'
#define printn(v) rep(i, (v).size() - 1) cout << (v)[i] << ' '; cout << (v)[n - 1] << '\n';
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define debug2(x, y) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;

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;
}

template<typename T> T lcm(const T a, const T b) {
    return a / gcd(a, b) * b;
}

template<typename T> bool chmin(T& a, const T& b) {
    if (a > b) return a = b, true; else return false;
}

template<typename T> bool chmax(T& a, const T& b) {
    if (a < b) return a = b, true; else return false;
}

// End of template.

int main() {
    cout << fixed << setprecision(15);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    // cin.read(buf, sizeof buf); // 注意: ./a.out < in か pbp | ./a.out で入力すること

    string s;
    cin >> s;
    if (s[0] == s[1] && s[1] == s[2])
        print("No");
    else
        print("Yes");

    return 0;
}



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

int N, s[110];
int ans = 0;

int main() {
    cin >> N;
    for (int i=0; i<N; i++) {
        cin >> s[i];
        ans += s[i];
    }
    if (ans % 10 != 0) {
        cout << ans << endl;
        return 0;
    }
    sort(s, s+N);
    for (int i=0; i<N; i++) {
        if (s[i] % 10 != 0) {
            cout << ans - s[i] << endl;
            return 0;
        }
    }
    cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int W,H,x,y,r;
	scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);

	if(x-r>=0&&x+r<=W&&y-r>=0&&y+r<=H)
	{
		printf("Yes\n");
		
	}
	else printf("No\n");
 return 0;
}



Measured memory_bytes: 2140
import sys
from random import choice,randint
inp=sys.stdin.readline
out=sys.stdout.write
flsh=sys.stdout.flush
 
sys.setrecursionlimit(10**9)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
 
def MI(): return map(int, inp().strip().split())
def LI(): return list(map(int, inp().strip().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]
def LI_(): return [int(x)-1 for x in inp().strip().split()]
def LF(): return [float(x) for x in inp().strip().split()]
def LS(): return inp().strip().split()
def I(): return int(inp().strip())
def F(): return float(inp().strip())
def S(): return inp().strip()
def pf(s): return out(s+'\n')
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)

def main():
    s,t=LS()
    print(t+s)

if __name__ == "__main__":
    main()

Measured memory_bytes: 5608
a,b,c,k = map(int, input().split())

total = 0

if k > a:
    k = k-a
    total += a

elif k == a:
    k = 0
    total = a

elif k < a:
    total = k
    k = 0

if k > b:
    k = k-b

elif k == b:
    k = 0

elif k < b:
    k = 0

if k > c:
    total -= c
    k -= c

elif k == c:
    total -= k
    k = 0

elif k < c:
    total -= k
    k = 0
    
print(total)


Measured memory_bytes: 9112
#define _CRT_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <limits>
#include <numeric>
#include <valarray>
#include <fstream>

using namespace std;
typedef unsigned int uint;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;
#define REP(i, a, n) for(LL i = (a), i##_max = (n); i < i##_max; ++i)
#define REM(i, a, n) for(LL i = (LL)(n) - 1, i##min = (a); i >= i##min; --i)
#define ALL(arr) (arr).begin(), (arr).end()
#define FLOAT fixed << setprecision(16)
#define SPEEDUP {cin.tie(NULL); ios::sync_with_stdio(false);}
const int INF = 0x3FFFFFFF;
const LL INFLL = 0x3FFFFFFF3FFFFFFF;
const double INFD = 1.0e+308;
const double EPS = 1.0e-9;

void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, const pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(dest, dest + N, val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }
template<class T>
T Compare(T left, T right) { return left > right ? 1 : (left < right ? -1 : 0); }
istream& Ignore(istream& ist) { string s; ist >> s; return ist; }
bool Inside(int i, int j, int h, int w) { return i >= 0 && i < h && j >= 0 && j < w; }
template <class T>
T Next() { T buf; cin >> buf; return buf; }

#ifdef ONLY_MY_ENVIR
#include "IntMod.h"
#include "BinaryMatrix.h"
#include "BIT.h"
#include "Factorization.h"
#include "FlowSolver.h"
#include "Graph.h"
#include "LazySegmentTree.h"
#include "Math.h"
#include "Matrix.h"
#include "MinMax.h"
#include "Position.h"
#include "Range.h"
#include "Rational.h"
#include "SegmentTree.h"
#include "SegmentTree2D.h"
#include "SuffixArray.h"
#include "Tree.h"
#include "UnionFind.h"
#endif

#ifdef __GNUC__
typedef __int128 LLL;
istream& operator>> (istream& ist, __int128& val) { LL tmp;  ist >> tmp; val = tmp; return ist; }
ostream& operator<< (ostream& ost, __int128 val) { LL tmp = val; ost << tmp; return ost; }
#endif

#if 1234567891
#include <array>
#include <random>
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;
// template <class T>
// auto Is(const T& value) { return [value](const auto& comparand) -> bool { return comparand == value; }; }
#endif

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

	if (K == 1) {
		cout << 0 << endl;
	} else {
		cout << N - K << endl;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<stack>
#include<queue>
#include<vector>
#include<map>

using namespace std;

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

  map<char, char> m;
  map<char, char> mm;

  
  for (int i=0; i<s.length(); i++) {
    bool f = false;
    if (m.count(t[i]) == 0) {
      m[t[i]] = s[i];
    }

    if (mm.count(s[i]) == 0) {
      mm[s[i]] = t[i];
    }

    if (m[t[i]] != s[i] || mm[s[i]] != t[i]) {
      // cout << m[t[i]] << ":" << s[i] << endl;
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;
}


Measured memory_bytes: 776
#include<iostream>
#include<cstdio>

#include<vector>
#include<string>

#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
const ll INF = 1e12+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() {
    ll x;
    cin >> x;
    ll y = x / 11;
    if (x - y * 11 >= 7) {
        cout << 2 * y + 2 << endl;
    } else if (x - y * 11 >= 1) {
        cout << 2 * y + 1 << endl;
    } else {
        cout << 2 * y << endl;
    }

}


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

int main() {
    int K, X;
    cin >> K >> X;
    int start = 0;
    int end = 0;
    if(X - K + 1 > -1000000){
        start = X - (K-1);
    } else {
        start = -1000000;
    }
    if(X + K - 1 <= 1000000){
        end = X + (K-1);
    } else {
        end = 1000000;
    }

    for(int i = start; i <= end; i++){
        cout << i <<" ";
    }
    cout << endl;


}

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

int main(){
    vector<int> A(3);
    for(int i=0; i<3; i++){
        cin >> A.at(i);
    }
    sort(A.begin(), A.end());
    int x,y;
    x=A.at(2)-A.at(0);
    y=A.at(2)-A.at(1);
    if(x%2==0 && y%2 ==0){
        cout << (x+y)/2 << endl;
    }
    else if(x%2==1 && y%2==1){
        cout << (x+y)/2 << endl;
    }
    else{
        cout << (x+y)/2 + 2 << endl;
    }
}

Measured memory_bytes: 3608
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>

using namespace std;

int main(){
    int N,max=0;
    cin>>N;
    int a[N];
    for(int i=0;i<N;i++)cin>>a[i];
    map<int,int> MAPA;
    for(int i=0;i<N;i++){
        MAPA[a[i]]++;
    }
    for(int X=0;X<=99999;X++){
        int z=MAPA[X]+MAPA[X+1]+MAPA[X+2];
        if(max<z) max=z;
    }
    cout<<max<<endl;
    return 0;
}

Measured memory_bytes: 5376
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define INF (1e9)

int N;
string S, T;

int main() {
    cin >> N >> S >> T;

    vi A(N);
    for (int i = 0; i < N; i++) {
        cout << S[i];
        cout << T[i];
    }

    return 0;
}


Measured memory_bytes: 256
let cnt = ref 0

let insertion_sort (a : int array) n g =
  for i = g to n - 1 do
    let v = a.(i) in
    let j = ref (i - g) in
    while !j >= 0 && a.(!j) > v do
      a.(!j+g) <- a.(!j);
      j := !j - g;
      incr cnt;
    done;
    a.(!j+g) <- v;
  done

let generate_g n =
  let rec doit i g acc =
    if g > n then acc
    else doit (i + 1) (int_of_float (4.**(float_of_int i) +. 3.*.2.**(float_of_int (i - 1)) +. 1.)) (g :: acc) in
  doit 1 1 []

let shell_sort (a : int array) n =
  cnt := 0;
  let g = generate_g n in
  List.iter (fun g -> insertion_sort a n g) g;
  g

let () =
  let n = read_int () in
  let a = Array.init n (fun _ -> read_int ()) in
  let g = shell_sort a n in
  Printf.printf "%d\n" (List.length g);
  match g with
  | [] -> assert false;
  | hd :: tl -> print_int hd; List.iter (fun x -> Printf.printf " %d" x) tl;
  print_newline ();
  Printf.printf "%d\n" !cnt;
  Array.iter (fun n -> Printf.printf "%d\n" n) a

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

int main() {
  int N;
  cin >> N;
  
  vector<int64_t> a(3 * N);
  for (int i = 0; i < 3 * N; ++i) cin >> a.at(i); 
  sort(a.begin(), a.end(), greater<int64_t>());
 
  int64_t amount = 0;

  for (int i = 0; i < 2 * N; ++i) {
    if (i % 2 == 1) amount += a.at(i);
  }

  cout << amount << endl;
  
}

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

int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

int a,b;cin>>a>>b;
if(a>b)swap(a,b);
if(a==b){
  cout<<a*2<<endl;
}else{
  cout<<b*2-1<<endl;
}

  
  return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;
vector<pair<ll,ll>> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}

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; }

#define MAX_N 110
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};

ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}

ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    
    return p;
}

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

void rec(){
    
}

int main(){
    ll ans=0,x=0,count=0;
    string s;
    cin >> s;
    for (ll i=0;i<s.size();i++){
        if (s[i]=='>'){
            x--;
            if (i>0 && s[i-1]!=s[i]){
                count=0;
            }
            ans+=x;
        }else{
            if (i>0 && s[i-1]!=s[i]){
                if ((0-x)>0){
                    count++;
                    ans+=(0-x)*count;
                }else{
                    ans+=(0-x)*count;
                }
                count=0;
                x=0;
            }
            x++;
            ans+=x;
        }
        count++;
    }
    if (s[s.size()-1]=='>'){
        if ((0-x)>0){
            count++;
            ans+=(0-x)*count;
        }else{
            ans+=(0-x)*count;
        }
    }
    cout << ans << endl;
    return 0;
}



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

using namespace std;

const int N = 1e6 + 5;
int n, arr[N], lp[N], cnt[N];

void sieve(){
    for(int i = 1; i < N; i++){
        lp[i] = i;
    }

    for(int i = 2; i < N; i++){
        if(lp[i] == i){
            for(int j = 2 * i; j < N; j += i){
                if(lp[j] == j){
                    lp[j] = i;
                }
            }
        }
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    sieve();

    cin >> n;

    int gc = 0;
    for(int i = 1; i <= n; i++){
        cin >> arr[i];
        gc = __gcd(gc, arr[i]);

        int k = arr[i];
        set<int> st;
        while(k != 1){
            st.insert(lp[k]);
            k /= lp[k];
        }

        for(auto x : st){
            cnt[x]++;
        }
    }

    if(gc != 1){
        cout << "not coprime\n";
    } else {
        bool pairwise = true;
        for(int i = 2; i < N; i++){
            if(cnt[i] > 1){
                pairwise = false;
                break;
            }
        }

        if(pairwise){
            cout << "pairwise coprime\n";
        } else {
            cout << "setwise coprime\n";
        }
    }
    return 0;
}

Measured memory_bytes: 15148
import numpy as np
import collections
input1 = list(map(int,input().split()))
input2 = list(map(int,input().split()))

N = input1[0]
D = input2

if D[0] != 0:
  print(0)
  exit()

counter = collections.Counter(D)

ans = 1

D.sort()
D_numpy = np.array(D)
if (np.diff(D_numpy)<=1).prod():
  if counter[0] != 1:
    ans = 0
  else:
    for i in range(len(counter)):
      ans *= counter[i]**counter[i+1]
      if ans >= 998244353:
        ans = ans%998244353

else:
  ans = 0



print(ans)

Measured memory_bytes: 27308
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>

int abs(int a) { return (a > 0) ? a : -a; }

int main() {
    int n, t, ret = 0;
    std::cin >> n;
    std::set<int> s;
    std::vector<int> num(13, 0);
    for (auto i = 0; i < n; i++) {
        std::cin >> t;
        s.insert(t);
        num[t]++;
        if (num[t] > 2 || t == 0) {
            std::cout << 0 << std::endl;
            return 0;
        }
    }

    for (long long i = 0ll, size = 1 << s.size(); i < size; i++) {
        std::set<int> t;
        t.insert(24);
        auto j = i;
        for (auto d : s) {
            int tmp = ((j & 1) ? d : 24 - d);
            t.insert(tmp);
            if (num[d] > 1) t.insert(24 - tmp);
            j >>= 1;
        }
        std::set<int> result;
        std::adjacent_difference(t.begin(), t.end(), std::inserter(result, result.end()));
        if (ret < *result.cbegin()) ret = *result.cbegin();
    }

    std::cout << ret << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    // Your code here!
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(a<=b)
        printf("%s\n", (a<=c && c<=b)? "Yes":"No");
    else
        printf("%s\n", (b<=c && c<=a)? "Yes":"No");
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=10100100100100100;
int main(){
    int n,W;cin >> n >> W;
    vector<int> w(n),v(n);
    for(int i=0; i<n; i++) cin >> w[i] >> v[i];
    vector<vector<ll>> dp(n+1,vector<ll>(W+1));
    for(int i=0; i<n; i++){
        for(int j=0; j<=W; j++){
            if(j-w[i]>=0){
                dp[i+1][j]=max(dp[i][j],dp[i][j-w[i]]+v[i]);
            }
            else{
                dp[i+1][j]=dp[i][j];
            }
        }
    }
    cout << dp[n][W] << endl;
    return 0;
}

Measured memory_bytes: 80256
#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    int p,q,r,a;
    cin >> p >> q >> r;
    a=min({p+q,q+r,r+p});
    cout << a << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
int main(){
    int H,W;
    while(cin>>H>>W){
        if(H==0&&W==0) break;
        for(int i=1;i<=H;i++){
            for(int j=1;j<W;j++){
                cout<<"#";
                }
            cout<<"#"<<endl;
        }
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 1152
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var NMK = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        var (N, M, K) = (NMK[0], NMK[1], NMK[2]);
        var A = new int[M];
        var B = new int[M];
        var C = new int[K];
        var D = new int[K];
        for (int i = 0; i < M; i++)
        {
            var AB = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            (A[i], B[i]) = (AB[0] - 1, AB[1] - 1);
        }
        for (int i = 0; i < K; i++)
        {
            var CD = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            (C[i], D[i]) = (CD[0] - 1, CD[1] - 1);
        }

        var adjacencyList = new List<int>[N];

        for (int i = 0; i < N; i++)
            adjacencyList[i] = new List<int>();

        for (int i = 0; i < M; i++)
        {
            adjacencyList[A[i]].Add(B[i]);
            adjacencyList[B[i]].Add(A[i]);
        }

        var blockshipList = new List<int>[N];

        for (int i = 0; i < N; i++)
            blockshipList[i] = new List<int>();

        for (int i = 0; i < K; i++)
        {
            blockshipList[C[i]].Add(D[i]);
            blockshipList[D[i]].Add(C[i]);
        }

        var nodeInfo = new int[N];
        var groupInfo = new List<List<int>>();

        for (int i = 0; i < N; i++)
            nodeInfo[i] = -1;

        void DFS(int v, int g)
        {
            nodeInfo[v] = g;
            groupInfo[g].Add(v);

            foreach (var next in adjacencyList[v])
                if (nodeInfo[next] == -1)
                    DFS(next, g);
        }

        var groupId = 0;

        for (int i = 0; i < N; i++)
        {
            if(nodeInfo[i] == -1)
            {
                groupInfo.Add(new List<int>());

                DFS(i, groupId);

                groupId++;
            }
        }

        var friendCandidateCount = new int[N];

        for (int i = 0; i < N; i++)
        {
            var g = nodeInfo[i];
            var groupCount = groupInfo[g].Count;
            var myselfCount = 1;
            var friendsCount = adjacencyList[i].Count;
            var blocksCount = blockshipList[i].Count(v => nodeInfo[v] == g);

            var ans = groupCount - myselfCount - friendsCount - blocksCount;

            Write($"{ans} ");
        }

        WriteLine();
    }
}


Measured memory_bytes: 66308
fun main(args: Array<String>){
    val (X, Y) = readLine()!!.split(" ").map { it.toInt() }
    var ans = "No"
    for(i in 0..X){
        var b = X - i
        if(2 * i + 4 * b == Y){
            ans = "Yes"
        }
    }

    println(ans)

}

Measured memory_bytes: 36320
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_set>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;

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

int main(){
  int N;
  cin >> N;
  vector<int> p(N);
  vector<int> idx(N);
  rep(i,N) cin >> p[i];
  rep(i,N) p[i]--;
  rep(i,N) idx[p[i]] = i;

  ll ans = 0;
  set<int> s;
  for(int x = N - 1; x >= 0; --x){
    int i = idx[x];
    s.insert(i);
    // calc c
    ll c = 0;
    {
      vector<int> l(2,-1);
      vector<int> r(2,N);
      // calc l,r
      {
	auto it = s.find(i);
	rep(j,2) {
	  if(it == s.begin()) break;
	  it--;
	  l[j] = *it;
	}
      }
      {
	auto it = s.find(i);
	rep(j,2) {
	  it++;
	  if(it == s.end()) break;
	  r[j] = *it;
	}

      }
      vector<int> ls(2);
      vector<int> rs(2);
      // calc ls,rs
      {
	ls[0] = i - l[0];
	ls[1] = l[0] - l[1];
	rs[0] = r[0] - i;
	rs[1] = r[1] - r[0];
      }
      c = (ll)ls[0] * rs[1] + (ll)ls[1] * rs[0];
    }
    ans += c * (x + 1);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5760
#include <iostream>
#include <fstream>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <sstream>
#include <string>
#include <vector>
using namespace std;

#define EPS 1e-9
#define INF MOD
#define MOD 1000000007LL
#define fir first
#define iss istringstream
#define sst stringstream
#define ite iterator
#define ll long long
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<n;i++)
#define pi pair<int,int>
#define pb push_back
#define sec second
#define sh(i) (1LL<<i)
#define sz size()
#define vi vector<int>
#define vc vector
#define vl vector<ll>
#define vs vector<string>

int n,m,a[99][99],b[99][99],ans,dy[]={1,0,-1,0},dx[]={0,1,0,-1};

void f(int y,int x,int s){
	ans=max(ans,s);
	rep(i,4){
		int ny=y+dy[i],nx=x+dx[i];
		if(0<=ny&&ny<n&&0<=nx&&nx<m&&a[ny][nx]&&!b[ny][nx]){
			b[ny][nx]=1;
			f(ny,nx,s+1);
			b[ny][nx]=0;
		}
	}
}

int main(){
	while(cin>>m>>n&&m){
		rep(i,n)rep(j,m)cin>>a[i][j];
		ans=0;
		rep(i,n)rep(j,m)f(i,j,0);
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 0
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

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

int main()
{
        //input->compute->output//
        string s;
        cin >> s;
        string op = "+++";

        int len = s.length();

        for (int mask = 0; mask < (1 << (len - 1)); mask++)
        {
                int num = s[0] - '0';
                for (int i = 0; i < len - 1; i++)
                {
                        if (mask & (1 << i))
                        {
                                op[i] = '-';
                                num -= (s[i + 1] - '0');
                        }
                        else
                        {
                                op[i] = '+';
                                num += (s[i + 1] - '0');
                        }
                }
                debug(num);
                if (num == 7)
                {
                        cout << s[0] << op[0] << s[1] << op[1] << s[2] << op[2] << s[3] << "=7" << endl;
                        return 0;
                }
        }

        return 0;
}


Measured memory_bytes: 256
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n=n0()
xy=n3(n)

import itertools,math
ite=itertools.permutations(range(n))

ans=c=0
for line in ite:
    d=0
    for i in range(1,n):
        ax,ay=xy[line[i]]
        bx,by=xy[line[i-1]]
        d+=math.sqrt((ax-bx)**2+(ay-by)**2)
    ans+=d
    c+=1
print(ans/c)

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

int main() {
  long n,d;
  cin>>n>>d;
  
  int count=0;
  
  for(int i=0;i<n;i++){
    long x,y;
    cin>>x>>y;
    long dis=(x*x)+(y*y);
    
    if(dis<=d*d){
      count++;
    }
  }
  cout<<count<<endl;
}
      

Measured memory_bytes: 3628
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        System.out.println(((a * b) % 2 == 1) ? "Odd" : "Even");
    }
}
 

Measured memory_bytes: 23764
/*   -----------------------------
    | If you see my code,         |
    | You are BC (best coder -_- )|
    |                             |
     -----------------------------
*/
#include<bits/stdc++.h>
#include<iomanip>
typedef long long ll;
typedef unsigned long long ul;
#define to_lower(x)  transform(x.begin(), x.end(), x.begin(), ::tolower)
#define to_upper(x)  transform(x.begin(), x.end(), x.begin(), ::toupper)
#define pi acos(-1)
#define ll long long
#define ull unsigned long long
#define vec vector<ll>
#define f1(i,n) for(i=1;i<n;i++)
#define input  ll nn;cin>>nn;ll arr[nn];for(i=0;i<nn;i++)cin>>arr[i];
#define test   ll ttt;cin>>ttt;while(ttt--)
#define faster  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define faster2 ios_base::sync_with_stdio(0);
#define en '\n'
#define eps 10e9
#define pb push_back
ll i,j;
using namespace std;

void Main();
int main()
{
    clock_t tStart = clock();
    Main();
#ifndef ONLINE_JUDGE
    cout << "\n\n**Time -> " << fixed << setprecision(10) << (double)(clock()-tStart) / CLOCKS_PER_SEC << " fs" << endl;
#endif
    return 0;
}
void Main()
{
    int x,n,c=0;cin>>n; map<int,int>m;
    while(n--)
    {
        cin>>x;
        m[x]++;
    }
    for(auto i:m)
    {

        if(i.second>=i.first)c+=i.second-i.first;
        else c+=i.second;
    }
    cout<<c<<endl;

}


Measured memory_bytes: 8056
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL


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

    int n;
    cin >> n;

    cout << CEIL(n, 2) << "\n";

    return 0;
}



Measured memory_bytes: 892
#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = m; i < (n); i++)
#define RFOR(i, m, n) for (int i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

struct mint {
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

mint factorial(ll n) {
  mint answer = 1;
  while (n > 1) {
    answer *= n;
    n--;
  }
  return answer;
}

mint combination(ll n, ll r) {
  return factorial(n) / (factorial(r) * factorial(n - r));
}

mint permutation(ll n, ll r) { return factorial(n) / factorial(n - r); }

// setprecision(8) 桁数指定
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

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

template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}

map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}
// for (auto p : prime_factor(n)) {
//	while (p.second--) {
//		cout << p.first << endl;
//	}
//}

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

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

vector<ll> Eratosthenes(const ll N) {
  bool is_prime[1000000 + 1];
  vector<ll> P;
  for (ll i = 0; i <= N; i++) {
    is_prime[i] = true;
  }
  for (ll i = 2; i <= N; i++) {
    if (is_prime[i]) {
      for (ll j = 2 * i; j <= N; j += i) {
        is_prime[j] = false;
      }
      P.emplace_back(i);
    }
  }
  return P;
}

typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

int main() {
  string s;
  cin >> s;
  string ans = "";
  REP(i, s.size()) {
    if (i % 2 == 0) {
      ans += s[i];
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
		int i;
		int j;
		for(i = 1; i < 10; i++){
			for(j = 1; j < 10; j++){
    		cout << i << "x" << j << "=" << i*j << endl;
			}
		}
    return 0;
}

Measured memory_bytes: 1116
N = int(input())
ab = [list(map(int,input().split())) for i in range(N-1)]

graph = [[] for _ in range(N+1)]
for a,b in ab:
    graph[a].append(b)
    graph[b].append(a)

from collections import deque
todo = deque([1])
seen = deque([])
parent = [0] * (N+1)

while todo:
    x = todo.popleft()
    seen.append(x)
    for y in graph[x]:
        if y == parent[x]:
            continue
        parent[y] = x
        todo.append(y)
        
# 根以外の頂点は、唯一の親を持つことから、
# vの親がpであるとき → color[v] に辺 pvの色を持たせると定めて色を管理
color = [-1] * (N+1)
for x in seen:
    ng = color[x]
    c = 1
    for y in graph[x]:
        if y == parent[x]:
            continue
        if c == ng:
            c += 1
        color[y] = c
        c += 1

ans = []
for a,b in ab:
    ans.append(color[b])

print(max(ans))
for i in ans:
    print(i)

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

int main(void){
    // Your code here!
    int a, b;
    cin >> a >> b;
    bool flag[3];
    for(int i = 0; i < 3; i++) flag[i] = true;
    flag[--a] = false;
    flag[--b] = false;
    for(int i = 0; i < 3; i++){
        if(flag[i]) {
            cout << i+1 << endl;
            return 0;
        }
    }
}


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

using namespace std;

int main (){

	string s;
	cin >> s;

	int i;

	for(i = 0; i < s.size(); i++){
		if(i % 2 == 0){
			cout << s[i];
		}
	
	}
	
	cout << endl;

	return 0;

}

Measured memory_bytes: 512
/* _________________________________________________________________________________________________
  |                                                                                                 |
  |                             Author      : Aditya Ahuja                                          |
  |                             Date        : Sun, 19th Jan 2020                                    |
  |_________________________________________________________________________________________________|
*/
 
#include<bits/stdc++.h>
using namespace std;

// #define int long long

#define pb          push_back
#define F           first
#define S           second
#define endl        "\n"
#define rep(i,a,b)  for(int i = a; i < (int)b; i++)
#define req(i,a,b)  for(int i = (int)b - 1; i >= a; i--)
#define all(a)      (a).begin(),(a).end()
#define ret(x)      {cout << x << endl; return;}
#define sz(x)       (int)x.size()
#define type(x)     typeid(x).name()

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<vector<int>> vii;

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

#ifdef LOCAL
	#define wa(x)       cerr << (#x) << " --- " << (x) << endl
	#define pvi(v)      {for(auto it:v) cerr << it << " "; cerr << endl;}
	#define line1	    cerr << "---------------------------" << endl;
#else
	#define wa //
	#define line1 //
	#define pvi //
	#define printf //
#endif

void solve();
signed main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	cout << fixed << setprecision(10);

	int t=1; 
	// cin>>t;
	while(t--) solve();
	return 0;
}

//___________________________________________________________________________________________________

void solve() {

	int a,b,n;
	cin >> a >> b >> n;

	int mx = max(a,b);
	int mn = min(a,b);

	wa(mx);
	int ans = ceil((double)n/mx);
	assert(ans <= mn);
	ret(ans);

}


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

int main(void){
  int N, X;
  cin >> N >> X;
  vector<int> donut(N);
  
  for (int i = 0; i < N; i++) {
    cin >> donut.at(i);
  }
  
  int sum = 0; // sum from donut.at(0) to donut.at(donut.size(0) - 1);
  
  for (int i = 0; i < N; i++) {
    sum += donut.at(i);
  }
  
  int residue = X - sum;
  
  sort(donut.begin(), donut.end());
  int mi = donut.at(0);
  
  int number = N;
  
  while (residue >= mi) {
    residue -= mi;
    number++;
  }
  
  cout << number << endl;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int r = scanner.nextInt();
		int g = scanner.nextInt();
		int b = scanner.nextInt();

		String result = ((r*100 + g*10 + b) % 4 == 0) ? "YES" : "NO";
		System.out.println(result);

	}

}

Measured memory_bytes: 21076
#include "bits/stdc++.h"
using namespace std;
 
// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
 
 
/*
--------------------------------------------
 
	type
 
--------------------------------------------
*/
using LL = long long;
using ULL = unsigned long long;
//using pair<T1, T2> = p12;
 
/*
--------------------------------------------
 
	container
 
--------------------------------------------
*/
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
 
/*
--------------------------------------------
 
	repetition
 
--------------------------------------------
*/
#define MAX(a,b) (a>b)?a:b
#define MIN(a,b) (a>b)?b:a
#define REP(n) for(int i=0; i<n; i++)
#define REPj(n) for(int j=0; j<n; j++)
#define REPS(i,n) for(int i=0; i<(n); i++)
#define REPinit(a,n) for(int i=a; i<(n); i++)
#define REPinitj(a,n) for(int j=a; j<n; j++)
 
//algorithm
//#define SORT(c) sort((c).begin(),(c).end())
 
/*
--------------------------------------------
 
	constant
 
--------------------------------------------
*/
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
/*
 
	Optimizer
 
*/
//#pragma GCC optimize("Ofast")


/*
 
	Utility Algorithm
 
*/
template <typename T>
void swapAlgorithm(T& a, T& b) {
    T tmp = a;
    a = b;
    b = tmp;
}

LL euclideanAlgorithm(LL a, LL b) {
    LL a_tmp = a;
    LL b_tmp = b;

    if (a_tmp > b_tmp) {
        swapAlgorithm<LL>(a_tmp, b_tmp);
    }

    LL r = a_tmp % b_tmp;
    while (r != 0) {
        a_tmp = b_tmp;
        b_tmp = r;
        r = a_tmp % b_tmp;
    }
    return b_tmp;    
}

LL getLCM(LL a, LL b) {
    return (a * b)/(euclideanAlgorithm(a, b));
}

/*
  Code
*/

double eauclidDistance(pair<double, double>& x1, pair<double, double>& x2) {
  return sqrt((x1.first - x2.first) * (x1.first - x2.first) + (x1.second - x2.second) * (x1.second - x2.second));
}

void swap(int& a, int& b) {
  int tmp;
  tmp = a;
  a = b;
  b = tmp;
}

int main(int argc, char const *argv[])
{
  vector<int> ABC(3);
  REP(3) cin >> ABC[i];

  int K;
  cin >> K;

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

  REP(K) {
    ABC[2] *= 2;
  }

  cout << (ABC[0] + ABC[1] + ABC[2]) << endl;

  return 0;
}


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

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int INF = int (1e9) + int (1e5);
const ll INFL = ll(2e18) + ll(1e10);
const ui MOD = 1E9 + 7;
const double EPS = 1e-9;
#define FOR(i,n) for (int i=0;i<(n);++i)
#define ROF(i,x) for(int i = (x) ; i >= 0 ; --i)
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define ODD(x) (((x)&1)==0?(0):(1))
#define sign(x) ((x > 0) - (x < 0))
std::mt19937_64  generator(std::chrono::system_clock::now().time_since_epoch().count());

inline ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a, ll b) { return a ? gcd(b%a, a): b; }
ll lcm(ll a, ll b) { return a / gcd(a,b) * b; }


void READ(bool _local){
    ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef _DEBUG
    if (_local)
        freopen ("in.txt", "r", stdin);
#endif
}

const double PI=acos(-1);
double getang(ii a){
    if (a.first==0)
        return (a.second>=0 ? PI/2: -PI/2);
    double ret=atan((double)a.second/a.first);
    if (a.first<0){
        ret += PI;
    }
    return ret;
}

int main() {
    READ(0);
    int n;cin>>n;
    vii a(n);
    FOR(i,n) cin>>a[i].first>>a[i].second;
    sort(a.begin(),a.end(),[](ii x,ii y){return getang(x)<getang(y);});
    double ret=0;
    FOR(i,n){
        ll x=a[i].first,y=a[i].second;
        double ans=sqrt(x*x+y*y);
        int j=i+1; if (j==n) j=0;
        while(j!=i){
            x += a[j].first,
            y += a[j].second;
            double este=sqrt(x*x+y*y);
            if (este<ans) break;
            ans=este;
            if (++j==n) j=0;
        }
        ret=max(ret,ans);
    }
    cout << setprecision(10) << fixed << ret;
    return 0;
}



Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
#define ll long long
inline int read()
{
	int x=0;bool t=false;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')t=true,ch=getchar();
	while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
	return t?-x:x;
}
ll A,B,C;
int main()
{
	A=read();B=read();C=read();swap(A,B);
	if(A+B+1>=C)
	{
		cout<<A+C<<endl;
	}
	else
	{
		ll ans=A+B+1;
		ans+=A;
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        PrintWriter pw = new PrintWriter(System.out);
        
        try {
            int n = Integer.parseInt(br.readLine());
            
            int ans = n %= 1000; 
            if(ans != 0) {
                ans = 1000 - ans;
            }
            pw.println(ans);
        }
        finally {
            pw.flush();
            pw.close();
        }
    }
}


Measured memory_bytes: 32652
#include <iostream>
#include <cstdlib>
#include <vector>
#include <string>
#include <climits>
#include <algorithm>
#include <functional>
#include <string.h>
#include <numeric>

#define LOP(N) for(int i=0; i<N; i++)
#define LOOP(i, N) for(int i=0; i<N; i++)
#define LOOP_s(i, start, end) for(int i=start; i<end; i++)

typedef long long ll;

using namespace std;

int gcd(int a, int b) {
    int tmp;
    while (a % b != 0) {
        tmp = a;
        a = b % a;
        b = tmp;
    }
    return b;
}

int main() {
    // nA % B = C
    int A, B, C;
    cin >> A >> B >> C;
    if (C % gcd(A, B) == 0) cout << "YES";
    else cout << "NO";
}


Measured memory_bytes: 256
#include<stdio.h>

void print(int* A, int N){
  int i;
  for(i = 0; i < N; i++){
    if(i) printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
}

int bubble_sort(int* A, int N){
  int i,j, cnt = 0;
  for(i = 0; i < N; i++)
    for(j = N-1; j >= i+1; j--)
      if(A[j] < A[j-1]){
	int tmp = A[j];
	A[j] = A[j-1];
	A[j-1] = tmp;
	cnt++;
      }
  print(A,N);
  return cnt;
}

int main(){
  int i,N,data[100];
  scanf("%d",&N);
  for(i = 0; i < N; i++) scanf("%d",&data[i]);
  printf("%d\n",bubble_sort(data,N));
  return 0;
}

Measured memory_bytes: 604
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <math.h>
#include <map>
#include <stack>
using namespace std;
static const int INF = 1e9+7;
// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (int i =a; i < b; i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define PI 3.14159265359

int main(){
    int n, m, x; cin >> n >> m >> x;
    int board[101] = {};
    rep(i, m){
        int tmp; cin >> tmp;
        board[tmp] = 1;
    }

    int first = 0;
    rep(i, x+1){
        if(board[i] == 1) first++;
    }
    int second = 0;
    repr(i, x+1, n+1){
        if(board[i] == 1) second++;
    }
    cout << min(first, second) << endl;

    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
  ll dp[100][100][5000];


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

  int n, a;
  cin >> n >> a;

  vector<int> x(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }

  ll ans = 0;

  dp[0][0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < 5000; k++) {
        if (dp[i][j][k] == 0) continue;
        dp[i + 1][j + 1][k + x[i]] += dp[i][j][k];
        dp[i + 1][j][k] += dp[i][j][k];
      }
    }
  }

  for (int i = 1; i <= n; i++) {
    ans += dp[n][i][a * i];
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 151808
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

struct edge {
    int from, to; ll cost;
    edge(int s, int t, ll w = 0) : from(s), to(t), cost(w) {}
};

int main() {
    init();
    
    int n, m; ll l; cin >> n >> m >> l;

    vector<VL> dis(n, VL(n, LLINF));
    FOR(i, 0, n)dis[i][i] = 0;
    FOR(i, 0, m) {
        int a, b; ll c;
        cin >> a >> b >> c;
        a--, b--;
        if (c > l)continue;
        dis[a][b] = c;
        dis[b][a] = c;
    }

    FOR(k, 0, n)FOR(i, 0, n)FOR(j, 0, n) {
        chmin(dis[i][j], dis[i][k] + dis[k][j]);
    }

    vector<VL> dis2(n, VL(n, LLINF));
    FOR(i, 0, n)dis2[i][i] = 0;
    FOR(i, 0, n)FOR(j, i + 1, n) {
        if (dis[i][j] <= l) {
            dis2[i][j] = 1;
            dis2[j][i] = 1;
        }
    }

    FOR(k, 0, n)FOR(i, 0, n)FOR(j, 0, n) {
        chmin(dis2[i][j], dis2[i][k] + dis2[k][j]);
    }

    int q; cin >> q;
    FOR(i, 0, q) {
        int s, t; cin >> s >> t;
        s--, t--;
        cout << (dis2[s][t] == LLINF ? -1 : dis2[s][t] - 1) << "\n";
    }

}


Measured memory_bytes: 2048
N,M = map(int,input().split())
a = 0
w = 0
lis = [[] for _ in range(N)]
for i in range(M):
  p,s = map(str,input().split())
  p = int(p)
  lis[p - 1].append(s)
for j in range(N):
  if lis[j].count("AC") > 0:
    a += 1
    w += lis[j].index("AC")

    
print(a,w)



Measured memory_bytes: 20352