akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <cassert>
#include <sstream>
using namespace std;
typedef pair<int, int> Pii;
#define double long double
int T;
int goal[4][4];
string team_name[4];
double f[9];
double prob[9];

struct result {
	int point, goal_diff, goal_score, id;
};
int comp(const result& r1, const result& r2) {
	if(r1.point != r2.point) return r1.point - r2.point;
	if(r1.goal_diff != r2.goal_diff) return r1.goal_diff - r2.goal_diff;
	if(r1.goal_score != r2.goal_score) return r1.goal_score - r2.goal_score;
	return 0;
}

double win(int T) {
	vector<result> res(4, result{ 0, 0, 0, 0 });
	vector<int> w, l;

	int bit = 15;
	while(1) {
		res.assign(4, result{ 0, 0, 0, 0 });
		for(int i = 0; i < 4; i++) {
			res[i].id = i;
			if(((bit >> i) & 1) == 0) continue;
			for(int j = 0; j < 4; j++) {
				if(i == j) continue;
				if(((bit >> j) & 1) == 0) continue;
				if(goal[i][j] > goal[j][i]) res[i].point += 3;
				else if(goal[i][j] == goal[j][i]) res[i].point += 1;
				res[i].goal_diff += goal[i][j] - goal[j][i];
				res[i].goal_score += goal[i][j];
			}
		}

		int nbit = 0;
		for(int i = 0; i < 4; i++) {
			if(bit >> i & 1) {
				int c = comp(res[T], res[i]);
				if(c > 0) w.push_back(i);
				if(c < 0) l.push_back(i);
				if(c == 0) nbit |= 1 << i;
			}
		}
		if(w.size() >= 2) return 1;
		if(l.size() >= 2) return 0;
		if(nbit == bit) break;
		bit = nbit;
	}

	int m = 2 - l.size();
	int n = 0;
	for(int i = 0; i < 4; i++) {
		if(bit >> i & 1) n++;
	}
	return (double)m / n;
}

void solve() {
	string s;
	getline(cin, s);
	replace(s.begin(), s.end(), '_', ' ');
	stringstream ss(s);
	for(int i = 0; i < 4; i++) {
		ss >> team_name[i];
		if(team_name[i][0] == '*') T = i;
	}

	vector<Pii> match;
	for(int i = 0; i < 4; i++) {
		string t;
		getline(cin, s);
		replace(s.begin(), s.end(), '_', ' ');
		ss = stringstream(s);
		ss >> t;
		for(int j = i + 1; j < 4; j++) {
			ss >> t;
			if(t == "-") {
				goal[i][j] = goal[j][i] = -1;
				match.push_back(Pii(i, j));
			}
			else {
				goal[i][j] = t[0] - '0';
				goal[j][i] = t[2] - '0';
			}
		}
	}
	assert(match.size() == 2);

	double ans = 0;
	for(int m1i = 0; m1i <= 8; m1i++) {
		for(int m1j = 0; m1j <= 8; m1j++) {
			for(int m2i = 0; m2i <= 8; m2i++) {
				for(int m2j = 0; m2j <= 8; m2j++) {
					double p = prob[m1i] * prob[m1j] * prob[m2i] * prob[m2j];
					goal[match[0].first][match[0].second] = m1i;
					goal[match[0].second][match[0].first] = m1j;
					goal[match[1].first][match[1].second] = m2i;
					goal[match[1].second][match[1].first] = m2j;
					ans += win(T) * p;
				}
			}
		}
	}

	cout << fixed << setprecision(7) << ans << endl;
}

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

	f[0] = 1;
	for(int i = 1; i <= 8; i++) {
		f[i] = f[i - 1] * i;
	}
	for(int p = 0; p <= 8; p++) {
		prob[p] = f[8] / f[p] / f[8 - p] * pow(0.25, p) * pow(0.75, 8 - p);
	}

	int N;
	cin >> N;
	cin.ignore();
	while(N--) {
		solve();
	}
}

Measured memory_bytes: 3412
package main

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

func main() {
	sc := NewScanner()
	N := sc.NextInt()
	DAY := 86400
	time := make([]int, DAY + 1)
	current := 0
	for i := 0; i < N; i++ {
		A := sc.NextInt()
		current += A
		current %= DAY
		B := sc.NextInt()
		time[current] += 1
		//time[(current + B + 1) % DAY] -= 1

		current += B
		current %= DAY

	}

	mx := 0

	sm := 0
	DIF := 10800
	for i := 0; i <= DIF; i++ {
		sm += time[i]
	}
	mx = max(sm, mx)
	for i := 1; i < DAY; i++ {
		sm -= time[i - 1]
		sm += time[(i + DIF) % DAY]
		mx = max(sm, mx)

	}
	fmt.Println(mx)

}

func max(a int, b int) int {
	if a < b {
		return b
	}
	return a
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r:rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}




Measured memory_bytes: 4096
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

class Main {

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

    void compute() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int W = sc.nextInt();
        Map<Integer, ArrayList<Integer>> itemMap = new HashMap<>();
        int w0 = sc.nextInt();
        for (int i = 0; i < 4; i++) {
            itemMap.put(w0 + i, new ArrayList<>());
        }
        itemMap.get(w0).add(sc.nextInt());
        for (int i = 1; i < N; i++) {
            itemMap.get(sc.nextInt()).add(sc.nextInt());
        }
        for (int i = 0; i < 4; i++) {
            Collections.sort(itemMap.get(w0 + i), (o1, o2) -> o2 - o1);
            itemMap.get(w0 + i).add(0, 0);
        }
        int max = 0;

        long wSum0 = 0;
        int vSum0 = 0;
        for (int i = 0; i < itemMap.get(w0).size(); i++) {
            vSum0 += itemMap.get(w0).get(i);
            long wSum1 = 0;
            int vSum1 = 0;
            for (int j = 0; j < itemMap.get(w0 + 1).size(); j++) {
                vSum1 += itemMap.get(w0 + 1).get(j);
                long wSum2 = 0;
                int vSum2 = 0;
                for (int k = 0; k < itemMap.get(w0 + 2).size(); k++) {
                    vSum2 += itemMap.get(w0 + 2).get(k);
                    long wSum3 = 0;
                    int vSum3 = 0;
                    for (int l = 0; l < itemMap.get(w0 + 3).size(); l++) {
                        vSum3 += itemMap.get(w0 + 3).get(l);
                        if (wSum0 + wSum1 + wSum2 + wSum3 <= W) {
                            max = Math.max(max, vSum0 + vSum1 + vSum2 + vSum3);
                        }
                        wSum3 += w0 + 3;
                    }
                    wSum2 += w0 + 2;
                }
                wSum1 += w0 + 1;
            }
            wSum0 += w0;
        }
        System.out.println(max);
    }
}


Measured memory_bytes: 39776
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;
 
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()


int main(){
  int n;cin>>n;
  int a[n];rep(i,n)cin>>a[i];
  int b[n];rep(i,n-1)b[i]=a[i+1]-a[i];
  b[n-1]=a[0]-a[n-1];
  ll sum=0;
  rep(i,n)sum+=a[i];
  if(sum%(1ll*n*(n+1)/2)!=0){
    cout<<"NO"<<endl;exit(0);
  }
  int ctr=sum/(1ll*n*(n+1)/2);
  rep(i,n)b[i]-=ctr;
  rep(i,n){
    if(b[i]<=0&&(-b[i])%n==0)continue;
    else{
      cout<<"NO"<<endl;exit(0);
    }
  }
  cout<<"YES"<<endl;
}
  

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
int a[1001][1001], h, w;
char in[1001][1001];
long long dp[1001][1001];

int main() {
	scanf("%d%d",&h,&w);
	for (int i = 1; i <= h; i++) scanf("%s", in[i]+1);
	memset(dp, 0, sizeof dp);
	dp[1][1] = 1;
	for (int i = 2; i <= w; i++) if (in[1][i] == '.') dp[1][i] = (dp[1][i] + dp[1][i-1])%mod;
	for (int i = 2; i <= h; i++) {
		for (int j = 1; j <= w; j++) {
			if (in[i][j] == '.') {
				if (in[i-1][j] == '.') dp[i][j] = (dp[i-1][j] + dp[i][j])%mod;
				if (in[i][j-1] == '.') dp[i][j] = (dp[i][j-1] + dp[i][j])%mod;
			}
		}
	}
	printf("%lld\n",dp[h][w]);
	return 0;
}

Measured memory_bytes: 10496
//B - Aが奇数のとき, 距離を偶数にするために, 卓1にA君が行くか, 卓NにB君が行くかすればよい。
//1回調整したら、距離が1減って偶数の場合に帰着できるので、はい。
#include <iostream>
#include <algorithm>
#define int long long
using namespace std;

int n, a, b;

signed main() {
	cin >> n >> a >> b;
	if ((b - a) % 2 == 0) { cout << (b - a) / 2 << endl; }
	else { cout << min(a, n + 1 - b) + (b - a - 1) / 2 << endl; }
	return 0;
}

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

int main() {
  int a,b;
  cin >> a >> b;
  int x1 = a/0.08;
  int x2 = b/0.1;

  for(int i = min(x1,x2); i <= max(x1,x2)+1; i++) {
    if (floor(i * 0.08) == a && floor(i*0.1) == b) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int n,a=0,b=0;
cin>>n;
int num[n];
for(int i=0;i<n;i++)
cin>>num[i];
sort(num,num+n);
for(int i=0;i<n;i++){
if((i+1)%2==0)
b+=num[i];
else
a+=num[i];
}
cout<<abs(a-b);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define res register int
#define ll long long
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define INF 1000000007
#define gc getchar()
#define MAXN 10000005
#define lc pos<<1
#define rc pos<<1|1
using namespace std;

inline int read()
{
    int ch=gc,f=0;
    int x=0;
    while(ch<'0'||ch>'9')
    {
        f|=ch=='-';
        ch=gc;
    }
    while(ch>='0'&&ch<='9')
    {
        x=x*10+ch-'0';
        ch=gc;
    }
    return f?-x:x;
}
const int kcz=INF;
int n,m;
int k;
int f[2005][2005];
int js[4000005],inv[4000005];
inline int power(int a,int p)
{
	int ret=1;
	while(p)
	{
		if(p&1)
		ret=1ll*ret*a%kcz;
		a=1ll*a*a%kcz;
		p>>=1;
	}
	return ret;
}
inline void init(int n)
{
	js[0]=inv[0]=1;
	for(int i=1;i<=n;i++)
	js[i]=i*1ll*js[i-1]%kcz;
	inv[n]=power(js[n],kcz-2);
	for(int i=n-1;i;i--)
	inv[i]=(i+1)*1ll*inv[i+1]%kcz;
}
inline int C(int n,int m)
{
	return js[n]*1ll*inv[m]%kcz*inv[n-m]%kcz;
}
int main()
{
	n=read(),m=read();
	f[n][n]=1;
	init(4000000);
	if(m==1)
	{
		puts("1");
		return 0;
	}
	for(int i=n-1;~i;i--)
	{
		for(int j=n;j>=i;j--)
		{
			f[i][j]=(f[i+1][j]+f[i][j+1]*1ll*(j+1)%kcz*C(i+(j+1)*(m-1)-1,m-2)%kcz)%kcz;
		}
	}
	printf("%d\n",f[0][0]);
	return 0;
}

Measured memory_bytes: 46336
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define inf  1000000000
#define mod  1e9+1
#pragma GCC optimization ("O3")
using namespace std;
const long long int N = 6999999;
#define all(x) begin(x),end(x)
int main()
{
 
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n,d,c=0;
  cin >> n >> d;
  vector <vector<int>> v(n,vector<int>(d));
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < d; ++j)
      cin >> v[i][j];
  for (int i = 0; i < n; ++i)
  {
    for (int j = i+1; j < n; ++j)
    {
      int s = 0;
      for (int k = 0; k < d; ++k)
          s += (v[i][k]-v[j][k])*(v[i][k]-v[j][k]);
        if((int)sqrt(s)*(int)sqrt(s) == s)
          c++;
      
    }
  }
  cout <<  c;
  return 0;
} 


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define N 8
#define FREE 0
#define NOT_FREE 1

int row[N],col[N],dpos[N*3],dneg[N*3]; //すべてFREEの状態
int row2[N];

int putQueen(int );
void printBord(void );

int main(){
  int i,j;
  int k,r,c;

  scanf("%d",&k);

  for(i=0;i<N;i++) row2[i] = -1;
  for(i=0;i<k;i++){
    scanf("%d%d" ,&r ,&c );
  row[r]  = c;
  col[c] = NOT_FREE;
  dpos[r+c] = NOT_FREE;
  dneg[r-c+N-1] = NOT_FREE;
  row2[r] = c;
  }

  putQueen(0);
  //printBord();
  
  return 0;
}

int putQueen(int i){

  int j;
  // printBord();
  // printf("\n");
  if( i == N ){
    printBord();
    return 0;
    //exit(3);
  }




    if(row2[i] != -1 ){
      putQueen(i+1);
      return 0;     
    }
  
  for(j=0;j<=N-1;j++){
    // printf("i=%d j=%d, row2[%d] = %d\n", i, j, i, row2[i]);
    //	printf("%d %d %d\n", col[j], dpos[i+j], dneg[i-j+N-1]);
    if(col[j] == NOT_FREE || dpos[i+j] == NOT_FREE || dneg[i-j+N-1] == NOT_FREE){
      continue;
    }





    

    /*
    if(row2[i] == 1 ){
      if(putQueen(i+1))return 1;
      return 2;
    }
    */

    
    //put a queen at(i,j)
    row[i] = j;
    col[j] = dpos[i+j] = dneg[i-j+N-1] = NOT_FREE;

    //try the next row 
    putQueen(i+1);
    
    //remove the queen at (i,j) for backtracking
    col[j] = dpos[i+j] = dneg[i-j+N-1] = FREE;
  }  

  return 0;
}

void printBord(){

  //チェス板を出力
  int i,j;
  for(i=0;i<N;i++){
    for(j=0;j<N;j++){
      if(j == row[i])printf("Q");
      else printf(".");
    }
    printf("\n");
  }

}




Measured memory_bytes: 2112
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		
		if(n==1) {
			System.out.println("Hello World");
			return;
		}
		else {
			System.out.println(scanner.nextInt()+scanner.nextInt());
		}
	}
}


Measured memory_bytes: 23764
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>

using namespace std;

using P = pair<int, int>;

#define INF 1145141919810

struct edge {
    int to, cost;
};

vector<edge> G[100010];
long long d[100010];

int main() {
    int v, e, r;
    scanf("%d", &v);
    scanf("%d", &e);
    scanf("%d", &r);
    for (int i = 0; i < e; i++) {
        int s, t, d;
        scanf("%d", &s);
        scanf("%d", &t);
        scanf("%d", &d);
        edge e;
        e.to = t;
        e.cost = d;
        G[s].push_back(e);
    }
    fill(d, d + v, INF);
    d[r] = 0;

    priority_queue<P, vector<P>, greater<P>> q;

    q.push(P(0, r));

    while (!q.empty()) {
        P p = q.top();
        q.pop();
        int v = p.second;
        if (d[v] < p.first) { continue; }
        for (int i = 0, size = G[v].size(); i < size; i++) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                q.push(P(d[e.to], e.to));
            }
        }
    }

    for (int i = 0; i < v; i++) {
        if (d[i] == INF) {
            printf("INF\n");
        } else {
            printf("%lld\n", d[i]);
        }
    }
}

Measured memory_bytes: 12916
#include <algorithm>
#include <iostream>

int main(int argc, char *argv[]) {
  int n;
  std::cin >> n;
  long a[100001];
  for (int i = 0; i < n; ++i)
    std::cin >> a[i];
  int q;
  std::cin >> q;

  for (int i = 0; i < q; ++i) {
    long k;
    std::cin >> k;
    std::cout << std::binary_search(a, a + n, k) << std::endl;
  }
}



Measured memory_bytes: 3884
import java.util.*;
public class Main {
	
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int X = sc.nextInt();
        int Y = sc.nextInt();
        
        int ans = 0;
        if (X >= 0 && Y >= 0) {
        	if (X > Y) {
        		ans += Y == 0 ? 1 : 2;
        		ans += X - Y;
        	} else {
        		ans += Y - X;
        	}
        } else if (X >= 0 && Y < 0) {
        	if (X == Math.abs(Y)) {
        		ans+=1;
        	} else {
        		ans+= 1;
        		ans+= Math.abs(X + Y);
        	}
        } else if (X < 0 && Y < 0) {
        	if (X < Y) {
        		ans+= Math.abs(X - Y);
        	} else {
        		ans+=2;
        		ans+= Math.abs(Y - X);
        	}
        } else if (X < 0 && Y >= 0) {
        	if (Math.abs(X) == Y) {
        		ans +=1;
        	} else {
        		ans += Y == 0 ? 0 : 1;
        		ans += Math.abs(X + Y);
        	}
        }
        
        System.out.println(ans);
    }
}



Measured memory_bytes: 23508
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a[1000];
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  int q;
  cin>>q;
  for(int i=0;i<q;i++){
    int b,e,t;
    cin>>b>>e>>t;
    for(int i=b;i<e;i++)swap(a[i],a[i-b+t]);
  }
  for(int i=0;i<n;i++){
    if(i)cout<<" ";
    cout<<a[i];
  }
  cout<<endl;
  return 0;
}



Measured memory_bytes: 3080
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
#define N 100010
inline int read(){
    int x=0,f=1;
    char c=getchar();
    while(c<'0'||c>'9'){
        if(c=='-')f=-1;
        c=getchar();
    }
    while(c>='0'&&c<='9'){
        x=(x<<3)+(x<<1)+c-'0';
        c=getchar();
    }
    return x*f;
}
int n,k,same;
char s[N];
int main(){
	n=read(),k=read();
	scanf("%s",s+1);
	for(int i=1;i<=n;i++){
		if((s[i]=='L'&&s[i-1]=='L')||(s[i]=='R'&&s[i+1]=='R')){
			same++;
		}
	}
	cout<<min(n-1,same+2*k)<<endl;
	return 0;
}


Measured memory_bytes: 384
N,K = map(int,input().split())
list = list(map(int,input().split()))
ans = 10**9

for i in range(N-K+1):
    temp = 0
    if list[i] > 0:
        temp = list[i+K-1]
    elif list[i+K-1] < 0:
        temp = abs(list[i])
    else:
        temp = list[i+K-1]+abs(list[i])+min(list[i+K-1],abs(list[i]))

    ans = min(ans,temp)

print(ans)


Measured memory_bytes: 14228
#include<bits/stdc++.h>
#define pb push_back
#define mod 1000000007
#define N 100001
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
 
typedef long long ll;

int main(){
    IOS;
    ll n;
    cin>>n;
    string s;
    unordered_map<string,ll> m;
    for(ll i=0;i<n;i++){
        cin>>s;
        m[s]++;
    }
    cout<<"AC"<<" "<<"x"<<" "<<m["AC"]<<endl;
    cout<<"WA"<<" "<<"x"<<" "<<m["WA"]<<endl;
    cout<<"TLE"<<" "<<"x"<<" "<<m["TLE"]<<endl;
    cout<<"RE"<<" "<<"x"<<" "<<m["RE"]<<endl;

    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
#define _USE_MATH_DEFINES
#include <math.h>
int main() {
	ll n;
	cin>>n;
	ll ch[200010]={};
	for(ll i=0;i<n-1;i++){
		ll now;
		cin>>now;
		now--;
		ch[now]++;
	}
	for(ll i=0;i<n;i++){
		cout <<ch[i]<<endl;
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 5160
from functools import partial
from itertools import product
import numpy as np


def main():
    N, M = map(int, input().split())
    k = []
    s = []
    for _ in range(M):
        input_list = list(map(int, input().split()))
        k.append(input_list[0])
        s.append(input_list[1:])
    ps = list(map(int, input().split()))
    candidates = np.array(list(product([0, 1], repeat=N)))
    for i in range(M):
        index = s[i]
        p = ps[i]
        candidates = list(map(partial(is_match, index=index, p=p), candidates))
        candidates = [c for c in candidates if not isinstance(c, type(None))]
        if candidates == None:
            candidates = []
            break
    print(len(candidates))


def is_match(candidate, index, p):
    if sum(candidate[np.array(index) - 1]) % 2 == p:
        return candidate


if __name__ == '__main__':
    main()


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

int main(){
 int a, b, c, d, e, f, g, h, i, j, k, l, m, n;
 cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j>>k>>l>>m>>n;
 if(a > b)cout<<a - b<<endl;else cout<<b - a<<endl;
 if(c > d)cout<<c - d<<endl;else cout<<c - d<<endl;
 if(e > f)cout<<e - f<<endl;else cout<<f - e<<endl;
 if(g > h)cout<<g - h<<endl;else cout<<h - g<<endl;
 if(i > j)cout<<i - j<<endl;else cout<<i - j<<endl;
 if(k > l)cout<<k - l<<endl;else cout<<l - k<<endl;
 if(m > n)cout<<m - n<<endl;else cout<<n - m<<endl;
return 0;
}


Measured memory_bytes: 3076
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define fi first
#define se second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using v_bool = vector<bool>;
using v_Pii = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;



signed main(){

    int N; cin >> N;
    vec A(N), B(N); cin >> A >> B;
    v_Pii a(N), b(N);
    REP(i, N){
        a[i] = Pii(A[i], i);
        b[i] = Pii(B[i], i);
    }
    Sort(a); Sort(b);
    Sort(A); Sort(B);

    REP(i, N) if(A[i] > B[i]){
        Out("No");
        return 0;
    }

    vec c(N);
    REP(i, N)c[a[i].se] = b[i].se;
    int now = 0, cnt = 0;
    while(true){
        now = c[now];
        cnt++;
        if(now == 0) break;
    }
    
    bool ans = (cnt < N);
    REP(i, N - 1) if(A[i + 1] <= B[i]) ans = true;
    Ans(ans, "Yes", "No");

    return 0;
}


Measured memory_bytes: 5760
def output(W,H):
    i=1
    while i<=H:
        print("#"* W)
        i=i+1
    print("")
#入力した文字を変数に格納する
input_number=input()

array=input_number.split()

#整数型に変換を行う
W=int(array[0])
H=int(array[1])

while not( W==0 and H==0):

    output(H,W)
    
    input_number=input()
    array=input_number.split()
    W=int(array[0])
    H=int(array[1])


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

int main()
{
    string s;
    int a=0, b=0;
    cin>>s;
    for(int i=0;i<s.length();++i)
    {
        if(s[i]=='A')
        a = 1;
        else
        b=1;
    }
    if(a==1 && b==1)
    cout<<"Yes"<<endl;
    else
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
c=0
for W in iter(input,'0'):
 c+=1
 W=int(W)
 dp=[0]*-~W
 for _ in[0]*int(input()):
  v,w=map(int,input().split(','))
  for i in range(W,w-1,-1):
   if dp[i]<dp[i-w]+v:dp[i]=dp[i-w]+v
 for i in range(W+1):
  if dp[W]==dp[i]:print(f'Case {c}:\n{dp[W]}\n{i}');break


Measured memory_bytes: 5628
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
 
public class Main {
 
	public Main() {
		// TODO 自動生成されたコンストラクター・スタブ
	}
 
	public static void main(String[] args){
		Map <Integer,Integer> mapL = new HashMap<Integer,Integer> ();
 
		Scanner sc = new Scanner(System.in);
			// 整数の入力
			int sum,sum2,n,l,s,index;
			int result;
			n = sc.nextInt();
			l = sc.nextInt();
			sc.close();
			result=0;
			if(l>=0) {
				result=0;
			}
			else if(l<0 && -l<n) {
				result=-l;
			}
			else if(l<0) {
				result=n-1;
			}
			sum=(l*2+n-1)*n/2-l-result;
			System.out.println(sum);
			
 
			// 出力
 
	}
}

Measured memory_bytes: 23252
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <math.h> // sqrt()

using namespace std;

int main(){
    int l, m, small;
    cin >> l >> m;
    vector<int> num;
    if (m / 2019 != l / 2019 || m % 2019 == 0){
        cout << 0 << endl;
        return 0;
    }
    small = 2021;
    int remain = l % 2019;
    for (int i = remain; i <= m - l + remain; i++){
        for (int x = remain; x <= m - l + remain; x++){
            if (i != x){
                small = min(small , i * x % 2019);
            }
        }
    }
    cout << small << endl;



}

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

int main(void){
  int H, W;
  cin >> H >> W;
  char m[H][W];
  for(int i=0; i<H; i++)
    for(int j=0; j<W; j++)
      cin >> m[i][j];

  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      if(m[i][j]=='.'){
        int jib=0;
        if(i>0){
          if(m[i-1][j]=='#')jib++;
          if(j>0) if(m[i-1][j-1]=='#')jib++;
          if(j<W-1) if(m[i-1][j+1]=='#')jib++;
        }
        if(j>0) if(m[i][j-1]=='#')jib++;
        if(j<W-1) if(m[i][j+1]=='#')jib++;
        if(i<H-1){
          if(m[i+1][j]=='#')jib++;
          if(j>0) if(m[i+1][j-1]=='#')jib++;
          if(j<W-1) if(m[i+1][j+1]=='#')jib++;
        }
        cout << jib;
      }else{
        cout << "#";
      }
      if(j==W-1)cout<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <bitset>
#include <string>
#include <sstream>
#include <memory.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <functional>
#include <algorithm>
using namespace std;
typedef long long ll;
vector<vector<int> > g;
int DFS(int u, int p) {
	int ret = 0;
	for (auto &v : g[u])
		if (v != p)
			ret = max(ret, 1 + DFS(v, u));
	return ret;
}
int main()
{
	g.resize(4);
	for (int i = 0; i < 3; ++i) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	for(int i=0;i<4;++i)
		if (g[i].size() == 1 && DFS(0, -1) == 3){
			puts("YES");
			return 0;
		}
	puts("NO");
	return 0;
}

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

#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)

#define ll long long

#define pq(name,type) priority_queue<type> name
#define vec(name,type,length,value) vector<type> name(length,value)
#define vec2(name,type,length,width,value) vector<vector<type>> name(length,vector<type>(width,value));

int main(){
	string N;
  cin >> N;
  ll sl = N.length();
  ll count = 0,c1 = 0;
  froop1(0,sl){
   if(N[i] == 'B') c1++;
  else
    count += c1;
  
  }
  cout << count << endl;

return 0;
}

Measured memory_bytes: 3736
n, k = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)
b = 0
k.times do 
    imos = Array.new(n,0)
    a.each_with_index do |item,i|
            min = [i-item,0].max
            max = [i+item+1,n].min
            imos[min] += 1
            if max != n
            imos[max] -= 1
            end
    end
    (1..(n-1)).each do |i|
        imos[i] += imos[i-1]
        

    end
    b = imos
    if a == b
        break
    end

    a = imos
      
end
puts b.join(" ")

Measured memory_bytes: 81292
import sys
sys.setrecursionlimit(100000)

N,M = map(int,input().split())
adj_list = { i: [] for i in range(1, N+1) }

for i in range(M):
  a,b = map(int, input().split())
  adj_list[a].append(b)
  adj_list[b].append(a)

visited = [False]*(N+1)
colors = [None] * (N)
is_bipartite = True

## improved dfs ###
def dfs(node, c):
  colors[node-1] = c
  visited[node] = True
  for nei in adj_list[node]:
    if colors[nei-1] == c:
      return False
    if not visited[nei] and not dfs(nei, 1-c):
      return False

  return True

if dfs(1, 1):
  black = colors.count(1)
  print(black*(N-black) - M)
else:
  print(N*(N-1)//2 - M)

Measured memory_bytes: 213904
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll n;
cin>>n;
string ans;
while(n){
n--;
ans+='a'+n%26;

n/=26;


}
reverse(ans.begin(),ans.end());
cout<<ans<<endl;

return 0;
}

Measured memory_bytes: 3636
use std::collections::VecDeque;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: usize = sc.read();
    let q: usize = sc.read();
    let mut tree = vec![vec![]; n];
    for _ in 1..n {
        let a = sc.read::<usize>() - 1;
        let b = sc.read::<usize>() - 1;
        tree[a].push(b);
        tree[b].push(a);
    }
    let mut add = vec![0; n];
    for _ in 0..q {
        let p = sc.read::<usize>() - 1;
        let x: u64 = sc.read();
        add[p] += x;
    }

    let mut ans = vec![0; n];
    let mut q = VecDeque::new();
    q.push_back((0, 0));
    ans[0] = add[0];
    while let Some((v, p)) = q.pop_front() {
        for &next in tree[v].iter() {
            if next == p {
                continue;
            }
            ans[next] = add[next] + ans[v];
            q.push_back((next, v));
        }
    }

    for i in 0..n {
        if i > 0 {
            print!(" ");
        }
        print!("{}", ans[i]);
    }
    println!();
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll B[105];
ll A[105];

int main()
{
    ll N;
    cin >> N;
    REP(i, N - 1)
    {
        cin >> B[i];
    }
    memset(A, 0, sizeof(A));
    REP(i, N - 2)
    {
        ll a = std::min(B[i], B[i + 1]);
        A[i + 1] = a;
    }
    A[0] = B[0];
    A[N - 1] = B[N - 2];
    ll s = 0;
    REP(i, N)
    {
        s += A[i];
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	N, K := ReadInt(), ReadInt()
	A := ReadInts(N)
	principal := 0
	inversion := 0
	for i := 0; i < N-1; i++ {
		for j := i; j < N; j++ {
			if A[i] < A[j] {
				principal++
			}
			if A[i] > A[j] {
				inversion++
			}
		}
	}
	ans := ModAdd(
		ModMul(inversion, K*(K+1)/2),
		ModMul(principal, K*(K-1)/2),
	)
	fmt.Println(ans)
}

const Mod = int(1e9) + 7

func ModAdd(a, b int) int  { return ((Mod + a%Mod) + (Mod + b%Mod)) % Mod }
func ModMul(a, b int) int  { return (Mod + a%Mod) * (Mod + b%Mod) % Mod }
func ModInverse(n int) int { return ModPow(n, Mod-2) }
func ModDiv(a, b int) int  { return a * ModInverse(b) }
func ModPow(a, b int) int {
	x := 1
	for b > 0 {
		if b&1 == 1 {
			x = x * a % Mod
		}
		a = a * a % Mod
		b >>= 1
	}
	return x
}
func ModFactorial(n int) int      { return fac[n] }
func ModPermutation(n, r int) int { return fac[n] * finv[n-r] % Mod }
func ModCombination(n, k int) int { return fac[n] * (finv[k] * finv[n-k] % Mod) % Mod }

var fac, finv, inv []int

func init() {
	const MAX = 5 * 1e5
	fac, finv, inv = make([]int, MAX+1), make([]int, MAX+1), make([]int, MAX+1)
	fac[0], fac[1], finv[0], finv[1], inv[1] = 1, 1, 1, 1, 1
	for i := 2; i <= MAX; i++ {
		fac[i] = fac[i-1] * i % Mod
		inv[i] = Mod - inv[Mod%i]*(Mod/i)%Mod
		finv[i] = finv[i-1] * inv[i] % Mod
	}
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


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

int main() {
    int N, M; cin >> N >> M;
    long long ac = 0;
    long long pena = 0;
        
    vector<long long> wa(N, 0), isac(N, 0);
    for (int i = 0; i < M; ++i) {
        int p; string s;
        cin >> p >> s;
        --p;
        if (s == "AC") {
            if (!isac[p]) {
                ++ac;
                pena += wa[p];
                isac[p] = true;
            }
        }
        else wa[p]++;
    }
    cout << ac << " " << pena << endl;
}


Measured memory_bytes: 1792
import std.stdio;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;
 
void main() {
    int N;
    bool input() {
        scanf("%d\n", &N);
        return N != 0;
    }
    auto dp = new double[][](31, 100001);
    void solve() {
        foreach (ref l; dp) l[] = 0;
        for (int n = N - 1; n >= 0; n--) {
            for (int c = 0; c < 30; c++) {
                double x = (1.0 / (1 << c));
                dp[c][n] = x + x * dp[c + 1][n + 1] + (1.0 - x) * dp[0][n + 1];
            }
        }
        writefln("%.5f", dp[0][0]);
    }
    while (input) solve;
}

Measured memory_bytes: 26036
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int n;
int a[55];
ll dp[55][2505][55];
ll rec(int pos, int sum, int rem)
{
    if(rem < 0)
        return 0;
    
    if(sum == 0 && rem == 0)
        return 1;

    if(pos == n )
        return 0;
    
    // if(sum == 0 && rem != 0)
    //     return 0;
    if(dp[pos][sum][rem]!=-1)
        return dp[pos][sum][rem];
    

    ll ans = 0;

    if(a[pos] <= sum)
        ans = rec(pos+1, sum-a[pos], rem-1) + rec(pos+1,sum, rem);
    else
        ans = rec(pos+1, sum, rem);

    dp[pos][sum][rem] = ans;

    return ans;
}
int main() {
    int k;
    cin>>n>>k;
    for(int i = 0; i < n; i++)
        cin>>a[i];

    ll ans = 0;
    for(int i = 1; i <= n; i++)
    {
        memset(dp,-1,sizeof(dp));
        // cout<<"i:"<<i<<",sum:"<<k*i<<"=";
        ans+=rec(0,k*i, i);
    }    

    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 59520
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
typedef long long int ll;
typedef pair<int,int> pi;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    string s;
    ll k;
    cin>>s>>k;
    for (int i=0;i<s.size();i++) {
        if (s[i]!='1') {
            for (int j=i+1;j<s.size();j++) {
                s[j]=s[i];
            }
            break;
        }
    }
    if (k<=s.size()) {
        cout<<s[k-1];
    }
    else {
        cout<<s[-1+s.size()];
    }
}


Measured memory_bytes: 256
package main
import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	ar := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&ar[i])
	}

	no := 0
	j := 1
	for i := 0; i < n; i++ {
		if ar[i] == j {
			j++
		} else {
			no++
		}
	}
	if no < n {
		fmt.Println(no)
	} else {
		fmt.Println(-1)
	}
}

Measured memory_bytes: 6400
n = int(input())

a = []
for x in input().split():
    a.append(int(x))
    
is_approved = True

for i in a:
    if i % 2 ==0:
        if (i % 3 !=0) and (i % 5 !=0):
            is_approved = False
            
if is_approved:
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
int main(){
    ll n,m;
    cin >> n >> m;
    ll ans = 0;
    if(2*n >=m ){
        ans += m/(ll)(2);
    }
    else{
        ans += n;
        m = m-2*n;
        ans += m/(ll)(4);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Tue Sep  8 16:35:44 2020

@author: liang
"""
#from collections import deque

N = int(input())
P_list = list()

num = list(range(N))
perm = list()

def make_perm():
    #print("start")
    if len(num) == 0:
        P_list.append(perm.copy())
        #print("append")
        return
    for i in range(len(num)):
        t = num.pop(0)
        perm.append(t)
        #print(perm)
        make_perm()
        perm.pop()
        num.append(t)
        
make_perm()
#print(P_list)
P_list.sort()
#print(P_list)

ans = 0
P = [int(x)-1 for x in input().split()]
Q = [int(x)-1 for x in input().split()]
for i in range(len(P_list)):
    if P == P_list[i]:
        a = i
    if Q == P_list[i]:
        b = i
print(abs(a-b))

Measured memory_bytes: 14580
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
#include <stack>
#include <map> // pair
#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
typedef std::stack<int> IntStack;
typedef std::stack<char> charStack;
#define START 0
#define FORWARD 1
#define BACK 2
using namespace std;
using ll = long long;
typedef pair <ll, ll > pll;

int main()
{
	ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	ll n, m, K;
	ll x[100004] = {};
	ll y[100004] = {};
	ll z[100004] = {};
	string s;
	string s1, s2;
	//IntStack yStack;
	//charStack Stack;
	//vector<pair<int, int> > pairs(a);

	cin >> a;
	cin >> b;
	cin >> c;
	for (int i = 1; i <= c; i++)
	{
		if (i%a==0)
		{
			ans += b;
		}
	}


	cout << ans<< endl;


	//sort(x, x + a);
	//cout << z << endl;


	//cout << ans << endl;

	////std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	//cout << d+1 << endl;
	//cout << "" << endl;

	return 0;
}
//char型の文字数字は、-'0'で数値に変換できる
//accumulate(x, x + a, 0);//int型までの配列の合計
//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;
//cout << char(z - 'a');
//log10(i) + 1 //10進数の桁数を取得
//
//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}
//
//最小公倍数
//ll x = a * b;
//ll tmp;
///* 自然数 a > b を確認・入替 */
//if (a<b) {
//	tmp = a;
//	a = b;
//	b = tmp;
//}
///* ユークリッドの互除法 */
//ll r = a % b;
//while (r != 0) {
//	a = b;
//	b = r;
//	r = a % b;
//}
//a = x / b;//答え

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<functional>
#include <string>
#include<cstdio>
#include<math.h>
#include<stack>
#include<queue>
#include<cstring>
#include<vector>
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EREP(i,n) for(int i=(n-1);i>=0;--i)
#define D(n,retu) REP(i,n){cin>>retu[i];}
#define mod 1000000007
#define MIN -93193111451418101
#define INF 931931114518101
using namespace std;
typedef long long int ll;
template<typename T>
void fill_all(T& arr, const T& v) {
	arr = v;
}
template<typename T, typename ARR>
void fill_all(ARR& arr, const T& v) {
	for (auto& i : arr) { fill_all(i, v); }
}
ll combination(ll n) {
	ll nck[100][100];
	nck[0][0] = 1;
	for (int i = 1; i < 1 + n; i++) {
		nck[i][0] = nck[i][i] = 1;
		for (int j = 1; j < i; j++) {
			nck[i][j] = nck[i - 1][j - 1] + nck[i - 1][j];
		}
	}
	return 0;
}
//------------------変数-----------------------//

//-------------------関数----------------------//

int main() {
	ll a, b, c, d; cin >> a >> b >> c >> d;
	ll fuck[1145] = {};
	for (int i = a; i <b; i++)
	{
		fuck[i]++;
	}
	for (int i = c; i < d; i++)
	{
		fuck[i]++;
	}
	ll cnt = 0;
	REP(i, 101) { if (fuck[i] == 2) { cnt++; } }cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define ULL unsigned long long
#define mem(i, j) memset(i, j, sizeof(i))
#define rep(i, j, k) for(int i = j; i <= k; i++)
#define dep(i, j, k) for(int i = k; i >= j; i--)
#define pb push_back
#define make make_pair
#define INF INT_MAX
#define inf LLONG_MAX
#define PI acos(-1)
#define fir first
#define sec second
using namespace std;

const int N = 1e6 + 5;

const LL mod = 998244353;

LL ksm(LL a, LL b) { LL ans = 1LL; while(b) { if(b & 1) ans = ans * a % mod; a = a * a % mod; b >>= 1; }  return ans; }

pair < int, int > a[N];

bool cmp(pair < int, int > A, pair < int, int > B) {
    return A.sec < B.sec;
}

void solve() {

    int n;
    scanf("%d", &n);
    rep(i, 1, n) {
        int x, l;
        scanf("%d %d", &x, &l);
        a[i] = make(x - l, x + l);
    }
    sort(a + 1, a + 1 + n, cmp);

    int now = a[1].sec, ans = 1;

    rep(i, 2, n) {
        if(a[i].fir >= now) {
            ans++;
            now = a[i].sec;
        }
    }
    printf("%d\n",ans);
}


int main() {
//    int _; scanf("%d", &_);
//    while(_--) solve();


    solve();

    return 0;
}


Measured memory_bytes: 1024
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        Set<Integer> set = new HashSet<>();
        set.add(a);
        set.add(b);
        set.add(c);
        System.out.println(set.size() == 2 ? "Yes" : "No");
    }

}

Measured memory_bytes: 21844
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#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 = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------
int A[10];

int main() {
  cin >> A[0] >> A[1] >> A[2];
  int ans = inf;
  vector<int> perm = {0, 1, 2};
  do {
    int t0 = A[perm[0]];
    int t1 = A[perm[1]];
    int t2 = A[perm[2]];
    chmin(ans, abs(t1 - t0) + abs(t2 - t1));
  } while (next_permutation(perm.begin(), perm.end()));
  cout << ans << endl;
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

ll dp[100010];
int main(){
    int n;
    cin >> n;
    VI h(n);
    rep(i,n) cin >> h[i];
    rep(i,n) dp[i] = 1e9;
    dp[0] = 0;
    rep(i,n-1){
        if(i == n-2){
            dp[i+1] = min(dp[i] + abs(h[i] - h[i+1]),dp[i+1]);
        }
        else {
            dp[i+1] = min(dp[i]+abs(h[i+1]-h[i]), dp[i+1]);
            dp[i+2] = min(dp[i]+abs(h[i+2]-h[i]), dp[i+2]);
        }
    }
    cout << dp[n-1] << endl;
    return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define cs const 
#define int long long
#define mid ((l+r)>>1)
#define low(i) (i&(-i))
#define ls (now<<1)
#define rs (now<<1|1)
cs int ff = 1e6+1;
cs int mod = 1e9+7;
int n, a, b;
void init()
{
	cin >> n >> a >> b;
	cout << n / (a+b) * a + min(a, n % (a+b) );
}
signed main()
{
	init();
} 

Measured memory_bytes: 256
N,M = gets.split.map {|x| x.to_i}
X = gets.split.map {|x| x.to_i}

X.sort!

arr = []
X << 999999999
M.times { |i|
  arr << [X[i], X[i+1]-X[i]]
}
arr.sort! {|a,b| a[1] <=> b[1]}

sum = 0

if M > N
  (M-N).times { |i|
    sum += arr[i][1]
  }
end

puts sum


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

int main()
{
  int N, a[200];
  cin >> N;
  N *= 2;
  for (int i = 0; i < N; i++){
    cin >> a[i];
  }
  sort(a, a + N);
  int cnt = 0;
  for (int i = 0; i < N; i += 2) cnt += a[i];

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 256
# ABC044C - 高橋君とカード / Tak and Cards (ARC060C)
def main():
    N, A = tuple(map(int, input().split()))
    X = tuple(map(lambda x: int(x) - A, input().split()))
    D = {0: 1}
    for i in X:
        for j, k in list(D.items()):
            D[i + j] = D.get(i + j, 0) + k
    ans = D[0] - 1
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int K, Q; cin >> K >> Q;
  vector<ll> D(K); rep(i, K) cin >> D[i];
  while (Q--) {
    ll N, X, M; cin >> N >> X >> M;
    X %= M;
    ll s = 0;
    rep(i, K) {
      if (D[i] % M == 0) {
        s += M;
      } else {
        s += D[i] % M;
      }
    }
    ll y = X + s * ((N - 1) / K);
    rep(i, (N - 1) % K) {
      if (D[i] % M == 0) {
        y += M;
      } else {
        y += D[i] % M;
      }
    }
    cout << (N - 1) - y / M << endl;
  }
}

Measured memory_bytes: 384
#include<stdio.h>
#include<math.h>

int main(void)
{
    int N,L,i;
    int azi[200];
    int fabs_azi[200];
    int min_zantei,nanbanme;
    int pie=0;

    scanf("%d%d",&N,&L);

    for(i=0;i<N;i++){
        azi[i]=L+i;
        fabs_azi[i]=fabs(L+i);
    }

    min_zantei=fabs_azi[0];

    for(i=1;i<N;i++){
        if(min_zantei>fabs_azi[i]){
            min_zantei=fabs_azi[i];
            nanbanme=i;
        }
    }
    

    for(i=0;i<N;i++){
        pie+=azi[i];
    }

    printf("%d\n",pie-azi[nanbanme]);

    return 0;
}

Measured memory_bytes: 128
atama, asi = [int(x) for x in input().split()]
if asi%2 == 0 and asi >= atama*2 and asi <= atama*4:
    print("Yes")
else:
    print("No")

# 足の総数は常に偶数
# 鶴が多いほど、少ない足で頭数を揃えられる
# 亀が多いほど、頭数に対して足の数が必要

Measured memory_bytes: 9164