akhauriyash/Code-Regression huggingface dataset:
N = int(input())
a = [int(ai) for ai in input().split()]

def color(ai):
    if ai < 400:
        return 1
    elif ai < 800:
        return 2
    elif ai < 1200:
        return 3
    elif ai < 1600:
        return 4
    elif ai < 2000:
        return 5
    elif ai < 2400:
        return 6
    elif ai < 2800:
        return 7
    elif ai < 3200:
        return 8
    else:
        return -1

colors = []
n_minus = 0
for ai in a:
    c = color(ai)
    if c == -1:
        n_minus += 1
    else:
        colors.append(c)
n_colors = len(set(colors))

if n_colors == 0:
    print(1, n_minus)
else:
    print(n_colors, n_colors + n_minus)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
char ans[100002];
string s;

bool check(int n) {
  for (int i=1; i<n+1; i++) {
    if (s[i%n] == 'o') {
      if (ans[i] == 'S')
        ans[i+1] = ans[i-1];
      else
        ans[i+1] = (ans[i-1] == 'S') ? 'W' : 'S';
    } else {
      if (ans[i] == 'W')
        ans[i+1] = ans[i-1];
      else
        ans[i+1] = (ans[i-1] == 'S') ? 'W' : 'S';
    }
  }
  return (ans[0]==ans[n] && ans[1]==ans[n+1]);
}

int main() {
  int N;
  cin >> N >> s;
  ans[0] = 'S';
  ans[1] = 'S';
  if (check(N)) {
    for (int i=0; i<N; i++)
      cout << ans[i];
    cout << endl;
    return 0;
  }
  ans[0] = 'S';
  ans[1] = 'W';
  if (check(N)) {
    for (int i=0; i<N; i++)
      cout << ans[i];
    cout << endl;
    return 0;
  }
  ans[0] = 'W';
  ans[1] = 'S';
  if (check(N)) {
    for (int i=0; i<N; i++)
      cout << ans[i];
    cout << endl;
    return 0;
  }
  ans[0] = 'W';
  ans[1] = 'W';
  if (check(N)) {
    for (int i=0; i<N; i++)
      cout << ans[i];
    cout << endl;
    return 0;
  }
  cout << "-1\n";
  return 0;
}

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

int main(){
  int N, A, B;
  cin >> N >> A >> B;
  int ans=0;
  for(int i=1; i<=N; i++){
    int a=i/10000;
    int b=i%10000/1000;
    int c=i%1000/100;
    int d=i%100/10;
    int e=i%10;
    if(a+b+c+d+e>=A && a+b+c+d+e<=B) ans+=i;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main (void){
int a,b,c,i,f,d=0;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
for(i=a;i<=b;i++){
if(c%i==0){
f=1+d++;
}
}
printf("%d\n",f);
return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <vector>

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

    std::vector<std::vector<int>> matrix(n, std::vector<int>(n, 0));
    for(int i = 0; i < n; ++i){
        int m, l;
        std::cin >> m >> l;
        for(int j = 0; j < l; ++j){
            int index;
            std::cin >> index;
            ++matrix.at(m - 1).at(index - 1);
        }
    }

    for(int i = 0; i < n; ++i){
        for(int j = 0; j < n; ++j){
            std::cout << matrix.at(i).at(j);
            if(n - 1 != j){
                std::cout << " ";
            }else{
                std::cout << std::endl;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3160
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	int n=sc.nextInt(),k=sc.nextInt(),e=0;
  	int[] d=new int[k],a=new int[n],f=new int[n];
  	for(int i=0;i<n;i++){
  		f[i]=0;
  	}
  	for(int i=0;i<k;i++){
  		d[i]=sc.nextInt();
  		int[] b=new int[d[i]];
  		for(int j=0;j<d[i];j++){
  			b[j]=sc.nextInt();
  			f[b[j]-1]++;
  		}
  	}
  	for(int i=0;i<n;i++){
  		if(f[i]==0){
  			e++;
  		}
  	}
  	System.out.print(e);
  }
}

Measured memory_bytes: 46216
n,m=map(int,input().split())
List=[int(i) for i in input().split()]
s=sum(List)
for i in range(m):
    a=max(List)    
    if a>=s*(1/(4*m)):
        del List[List.index(a)]
        a=1
       
    else:
        
        a=0

print('Yes' if a==1 else 'No')


Measured memory_bytes: 3060
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner scan = new Scanner(System.in);
        int rod1 = scan.nextInt();
        int rod2 = scan.nextInt();
        
        int difference = rod2 - rod1;
        
        int rodall = 0;
        
        for (int i = 1 ; i <= difference ; i++){
            rodall = rodall + i;
        }
        
        int ans = rodall - rod2;
 
        System.out.println(ans);
        
    }
}

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

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

    for(int i=0; i<S.size(); i++){
        int tmp = int(S.at(i));
        if( tmp + N > int('Z') ){
            tmp = tmp - 26; 
        }
        S.at(i) = char(tmp+N);
    }

    cout << S << endl;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n-1;i>=0;i--)
#define Pool(i, m, n) for(ll i=n-1;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
int main() {
cout << fixed << setprecision(30);
  ll n;
  cin>>n;
  vec a(n);
  ll ans=0;
  map<ll,ll> count;
  loop(i,n){
    cin>>a[i];
    if(a[i]>100000)ans++;
    else count[a[i]]++;
  }
  Loop(i,1,100001){
    if(count[i]<i)ans+=count[i];
    else ans+=count[i]-i;
  }
  putout(ans);
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int MOD = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%MOD+MOD)%MOD){}
  mint operator-() const { return mint(-x);}
  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 { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= 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 { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
// combination MOD prime
struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < MOD);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
  mint p(int n, int k) {
    return fact[n]*ifact[n-k];
  }
} comb(10000007);
// comb(5, 2) → 10, comb.p(5, 2) → 20
// comb.fact[4] → 24, 2のN乗 → mint(2).pow(N)

int main() {
  // 和の事象は詰まっている
  int N, K;
  cin >> N >> K;
  mint ans = 0;
  for (int i = K; i <= N+1; i++) {
    ll low = (ll)(i-1) * i / 2;
    ll high = (ll)(N + N - i + 1) * i / 2;
    ans += high - low + 1;
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 159364
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


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

	int x, y;
	cin >> x >> y;
	int ans = abs(abs(y) - abs(x));
	if (x == 0 && y == 0) {
	}
	else if (y < 0) {
		if (x < 0) {
			if (y < x)ans += 2;
		}
		else {
			ans++;
		}
	}
	else {
		if (x < 0) {
			if (y != 0)ans++;
		}
		else {
			if (y == 0)ans++;
			else if (y < x)ans += 2;
		}
	}
	cout << ans << endl;



	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
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 sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def solve():
    N = int(input())
    A = list(map(int, input().split()))

    ans = 0
    d = defaultdict(int)
    for a in A:
        d[a] += 1
        ans += a

    Q = int(input())
    for i in range(Q):
        B, C = map(int, input().split())

        if d[B] != 0:
            ans -= B * d[B]
            ans += C * d[B]

        d[C] += d[B]
        d[B] = 0

        print(ans)


def main():
    solve()


if __name__ == '__main__':
    main()


Measured memory_bytes: 23464
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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

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

map<char, set<int>> froms;
map<char, set<int>> tos;

int main(void) {
    string S, T;
    cin >> S >> T;
    const int slen = (int) S.size();

    for (int i = 0; i < slen; i++) {
        froms[S[i]].insert(T[i]);
        tos[T[i]].insert(S[i]);
    }

    bool ok = true;

    for (auto p :froms) {
        const int n = (int) p.second.size();
        // printf("froms %c: %d\n", p.first, n);
        if (n > 1) {
            ok = false;
        }
    }
    for (auto p : tos) {
        const int n = (int) p.second.size();
        // printf("tos %c: %d\n", p.first, n);
        if (n > 1) {
            ok = false;
        }
    }

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

    return 0;
}


Measured memory_bytes: 3868
#include <iostream>

using namespace std;

const long long mod = 998244353;

typedef long long ll;

ll fact[300001];
ll inv[300001];
int N;

ll pow(ll x,ll n){
    ll ans = 1;
    while (n > 0) {
        if (n & 1) ans = (ans * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return ans;
}

void calc_fact(){
    fact[0] = 1;
    for(int i = 1; i <= N; i++){
        fact[i] = (fact[i-1] * i) % mod;
    }
}

void calc_inv(){
    inv[N] = pow(fact[N], mod - 2);
    for(int i = N; i > 0; i--){
        inv[i-1] = (inv[i] * i) % mod;
    }
}

ll comb(int i, int j){
    return (((fact[i] * inv[j]) % mod) * inv[i-j]) % mod;
}

int main(){
    ll a,b,k,ans;
    cin >> N >> a >> b >> k;
    ans = 0;
    calc_fact();
    calc_inv();
    
    for(int i = 0; i <= N; i++){
        ll tmp = k - (a * i);
        if(tmp % b == 0){
            ll j = tmp / b;
            if(0 <= j && j <= N)ans += (comb(N,i) * comb(N,j)) % mod;
            ans %= mod;
        }
    }
    cout << ans << endl;
    return 0;
}

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

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

  int N, K; cin >> N >> K;
  int K2 = K * 2;
  
  vector<vector<int>> a(K2, vector<int>(K2));
  for (int i = 0; i < N; i++) {
    int x, y; cin >> x >> y;
    char c; cin >> c;
    if (c == 'W') x += K;
    a[x%K2][y%K2]++;
  }

  vector<vector<int>> cs(K2+1, vector<int>(K2+1));
  for (int i = 0; i < K2; i++) {
    for (int j = 0; j < K2; j++) {
      cs[i+1][j+1] = cs[i][j+1] + cs[i+1][j]
                   - cs[i][j] + a[i][j];
    }
  }

  auto query = [&](int x1, int y1, int x2, int y2) {
    return cs[x2][y2] - cs[x1][y2] - cs[x2][y1] + cs[x1][y1];
  };

  int ans = 0;
  for (int i = 0; i <= K; i++) {
    for (int j = 0; j <= K; j++) {
      int res = query(0, 0, i, j)
              + query(i, j, i+K, j+K)
              + query(0, j+K, i, K2)
              + query(i+K, 0, K2, j)
              + query(i+K, j+K, K2, K2);
      ans = max(ans, res);
      ans = max(ans, N-res);
    }
  }
  cout << ans << "\n";
}

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

int main(){

	int a, b, n, m, ball[10];
	
	cin >> n;
	
	while(cin >> ball[0]){
		for(int i=1; i<10; i++){
			cin >> ball[i];
		}
		
		a = 0;
		b = 0;
		for(int i=0; i<10; i++){
			if(ball[i] < a && ball[i] < b){
				cout << "NO" << endl;
				break;
			}
			else if(a < ball[i] && ball[i] < b){
				a = ball[i];
			}
			else{
				b = ball[i];
			}
			
			if(i == 9) cout << "YES" << endl;
		}
	}

	return 0;

}

Measured memory_bytes: 1152
// ※※※ 解答不能 ※※※
// zeosutt氏.
// https://atcoder.jp/contests/code-festival-2017-qualb/submissions/1670621
#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000
struct Edge{
    int t;
    struct Edge *next;
};

Edge e[100000 * 2], *adj[100000];
int e_size;
int d[100000];
int cnt[100000];
int q[100000];
int front, rear;

void add(int f, int t){
    e[e_size] = (Edge){t, adj[f]};
    adj[f] = e + e_size++;
}

int main(){
    int n, m, a, b;
    scanf("%d %d", &n, &m);
    for(int i = 0; i < m; i++){
        scanf("%d %d", &a, &b);
        a--, b--;
        add(a, b);
        add(b, a);
    }
    for(int i = 0; i < n; i++) d[i] = INF;
    d[0] = 0;
    q[rear++] = 0;
    while(front != rear){
        const int f = q[front++];
        cnt[d[f]]++;
        for(Edge *p = adj[f]; p; p = p->next){
            const int t = p->t;
            if(d[t] == INF){
                d[t] = d[f] + 1;
                q[rear++] = t;
            }else if(d[t] == d[f]){
                printf("%lld\n", (long long)n * (n - 1) / 2 - m);
                return 0;
            }
        }
    }
    long long sum[2] = {0};
    for(int i = 0; i < 100000; i++) sum[i & 1] += cnt[i];
    printf("%lld\n", sum[0] * sum[1] - m);
    return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
#define int long long
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}

string s;
int ta = 0;

signed main() {
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'p')ta++;
	}
	cout << (s.size() / 2) - ta << endl;
	getchar(); getchar();
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF (1 << 30)
#define LLINF (1LL << 60)
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

signed main() {
    cin >> N;
    cout << N * N * N << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,-1,0,1},dy={1,0,-1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a,b;cin >> a >> b;
	if(abs(a-b)%2==0) cout << (a+b)/2 << endl;
	else cout << "IMPOSSIBLE" << endl;
}


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

int main() {
	int arr[3];
	scanf("%d%d%d",&arr[0],&arr[1],&arr[2]);
	sort(arr,arr+3);
	printf("%d\n",(arr[2]*10+arr[1]+arr[0]));
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>

int main(){

  int w,n,a,b,tmp;
  std::cin >> w >> n;

  int tate[w];

  for(int i=0;i<w;i++){
    tate[i]=i+1;
  }

  for(int i=0;i<n;i++){
    scanf(" %d,%d",&a,&b);
    tmp = tate[a-1];
    tate[a-1] = tate[b-1];
    tate[b-1] = tmp;
  }

  for(int i=0;i<w;i++){
    std::cout << tate[i] << std::endl;
  }


}

Measured memory_bytes: 3120
<?php

while (true) {
    $c = fscanf(STDIN, '%d %d %d');
    if (feof(STDIN)) {
        break;
    }
    $rest = 20 - $c[0] - $c[1];
    $over = 0;
    for ($i = 1; $i <= 10; $i++) {
        if ($i === $c[0] || $i === $c[1] || $i === $c[2]) {
            continue;
        }
        if ($i > $rest) {
            $over++;
        }
    }
    echo $over <= 3 ? 'YES' : 'NO';
    echo PHP_EOL;
}

Measured memory_bytes: 6608
#include <bits/stdc++.h>
using namespace std;
#define mod (int)1000000007
#define MOD (int)10000000007
#define X 1001100011100001111ll
#define M 26388279066623ll
#define all(a) a.begin(),a.end()
#define for0(i, n) for (int i = 0; i < n; i++)
#define for0e(i, n) for (int i = 0; i <= n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define bloop(i,a,b) for (int i = a ; i>=b;i--)
#define tc(t) int t; cin >> t; while (t--)
#define ll long long
#define pb emplace_back
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define in(x) scanf("%d", &x)
#define rr return 0
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define inf (int)(1e18)
#define ini(a, i) memset(a, i, sizeof(a))
#define vi vector<int> 
#define F first
#define S second
#define pi pair<int, int>
#define ppi pair<pair<int,int> , int >
#define vii vector<pi>
#define int long long
const int MAXN = (int)((1e5) + 100);
int max(int a,int b){if(a>b) return a; else return b;}
int min(int a,int b){if(a<b) return a; else return b;} 
int gcd(int a,int b) { if (a == 0) return b; return gcd(b%a, a);}
int cbrt(int x){ int lo=1,hi=min(2000000ll,x);while(hi-lo>1){int mid=(lo+hi)/2;if(mid*mid*mid<x){lo=mid;}else hi=mid;}if(hi*hi*hi<=x) return hi;else return lo;} 
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
const int N =  (int)(1e6+5); 

// ========================================================
signed main(){
  #ifndef ONLINE_JUDGE
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  #endif
  fio;
    int k;
    cin >> k;
	if(k%2==0 || k%5==0){
		return cout << "-1\n",0;
	}
	int cur=7%k;
	int ans=1;
	while(cur!=0){
		cur=cur*10+7;
		cur%=k;
		ans++;
	}
	cout << ans << endl;
  rr;
}



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

int main() {
	string s;
	while (cin >> s, s != "-") {
		int m; cin >> m;
		rep(i, m) {
			int h; cin >> h;
			s = s.substr(h) + s.substr(0, h);
		}
		cout << s << endl;
	}
}

Measured memory_bytes: 3156
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
#include <random>
#include <list>
#include <numeric>
using namespace std;
 
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<int, ll> i_ll;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };
 
#define rep(i, N) for (int i = 0; i < (int)(N); i++)
#define pb push_back
 
int INF = INT_MAX / 10;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	string s; cin >> s;
	int x = 0;
	for (char c: s) {
		if (x == 0 && c == 'C') x++;
		else if (x == 1 && c == 'F') x++;
	}
	cout << (x == 2 ? "Yes" : "No") << endl;
}


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

int64_t mod = 1000000007;
int64_t large = 9223372036854775807;
double PI = 3.141592653589793;

int main()
{
    int N, mi = mod, ma = -mod;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        int tmp;
        cin >> tmp;
        if (mi >= tmp)
            mi = min(tmp, mi);
        if (mi <= tmp)
            ma = max(tmp, ma);
    }
    cout << ma - mi;
}

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

vector<int>a(4);
bool OK=false;

void calc (vector<int>v){
  int sum=0;
  string res;
  
  sum+=a.at(0);
  res+='0'+a.at(0);
  
  
  for(int i=0;i<3;i++){
    if(v.at(i)==0){
      sum+=a.at(i+1);
      res+='+';
      res+='0'+a.at(i+1);
    }
    if(v.at(i)==1){
      sum-=a.at(i+1);
      res+='-';
      res+='0'+a.at(i+1);
    }
  }
  
  if(sum==7){
    cout<<res<<"=7"<<endl;
    OK=true;
  }
}



void dfs (int depth,vector<int>v){
  if(OK)
    return;
  if(depth==3){
    calc(v);
    return;
  }
  
  for(int i=0;i<2;i++){
    v.at(depth)=i;
    dfs(depth+1,v);
  }
}



int main(){
  int N;
  cin>>N;
  
  for(int i=0;i<4;i++){
    a.at(3-i)=N%10;
    N/=10;
  }
  
  vector<int>v(3);
    
  
  dfs(0,v);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
template<class T> void puts(T x) { std::cout << x << std::endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n, m;
vector<int> v1;
set<int> s2;

int main() {
    cin >> n >> m;
    rep(i, m) {
        int a, b; cin >> a >> b;
        if (a == 1) v1.push_back(b);
        if (b == n) s2.insert(a);
    }

    bool flg = false;
    for (int mid: v1) {
        auto it = s2.find(mid);
        if (it != s2.end()) flg = true;
    }
    if (flg) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
}


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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
vl modinv;
void fillModInv(ll n, ll mod){
  modinv = vl(n+1);
  modinv[1] = 1;
  FOR(i,2,n+1){
    modinv[i] = modinv[mod%i] * (mod - mod/i) % mod;
  }
}
/*}}}*/
int main() {
  ll n,k;
  cin >> n >> k;

  vector<bool> kashi(n,false);

  REP(i,k){
    ll d;
    cin >> d;
    REP(j,d){
      ll t;
      cin >> t;
      t--;
      kashi[t] = true;
    }
  }

  ll ans = n;
  REP(i,n) if(kashi[i]) ans--;
  
  //cout << fixed << setprecision(10);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define vec vector
#define pb push_back
#define MOD 1000000007
#define ll long long

ll pow(ll a, int n)
{
  ll ret = 1;
  rep(i, n) ret *= a;
  return ret;
}

int main(void)
{
  int n;
  ll k;
  cin >> n >> k;
  vec<vec<ll>> m(n, vec<ll>(0));
  rep(i, n - 1) {
    ll a, b;
    cin >> a >> b;
    a--; b--;
    m[a].pb(b);
    m[b].pb(a);
  }

  ll ans = k;
  vec<int> dp(n, 0);
  dp[0] = 1;
  queue<int> q;
  rep(i, m[0].size()) {
    ans *= k - 1 - i;
    ans %= MOD;
    q.push(m[0][i]);
    dp[m[0][i]] = 1;
  }
  while(q.size()) {
    int g = q.front();
    q.pop();
    int flag = 0;
    rep(i, m[g].size()) {
      if (dp[m[g][i]]) {
        flag = 1;
        continue;
      }
      dp[m[g][i]] = 1;
      ans *= k - 2 - i + flag;
      ans %= MOD;
      q.push(m[g][i]);
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 7284
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
#define ll long long
const int MOD = 1e9+7;
using namespace std;


int main(){
	int a, b, c, x, y;
	ll ans = 0;
	cin >> a >> b >> c >> x >> y;
	if (a + b >= c*2){
		ans += c*2*min(x, y);
		if (x > y){
			if (c*2 < a) ans += c*2*(x-y);
			else ans += a*(x-y);
		}else{
			if (c*2 < b) ans += c*2*(y-x);
			else ans += b*(y-x);
		}
		cout << ans << endl;
	}else{
		cout << a*x + b*y << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int x, a, b;
    cin >> x >> a >> b;
    cout << (x - a) % b;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
using namespace std;
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
const int INF = 1001001001;
const ll MOD = 1e9+7;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;

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


__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}


signed main(){
	string s; cin>>s;
	ll k; cin>>k;
	ll n = s.size();
	if(n==1) return cout<<k/2<<endl,0;

	ll cnt = 0;
	reps(i,n-1)	if(s[i-1]==s[i]) cnt++,i++;
	bool flg = false;
	if(s[0]==s[n-1]) flg = true;
	ll ans = cnt*k;

	int top = 1, btm = 1;
	reps(i,n-1){
		if(s[i]==s[0]) top++;
		else break;
	}
	REP(i,n-1){
		if(s[i]==s[n-1]) btm++;
		else break;
	}
	if(flg) if((btm%2)&&(top%2)) ans += k-1;
	if(top==n&&btm==n&&n%2){
		return cout<<n*k/2<<endl,0;
	}
	cerr << cnt SP top SP btm << endl;
	cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#include <vector>
#include <numeric>
#include <map>
#include <queue>
using ll =long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;


int main(){
    ll N, M, A;
    cin >> N >> M;
    priority_queue<ll> AA;

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

    for(int i=0; i<M; i++){
        ll p = AA.top()/2;
        AA.pop();
        AA.push(p);
    }

    ll sum = 0;
    for(int i=0; i<N; i++){
        sum += AA.top();
        AA.pop();
    }

    cout << sum << endl;



}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

void print(const vector<int> &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
}

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int count = 0;
  rep(i, n) {
    if(i==0) count++;
    else if(s[i] == s[i-1]) continue;
    else count++;
  }
  while(count > 1 && k > 0) {
    k--;
    if(count > 2) count -= 2;
    else count--;
  }
  out(n-count);
  return 0;
}


Measured memory_bytes: 512
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func main() {
	var n, a, b int
	fmt.Scan(&n, &a, &b)
	s := nextMega()

	rank := 0
	sum := 0
	for i := 0; i < n; i++ {
		ok := false
		if s[i] == 'a' && sum < a+b {
			sum++
			ok = true
		} else if s[i] == 'b' {
			rank++
			if sum < a+b && rank <= b {
				sum++
				ok = true
			}
		}
		if ok {
			puts("Yes")
		} else {
			puts("No")
		}
	}
	wt.Flush()
}


Measured memory_bytes: 3072
#include<algorithm>
#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
#define int long long
using namespace std;
const int INF=1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

signed main(){
  int x,a,b;
  cin>>x>>a>>b;
  if(a-b>=0)cout<<"delicious"<<endl;
  else if(a+x>=b)cout<<"safe"<<endl;
  else cout<<"dangerous"<<endl;
      
    return 0;
}



Measured memory_bytes: 256
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
N, X = map(int, input().split())
x = readints()
#print(N, X)
# print(x)

ans = abs(X-x[0])
for i in range(N-1):
    ans = fractions.gcd(ans, abs(x[i+1]-x[i]))
print(ans)


Measured memory_bytes: 84828
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

INF = float("inf")

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

def I():
    return int(input())

def MI():
    return map(int,input().split())

def RI():
    return list(map(int,input().split()))

def CI(n):
    return [ int(input()) for _ in range(n) ]

def LI(n):
    return [ list(map(int,input().split())) for _ in range(n) ]

def S():
    return input()

def MS():
    return input().split()

def RS():
    return list(input().split())

def CS(n):
    return [ input() for _ in range(n) ]

def LS(n):
    return [ list(input().split()) for _ in range(n) ]

a,b = MI()
print(a*b)

Measured memory_bytes: 68296
/***** author :  C0d1ngPhenomena *****/

    #include <bits/stdc++.h>
    #define endl "\n"
    #define ll long long int
    #define TestCases int T; cin>>T; while(T--)
    #define rep(i,n) for(ll i = 0; i < n; i++)
    #define revrep(i,n) for(ll i = n-1; i >= 0; i--)
    #define vll vector<ll>
    #define vvll vector < vll >
    #define pll pair<ll, ll>
    #define vpll vector <pll>
    #define mp(x,y) make_pair(x,y)
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define alld(c) c.begin(),c.end(),greater<int>()
    #define mem(a,val) memset(a,val,sizeof(a))
    #define f first
    #define s second
    #define pb push_back
    using namespace std;
    
    bool sortbysec(const pair<int, int> &a, const pair<int, int> &b)
    {
        return (a.second < b.second);
    }

    ll n;
    ll solve(ll x, ll y, ll z)
    {
    	return (pow(x,2) + pow(y,2) + pow(z,2) + x*y + y*z + x*z);
    }


    ll arr[100000];
    int main()
    {
        std::ios::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
       
      	
      	ll counta = 0;

      	cin >> n;
      	for (int i = 1; i < sqrt(n); ++i)
      		for (int j = 1; j < sqrt(n); ++j)
      			for (int k = 1; k < sqrt(n); ++k)
      			{
      				ll x = solve(i,j,k);
      				if(x <= n)
      					arr[x-1]++;
      			}
      	
      for (int i = 0; i < n; ++i)
      {
      	cout << arr[i]<<endl;
      }


        return 0;
    }







Measured memory_bytes: 3640
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>
#include <cassert>

using namespace std;
typedef long long ll;

int main(){
   long long X;
   cin >> X;
   long long ans = X*(1+X)/2;
   for(int i = 2; i <=X; i++){
      for(int j = i; j <= X; j+=i){
         ans += j;
      }
   }
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 3632
x1, y1, x2, y2 = map(int, input().split())
q = int(input())

p1, p2 = complex(x1, y1), complex(x2, y2)
p1p2 = p2 - p1
d2_p1p2 = p1p2.real ** 2 + p1p2.imag ** 2

while q:
    q -= 1
    p0 = complex(*map(int, input().split()))
    p1p0 = p0 - p1
    t = (p1p2.real * p1p0.real + p1p2.imag * p1p0.imag) / d2_p1p2
    ref = p0 + 2 * (p1p2 * t - p1p0)
    print(ref.real, ref.imag)

Measured memory_bytes: 7704
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std;

const int N=200005;

int n,x;
int a[N],b[N];

int main(){
	int i;
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%d",&a[i]);
	for (i=1;i<=n;i++){
		x=(n-i+2)/2;
		if (n-i+1&1) b[x]=a[i];
		else b[x+i]=a[i];
	}
	for (i=1;i<=n;i++) printf("%d ",b[i]);
	return 0;
}

Measured memory_bytes: 3712
import java.util.Scanner;

//  C - Otoshidama

public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    int Y = Integer.parseInt(sc.next());
    Integer man = 0;
    Integer gosen = 0;
    Integer sen = 0;

    label: for(int i = 0; i <= N; i++) {
    	if(i * 10000 == Y && i == N) {
			man = i;
			break label;
    	}
    	for(int m = 0; m <= (N-i); m++) {
			if(i * 10000 + m * 5000 == Y && i + m == N) {
				man = i;
				gosen = m;
				break label;
			}

			for(int n = 0; n <= (N-i-m); n++) {
				if(i * 10000 + m * 5000 + n * 1000 == Y && i + m + n == N) {
					man = i;
					gosen = m;
					sen = n;
					break label;
				}
			}
    	}
    }
    if(man == 0 && gosen == 0 && sen ==0) {
    	System.out.println("-1 -1 -1");
    } else {
//		System.out.println(man*10000+gosen*5000+sen*1000);
//		System.out.println(man+gosen+sen);
		System.out.println(man.toString()+" "+gosen.toString()+" "+sen.toString());
    }


  }
}

Measured memory_bytes: 23380
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n); for(int i = 0;i < (int)(n);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    rep(i,n)cin >> a[i];
    vector<int>data(100001,0);
    rep(i,n)data[a[i]]++;
    int ans = 0;
    rep(i,data.size()-3){
        int x = data[i]+data[i+1]+data[i+2];
        ans = max(ans,x);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4056
#include <iostream>
#include <algorithm>
#include <string>
#define int long long
using namespace std;
signed main() {
	int n, ans = 0; string st;
	cin >> n >> st;
	int m = st.size();
	for (int i = 0; i < n; i++) {
		string s; cin >> s;
		int t = s.size();
		for (int i = 0; i <= t - m; i++) {
			if (s[i] == st[0]) {
				for (int j = i + 1; (j - i)*(m - 1) + i < t; j++) {
					if (s[j] == st[1]) {
						for (int p = 2; p < m; p++) {
							if (s[(j - i)*p + i] != st[p])goto heaven;
						}
						ans++;
						goto hell;
					}
					heaven:;
				}
			}
		}
		hell:;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3224
function main (input) {
  const haiku = [5, 7, 5];
  const inputArr = input.split(' ').map((data) => {
    return Number(data);
  });
  let tempArr = inputArr;

  for (let i = 0; i < haiku.length; i++) {
    const indexOf = tempArr.indexOf(haiku[i]);
    if (indexOf >= 0) {
      tempArr.splice(indexOf, 1);
    }
  }

  return tempArr.length === 0 ? 'YES' : 'NO';
}

// console.log(main('5 5 7'));
console.log(main(require("fs").readFileSync("/dev/stdin","utf8")));


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll H, W;
    cin >> H >> W;
    vector<string> S(H);
    ll white = 0;
    rep(i, H) {
        cin >> S[i];
        iter(c, S[i]) {
            if(c == '.') white++;
        }
    }
    vector<pair<ll, ll>> directions{
        {1, 0},
        {-1, 0},
        {0, 1},
        {0, -1},
    };
    queue<pair<ll, ll>> Q;
    vector<vector<pair<ll, ll>>> prev(H, vector<pair<ll, ll>>(W, {-1, -1}));
    Q.emplace(0, 0);
    while(!Q.empty()) {
        pair<ll, ll> current = Q.front();
        Q.pop();
        iter(dir, directions) {
            pair<ll, ll> temp = current;
            temp.first += dir.first;
            temp.second += dir.second;
            if(temp.first < 0 || temp.first >= W || temp.second < 0 || temp.second >= H) continue;
            if(S[temp.second][temp.first] == '#') continue;
            if(prev[temp.second][temp.first].first != -1) continue;
            prev[temp.second][temp.first].first = current.first;
            prev[temp.second][temp.first].second = current.second;
            Q.push(temp);
        }
    }
    ll res = 2;
    pair<ll, ll> current = prev[H - 1][W - 1];
    if(current.first == -1) {
        cout << -1 << endl;
    } else {
        while(current != pair<ll, ll>{0, 0}) {
            current = prev[current.second][current.first];
            res++;
        }
        cout << white - res << endl;
    }
    return 0;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  int n,k;
  ll a[1001]={};
  vector<ll> v;
  cin >> n >> k;
  for(int i=1;i<=n;i++){
    cin >> a[i];
      a[i] += a[i-1];
  }
  for(int i=0;i<=n;i++){
    for(int j=i+1;j<=n;j++){
      v.push_back(a[j]-a[i]);
    }
  }
  ll ans = 0;
  int pw = 40;
  while(pw>=0){
    int cnt = 0;
    ll crr = (ans+pow(2,pw));
    for(int i=0;i<v.size();i++){
      if( (crr & v[i]) == crr)
        cnt ++;
    }
    if(cnt >= k){
      ans += pow(2,pw);
    }
    pw--;
  }
  cout << ans << endl;
}

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

int main(){
    int N;
    cin >> N;
    int n= N;
    int sum =0;
    while(n > 0){
        sum += n%10;
        n /=10;
    }
    if(N%sum ==0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  rep(i,n) a[i]--;
  vector<int> b(n);
  rep(i,n) cin >> b[i];
  vector<int> c(n-1);
  rep(i,n-1) cin >> c[i];
  
  int man = 0;
  
  rep(i,n){
    man += b[a[i]];
  }
  
  rep(i,n-1){
    if(a[i+1]==a[i]+1) man += c[a[i]];
  }
  cout << man << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int n;
	scanf("%d",&n);
	float sum=0;
	float k;
	k=n/3.0;
	if(3*k-n<1E-6||n-3*k<1E-6){
		sum=k*k*k;
	}
	printf("%.12f",sum); 
	
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>
#include <deque>
#include <set>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;
ll llmax = 10000000000000000000ll;
using namespace std;
using Graph = vector<vector<int>>;
Graph G;
const int AMAX = 100000;
/*int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}



int n;
vll a;

ll solve(bool isp)
{
	ll sum = 0ll;
	ll ret = 0ll;

	for (int i = 0; i < n; i++)
	{
		sum += a[i];
		if (isp and sum <= 0)
		{
			ret += -sum + 1;
			sum = 1ll;
		}
		if (not isp and sum >= 0)
		{
			ret += sum + 1;
			sum = -1ll;
		}
		isp ^= 1;
	}
	return ret;
}

*/


/*
 * 最大公約数計算
 */
ll gcd(ll a, ll b)
{
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}

ll lcm(ll a, ll b)
{
	ll g = gcd(a, b);

	return a / g * b;
}

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

	cin >> H >> W;
	vector<string> data(H);
	for (int y = 0; y < H; y++)
	{
		
		cin >> data[y];

	}
	for (int y = 0; y < H; y++)
	{
		for (int x = 0; x < W; x++)
		{
			if (data[y][x] == '.')
			{
				int c = 0;
				for (int dx = -1; dx < 2; dx++)
				{
					for (int dy = -1; dy < 2; dy++)
					{
						if (dx == 0 && dy == 0)
						{
							continue;
						}

						int xx = x + dx;
						int yy = y + dy;
						if (0 <= xx && xx < W && 0 <= yy && yy < H)
						{
							if (data[yy][xx] == '#')
							{
								c++;
							}
						}
					}
					
				}

				data[y][x] = char('0' + c);
				
			}

			
		}
	}

	for (int y = 0; y < H; y++)
	{
		cout << data[y] << endl;
	}
	

	return 0;

}



Measured memory_bytes: 256
import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun <T> Iterable<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)
fun <T> Array<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val (W, A, B) = nextIntList()
    val ans = if (A <= B) {
        (B - (A + W)).coerceAtLeast(0)
    } else {
        (A - (B + W)).coerceAtLeast(0)
    }
    println(ans)
}

Measured memory_bytes: 37872