akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

priority_queue<P> pq;
Int ans;
Int a[216000], b[216000];
Int n;

void ng(){
    cout << -1 << endl;
    exit(0);
}

int main(){
    cin >> n;
    for(int i = 0;i < n;i++)cin >> a[i];
    for(int i = 0;i < n;i++){
        cin >> b[i];
        pq.push(P(b[i], i));
    }
    while(!pq.empty()){
        P tmp = pq.top();pq.pop();
        int ind = tmp.second;
        if(b[ind] == a[ind])continue;
        if(b[ind] < a[ind])ng();
        int lr = b[(ind + n-1) % n] + b[(ind + 1) % n];
        int nxt = max(a[ind], b[ind] % lr);
        if(b[ind] == nxt)ng();
        if((b[ind] - nxt) % lr != 0)ng();
        ans += (b[ind] - nxt) / lr;
        b[ind] = nxt;
        pq.push(P(b[ind], ind));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9072
#include <bits/stdc++.h>
#include<math.h>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long
#define INF 2000000000
#define Min(a,b) (a<b?a:b)
#define Max(a,b) (a>b?a:b)
#define PI 3.1415926535897932
using namespace std;






int main()
{
int n,m;
cin>>n>>m;
char a[n+1][m+1];

for(int i=1; i<=n;i++){
	for(int j=1; j<=m;j++){
		cin>>a[i][j];
	}
}
long long  dp[n+1][m+1];

for(int i=0;i<=n;i++){
	for(int j=0;j<=m;j++){
		dp[i][j]=0;
	}
}

for(int i=1;i<=n;i++){
	if(a[i][1]=='.')
		dp[i][1]=1;
	else
		break;
}
for(int i=1;i<=m;i++){
	if(a[1][i]=='.')
		dp[1][i]=1;
	else
		break;
}
for(int i=2;i<=n;i++){
	for(int j=2;j<=m;j++){
		if(a[i][j]=='.')
			dp[i][j]=dp[i-1][j]%1000000007+dp[i][j-1]%1000000007;
		else
			dp[i][j]=0;	
			
		
	}
}
long long  ans=dp[n][m]%1000000007;
cout<<ans;


}



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

using namespace std;

#define eb emplace_back
#define ii pair<int, int>
#define OK (cerr << "OK" << endl)
#define debug(x) cerr << #x " = " << (x) << endl
#define ff first
#define ss second
#define int long long
#define tt tuple<int, int, int>
#define all(x) x.begin(), x.end()
#define vvi vector<vector<int>>
#define vvii vector<vector<pair<int, int>>>
#define Mat(n, m, v) vector<vector<int>>(n, vector<int>(m, v))
#define endl '\n'

constexpr int INF = 2e18;
constexpr int MOD = 1e9 + 7;
constexpr int MAXN = 2e5 + 3;

// #define MULTIPLE_TEST_CASES
void solve() {
  string s;
  cin >> s;

  vector<string> v = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};

  int idx = find(all(v), s) - v.begin();
  cout << 7 - idx << endl;
}

signed main() {
  // freopen(".in", "r", stdin);
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);

  int t = 1;
#ifdef MULTIPLE_TEST_CASES
  cin >> t;
#endif
  while (t--)
    solve();
}

Measured memory_bytes: 3648
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	int n;

	cin>>n;

	vs s(n);

	vvi count(n, vi(26, 0));
	
	vi min(26, 100);

	rep(i, n) cin>>s[i];

	rep(i, n){
		rep(j, s[i].size()){
			count[i][s[i][j]-'a']++;
		}
	}

	rep(i, 26){
		rep(j, n){
			if(min[i]>count[j][i]) min[i]=count[j][i];
		}
	}

	rep(i, 26){
		if(min[i]==100) min[i]=0;
		rep(j, min[i]){
			cout<<(char)('a'+i);
		}
	}
	cout<<endl;

}

Measured memory_bytes: 256
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1149&lang=jpfrom bisect import bisect_left
# 対称性から s <= w + h の範囲のみを考えれば良い
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

class Cake:
    def __init__(self, h, w):
        self.height = h
        self.width = w
    
    def circumference(self):
        return 2 * (self.height + self.width)
    
    def area(self):
        return self.height * self.width


def main():
    ans = []

    while True:
        n,w,d = map(int, readline().split())
        if (n, w, d) == (0, 0, 0):
            break

        piece = [Cake(d, w)]
        for _ in range(n):
            p, s = map(int, readline().split())
            p -= 1
            
            c = piece.pop(p)
            s %= c.circumference() // 2
            if s < c.width:
                h1, h2 = c.height, c.height
                w1, w2 = min(s, c.width - s), max(s, c.width - s)
            else:
                h = s - c.width
                h1, h2 = min(h, c.height - h), max(h, c.height - h)
                w1, w2 = c.width, c.width
            
            """
            if h == c.height:
                h1, h2 = h, h
                w1, w2 = min(w, c.width - w), max(w, c.width - w)
            else:
                h1, h2 = min(h, c.height - h), max(h, c.height - h)
                w1, w2 = w, w
            """

            piece.append(Cake(h1, w1))
            piece.append(Cake(h2, w2))

        ans.append(sorted([p.area() for p in piece]))
    
    for a in ans:
        print(*a)


if __name__ == "__main__":
    main()


Measured memory_bytes: 6292
#include <stdio.h>
int main(void)
{
	int a,b,i;
	char op;

	for(i=1;i>0;i++){scanf("%d %c %d",&a,&op,&b);

	if(op=='+'){printf("%d\n",a+b);
	}
		else if(op=='-'){printf("%d\n",a-b);
		}
		else if(op=='*'){printf("%d\n",a*b);
		}
		else if(op=='/'){printf("%d\n",a/b);
		}
		else if(op=='?'){break;
		}
	}
return 0;
} 


Measured memory_bytes: 2104
import sys
import math
import itertools
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

n = L()
n = [int(k) for k in n]
if len(n) == 1:
    print(n[0])
else:
    print(max(sum(n),9*(len(n)-1)+n[0]-1))

Measured memory_bytes: 3064
import java.util.*;
public class Main { 
	final static int maxn=(int)2e5+10;
	static int vis[]=new int [maxn];
	static int a[]=new int [maxn];
	static int b[]=new int [maxn];
	static int f[][]=new int [maxn][3];
 public static void main(String args[])
 {
	 Scanner input=new Scanner(System.in);
   int  x=input.nextInt();
   int num=x/500;
  // System.out.println(num);
   x%=500;x/=5;
   long sum=(long)num*1000+(long)x*5;
   System.out.println(sum);
}
}

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

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

    if (!((s[0] == s[1]) && (s[1] == s[2]) && (s[2] == s[3])) && ((s[0] == s[1] && s[2] == s[3]) || (s[0] == s[2] && s[1] == s[3]) || (s[0] == s[3] && s[1] == s[2]))){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
#define REP(a,b) for (int i = a; i <= (b); ++i) 
#define mREP(a,b) for (int i = a; i == (b); --i) 
typedef long long ll;
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	/*
	　　　  　 ,ﾍ／L──- 、
	　　　   　Lﾆ)r_」=＝= ｲ
	　　 　,ﾍ、i ﾉノλﾉﾊﾉﾍ
	　　   ,'　｀(ﾊﾘ ﾟ ヮﾟﾉi)　',
	　　 .i　　 >〈(つ,i!と)　　i
	　　  vﾍγk´_/___i,ゝﾍノ
	　　　　　 ｀ﾞr_,ｨ_ｧﾞ´
	*/
	int a, b;
	cin >> a >> b;
	int count = 0;
	int sum = 0;
	if (b == 1) {
		cout << 0 << endl;
		return 0;
	}
	while (sum != 1000000) {
		sum += a;
		count++;
		if (sum >= b) {
			cout << count << endl;
			return 0;
		}
		else {
			sum -= 1;
		}
}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
#include<iomanip>
#define PI 3.14159265359
int main()
{
  double x[2],y[2];
  double deg;
  double area,length,height;
  cin >> x[0] >> y[0]>> deg;

  setprecision(10);
  area = sin(deg/180*PI)*x[0]*y[0]/2.0;
  length = sqrt(x[0]*x[0] + y[0]*y[0] -2*x[0]*y[0]*cos(deg/180*PI)) + x[0] + y[0];
  height = area*2/x[0];
  cout << fixed <<area<<'\n'<<length<<'\n'<<height<< endl;
  return 0;
}



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

int n, k, s1, s2, d[100005];
vector<int> a[100005];
int f(int p, int q) {
	int i, mn = 2e9;
	if (p == n) return 0;
//	if (d[p] != 0) return d[p];
	for (i = 0; i < a[p].size(); i++) {
		if (a[p][i] == q) continue;
		mn = min(mn, f(a[p][i], p) + 1);
	}
	return mn;
}

void g(int p, int q, int w, int z) {
	int i;
	if (w < 0) return;
	if (d[p] != 0 && d[p] != z) return;
	d[p] = z;
	for (i = 0; i < a[p].size(); i++) {
		if (a[p][i] == q) continue;
		g(a[p][i], p, w - 1, z);
	}
}
int main()
{
	int i, t1, t2 ,num;
	cin >> n;
	for (i =0; i <n - 1; i++) {
		scanf ("%d %d", &t1, &t2);
		a[t1].push_back(t2);
		a[t2].push_back(t1);
	}
	num = f(1, -1);
	g(1, -1, num / 2, 1);
	g(n, -1, (num - 1) / 2, 2);
	g(1, -1, 100000000, 1);
	g(n, -1, 100000000, 2);
	for (i = 1; i <= n; i++) {
		if (d[i] == 1) s1++;
		else s2++;
	}
	if (s1 > s2) cout << "Fennec";
	else cout << "Snuke";
    return 0;
}


Measured memory_bytes: 12416
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>

using namespace std;

set<int> s;
vector<int> cards;
int n,k;

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


/*void solve(long long a, int cnt){
    if(cnt>=n)return a;
    r=(cards[cnt]/10)?100:10;
    s.insert(a*r+cards[cnt]);
    solve(a*r+cards[cnt], cnt+1);
    solve(a,cnt+1);
}*/


int main(void){
    // Here your code !
    while(cin>>n>>k,n||k){
        s.clear();cards.clear();
        rep(i,n){
            int t;
            cin>>t;
            cards.push_back(t);
        }
        sort(cards.begin(),cards.end());
        do{
            long long res=0;
            rep(i,k){
                int c=cards[i];
                long long r=c/10?100:10;
                res=res*r+c;
            }
            s.insert(res);
        }while(next_permutation(cards.begin(),cards.end()));
        /*for(auto i = s.begin(); i!=s.end(); i++)cout<<*i<<"\t";
        cout<<endl;*/
        cout<<s.size()<<endl;
    }
}


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

int main(void){
   int A,B,C,D;
   cin>>A>>B>>C>>D;
   int ans=min(B,D)-max(A,C);
   if(ans>0) cout<<ans<<endl;
   else cout<<0<<endl;
   return 0;
}



Measured memory_bytes: 3564
# abc161_c.py
# https://atcoder.jp/contests/abc161/tasks/abc161_c

# C - Replacing Integer /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 300点

# 問題文
# 青木君は任意の整数 xに対し、以下の操作を行うことができます。
# 操作: xを x と Kの差の絶対値で置き換える。
# 整数 Nの初期値が与えられます。この整数に上記の操作を 0 回以上好きな回数行った時にとりうる Nの最小値を求めてください。

# 制約
#     0≤N≤1018
#     1≤K≤1018
#     入力は全て整数

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N K

# 出力
# 操作を 0回以上好きな回数行った時にとりうる Nの最小値を出力せよ。

# 入力例 1
# 7 4

# 出力例 1
# 1

# 最初、 N=7です。
# 1回操作を行うと、N は |7−4|=3となります。
# 2回操作を行うと、N は |3−4|=1となり、これが最小です。

# 入力例 2
# 2 6

# 出力例 2
# 2

# 1回も操作を行わなかった場合の N=2が最小です。

# 入力例 3
# 1000000000000000000 1

# 出力例 3
# 0


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    # S = lines[0]
    # N = int(lines[0])
    N, K = list(map(int, lines[0].split()))
    # values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

    tmp = N % K
    result = min(tmp, K-tmp)

    return [result]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['7 4']
        lines_export = [1]
    if pattern == 2:
        lines_input = ['2 6']
        lines_export = [2]
    if pattern == 3:
        lines_input = ['1000000000000000000 1']
        lines_export = [0]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()


Measured memory_bytes: 9200
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
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; }

using ll = long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class BVotingJudges {
public:

    bool check(int x, ll n, ll m, ll v, ll p, const vector<ll>& a) {
      if (n-x <= p) {
        return true;
      }
      ll up = a[x] + m;
      v -= x+1;
      v -= p-1;
      ll mv = m*v;

      ll now = 0;
      for(int i=x+1; i<=n-p; i++) {
        if (a[i] > up) return false;
        now += up - a[i];
      }
      return (now >= mv);
    }

    void solve(istream& cin, ostream& cout) {
      SPEED;
      ll n, m, v, p;
      cin >> n >> m >> v >> p;
      vector<ll> a(n);
      rep(i, n) {
        cin >> a[i];
      }
      sort(all(a));
      auto b = a;

      int ng = -1;
      int ok = n-1;
      while(ng+1 < ok) {
        int med = (ok+ng)/2;

        if (check(med, n, m, v, p, a)) {
          ok = med;
        } else {
          ng = med;
        }
      }

      cout << n-ok << endl;

    }
};

signed main() {
  BVotingJudges solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

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

int main() {
	string s;
	int a = 0;
	cin >> s;
	for(int i = 0; i < 6;i++){
		if(s[i] == '0'){
			a++;
		}
	}
	cout << 6 - a << endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define EPS 0.0000000001
#define INF 1000000000
#define MOD 1000000007
typedef long long ll;

int main()
{
    int h,w;
    cin>>h>>w;
    char a[h][w];
    char b[h][w];
    char c[h][w];
    int memo=0;
    int cnt;
    for(int i=0;i<h;i++){
        cnt=0;
        for(int j=0;j<w;j++){
            cin>>a[i][j];
            if(a[i][j]=='.'){
                cnt++;
            }
        }
        if(cnt!=w){
            //memo++;
            for(int j=0;j<w;j++){
                b[memo][j]=a[i][j];
            }
            memo++;
        }
    }
    //memo++;
    int lll=0;
    for(int j=0;j<w;j++){
        cnt=0;
        int x=0;
        for(int i=0;i<memo;i++){
            if(b[i][j]=='.'){
                x++;
            }
        }
    
        if(x!=memo){
            //lll++;
            for(int i=0;i<memo;i++){
                c[i][lll]=b[i][j];
            }
            lll++;
        }
    }
    //lll++;
    for(int i=0;i<memo;i++){
        for(int j=0;j<lll;j++){
            cout<<c[i][j];
        }
        cout<<endl;
    }

}


Measured memory_bytes: 256
from collections import deque
N,M=map(int,input().split())

# 次に行こうと思えば行けるポイント
graph=[[]for _ in range(N+1)]
 
for _ in range(M):
    A,B=map(int,input().split())
    graph[A].append(B)
    graph[B].append(A)

# 探索済みリスト
dist=[-1]*(N+1)
dist[0]=0
dist[1]=0

# 候補探索キュー
D=deque()
D.append(1)
 
while D:
    V=D.popleft()
    for i in graph[V]:
        if dist[i]!=-1:
            continue
        dist[i]=V
        D.append(i)
 
print('Yes')
for j in dist[2:]:
    print(j)

Measured memory_bytes: 34772
n = int(input())
x = list(map(int, input().split()))
x = [0] + x + [0]

result = 0
for i in range(n+1):
    result += abs(x[i]-x[i+1])

for i in range(1, n+1):
    print(result-abs(x[i]-x[i-1])-abs(x[i]-x[i+1])+abs(x[i+1]-x[i-1]))

Measured memory_bytes: 14168
#include <bits/stdc++.h>
#define P pair<int, int>
#define PP pair<long long, P>
using namespace std;

int main()
{
    long long n, res = 0;
    cin >> n;
    vector<int> v(n);
    for( int i = 0; i < n; i++ )
        cin >> v[i];
    sort(v.begin(), v.end());
    priority_queue<PP> q;
    q.push(PP(v.back(), P(v.back(), v.back())));
    for( int i = n - 2; i >= 0; i-- ){
        PP mx = q.top();
        q.pop();
        res += mx.first;
        PP p1 = PP( v[i], P(v[i], mx.second.first) );
        PP p2 = PP( v[i] , P(v[i], mx.second.second  ));
        q.push(p1);
        q.push(p2);
    }
    cout << res << endl;
    return 0;
}

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

using namespace std;

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

const int MM = 1e9 + 7;
const double eps = 1e-8;
const int MAXN = 2e6 + 10;

int n, m;

void prework(){

}

void read(){

}

void solve(int casi){
//	cout << "Case #" << casi << ": ";
	ll A, B, C, D;
	cin >> n >> A >> B >> C >> D;
	n--;
	for (int i = 0; i <= n; i++){
		ll p = i, q = n - i;
		ll mx = A + p * D - q * C;
		ll mn = A + p * C - q * D;
		if (mn <= B && B <= mx){
			cout << "YES" << endl;
			return ;
		}
	}
	cout << "NO" << endl;
	return ;
}

void printans(){

}


int main(){
//	std::ios::sync_with_stdio(false);
	prework();
	int T = 1;
//	cin>>T;
	for(int i = 1; i <= T; i++){
		read();
		solve(i);
		printans();
	}
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define time_taken_start int begtime = clock();
#define time_taken_end int endtime = clock(); \
cerr << "\n\n" << "Time elapsed: " << \
(endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
return 0;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define inf 1000000000000000007
#define eps 0.0000000001
#define pi acosl(-1)
#define pii pair<int,int>
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vii vector<int>
#define vpl vector<pll>
#define vll vector<ll>
#define mseti multiset <ll>
#define msetd multiset <ll,greater<ll>>
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound 
#define stp fixed<<setprecision(20)
#define endl '\n'
ll ans;
void solve()
{
    ll n;
    cin>>n;
    set<ll> d;
    ans=1;
    set<ll> s;
    for(ll i=2;i<=sqrt(n);i++)
    {
    	if((n%i)==0)
    	{
    		ll x=i;
    		s.insert(i);
    		x=n/x;
    		s.insert(x);
    	}
    }
    for(auto i:s)
    {
    	ll x=i;
    	ll y=n;
    	while((y%x)==0)
    		y/=x;
    	if((y%x)==1)
    		ans++;
    }
    n--;
    s.clear();
    for(ll i=2;i<=sqrt(n);i++)
    {
    	if((n%i)==0)
    	{
    		ll x=i;
    		s.insert(i);
    		x=n/x;
    		s.insert(x);
    	}
    }
    if(n>1)
    	ans++;
    ans+=s.size();
    cout<<ans;
}
int main()
{
    FAST
    #ifdef ayk_16
    freopen("input.txt","rt",stdin);
    freopen("output.txt","wt",stdout);
    #endif
    ll t=1;
    //cin>>t;
    for(ll i=0;i<t;i++)
    {
        //cout<<"Case #"<<i+1<<": ";
        solve();
    }
}

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

int main() {
    int N,M;
    cin >> N >> M;
    
    vector<int> a(M);
    vector<int> b(M);
    
    for(int i=0 ; i<M ; i++){
        cin >> a.at(i) >> b.at(i) ;
    }
    cout <<endl;
    
    vector<int> count(N);
    
    for (int i=0; i<N ; i++) {
        for (int j=0; j<M ; j++) {
            if(a.at(j) == i+1 || b.at(j) == i+1){
                count.at(i)++;
            }
        }
        cout << count.at(i) <<endl;
    }
    
}

Measured memory_bytes: 256
a,b,c = gets.split.map(&:to_f)

puts a*b*Math.sin(c/180*3.14159265358979)/2
puts a+b+Math.sqrt(a**2+b**2-2*a*b*Math.cos(c/180*3.14159265358979))
puts b*Math.sin(c/180*3.14159265358979)

Measured memory_bytes: 8984
#include <iostream>

#define MAX 2000000
#define INFINITY 1000000000

int H;
int A[MAX+1];

int parent(int i) {
    return i / 2;
}

int left(int i) {
    return i * 2;
}

int right(int i) {
    return i * 2 + 1;
}

void maxHeapify(int i) {
    int l,r,largest;
    largest = i;
    l = left(i);
    r = right(i);
    if(l <= H && A[l] > A[largest]) largest = l;
    if(r <= H && A[r] > A[largest]) largest = r;

    if(largest != i) {
        std::swap(A[i], A[largest]);
        maxHeapify(largest);
    }
}


int heapExtractMax() {
    if(H < 1) {
        throw "heap underflow";
    }
    int max = A[1];
    A[1] = A[H--];
    maxHeapify(1);
    return max;
}

void heapIncreaseKey(int i, int key) {
    if (key < A[i]) {
        throw "invalid key";
    }
    A[i] = key;
    while(i > 1 && A[parent(i)] < A[i]) {
        std::swap(A[i], A[parent(i)]);
        i = parent(i);
    }
}

void insert(int key) {
    H++;
    A[H] = -INFINITY;
    heapIncreaseKey(H,key);
}

int main() {
    int n;
    std::string com;
    while(true) {
        std::cin >> com;
        if(com == "insert") {
            std::cin>>n;
            insert(n);
        }
        else if(com == "extract"){
            printf("%d\n", heapExtractMax());
        }else {
            break;
        }
    }
    return 0;
}


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

int main() {
  int a,b;
  string op;
  cin >> a >> op >> b;
 
  if(op=="+")
    cout << a+b << endl;
  else
    cout << a-b << endl;
}


Measured memory_bytes: 256
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
S = list(input())[:-1]
T = list(input())[:-1]
N = len(S)
ans = N
for i in range(N):
    if S[i] == T[i]:
        ans -= 1
print(ans)

Measured memory_bytes: 14996
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include <cctype>
#include<math.h>
#include <iomanip>  
#define loop(a) for(int i=0;i<a;++i)
#define floop(a,b) for(int b=0;b<a;++b)
using namespace std;
int main() {
	long long int n, k, s, x = 1000000000;
	cin >> n >> k >> s;
	if (s == x) {
		loop(n - k)cout << x-1 << ' ';
		loop(k)cout << s << ' ';
	}
	else {

		loop(n - k)cout << x << ' ';
		loop(k)cout << s << ' ';
	}
	cout << endl;
	//cin >> n;

}


Measured memory_bytes: 1280
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

import GHC.Exts

readInt = readLn :: IO Int
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readNInts = readInt >>= flip replicateM readInt

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	n <- readInt
	( etss, limits ) <- unzip . sortWith snd . map mp <$> replicateM n readInts
	let
		elapsed = scanl1 (+) etss
	putStrLn $ which "Yes" "No" $ and $ zipWith (<=) elapsed limits

Measured memory_bytes: 96636
import java.util.*;

class Main{
	static Scanner s=new Scanner(System.in);
	static int gInt(){
		return Integer.parseInt(s.next());
	}
	public static void main(String[] A){
		int a=gInt();
		long r=1;
		for(int i=2;i<a;++i){
			long v=i*i;
			if(v<=a){
				while(v*i<=a)
					v*=i;
				r=Math.max(r,v);
			}
		}
		System.out.println(r);
	}
}


Measured memory_bytes: 23764
n,m=map(int,input().split())
h=list(map(int,input().split()))

goods=[True]*n

for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    if(h[a]>=h[b]):
        goods[b]=False
    if(h[a]<=h[b]):
        goods[a]=False


ans=0

for i in range(n):
    if(goods[i]):
        ans+=1

print(ans)

Measured memory_bytes: 20112
import java.util.*;
public class Main {
 
         
        public static void main(String[] args) throws java.io.IOException{
            Scanner scan = new Scanner(System.in);
            	int a =Math.min(scan.nextInt(), scan.nextInt());
            	a = Math.min(scan.nextInt(), a);
            	int b =Math.min(scan.nextInt(),scan.nextInt());
            	System.out.println(a+b-50);
        }
}

Measured memory_bytes: 12000
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<assert.h>
#include<algorithm>
//#include<iostream>
using namespace std;

int n,a[13];
int main()
{
	scanf("%d",&n);
	int ans=1;
	for (int i=1;i<=n;i++) scanf("%d",&a[i]),ans*=3;
	int tmp=1;
	for (int i=1;i<=n;i++) if (!(a[i]&1)) tmp*=2;
	printf("%d\n",ans-tmp);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end()) // ちゃんとユニークな配列にする。連続した値を除去して切り出す。
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

int main() {
  int X, Y, Z;
  cin >> X >> Y >> Z;
  int result = (X - Z) / (Y + Z);
  cout << result << endl;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author toshibablack
 */

#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <fstream>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define ll long long int
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n) for(int i=0;i<n;++i)
#define FOREACH(x, a) for(auto& (x) : (a))
#define ALL(a) (a).begin(),(a).end()
#define OUT(x) out << (x) << endl;
#define M0(x) memset(x,0,sizeof(x))
#define MINF(x) memset(x,0x3f,sizeof(x))
#define MMINUS(a) memset(a,0xff,sizeof(a))
#define ten(n) ((int)1e##n)

const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double EPS = 1.0/LINF;
const char ENDL = '\n'; // for JetBrains IDE only supports yen

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

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

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

using namespace std;

class CPrison {
public:
    int N, M;
    int L[100000], R[100000];

    void solve(std::istream& in, std::ostream& out) {
        in >> N >> M;
        REP(i, M) in >> L[i] >> R[i];
        sort(L, L+M, greater<>());
        sort(R, R+M);
        int lmax = L[0];
        int rmin = R[0];
        OUT(max(rmin - lmax + 1, 0));
    }
};


int main() {
    CPrison solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 1024
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<usize>();
    let a = read::<usize>();
    let b = read::<usize>();
    println!("{}", std::cmp::min(n * a, b));
}


Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
#include<string>
#include<map>

#define req(i,n) for(i=0; i<(n); i++)
using namespace std;

int main()
{
	int i,n,m,tmp,max=0;
	map<string,int> count;
	string str;

	cin >> n;
	req(i,n){
		cin >> str;
		count[str]++;
	}

	cin >> m;
	req(i,m){
		cin >> str;
		count[str]--;
	}

	for(auto i = count.begin(); i != count.end(); i++){
		tmp = i->second;
		if(max < tmp)
			max = tmp;
	}
	cout << max << endl;
	
		

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

int main(void)
{
  int x[5],y[5];
  int check,a,b,xx,yy;
  cin>>x[0]>>y[0]>>x[1]>>y[1];
  xx=x[1]-x[0];
  yy=y[1]-y[0];
  if(xx!=0&&yy!=0){
    if(xx>0&&yy>0){
      check=0;a=xx;b=yy;
    }else if(xx<0&&yy>0){
      check=1;a=yy;b=-xx;
    }else if(xx<0&&yy<0){
      check=2;a=-xx;b=-yy;
    }else if(xx>0&&yy<0){
      check=3;a=-yy;b=xx;
    }
  }else{
    if(xx>0&&yy==0){
      check=0;a=xx;b=yy;
    }else if(xx==0&&yy>0){
      check=1;a=yy;b=-xx;
    }else if(xx<0&&yy==0){
      check=2;a=-xx;b=-yy;
    }else if(xx==0&&yy<0){
      check=3;a=-yy;b=xx;
    }
  }
  for(int i=0;i<2;i++){
    check=(check+1)%4;
    if(check==0){
      x[1]+=a;y[1]+=b;
    }else if(check==1){
      x[1]-=b;y[1]+=a;
    }else if(check==2){
      x[1]-=a;y[1]-=b;
    }else if(check==3){
      x[1]+=b;y[1]-=a;
    }
    x[2+i]=x[1];y[2+i]=y[1];
  }
  cout<<x[2]<<" "<<y[2]<<" "<<x[3]<<" "<<y[3]<<endl;
  return 0;
}


Measured memory_bytes: 384
H, W, K = map(int, input().split())
C = [input() for _ in range(H)]

ans = 0
for h in range(2**H):
  for w in range(2**W):
    black = 0
    for i in range(H):
      for j in range(W):
        if ((h >> i) & 1 == 0) and ((w >> j) & 1 == 0) and C[i][j] == '#': black += 1
    
    if black == K:
      ans += 1

print(ans)

Measured memory_bytes: 9052
#include<bits/stdc++.h>
#define mod 1000000007
#define mod1 998244353
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long int li;
typedef unsigned long long int ull;
using namespace std;
bool sortbysec(const pair<li,li>&a,const pair<li,li>&b)
{
    return (a.second<b.second);
}
int main()
{
fast_io
li n,m;
cin>>n>>m;
li a[n],s=0,i;
for(i=0;i<n;i++)
{
  cin>>a[i];
  s+=a[i];
}
double x=(s*1.0)/(4.0*m);
sort(a,a+n,greater<li>());
i=0;
while(m--)
{
  if(a[i]<x)
  {
    cout<<"No";
    return 0;
  }
  i++;
}
cout<<"Yes";
  return 0;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  REP(i, M) {
    int A;
    cin >> A;
    N -= A;
  }
  cout << max(N, -1) << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int,int> P;

int main() {
    ll N;cin >> N;
    ll A[N] = {};
    for (int i = 0;i < N;i++){
        cin >> A[i];
    }
    ll R[N] = {};
    R[0] = A[0];
    for (int i = 1;i < N;i++){
        if (i % 2 == 0) R[0] += A[i];
        else R[0] -= A[i];
    }
    for (int i = 1;i < N;i++){
        R[i] = (A[i - 1] * 2) - R[i - 1];
    }
    for (int i = 0;i < N;i++){
        cout << R[i] << " ";
        if (i == N - 1) cout << endl;
    }
}

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

int main() {
    long long c = 0, t = 0;
    string S;
    cin >> S;
    for(int i = 0; i < S.size(); i++) {
        if(S.at(i) == 'W') {
            t += c;
        } else {
            c++;
        }
    }

    cout << t << endl;
}

Measured memory_bytes: 640
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1000000000100000000;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); 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; }


int main(){
    int n; cin >> n;
    vector<ll> A(n); ll sum = 0;
    rep(i, n){
        cin >> A[i];
        sum += A[i];
    }
    ll snuke = A[0], arai = sum - A[0], res = abs(snuke - arai);
    rept(i, 1, n-1){
        snuke += A[i];
        arai -= A[i];
        chmin(res, abs(snuke - arai));
    }
    cout << res << ln;
}

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

/*
vector.push_back()
vector<int> hoge(3,-1); {-1,-1,-1}
vector<vector<int>> hogehoge(2,vector<int>(2,-1)); {{-1,-1},{-1,-1}} 
cin >>temp;
scanf("%d %d %d",&A,&B,&Q);
sort(a.begin(),a.end());
a.push_back(4000000000000);
a.insert(a.begin(),-1000000000000);
upper_bound(a.begin(),a.end(),x); // list[i] > x のイテレータ取得. *itrで数値化 
*/
template <typename T> void debug(T arr);
template <typename T> void debug (T arr, int dim);



int main(void){
    std::cout<<std::fixed<<std::setprecision(10);
    int h,w;
    cin >> h >> w;
    vector<vector<int>> ans(h+2,vector<int>(w+2,0));
    set<string> boms;
    for (int i = 0; i < h; ++i){
        string raw;
        cin >> raw;
        for (int j = 0; j < w; ++ j){
            auto c = raw[j];
            if (c == '#'){
                boms.insert(to_string(i)+","+to_string(j));
                ans[i+2][j] += 1;
                ans[i+2][j+1] += 1;
                ans[i+2][j+2] += 1;
                ans[i+1][j] += 1;
                ans[i+1][j+2] += 1;
                ans[i][j] += 1;
                ans[i][j+1] += 1;
                ans[i][j+2] += 1;
            }
        }
    }
    for (int i = 0; i <h ; ++ i){
        for (int j = 0; j < w; ++ j){
            if (boms.count(to_string(i)+","+to_string(j)) == 0){
                cout << ans[i+1][j+1];
            }else{
                cout << "#";
            }
        }
        cout << endl;
    }
};


template <typename T> void debug(T arr){
    for (auto col:arr){
        cout << col << " ";
    }
    cout <<endl;
};

template <typename T> void debug (T arr, int dim){
    for (auto raw:arr){
        for(auto col:raw){
            cout << col << " ";
        }
        cout << endl;
    }
};

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll ans=INF;
int main() {
	ll n;
	cin>>n;
	for(ll i=1;i<=sqrt(n);i++){
		if(n%i==0){
			ll a=0,b=0,now=i,next=n/i;
			
			while(now!=0){
				a++;
				now/=10;
			}
			while(next!=0){
				b++;
				next/=10;
			}
			ans=min(ans,max(a,b));
		}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
def isleap(a):return a%4==0 and a%100 or a%400==0
f=0
while 1:
    a,b=map(int,input().split())
    if not a: break
    if f:print()
    f,c=1,1
    for i in range(a,b+1):
        if isleap(i):
            print(i)
            c=0
    if c:print('NA')   

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

using namespace std;

int32_t main()
{
  int n, l; cin >> n >> l;
  string s[n];
  for (int i=0; i<n; i++)
  {
    cin >> s[i];
  }
  for (int i=0; i<n; i++)
  {
    for (int j=i+1; j<n; j++)
    {
      if (s[i]+s[j]>s[j]+s[i]) swap(s[i], s[j]);
    }
  }
  for (int i=0; i<n; i++) cout << s[i];
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	static boolean dp[]=new boolean[100005];
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int k=sc.nextInt();
		int[] arr=new int[n];
		for(int i=0;i<n;i++){
			arr[i]=sc.nextInt();
		}
		for(int i=0;i<k+1;i++){
			for(int j=0;j<n;j++){
				if(i>=arr[j]){
					if(dp[i-arr[j]]==false){
						dp[i]=true;
					}
				}
			}
		}
		if(dp[k]==true){
			System.out.println("First");
		}
		else{
			System.out.println("Second");
		}
	}
}


Measured memory_bytes: 36040
#include <iostream>
using namespace std;
int main(){
  string s;
  cin >> s;
  long long zero = 0;
  long long sm = 0;
  for(int i = 0; s.size() > i;i++){
    if(s[i] == 'B')zero++;
    else sm+=zero;
  }
  cout << sm << endl;
}






Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<double> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<VS> VSS;  
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;  //ll とdoubleは違う
// cout << << endl;
// cin >> ;
int main(){
    ll a,b,c=0,k=1,s=0,n,w,m,min=100000000000,ans=1,max=0;
    string s1,s2;
    cin >> n >> m;
    VI o(n);
    rep(i,m){
        cin >> a >> b;
        o[a-1]++;
        o[b-1]++;
    }
    rep(i,n)
        cout << o[i]<< endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <map>
#include <numeric>
#include <algorithm>
#include <iomanip>
#include <stdio.h>

int main(void){
  int k;
  std::cin >> k;
  std::vector<int> out = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  std::cout << out.at(k-1);
  return 0;
}

Measured memory_bytes: 3584
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;


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

	cin >> N;
	vector<long long int>v(N);
	for (int i = 0; i < N; i++) {
		cin >> v[i];
	}
	sort(v.begin(), v.end());
	M = v[0];
	for (int i = 0; i < N; i++) {
		if (v.back() % 2) {
			if (M <= v.back() / 2 + 1) {
				K = v.back() / 2 + 1 - M;
			}
			else {
				K = M - v.back() / 2;
			}
			if (v[i] <= v.back() / 2 + 1) {
				L = v.back() / 2 + 1 - v[i];
			}
			else {
				L = v[i] - v.back() / 2;
			}
		}
		else {
			K = max(v.back() / 2 - M, M - v.back() / 2);
			L = max(v.back() / 2 - v[i], v[i] - v.back() / 2);
		}
		if (K > L) {
			M = v[i];
		}
	}
	cout << v.back() << " " << M << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#define N 100000
int n,cnt=0;
int linearSearch(int*,int);
int main(){
  int i,m,S[N],T[N];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&m);
   for(i=0;i<m;i++){
    scanf("%d",&T[i]);
  }
  for(i=0;i<m;i++){
    linearSearch(S,T[i]);
  }
    printf("%d\n",cnt);
  return 0;
}
int linearSearch(int *A,int key){
  int i=0;
  while(A[i]!=key){
    i++;
    if(i==n)return 0;
  }
  cnt++;
    return i;
  }



Measured memory_bytes: 2048
#include<stdio.h>
#include<string.h>

char X[1001], Y[1001];
 
int LCS(void){
  int j,i=0, n=0, m=0, c[1001][1001];
 
  m = strlen(X);
  n = strlen(Y);

  //printf("%d ",m);
  
  for(i=1 ; i<=m ; i++)c[i][0] = 0;
  for(j=0 ; j<=n ; j++)c[0][j] = 0;

  
  for(i=1 ; i<=m ; i++){
    for(j=1 ; j<=n ; j++){
      if(X[i-1] == Y[j-1]){
	//printf("%d,%d",i,j);
	c[i][j] = c[i-1][j-1] + 1;
      }
      else if(c[i-1][j] >= c[i][j-1])c[i][j] = c[i-1][j];
      else c[i][j] = c[i][j-1];
    }
  }

  return c[m][n];
}

int main(){
  int q, i, j;
  
  scanf("%d",&q);
  for(i=0 ; i<q ; i++){
  scanf("%s",X);
  scanf("%s",Y);

  j = LCS();
  
  printf("%d\n",j);
  }
  
    
   
  
  
  return 0;
}





Measured memory_bytes: 5604
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <cstdio>
#include <climits>
#include <cmath>
#include <array>
#include <functional>
#include <sstream>
#include <list>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const double eps=1e-9;
const int inf=1e9;
typedef pair<int,int> P;
typedef pair<double,int> Pdi;
int dx[3]={-1,0,1};
int dy[3]={-1,0,1};
int dz[3]={-1,0,1};
int main(int argc,char const* argv[])
{
  int n,m,p;
  while(1)
    {
      cin >> n >> m >> p;
      if(!n) break;
      int board[n+5][n+5][n+5];
      int num[n+5][n+5];
      memset(board,-1,sizeof(board));
      memset(num,0,sizeof(num));
      string winner="";
      int hand=0;
      for(int i=0;i<p;i++)
	{
	  int x,y;
	  cin >> x >> y;
	  x--,y--;
	  if(i%2==0)
	    {
	      board[x][y][num[x][y]]=0;
	      num[x][y]++;
	    }
	  else
	    {
	      board[x][y][num[x][y]]=1;
	      num[x][y]++;
	    }
	  int z=num[x][y]-1;
	  for(int j=0;j<3;j++)
	    {
	      for(int k=0;k<3;k++)
		{
		  for(int l=0;l<3;l++)
		    {
		      if(dx[j]==0 && dx[k]==0 && dz[l]==0) continue;
		      int len=1;
		      int sgn=1;
		      for(int o=0;o<2;o++)
			{
			  int nx=x,ny=y,nz=z;
			  while(1)
			    {
			       nx+=(sgn*dx[j]),ny+=(sgn*dy[k]),nz+=(sgn*dz[l]);
			       if(nx<0 || n<=nx || ny<0 || n<=ny || nz<0 || n<=nz) break;
			       if(board[x][y][z]==board[nx][ny][nz]) len++;
			       else break;
			    }
			  if(len>=m)
			    {
			      if(i%2==0 && winner.size()==0)
				{
				  hand=i+1;
				  winner="Black";
				}
			      else if(i%2==1 && winner.size()==0)
				{
				  hand=i+1;
				  winner="White";
				}
			    }
			  sgn*=(-1);
			}
		      if(len>=m)
			{
			  if(i%2==0 && winner.size()==0)
			    {
			      hand=i+1;
			      winner="Black";
			    }
			  else if(i%2==1 && winner.size()==0)
			    {
			      hand=i+1;
			      winner="White";
			    }
			}
		    }
		}
	    }	    
	}
      if(winner.size()!=0)
	{
	  cout << winner << ' ' << hand << endl;
	}
      else
	{
	  cout << "Draw" << endl;
	}
    }
  return 0;
}
      



Measured memory_bytes: 3012
#include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<math.h>
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>(b);i--)
using namespace std;

int main(void) {
	int n;
	int* a;
	int t;
	int check;
	int count[100002] = {};
	cin >> n;
	a = new int[n + 1];
	FOR(i, 1, n + 1) {
		cin >> a[i];
	}
	
	FOR(i, 1, n + 1) {
		count[a[i]]++;
		count[a[i] + 1]++;
		count[a[i] + 2]++;
	}
	check = count[0];
	FOR(i, 1, 100002) {
		if (count[i] == 0) {
			continue;
		}
		if (check < count[i]) {
			check = count[i];
			t = i;
		}
	}
	cout << count[t] << endl;
	delete[] a;
	return 0;
}

Measured memory_bytes: 1024
#define pb push_back
#define ff first
#define ss second
#define ll long long
#define maxn 100005
#define mod 1000000007
#include <bits/stdc++.h>
using namespace std;
 
 
 
int main() {
    int n;
    cin >> n;
    if(n%10 == 7){
        cout << "Yes" << endl;
        return 0;
    }
    n /= 10;
    if(n%10 == 7){
        cout << "Yes" << endl;
        return 0;
    }
    n /= 10;
    if(n%10 == 7){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
 
    return 0;
}


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

int cmp(const void *a,const void *b){
    if(*(int*)a>*(int*)b){return -1;}
    else if(*(int*)a<*(int*)b){return 1;}
    else {return 0;}
}





int main(void){
int n,k;
static int h[200005];
long long int time=0;

scanf("%d %d",&n,&k);

for(int i=0;i<n;i++){
    scanf("%d",&h[i]);
}

qsort(h,n,sizeof(int),cmp);

for(int i=0;i<n;i++){

    if(k>0){h[i]=0;k--;}
    else{break;}
}

for(int i=0;i<n;i++){

    if(h[i]!=0){time=time+h[i];h[i]=0;}
    else{}
}
printf("%lld",time);

return 0;

}


Measured memory_bytes: 1788
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <math.h>

#define N_MAX (100)
#define P_MAX (100)
#define DP_ARRAY_SIZE (N_MAX * P_MAX / 32 + 1)

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_sz_desc(const void* a, const void* b) {
    return *((size_t*)a) > * ((size_t*)b) ? -1 : 1;
}

int compare_f(const void* a, const void* b) {
    return *((int64_t*)a) < *((int64_t*)b) ? -1 : 1;
}

int compare_f2(const void* a, const void* b) {
    return *((uint64_t*)a) > * ((uint64_t*)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
    size_t result = 1;

    for (size_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static uint64_t combU64(const uint64_t n, const uint64_t r) {
    uint64_t result = 1;

    for (uint64_t i = 0; i < r; i++) {
        result *= n - i;
        result /= i + 1;
    }

    return result;
}

static uint64_t gcdU64(uint64_t m, uint64_t n)
{
    uint64_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

static size_t gcdZu(size_t m, size_t n) {
    size_t temp;

    while (m % n != 0) {
        temp = n;
        n = m % n;
        m = temp;
    }

    return n;
}

int main(void) {
    size_t A, P;

    scanf("%zu %zu", &A, &P);

    printf("%zu\n", (3*A+P)/2);

    return 0;
}


Measured memory_bytes: 128