akhauriyash/Code-Regression huggingface dataset:
/* ex2_3
    kas056 */

#include <stdio.h>

int main(){
  
    int N, A;
  //入力読み込み
	 scanf("%d", &N);
	 scanf("%d", &A);
	//N^2－A を計算、出力
     printf("%d\n", N*N - A);
  
    return 0;
}


Measured memory_bytes: 128
n,m = map(int,input().split())
s = []
for i in range(m):
    a =list(map(int,input().split()))
    a.append(i)
    s.append(a)
s.sort()
ans = [0 for i in range(m)]
num = 0
ans_ = ""
for i in range(m):
    if num != s[i][0]:
        num = s[i][0]
        count = 1
    ans_ = str(s[i][0])
    ans__ = str(count)
    for j in range(5):
        if len(ans_) < 6:
            ans_ = "0"+ans_
        if len(ans__) < 6:
            ans__ = "0" + ans__
    ans[s[i][2]] = ans_+ans__
    count += 1
for i in range(m):
    print(ans[i])

Measured memory_bytes: 39416
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int datanum = sc.nextInt();
        int dataroom[][][] = new int[3][10][4];
        int b,f,r,v;

        for(int i = 0; i < datanum; i++){
            b = sc.nextInt();
            f = sc.nextInt();
            r = sc.nextInt();
            v = sc.nextInt();
            dataroom[f-1][r-1][b-1] += v;
        }

        for(int i = 0; i < 4; i++ ){
            for(int m = 0; m < 3; m++ ){
                for(int n = 0; n < 10; n++){
                    System.out.print(" " + dataroom[m][n][i]);
                }
                System.out.println();
            }
            if( i != 3 ) System.out.println("####################");
        }
    }
}


Measured memory_bytes: 30080
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

#define M_PI       3.14159265358979323846

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

std::string pad(int num)
{
    char buffer[4];
    std::snprintf(buffer, sizeof(buffer), "%03d", num);
    return buffer;
}

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

struct Hashing {
    ull seed, mod;
    vector <ull> hs, pw;

    Hashing(ull seed = 31, ull mod = 1000173169) :
        seed(seed),
        mod(mod) {}

    void build(int n, const string& s) {
        hs.assign(n + 1, 0);
        pw.assign(n + 1, 1);
        pw[0] = 1;

        for (int i = 1; i <= n; ++i)
            pw[i] = pw[i - 1] * seed % mod;
        for (int i = 1; i <= n; ++i)
            hs[i] = (hs[i - 1] * seed + s[i]) % mod;
    }

    ull hash(int l, int r) {
        return (hs[r] - hs[l - 1] * pw[r - l + 1] % mod + mod) % mod;
    }
};

ll solve()
{
    int N, K;

    std::cin >> N >> K;
    
    vector<ll> healt = fetch_vec<ll>(N);

    std::sort(healt.begin(), healt.end(), std::greater<ll>());
    ll sum = 0;

    for (int i = K; i < N; ++i)
        sum += healt[i];

    return sum;
}

int main()
{
    cout << solve() << endl;

    return 0;
}

Measured memory_bytes: 1792
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#define lc (x<<1)
#define rc (x<<1|1)
#define gc getchar()//(p1==p2&&(p2=(p1=buf)+fread(buf,1,size,stdin),p1==p2)?EOF:*p1++)
#define mk make_pair
#define pi pair<int,int>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N=2e5+10,size=1<<20;

//char buf[size],*p1=buf,*p2=buf;
template<class o> void qr(o &x) {
	char c=gc; x=0; int f=1;
	while(!isdigit(c)){if(c=='-')f=-1; c=gc;}
	while(isdigit(c)) x=x*10+c-'0',c=gc;
	x*=f;
}
template<class o> void qw(o x) {
	if(x/10) qw(x/10);
	putchar(x%10+'0');
}
template<class o> void pr1(o x) {
	if(x<0)x=-x,putchar('-');
	qw(x); putchar(' ');
}
template<class o> void pr2(o x) {
	if(x<0)x=-x,putchar('-');
	qw(x); puts("");
}

ll n;
int ans;
int calc(ll x) {
	int res=x!=1;
	for(ll i=2;i*i<=x;i++) 
		if(x%i==0) {
			if(i*i==x) res++;
			else res+=2;
		}
	return res;
}
int Calc(ll x) {
	int res=1;
	for(ll i=2;i*i<=x;i++) 
		if(x%i==0) {
			ll y=x;
			while(y%i==0) y/=i;
			res+=(y%i==1);
			y=x;
			ll t=x/i;
			if(t==i) continue;
			while(y%t==0) y/=t;
			res+=(y%t==1);
		}
	return res;
}

int main() {
	qr(n); 
	ans=calc(n-1)+Calc(n);
	pr2(ans);
	return 0;
}



Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    long n = sc.nextLong();
    long m = sc.nextLong();
    TreeMap<Long, Long> map = new TreeMap<Long, Long>();
    BigInteger ans = BigInteger.ZERO;
    long bought = 0;

    for (int i = 0; i < n; i++) {
      long a = sc.nextLong();
      long b = sc.nextLong();
      if (map.containsKey(a)) {
        map.put(a, map.get(a) + b);
      } else {
        map.put(a, b);
      }
    }

    for (long key : map.keySet()) {
      if ((m - bought) <= 0) {
        break;
      }
      ans = ans.add(BigInteger.valueOf(key * Math.min(m - bought, map.get(key))));
      bought += map.get(key);
    }

    System.out.println(ans);

  }
}

Measured memory_bytes: 66496
import java.util.*;
public class Main{
  public static void main(String[]args){
      Scanner sc = new Scanner(System.in);

      int a = sc.nextInt();
      int b = sc.nextInt();

    if(a+b<24){
        System.out.println(a+b);
      }else{
      System.out.println(a+b-24);
    }

}
}


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

def get_input() -> tuple:
    """
    標準入力を取得する.

    Returns:\n
        tuple: 標準入力
    """
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))

    return N, K, A

def main(N: int, K: int, A: list) -> None:
    """
    メイン処理.

    Args:\n
        N (int): 学期数（2 <= N <= 200000）
        K (int): 直近何回分までの点数を考慮するか（1 <= K <= N - 1）
        A (list): i学期の期末テストの点数
    """
    # 求解処理
    for i in range(K, N):
        if A[i] > A[i - K]:
            print("Yes")
        else:
            print("No")

if __name__ == "__main__":
    # 標準入力を取得
    N, K, A = get_input()

    # メイン処理
    main(N, K, A)


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

int main() {
    int N,M;cin>>N>>M;
    int ans = 1;
    for(int i=1;i*i<=M;++i){
        if(M%i != 0) continue;
        int j = M / i;
        if(M/i>=N) ans = max(ans,i);
        if(M/j>=N) ans = max(ans,j);
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 256
#define FOR(i, min, max) for(int (i) = (min); (i) < (max); (i)++)
#define MAX(a,b) ((a) > (b) ? (a) : (b)) 
#define SWAP(a,b) { int r = a; a = b; b = r; }

#include <utility>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;

int main()
{
	int n, c = 0, a[100];
	cin >> n;
	FOR(i, 0, n)
		cin >> a[i];
	FOR(i, 0, n)
	{
		int minj = i;
		FOR(j, i, n)
		{
			if (a[j] < a[minj])
				minj = j;
		}
		if (a[i] != a[minj])
		{
			SWAP(a[i], a[minj]);
			c++;
		}
	}
	FOR(i, 0, n-1)
	{
		cout << a[i] << " ";
	}
	cout << a[n - 1] << endl;
	cout << c << endl;
	return 0;
}

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

int main(){
  const int Ndata= 3;
  vector<int> data(Ndata);
  for(int i=0; i<Ndata; i++){
    cin >> data.at(i);
  }
  sort(data.begin(), data.end(), greater<int>());

  int K;
  cin >> K;
  for(int i=0; i<K; i++){ // the rich gets richer方式で増やすのが最善
    data.at(0)*= 2;
  }

  int sum= 0;
  for(int i=0; i<Ndata; i++){
    sum+= data.at(i);
  }

  cout << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n,m,x,y,z,i,c=0,d=0;
  cin >> n >> m >> x >> y;
  vector<int> a(n),b(m);
  for (i=0;i<n;i++) {
    cin >> a[i];
  }
  for (i=0;i<m;i++) {
    cin >> b[i];
  }
  for (z = (x+1); z < (y+1); z++) {
    for (i=0;i<n;i++) {
    if(a[i] < z) c++;
    }
    for (i=0;i<m;i++) {
    if (b[i] >= z) d++;
    }
    if(c == n && d == m) {
     cout << "No War" << endl;
      break;
    }
    else if (z == y) {
      cout << "War" << endl;
      break;
    }
    c = 0;
    d = 0;
  }
}
      

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

#define int long long
using ll = long long;
using ld = long double;
using intpair = pair<int, int>;
using intmap = map<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
const int MOD = 1e9 + 7;
inline int mod (ll a, int m = MOD) { return (a % m + m) % m; }
inline bool bit (ll b, ll i) { return b & (1 << i); }
inline ll ceiv (ll a, ll b) { return (a + b - 1) / b; }
//struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;

#define debug(x) cerr << #x << ": " << x << '\n'
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()

int H, W, Ch, Cw, Dh, Dw;
vector<string> field;

inline bool is_safe(int h, int w){
    return (0 <= w && w < W)&&(0 <= h && h < H);
}

int dh[4] = {0,1,0,-1};
int dw[4] = {1,0,-1,0};

signed main() {
    cin >> H >> W >> Ch >> Cw >> Dh >> Dw;
    Ch--; Cw--; Dh--; Dw--;
    
    vvi cost(H, vi(W,INT_MAX));
    
    rep(i,H){
        string s; cin >> s;
        field.push_back(s);
    }
    queue<intpair> q0, q1;
    q0.push({Ch, Cw});
    cost[Ch][Cw] = 0;
    
    while(!q0.empty() || !q1.empty()){
        int h, w;
        if(!q0.empty()){
            h = q0.front().first;
            w = q0.front().second;
            q0.pop();
        }else{
            h = q1.front().first;
            w = q1.front().second;
            q1.pop();
        }
        
        int nowcost = cost[h][w];
        
        if(h == Dh && w == Dw) {
            cout << nowcost << endl;
            exit(0);
        }
        
        rep(i,4){
            if(!is_safe(h+dh[i], w+dw[i]))       continue;
            if(cost[h+dh[i]][w+dw[i]] <= nowcost)continue;
            if(field[h+dh[i]][w+dw[i]] == '#')   continue;
            q0.push({h+dh[i], w+dw[i]});
            cost[h+dh[i]][w+dw[i]] = nowcost;
        }
        
        reps(dH, -2, 2)reps(dW, -2, 2){
            if(!is_safe(h+dH, w+dW))            continue;
            if(cost[h+dH][w+dW] <= nowcost + 1) continue;
            if(field[h+dH][w+dW] == '#')        continue;
            q1.push({h+dH, w+dW});
            cost[h+dH][w+dW] = nowcost + 1;
        }
    }
    
    cout << -1 << endl;
}

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

using namespace std;

typedef long long ll;
typedef pair<int, int> PII;

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

#define N 10010
int f[N], c[N], a[N];

int fa(int x) {
	if (f[x] == x) return x;
	else return f[x] = fa(f[x]);
}

int n, m;

int main() {
	cin >> n >> m;
	for (int i = 0; i < n; i ++) {
		string s;
		cin >> s;
		for (int j = 0; j < m; j ++)
			a[s[j]-'a']++;
	}
	
	for (int i = 0; i < n*m; i ++) f[i] = i;
	
	for (int i = 0; i < n; i ++)
		for (int j = 0; j < m; j ++) {
			int x = i*m+j;
			int y = (n-i-1)*m+j;
			f[fa(x)] = fa(y);
			y = i*m+(m-j-1);
			f[fa(x)] = fa(y);
		}
	for (int i = 0; i < n*m; i ++)
		c[fa(i)] ++;
	sort(c, c+n*m);
	reverse(c, c+n*m);
	for (int i = 0; i < n*m; i ++) {
		bool F = false;
		for (int j = 0; j < 26 && !F; j ++)
			if (a[j] >= c[i]) {
				a[j] -= c[i];
				F = true;
			}
		if (!F) {
			puts ("No");
			exit(0);
		}
	}
	puts ("Yes");
	return 0;
}

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

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define _dec(i,N,j) for(int i = (N-1);i >= (j);i--)
#define _rec(i,N,j) for(int i = (N);i >=(j);i--)
#define ALL(x) x.begin(),x.end()
#define MEM(a,n) memset(a,n,sizeof(a))
#define fst first
#define scd second
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

int get_int(){int x;scanf("%d",&x);return x;}
LL get_ll(){LL x;scanf("%lld",&x);return x;}
double get_db(){double x;scanf("%lf",&x);return x;}

template<typename T> int chmin(T &a,T b){if(a > b){a = b;return 1;}else return 0;}
template<typename T> int chmax(T &a,T b){if(a < b){a = b;return 1;}else return 0;}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {_for(i,0,v.size()) os << v[i] << " ";return os;}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){for(auto a:v) os << a <<" ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& v){os << v.fst <<" "<<v.scd << " ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const map<T1,T2>& v){for(auto a:v) cout << a << endl;return os;}

static const int dx[8] = { -1,  0, 1, 0,  1, -1,  1, -1};
static const int dy[8] = {0,  1, 0,  -1,  1, -1, -1,  1};
const double pi  = acos(-1.0);
const double eps = 1e-8;
const LL  INF  = 0x3f3f3f3f3f3f3f3f;
const int inf  = 0x3f3f3f3f;

const int maxn = 2e5 + 5;
const LL maxm = LL(1e18)+5;

LL A[maxn];
vector<LL> minu;
vector<LL> plu;
vector<LL> num;
LL K,N;

bool valid(LL mid){
    LL cnt = 0;

    _for(i,0,num.size()){
        if(num[i] < 0){
            int l = -1;
            int r = N;
            while(r - l > 1){
                LL m = (l+r)/2;
                if(num[m] * num[i] <= mid){
                    r = m;
                }else{
                    l = m;
                }
            }
            cnt += N - r;
            if(i >= r) cnt--;
        }
        else if(num[i] == 0){
            if(mid >= 0) cnt += N - 1;
        }
        else{
            int l = -1;
            int r = N;
            while(r - l > 1){
                LL m = (l+r)/2;
                if(num[m] * num[i] <= mid){
                    l = m;
                }else{
                    r = m;
                }
            }
            cnt += (l + 1);
            if(i <= l) cnt--;

        }

    }


    //cout <<mid <<" "<< cnt/2 << endl;

    return cnt/2 < K;

}

int main()
{
    cin >> N >> K;
    int mnum = 0;
    int pnum;
    _for(i,0,N){
        cin >> A[i];
        num.PB(A[i]);
    }


    sort(ALL(num));

    LL l =  -maxm;
    LL r =  maxm;
    while(r - l > 1){
        LL mid = l + (r - l)/2;
        //乘积小于mid的个数小于K valid return true
        if(valid(mid)){
            l = mid;
        }else{
            r = mid;
        }
    }
    cout << r <<endl;


    return 0;
}


Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl '\n'
#define ll long long
int main()
{
    Hello
    int k, n;
    cin >> k >> n;
    int arr[n + 5];
    for(int i = 0; i < n; i++)
        cin >> arr[i];
    int mx = k - arr[n - 1] + arr[0];
    for(int i = 1; i < n; i++)
        mx = max(mx, arr[i] - arr[i - 1]);
    cout << k - mx;
    return 0;
}

Measured memory_bytes: 4408
n, m, x = map(int, input().split())
As = list(map(int, input().split()))
count1 = 0
count2 = 0
for i in range(x, n + 2):
    if i in As and i != n and i != 0 and i != x:
        count1 += 1
for i in range(0, x):
    if i in As and i != n and i != 0 and i != x:
        count2 += 1
print(min(count1, count2))


Measured memory_bytes: 3060
use proconio::input;
use std::io::{stdout, BufWriter, Write};

fn main() {
    input! {
        x: usize,
        n: usize,
        p: [usize; n],
    }
    let out = stdout();
    let mut out = BufWriter::new(out.lock());
    let mut i = 0;
    loop {
        if !p.contains(&(x - i)) {
            writeln!(out, "{}", x - i);
            return;
        } else if !p.contains(&(x + i)) {
            writeln!(out, "{}", x + i);
            return;
        }
        i += 1;
    }
}

Measured memory_bytes: 2200
import collections

def solve(N, A):
    c_dict = collections.Counter(A)
    originals = [0 for i in range(N + 1)]
    minus = [0 for i in range(N + 1)]
    
    for (k, v) in c_dict.items():
        originals[k] = v * (v - 1) // 2
        minus[k] = ((v * (v - 1)) - (v - 1) * (v - 2)) // 2
        
    total = sum(originals)
    
    ans = []
    for a in A:
        ans.append(str(total - minus[a]))
    return '\n'.join(ans)
    
if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    print(solve(N, A))

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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e6 + 5;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  cout << fixed << setprecision(12);
  char a,b; cin>>a>>b;
  if (a==b) out("=");
  if (a>b) out(">");
  out("<");
  

  return 0;
}


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

int main(){
    int n, x[1000], y[1000];

    cin >> n;

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

    double d[4] = {0.0, 0.0, 0.0, 0.0};

    for (int  p = 1; p <= 3; p++ ){
        for (int i = 0; i < n; i++){
            d[p] += pow(fabs(x[i]-y[i]), p);
        }

        d[p] = pow(d[p], 1.0/p); 
    }

    for (int i = 0; i < n; i++){
        d[0] = (d[0] < fabs(x[i]-y[i])?fabs(x[i]-y[i]): d[0]);
    }

    printf("%lf\n", d[1]);
    printf("%lf\n", d[2]);
    printf("%lf\n", d[3]);
    printf("%lf\n", d[0]);
    
}



Measured memory_bytes: 3340
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B
# CreatedDate:  2020-06-27 15:34:06 +0900
# LastModified: 2020-06-27 15:35:45 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    h, n = map(int, input().split())
    a = list(map(int, input().split()))
    if sum(a)>=h:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()


Measured memory_bytes: 20656
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N,M = map(int,input().split())
UV = [tuple(map(int,input().split())) for _ in range(M)]
S,T = map(int,input().split())

S,T = S-1,T-1

E = [[] for i in range(3*N)]
for u,v in UV:
    u,v = u-1,v-1
    E[u].append(v+N)
    E[u+N].append(v+2*N)
    E[u+2*N].append(v)

from collections import deque
dq = deque([S])
inf = float("inf")
dist = [inf]*(3*N)
dist[S] = 0

while dq:
    v = dq.popleft()
    for e in E[v]:
        if dist[e] != inf:
            continue
        dist[e] = dist[v]+1
        if e==T:
            print(dist[e]//3)
            sys.exit()
        dq.append(e)

print(-1)

Measured memory_bytes: 73632
//
// ~oisín~ C++ Template
//

#include                <bits/stdc++.h>
#define MX_N            5001
#define mp              make_pair
#define mod7            1000000007
#define modpi           314159
#define PI              3.141592653589793238
#define pb              push_back
#define FastIO          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define All(a)          a.begin(),a.end()
#define fi              first
#define se              second
#define ll              long long int
#define ull             unsigned long long int

int kx[8]  =            {+2, +2, -2, -2, +1, +1, -1, -1};
int ky[8]  =            {+1, -1, +1, -1, +2, -2, +2, -2};
int d9x[9] =            {+1, +1, +1, +0, +0, +0, -1, -1, -1};
int d9y[9] =            {+1, +0, -1, +1, +0, -1, +1, +0, -1};
int dx4[4] =            {+0, +0, +1, -1};
int dy4[4] =            {+1, -1, +0, +0};

ll gcd(ull a, ull b){
    return (a==0)?b:gcd(b%a,a);
}

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

const long long INF = 1e18;

using namespace std;

ll n_from_x(ll x){
    return (-1LL + (long long)sqrt(1 + 8 * x)) >> 1;
}

int main(){
    ll n;
    cin >> n;
    ll N = n;
    ll s = sqrt(N);
    int cur = 2;
    map<ll, int> factor_frequency;
    while(cur <= sqrt(n)){
        if(n % cur == 0){
            n/=cur;
            ++factor_frequency[cur];
        }else{
            ++cur;
        }
    }
    if(n == 1){
        cout << "0\n";
        return 0;
    }
    ++factor_frequency[n];
    int ans = 0;
    for(auto it = factor_frequency.begin(); it != factor_frequency.end(); ++ it){
        ans += n_from_x(it->second);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3724
import math

n=int(input())
for i in range(1,int(math.sqrt(n))+1):
    ans=0
    if n%i==0:
        j=int(n/i)
        ans1=str(i)
        ans2=str(j)
        if len(ans1)>=len(ans2):
            break

if len(ans1)>=len(ans2):
    print(len(ans1))
else:
    print(len(ans2))

Measured memory_bytes: 9028
h,w=map(int,input().split())
s=[list(input()) for _ in range(h)]
dy=[1, 0, -1, 0]
dx=[0, 1, 0 ,-1]

from collections import deque
ans=0
for i in range(h):
    for j in range(w):
        if s[i][j]=='#':
            continue
        d=[[-1]*w for _ in range(h)]
        queue=deque()
        queue.append((i,j))
        d[i][j]=0
        tmp_ans=-1
        while queue:
            y,x=queue.popleft()
            for d_y, d_x in zip(dx,dy):
                new_y=y+d_y
                new_x=x+d_x
                if new_y<0 or h<=new_y or new_x<0 or w<=new_x:
                    continue
                if s[new_y][new_x]=='.' and d[new_y][new_x]==-1:
                    d[new_y][new_x]=d[y][x]+1
                    queue.append((new_y, new_x))
                    tmp_ans=max(tmp_ans, d[new_y][new_x])
        ans=max(ans, tmp_ans)
print(ans)


Measured memory_bytes: 3444
import sys
from heapq import*
r=sys.stdin.readline
def g(n,E,S,G):
 F=[1e7]*-~n;F[S]=0
 H=[(0,S)]
 while H:
  c,u=heappop(H)
  if u==G:return c
  for f,v in E[u]:
   t=c+f
   if t<F[v]:
    F[v]=t
    heappush(H,(t,v))
 return-1
def s():
 for e in iter(r,'0 0\n'):
  n,k=map(int,e.split())
  E=[[]for _ in[0]*-~n]
  for _ in[0]*k:
   f=r()
   if'0'==f[0]:print(g(n,E,*map(int,f[2:].split())))
   else:
    c,d,e=map(int,f[2:].split())
    E[c]+=[(e,d)];E[d]+=[(e,c)]
s()


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int n;
    cin >> n;
    LL res;
    cin >> res;
    n--;
    bool f = true;
    for(int i = 0; i < n; ++i) {
        LL a;
        cin >> a;
        LL tmp = res;
        res *= a;
        if(a == 0) {f = true; break;}
        if(res < tmp) {
            f = false;
        }
    }
    if(!f || res > 1000000000000000000ll) cout << -1 << endl;
    else cout << res << endl;
    return 0;
}



Measured memory_bytes: 3656
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 入力
		int N = sc.nextInt();
		int[] H = new int[N];
		boolean error = false;
		for (int i = 0; i < N; i++) {
			H[i] = sc.nextInt();
			// 入力チェック
			if (H[i] > 100 || H[i] < 1) {
				error = true;
			}
		}
		
		// 入力チェック
		if (N > 20 || N < 1) {
			System.out.println("無効な入力値です");
			return;
		}
		if (error) {
			System.out.println("無効な入力値です");
			return;
		}
		
		// 答えを出力
		int count = 0;
		int max = 0;
		for (int i = 0; i < N; i++) {
			if (max <= H[i]){
				max = H[i];
				count++;
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,X1,X2,X3,a,b,c;
  double d,e,f;
  cin >> N;
  a = (N+(1.08/2))/1.08;
  b = a - 1.0;
  c = a + 1.0;
  d = a * 1.08;
  e = b * 1.08;
  f = c * 1.08;
  X1 = d;
  X2 = e;
  X3 = f;
  if(N == X1)
    cout << a << endl;
  else if(N == X2)
    cout << b << endl;
  else if(N == X3)
    cout << c << endl;
  else
    cout << ":(" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#define WALL "####################"
 
int main(void) {
    int n, b, f, r, v, tbl[4][3][10] = {};
    for(scanf("%d", &n); n--; tbl[~-b][~-f][~-r] += v) {
        scanf("%d %d %d %d", &b, &f, &r, &v);
    }
    for(n = 0; n < 120; ++n % 10 || printf("\n")) {
        n % 30 || !n || printf("%s\n", WALL);
        printf("%2d", tbl[n / 30][n % 30 / 10][n % 10]);
    }
    return 0;
}

Measured memory_bytes: 620
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <vector>
#include <set>
#include <cstdlib>
#include <stack>

using namespace std;

typedef long long LL;
typedef double db;
#define FAST ios::sync_with_stdio(false);
const int MaxN = 105;
int main()
{
	char a[5];
	cin >> a[0] >> a[1] >> a[2];
	for(int i = 0 ; i <= 2 ; i++)
	{
		if(a[i] == '1')cout << '9';
		else cout << '1';
	}
	cout << endl;
	return 0;
	}

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

int main(){
  int n, k ,x, y;
  cin >> n >> k >> x >> y;
  
  int total = 0;
  for(int i=0; i<n;i++){
    if(i < k) total += x;
    else total += y;
  }
  
  cout << total << endl;
  
  return 0;
}

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

using namespace std;

bool check[100001];
int cntwa[100001];

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

	int n,m,p;
	string s;
	int ac = 0,wa = 0;

	memset(check,false,sizeof(check));
	memset(cntwa,0,sizeof(cntwa));

	cin >> n >> m;

	for(int i=0;i<m;i++)
	{
		cin >> p >> s;
		if(s=="AC")
		{
			if(check[p]==false)
			{
				check[p] = true;
				ac++;
			}
		}
		else
		{
			if(check[p]==false)
			{
				cntwa[p]++;
				wa++;
			}
		}
	}

	for(int i=1;i<=n;i++)
	{
		if(check[i]==false)
		{
			wa -= cntwa[i];
		}
	}

	cout << ac << ' ' << wa << '\n';

	return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;

int main(){
    int n ;
    cin >> n ;
    vector<int> a(n) ,b(n) ,c(n) ;
    for (size_t i = 0; i < n; i++)
    {
        /* code */
        cin >> a.at(i) >>b.at(i) >> c.at(i) ;
    }
    vector<vector<int> > dp(n,vector<int>(3)) ;

    dp.at(0).at(0) = a.at(0) ;
    dp.at(0).at(1) = b.at(0) ;
    dp.at(0).at(2) = c.at(0) ;

    for (size_t i = 1; i < n; i++)
    {
        dp.at(i).at(0) = max(dp.at(i-1).at(1) , dp.at(i-1).at(2)) + a.at(i) ;
        dp.at(i).at(1) = max(dp.at(i-1).at(0) , dp.at(i-1).at(2)) + b.at(i) ;
        dp.at(i).at(2) = max(dp.at(i-1).at(0) , dp.at(i-1).at(1)) + c.at(i) ;
           
    }
    int ans =  max(max(dp.at(n-1).at(0),dp.at(n-1).at(1)),dp.at(n-1).at(2))  ;
    cout << ans << endl ;
    
}

Measured memory_bytes: 6912
import sys
Input = sys.stdin.readline

N, T = map(int, Input().split())
c_t = [list(map(int, Input().split())) for _ in range(N)]
mi = float("inf")

for c, t in c_t:
    if t <= T and c < mi:
        mi = c

if mi == float("inf"):
    print("TLE")
else:
    print(mi)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<class T> void re(T& x) { cin >> x; }
template<typename T> 
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
template<class H, class... T> void re(H& h, T&... t) { re(h); re(t...); }
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "C:\Users\navodit\Desktop\mycodes\pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  





void solve(){
	int a , b , c ,d ;
	re(a, b, c, d);
	int l = lcm(c,d);
	auto f = [&](int x){
		return x - x/c - x/d + x/l;
	};
	cout << f(b) - f(a - 1) << endl;
}

signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 3628
// -*- coding:utf-8-unix -*-

use proconio::input;
use std::collections::HashSet;

fn main() {
    input! {
        n: usize,
        m: usize,
    }
    let mut k = vec![];
    let mut s = vec![];
    for _ in 0..m {
        input! {
            a: usize,
            b: [u16; a],
        }
        k.push(a);
        s.push(b);
    }
    input! {
        p: [u16; m],
    }
    // println!("k: {:?}", k);
    // println!("s: {:?}", s);
    // println!("p: {:?}", p);

    let mut ans = 0;
    for bit_row in 0..2u32.pow(n as u32) {
        // println!("{:b}", bit_row);
        let mut selected = HashSet::new();
        for i in 0..n {
            if (bit_row & (1 << i)) > 0 {
                selected.insert(i as u16);
            }
        }
        // println!("on: {:?}", selected);

        // if selected.len() == 0 {
        //     if p.iter().all(|&a| a == 0) {
        //         ans += 1;
        //     }
        // }

        for i in 0..m {
            let mut swsum = 0;
            for j in 0..k[i] {
                // スイッチは 1 スタート
                if selected.contains(&(s[i][j] - 1)) {
                    swsum += 1;
                }
            }
            // println!("sw no. {}: {}", i, swsum);
            if swsum % 2 != p[i] {
                break;
            }

            if i == m - 1 {
                ans += 1;
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 2204
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
#define PI 3.14159265359
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

int main() {
  int N;
  string S;
  cin >> N >> S;
  int count = 0;
  for (int i = 0; i < N - 2; i++) {
    string str = S.substr(i, 3);
    if (str == "ABC") count++;
  }
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

bool isPrime(int n){
    for(int i=2; i*i<=n; i++){
        if(n%i == 0) return false;
    }

    return true;
}

int main(){
    int N; cin >> N;
    vector<int> ans(N);
    int pos = 0;

    for(int i=2; i<=55555; i++){
        if(isPrime(i) && i%5 == 1){
            ans[pos++] = i;
            if(pos == N) break;
        }
    }

    for(int i=0; i<N; i++) cout << ans[i] << " ";
    cout << endl;
}



Measured memory_bytes: 256
// Created by new_sm
//
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define si set<int>
#define mii map<int,int>
#define pb push_back
#define pf push_front
#define pii pair<int,int>
#define extract_word(s)  stringstream str(s); while(str>>word)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define SET(s) cout<<fixed<<setprecision(s)
#define chotu 1000000007
#define set0(a) memset(a,0,sizeof(a))
#define endl "\n"
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define lower_string(s) transform(all(s),s.begin(),::tolower())
#define upper_string(s) transform(all(s),s.begin(),::toupper())
#define size(s) s.size()
template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }
template<typename T,typename U>
bool compare(T x,U y){return(abs(x-y)<=1e-9);}
void solve()
{
fastio
int n;
cin>>n;
vi arr(n);
for(int x=1;x<=100;x++)
{
	for(int y=1;y<=100;y++)
	{
		for(int z=1;z<=100;z++)
		{
			int tg=x*x+y*y+z*z+x*y+y*z+z*x;
			if(tg<=n)
			arr[tg-1]++;
			else
			continue;
		}
	}
}
for(auto &x:arr)
cout<<x<<endl;
}
int main()
{
//code
fastio
int t;
t=1;
while(t--)
{
	solve();
	cout<<endl;
}
}



Measured memory_bytes: 3568
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> v(m);
    for (auto &&i : v) scanf("%d", &i);
    vector<int> ans(n, 0);
    for (int i = 0; i < m; ++i) {
        int u = 0;
        for (int j = 0; j < n; ++j) {
            int k;
            cin >> k;
            if(k == v[i]) ans[j]++;
            else u++;
        }
        ans[v[i]-1] += u;
    }
    for (int i = 0; i < n; ++i) printf("%d\n", ans[i]);

    return 0;
}



Measured memory_bytes: 3204
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#define PI acos(-1.0)
#define LL long long
#define MAX 0x3fffffff
using namespace std;

int h, a;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> h >> a;
	double t = 1.0*h / a;
	if (t - (int)t == 0)cout << (int)t << endl;
	else cout << (int)t + 1 << endl;
	return 0;
}


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

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

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

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

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

// --------------------------------------
class UnionFind {
public:
  vector<int> data;
  UnionFind(int size) : data(size, -1) {}

  int find(int x) {
    return data[x] < 0 ? x : data[x] = find(data[x]);
  }
  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if(x != y) {
      if(data[y] < data[x]) swap(x, y);
      data[x] += data[y];
      data[y] = x;
    }
  }
  int size(int x) {
    return -data[find(x)];
  }
};
int n, m;
int p[100000];

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

  cin >> n >> m;
  UnionFind uf(n);

  REP(i, n) {
    cin >> p[i];
    p[i]--;
  }

  REP(i, m) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    uf.unite(a, b);
  }

  int ans = 0;
  REP(i, n) {
    if(p[i] == i || uf.find(p[i]) == uf.find(i)) ans++;
  }

  cout << ans << endl;
}


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

for i in range(k):
    if b <= a:
        b = b*2
    elif c <= b:
        c = c*2
    if c > b > a:
        print("Yes")
        break
    if i+1 == k:
        print("No")

Measured memory_bytes: 9024
# coding: utf-8 
# Your code here!
import sys
input=sys.stdin.readline
sys.setrecursionlimit(100000000)

N,Q=map(int,input().split()) 

l=[[i] for i in range(N)] 

#print(l) 
def dfs(num,point,visited): 
    visited[num]=1 
    point+=plus[num] 
    
    ans[num]=point 
    while l[num][-1]!=num: 
        temp=l[num].pop(-1) 
        if visited[temp]==0: 
            dfs(temp,point,visited) 
            
    return 0 

for _ in range(N-1): 
    a,b=map(int,input().split()) 
    l[a-1].append(b-1) 
    l[b-1].append(a-1) 
    
ans=[0]*N 
plus=[0]*N 

for _ in range(Q): 
    p,x=map(int,input().split()) 
    plus[p-1]+=x 

dfs(0,0,[0]*N) 

print(*ans)



Measured memory_bytes: 230992
def sum_digit(n):
    L = []
    while n != 0:
        k = n % 10
        L.append(k)
        n = n // 10
    return sum(L)


N, A, B = map(int, input().split())
ans = 0

for i in range(N+1):
    X = sum_digit(i)
    if A <= X and X <= B:
        ans += i
print(ans)

Measured memory_bytes: 3060
import java.util.*;

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

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long A = sc.nextLong();
        long B = sc.nextLong();

        long diff = Math.abs(A - B);

        if (diff % 2 == 0) {
            System.out.println(diff / 2);
        } else {
            long v1 = Math.min(Math.max(A, B) - 1, Math.max(N - A, N - B));
            long v2 = Math.min(Math.min(A, B) - 1 + 1 + diff / 2,
                               Math.min(N - A, N - B) + 1 + diff / 2);
            System.out.println(Math.min(v1, v2));
        }
        
        return;
    }

}

Measured memory_bytes: 23636
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <utility>
#include <queue>
#include <cassert>

using namespace std;
typedef long long ll;
const int LEN = 100000;

struct fastio{
  int it,len;
  char s[100005];
  fastio(){
	  it = len = 0;
  }
  char get(){
    if(it < len) return s[it++];
    len = fread(s,1,100000,stdin);
    it = 0;
    return len ? s[it++] : EOF;
  }
  void put(char c){
    if(it == LEN) fwrite(s,1,LEN,stdout), it = 0;
    s[it++] = c;
  }
  void flush(){
    fwrite(s,1,it,stdout);
  }
}buff;
inline int getint(){
  char c; int res = 0, sig = 1;
  for(c = buff.get();c < '0' || c > '9';c = buff.get()) if(c == '-') sig = -1;
  for(;c >= '0' && c <= '9';c = buff.get()) res = res * 10 + (c - '0');
  return sig * res;
}
bool f[105];
int n;
int main(){
  n = getint();
  f[0] = 1;
  for(int i = 1;i <= n;i++){
    if(i >= 4 && f[i - 4]) f[i] = 1;
    else if(i >= 7 && f[i - 7]) f[i] = 1;
    else f[i] = 0;
  }
  if(f[n]) puts("Yes");
  else puts("No");
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

const int inf = INT_MAX;
const int MOD = 1000000007;
const long long INF = LLONG_MAX;

// -------------------------------------------------------

int N, M;
int ans[100];

int main() {
  cin >> N >> M;
  rep(i, 0, M) {
    int a, b;
    cin >> a >> b;
    ++ans[a];
    ++ans[b];
  }

  repe(i, 1, N) { cout << ans[i] << "\n"; }
}


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

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

    int a, b, c;
    for (int a = 0; a <= n; a++) {
        for (int b = 0; b <= n - a; b++) {
            c = n - a - b;
            if (c < 0) {
                break;
            }
            if (a * 10000 + b * 5000 + c * 1000 == y) {
                cout << a << " " << b << " " << c << endl;
                return 0;
            }
        }
    }

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

    return 0;
}


Measured memory_bytes: 256
/*
 * main.cpp
 *
 *  Created on: 2011/04/01
 *      Author: satoki
 *      22:08 ~ 04/09 10:51
 *      »ê¼êÆ§Åððo·
 */
#include <iostream>
#include <string.h>
using namespace std;

double dA;
double dB;
double dC;
double dD;
double dE;
double dF;

double dX;
double dY;

bool input() {
  if (scanf("%lf %lf %lf %lf %lf %lf", &dA, &dB, &dC, &dD, &dE, &dF) == EOF) return false;
  return true;
}

void manage() {
  int tmp;

  dX = (dC * dE - dB * dF) / (dA * dE - dB * dD);
  dY = (dC * dD - dA * dF) / (dB * dD - dA * dE);

  tmp = (int)dX;
  dX -= tmp;
  dX = (int)(dX * 1000 + 0.5 - (dX < 0)) / (double)1000;
  dX += tmp;
  tmp = (int)dY;
  dY -= tmp;
  dY = (int)(dY * 1000 + 0.5 - (dY < 0)) / (double)1000;
  dY += tmp;
}

int main() {
  while (1) {
    if (!input()) break;
    manage();
    printf("%.3f %.3f\n", dX, dY);
  }
}

Measured memory_bytes: 0
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

// fact(n)
int fact(int n){
	if(n == 1)	return 1;
	else return (n * fact(n - 1));
}

// combination(n,r)
int combination(int n, int r){
	if(r == 0 || r == n)	return 1;
	else if(r == 1)	return n;
	return (combination(n - 1, r - 1) + combination(n - 1, r));
}

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

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

// qsort(array, size, sizeof(int),comp);
int comp(const int *a,const int *b){
	return (*a - *b);
}

// append(array,*size,addNum)
void append(int *array,int *size,int num){
	realloc(array, sizeof(int) * (*size + 1));
	array[(*size)] = num;
	++(*size);
}

// pop(array,*size) & nongetpop(array,*size)
int pop(int *array,int *size){
	int temp = array[(*size - 1)];
	nongetpop(array,&(*size));
	return temp;
}

int nongetpop(int *array,int *size){
	realloc(array,sizeof(int) * (*size - 1));
	--(*size);
}

int main(int argc, char const *argv[])
{
	int ant[5] = { 0 };
	int k;
	for (int i = 0; i < 5; ++i)
	{
		scanf("%d",&ant[i]);
	}
	scanf("%d",&k);
	for (int i = 0; i < 5; ++i)
	{
		for (int j = i + 1; j < 5; ++j)
		{
			if(ant[j] - ant[i] > k){
			puts(":(");
			return 0;
           }
		}
	}
	puts("Yay!");
	return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main{

public static void main(String[] args) {
int p = 9;
int counter = 1;
Scanner scan = new Scanner(System.in);
while (p != 0) {
p = scan.nextInt();
if (p != 0) {
System.out.println("Case " + counter +": " + p);
}
counter++;
} 

}
}



Measured memory_bytes: 41148
#include <iostream>
#include <vector>
#include <list>

int main() {
    int N, Q;
    std::cin >> N >> Q;
    std::vector<std::list<int>> v(N);
    for (int q = 0; q < Q; ++q) {
        int t;
        std::cin >> t;
        if (t == 0) {
            int i, x;
            std::cin >> i >> x;
            v[i].push_back(x);
        } else if (t == 1) {
            int i;
            std::cin >> i;
            if (!v[i].empty()) {
                auto itr = v[i].begin();
                std::cout << *itr;
                while (++itr != v[i].end()) std::cout << " " << *itr;
            }
            std::cout << std::endl;
        } else {
            int i, j;
            std::cin >> i >> j;
            v[j].splice(v[j].end(), v[i]);
            v[i].clear();
        }
    }
    return 0;
}



Measured memory_bytes: 18716
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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 int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int A, B, C;
  cin >> A >> B >> C;

  cout << C << " " << A << " " << B << "\n";

  return 0;
}


Measured memory_bytes: 3596