akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e4+5;
const ll inf=2e18;
const int mod=998244353;
int n;
bool vis[maxn];
int p[maxn],tot=0;
int st[maxn],top;
void init(int n){
    for(int i=2;i<=n;i++){
        if(!vis[i]){
            p[++tot]=i;
        }

    for(int j=1;j<=tot&&p[j]*i<=n;j++){
            vis[i*p[j]]=1;
            if(i%p[j]==0)break;
        }
    }
}
int fun(int x){
    int ans=1;
    top=0;
    for(int i=1;p[i]*p[i]<=x;i++){
        if(x%p[i]==0){
            int cnt=0;
            while(x%p[i]==0)cnt++,x/=p[i];
            st[++top]=cnt;
        }
    }
    if(x!=1)st[++top]=1;

    for(int i=1;i<=top;i++)
        ans*=st[i]+1;
    return ans;
}

int main(){
    init(1200);
    cin>>n;
    ll ans=0;
    for(int i=1;i<n;i++){
        ans+=fun(i);
    }
    printf("%lld\n",ans);


    return 0;
}


Measured memory_bytes: 3720
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <stack>
#include <algorithm>
#define forn(a, n) for(int a = 0; a<(int) (n); ++a)
#define rforn(a, n) for(int a = (n)-1; a>=0; --a)
using namespace std;
const int N = 6e5+20;

int main()
{
    int n, m, b;
    cin>>n;
    if(n>=30) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

}

Measured memory_bytes: 3516
ptn=["23542","14631",
"12651","15621",
"13641","32453"]

def rNO(d):
  global ptn
  for i,e in enumerate(ptn):
    if d in e:
      return i
  return 0

dice1 = list(input().split(" "))
dice2 = list(input().split(" "))

e = dice1[2]

#dice1の１，２番目はdice2で何番目？
d2=["",""]
for i ,v in enumerate(dice2):
  if dice1[0] == v:
    d2[0] = str(i + 1)
  if dice1[1] == v:
    d2[1] = str(i + 1)

d2Idx = rNO("".join(d2))

if dice1[2] == dice2[d2Idx] :
  print("Yes")
else:
  print("No")



Measured memory_bytes: 5564
n,k=map(int,input().split())
a=list(map(lambda x:int(x)-1,input().split()))
ii=0
array=[-1]*n
for i in range(k):
    if array[ii]>=0:
        r=i-array[ii]
        k-=array[ii]
        m=k%r
        print(array.index(m+array[ii])+1)

        exit()
    array[ii]=i
    ii=a[ii]
else:
    print(ii+1)


Measured memory_bytes: 32352
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def cnt(m):
    res=0
    for a in aa:res+=(a+m-1)//m-1
    return res

n,k=MI()
aa=LI()
l=0
r=max(aa)
while l+1<r:
    m=(l+r)//2
    if cnt(m)>k:l=m
    else:r=m
print(r)


Measured memory_bytes: 30972
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;
using ll=long long;
using P=pair<int,int>;
#define rep(i,a,b) for(ll i=a;i<ll(b);i++)
#define repr(i,a,b) for(ll i=a;i>=ll(b);i--)
#define endl '\n'
#define ALL(x) x.begin(),x.end()
#define ALLR(x) x.rbegin(),x.rend()
#define INF 1e9
#define DEBUG(x) cout<<"debug: "<<x<<endl
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}

ll a, b, c, d;
int main(){
    cin >> a >> b >> c >> d;
    ll n1 = a*c;
    ll n2 = a*d;
    ll n3 = b*c;
    ll n4 = b*d;
    ll ans = max({n1, n2, n3, n4});
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3236
import java.util.*;

public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        sc.close();

        for(int i = 1; i <= 9; i++){
            if(N%i == 0){
                if(N/i  <= 9){
                    System.out.println("Yes");
                    return;
                }
            }
        }
        System.out.println("No");
    }
}

Measured memory_bytes: 23764
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;
#define ll long long
int main(){
    int h,w;
    cin>>h>>w;
    int arr[100][100];
    int a,b,c,i,n;
    cin>>n;
    int ae[10000];
    for(i = 1;i <= n;i++){
        cin>>ae[i];
        //cout<<ae[i]<<endl;
    }
    int j,k=0,s=1;
    for(i = 0;i < h;i++){
        if(k==0){
            for(k;k<w;k++){
                if(ae[s]>0){
                    arr[i][k] = s;
                    ae[s]--;
                    /*if(s==3){
                        cout<<ae[s]<<endl;
                    }*/
                }
                else{
                    s++;
                    arr[i][k] = s;
                    ae[s]--;
                }
            }
            //cout<<ae[s]<<endl;
        }
        else{
            k = k-1;
            for(k;k>=0;k--){
                //cout<<ae[s]<<endl;
                if(ae[s]>0){
                    //cout<<s<<endl;
                    arr[i][k] = s;
                    ae[s]--;
                }
                else{
                    //cout<<"********"<<endl;
                    s++;
                    arr[i][k] = s;
                    ae[s]--;
                }
            }
            k++;
        }

    }
    for(i = 0;i < h;i++){
        for(j = 0;j < w;j++){
            cout<<arr[i][j]<<' ';
        }
        cout<<endl;
    }
}


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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

int a[5555];
int cache[5555][5555];
void c_p_c()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}
int solve(int start,int end)
{
	if(start > end)
	{
		return 0;
	}
	if(start == end)
	{
		return a[start];
	}
	if(cache[start][end] != -1)
	{
		return cache[start][end];
	}
	return cache[start][end] = max(a[start] + min(solve(start+2,end),solve(start+1,end-1)),a[end] + min(solve(start,end-2),solve(start+1,end-1)));
}
int32_t main()
{
  //c_p_c();
  memset(cache,-1,sizeof(cache));
  int n,ts = 0;
  cin >> n;
  for(int i=0;i<n;i++)
  {
  	cin >> a[i];
  	ts+=a[i];
  }
  int x = solve(0,n-1);
  int y = ts - x;
  cout<<x-y<<endl;
  return 0;
}



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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

const double EPS = 1e-14;
const double PI  = acos(-1.0);

class AllPairsGraph {
  private:
    int vertex;
  
  public:
    std::vector<std::vector<int> > prev;
    std::vector<std::vector<long long> > dist;

    long long inf = LLONG_MAX / 3;

    AllPairsGraph(int v);

    
    virtual void push(int from, int to, int cost) = 0;

    bool warshall_floyed();

    std::vector<std::vector<long long> > get_dist();
    std::vector<int> get_path(int s, int d);
};

AllPairsGraph::AllPairsGraph(int v) {
  vertex = v;
  dist.resize(vertex);
  prev.resize(vertex);
  for (int i = 0; i < vertex; ++i) {
    dist[i].resize(vertex);
    prev[i].resize(vertex);
    for (int j = 0; j < vertex; ++j) {
      dist[i][j] = inf;
      if (i == j) dist[i][j] = 0;
      prev[i][j] = -1;
    }
  }
}

bool AllPairsGraph::warshall_floyed() {
  bool has_neg_cycle = false;
  for (int j = 0; j < vertex; ++j) {
    for (int i = 0; i < vertex; ++i) {
      for (int k = 0; k < vertex; ++k) {
        if (dist[i][j] != inf && dist[j][k] != inf && dist[i][j] + dist[j][k] < dist[i][k]) {
          dist[i][k] = dist[i][j] + dist[j][k];
          prev[i][k] = prev[j][k];
        }
      }
    }
  }
  for (int i = 0; i < vertex; ++i) {
    if (dist[i][i] < 0) has_neg_cycle = true;
  }
  return has_neg_cycle;
}

std::vector<std::vector<long long> > AllPairsGraph::get_dist() {
  return dist;
}

std::vector<int> AllPairsGraph::get_path(int s, int d) {
  std::vector<int> path;
  int v = d;
  while (v != s) {
    path.push_back(v);
    v = prev[s][v];
    if (v == -1) {
      path.clear();
      return path;
    }
  } 
  path.push_back(v);
  std::reverse(path.begin(), path.end());
  return path;
}

class AllPairsDirectedGraph : public AllPairsGraph {
  using AllPairsGraph::AllPairsGraph;

  public:
    void push(int from, int to, int cost) {
      dist[from][to] = cost;
      prev[from][to] = from;
    }
};

class AllPairsUndirectedGraph : public AllPairsGraph {
  using AllPairsGraph::AllPairsGraph;

  public:
    void push(int from, int to, int cost) {
      dist[from][to] = cost;
      prev[from][to] = from;

      dist[to][from] = cost;
      prev[to][from] = to;
    }
};

int main() {
  
  int v;
  int e;

  scanf("%d %d", &v, &e);

  AllPairsDirectedGraph g = AllPairsDirectedGraph(v);

  int from, to, cost;

  for (int i = 0; i <  e; i++) {
    scanf("%d %d %d", &from, &to, &cost);
    g.push(from, to, cost);
  }

  bool flag = g.warshall_floyed();
  if (flag) printf("NEGATIVE CYCLE\n");
  else {
    std::vector<std::vector<long long> > dist = g.get_dist();
    for (int i = 0; i < v; ++i) {
      for (int j = 0; j < v; ++j) {
        if (dist[i][j] != g.inf) printf("%lld", dist[i][j]);
        else printf("INF");
        printf("%s", j == v - 1 ? "\n" : " ");
      }
    }
  }
}



Measured memory_bytes: 3416
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

typedef long long ll;

typedef std::pair<int, int> ipair;
bool lessPair(const ipair& l, const ipair& r){return l.second < r.second;}
bool morePair(const ipair& l, const ipair& r){return l.second > r.second;}

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

const ll MOD = 1e9 + 7;
// const long long INF = 1LL<<60;
void add(long long &a, long long b) { a += b; if (a >= MOD) a -= MOD; }
void sub(long long &a, long long b) { a -= b; if (a < 0) a += MOD; }
void mul(long long &a, long long b) { a *= b; a %= MOD; }
ll llmin(ll a, ll b) { if (a < b) return a; else return b; }
ll llmax(ll a, ll b) { if (a < b) return b; else return a; }
ll llabs(ll a) { if (a >= 0) return a; else return - a; }
ll llmodpow(ll a, ll n) {
   if (n == 0) return 1;
   ll tmp = llmodpow(a, n / 2);
   mul(tmp, tmp);
   if (n & 1) mul(tmp, a);
   return tmp;
}

int main() {
   string O, E;
   cin >> O >> E;
   int N = (int)O.size() + (int)E.size();
   for (int i = 1; i <= N; i++) {
      if (i % 2 == 0) 
         cout << E[i / 2 - 1];
      else 
         cout << O[i / 2];
   }
   cout << endl;
   return 0;
}


Measured memory_bytes: 256
main(i,j,k,n,c){int a[3][3];for(i=0;i<3;i++)for(j=0;j<3;j++)scanf("%d",&a[i][j]);scanf("%d",&n);int b[n];for(i=0;i<n;i++)scanf("%d",&b[i]);for(i=0;i<3;i++)for(j=0;j<3;j++)for(k=0;k<n;k++)if(b[k]==a[i][j])a[i][j]=0;for(i=0;i<3;i++)if(((a[i][0]==a[i][1])&&(a[i][1]==a[i][2]))||((a[0][i]==a[1][i])&&(a[1][i]==a[2][i])))c=1;if(((a[0][0]==a[1][1])&&(a[1][1]==a[2][2]))||((a[0][2]==a[1][1])&&(a[1][1]==a[2][0])))c=1;if(c==1)puts("Yes");else puts("No");}

Measured memory_bytes: 128
n = int(input())
numbers = list(map(int, input().split()))
count = 0
next_number = 1
if 1 in numbers :
    for i in range(len(numbers)):
        if numbers[i] != next_number:
            count += 1
        else:
            next_number += 1
    print(count)
else:
    print(-1)

Measured memory_bytes: 24744
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC165D
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            decimal A = decimal.Parse(input[0]);
            decimal B = decimal.Parse(input[1]);
            decimal N = decimal.Parse(input[2]);
            decimal ans = 0;
            decimal max = 0;
            if (B-1 >= N)
            {
                max = N;
            }
            else
            {
                max = B-1;
            }
            for (decimal i = max-1; i < max+1; i++)
            {
                decimal syousuu = i / B;
                syousuu *= A;
                decimal temp = Math.Truncate(syousuu);
                if (temp > ans)
                {
                    ans = temp;
                }
            }
            Console.WriteLine(ans);
        }
    }
}


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

void Main()
{
  ll N, K;
  cin >> N >> K;
  ll res = N % K;
  //cout << abs(res-K) << endl;
  if (abs(res-K) < res) res = abs(res-K);
  cout << res << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}

Measured memory_bytes: 256
import math
import sys,collections
from sys import stdin, stdout  
#MAXN = 10000001

def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_string(): return sys.stdin.readline().strip() 
def input(): return sys.stdin.readline().strip()
#spf = [0 for i in range(MAXN)] 
def file():
	sys.stdin = open('input.py', 'r')
	sys.stdout = open('output.py', 'w') 
def is_subsequence(x, y):
    """Test whether x is a subsequence of y"""
    x = list(x)
    for letter in y:
        if x and x[0] == letter:
            x.pop(0)

    return not x    
def sieve(): 
	spf[1] = 1
	for i in range(2, MAXN): 
		spf[i] = i 
	for i in range(4, MAXN, 2): 
		spf[i] = 2

	for i in range(3, mt.ceil(mt.sqrt(MAXN))): 
		if (spf[i] == i): 
			for j in range(i * i, MAXN, i): 
				if (spf[j] == j): 
					spf[j] = i 
def getFactorization(x): 
	ret = list() 
	while (x != 1): 
		ret.append(spf[x]) 
		x = x // spf[x] 

	return ret 
def getFloor(A, x):

    (left, right) = (0, len(A) - 1)

    ind,floor = -1,-1
    while left <= right:
        mid = (left + right) // 2
        '''if A[mid] == x:
            return mid'''
        if x < A[mid]:
            right = mid - 1
        else:
            floor = A[mid]
            ind=mid
            left = mid + 1
            
    return ind
def check(st) : 
  
    # Compute sum of digits 
    n = len(st) 
    digitSum = 0
      
    for i in range(0,n) : 
        digitSum = digitSum + (int)(st[i]) 
  
    # Check if sum of digits 
    # is divisible by 9. 
    return (digitSum % 9 == 0)     
#file()
#sieve() 
mod=(10**9)+7

def main():
	a=input()
	if(check(a)):
		print("Yes") 
	else:
		print("No") 

	





















	




















		
			


		

			

		





			

	























				

	















	

	










if __name__ == '__main__':
    main()

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> PP;

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

int n,m,ma,a,b;

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

	cin>>n>>m;
	ma=m;
	REP(i,n) {
		cin>>a>>b;
		m+=(a-b);
		ma=max(ma,m);
		if(m<0) ma=INF;
	}
	cout<<(ma==INF?0:ma)<<endl;

	return 0;
}



Measured memory_bytes: 3224
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <cstring>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}

struct edge {
    int time, x, y;
};

int main(){
    long long N,K; cin >> N >> K;
    vector<long long> t(N),d(N);
    vector<pair<long long,long long> > p(N);
    for (int i = 0; i < N; i++){
        cin >> t[i] >> d[i];
        p[i] = {d[i],t[i]};
    }
    sort(p.begin(),p.end());
    reverse(p.begin(),p.end());
    map<long long,long long> vari;
    long long sum = 0;
    priority_queue<pair<long long,long long>,vector<pair<long long,long long> >,greater<pair<long long,long long> > > pq;
    for (int i = 0; i < K; i++){
        vari[p[i].second]++;
        sum += p[i].first;
        pq.push(p[i]);
    }
    //cout << "n1 = " << vari.size() << endl;
    sum += vari.size()*vari.size();
    //cout << sum << endl;
    long long total = sum;
    for (int i = K; i < N; i++){
        if (vari[p[i].second] != 0) continue;
        while (!pq.empty()){
            pair<long long,long long> se = pq.top();
            pq.pop();

            if (vari[se.second] > 1){
                //cout << se.first << endl;
                //cout << p[i].first << " " << p[i].second << endl;
                long long n = vari.size();
                //cout << "n2 = " << n << endl;
                total = total + p[i].first - se.first + n*n - (n-1)*(n-1);
                vari[se.second]--;
                vari[p[i].second]++;
                sum = max(sum,total);
                break;
            }
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 10356
#include <cstdio>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)

typedef long long ll;

//------------------------------------------------------------------------------
int extgcd(int a, int b, int &x, int &y) {
  int ret = a;
  if (b == 0) {
    x = 1;
    y = 0;
  } else {
    ret = extgcd(b, a % b, y, x);
    y -= (a / b) * x;
  }
  return ret;
}

int mod_inverse(int a, int m) {
  int x, y;
  extgcd(a, m, x, y);
  return (m + x % m) % m;
}

//------------------------------------------------------------------------------
const int N_MAX = 200000;

ll fact[N_MAX + 1];

void init_fact(ll n, ll mod) {
  fact[0] = 1;
  FOR(i, 1, n) fact[i] = fact[i - 1] * i % mod;
}

ll mod_comb(ll n, ll k, ll mod) {
  if (n < 0 || k < 0 || n < k) return 0;
  ll a = fact[n];
  ll b = fact[k] * fact[n - k] % mod;
  return a * mod_inverse(b, mod) % mod;
}

//------------------------------------------------------------------------------
const ll MOD = 1000000007;

int H, W, A, B;

void solve() {
  init_fact(H + W, MOD);
  ll ans = 0;
  REP(i, H - A) {
    ll a = mod_comb(i + B - 1, B - 1, MOD);
    ll b = mod_comb(H - i + W - B - 2, W - B - 1, MOD);
    ans = (ans + (a * b % MOD)) % MOD;
  }
  printf("%lld\n", ans);
}

void input() {
  scanf("%d%d%d%d", &H, &W, &A, &B);
}

int main() {
  input();
  solve();
  return 0;
}


Measured memory_bytes: 1664
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i = 0; i < n; i++){
            a[i] = sc.nextInt();
        }
        int[] copy = new int[n];
        for(int i = 0; i < n; i++){
            copy[i] = a[i];
        }
        int count = 0;
        int light = 1;
        int flag = 1;
        for(int i = 0; ; i++){
            if(light != 2 && copy[light-1] != 0){
                copy[light-1] = 0;
                light = a[light-1];
                count++;
            } else if(copy[light-1] == 0){
                flag = 0;
                break;
            } else if(light == 2){
                break;
            }
        }
        if(flag == 0){
            System.out.print("-1");
        } else {
            System.out.print(count);
        }
    }
}

Measured memory_bytes: 52424
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
#define MOD 1000000007
//int kaijo(int n){
	//int ans=1;
	//for(int i=2;i<=n;i++){
	//	ans*=i;
	//	ans%=MOD;
	//}
	//return ans;
//}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	return modpow(a,b/2)*modpow(a,b/2)%MOD;
}
//int comb(int a,int b){
	//return kaijo(a)*modpow(kaijo(a-b),MOD-2)%MOD*modpow(kaijo(b),MOD-2)%MOD;
//}
int kaijo[114514];
void init_kaijo(){
	kaijo[0]=1;
	for(int i=1;i<=114513;i++)kaijo[i]=kaijo[i-1]*i%MOD;
}
int comb(int a,int b){
	if(b>a)return 0;
	return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int n,l,r;
signed main(){
	cin>>n;
	init_kaijo();
	vector<pair<int,int>>v;
	rep(i,n+1){
		int a;
		cin>>a;
		v.push_back({a,i});
	}
	sort(v.begin(),v.end());
	rep(i,n){
		if(v[i].first==v[i+1].first){
			l=v[i].second,r=v[i+1].second;
			break;
		}
	}
	int s=n-(r-l);
	for(int k=1;k<=n+1;k++){
		cout<<(comb(n+1,k)-comb(s,k-1)+MOD)%MOD<<endl;
	}
	return 0;
}


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


int main()
{
    int a,b;
    cin>>a>>b;
    if(a>b)
    {
        if(a==13 && b== 1)
        {
            cout<<"Bob";
        }
        else
        {
            cout<<"Alice";
        }
    }
    else if(a<b)
    {
        if(a==1 && b==13)
        {
            cout<<"Alice";
        }
        else
        {
            cout<<"Bob";
        }
    }
    if(a==b)
    {
        cout<<"Draw";
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
using plpii = std::pair<long long, std::pair<int, int>>;
using pdd = std::pair<double, double>;

using namespace std;

const long long _MOD = 1000000007;
const long long MOD = 998244353;
const int ALPHABET = 27;
const double pi = 3.14159265358979;

struct node {
	int distance;
	int pre;
	vector<int> conected;
};

void dikstra(node* nodes, int n) {
	priority_queue<pii, vector<pii>, greater<pii>> que;
	rep(i, n) que.push(pii(nodes[i].distance, i));

	while (!que.empty()) {
		pii t = que.top();
		que.pop();
		if (t.first > nodes[t.second].distance) continue;

		rep(i, nodes[t.second].conected.size()) {
			if (nodes[nodes[t.second].conected[i]].distance > nodes[t.second].distance + 1) {
				nodes[nodes[t.second].conected[i]].distance = nodes[t.second].distance + 1;
				nodes[nodes[t.second].conected[i]].pre = t.second;

				que.push(pii(nodes[nodes[t.second].conected[i]].distance, nodes[t.second].conected[i]));
			}
		}
	}
}

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

	int n, m;
	cin >> n >> m;
	node* nodes = new node[n];
	rep(i, n) nodes[i].distance = _MOD;

	int a, b;
	rep(i, m) {
		cin >> a >> b;
		nodes[a - 1].conected.push_back(b - 1);
		nodes[b - 1].conected.push_back(a - 1);
	}

	nodes[0].distance = 0;
	dikstra(nodes, n);

	cout << "Yes" << "\n";
	REP(i, 1, n) {
		cout << nodes[i].pre + 1 << "\n";
	}

	return 0;
}



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

int main() {
	long long N; cin >> N;
	vector<long long>A(N);
	vector<long long>InA(2000000, 0);
	for (long long i = 0; i < N; i++) {
		cin >> A.at(i);
		InA.at(A.at(i))++;
	}
	long long ans = 0;
	for (long long i = 0; i < N; i++) {
		long long num = 0;
		for (long long j = 1; j * j <= A.at(i); j++) {
			if (A.at(i) % j == 0) {
				num += InA.at(j);
				if (A.at(i) / j != j) num += InA.at(A.at(i) / j);
			}
		}
		if (num - 1 == 0) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 20432
// button

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <ios>
#include <iomanip>
#include <string>
#include <numeric>

using namespace std;

int main() {
    int n, k;
    string s;
    cin >> n >> k;
    cin >> s;

    s[k-1] = s[k-1] + 32;
    cout << s << endl;

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Threading.Tasks;


class Program
{
	//二分探索
	/*
	Min <= n <= Maxを満たす整数nのうち、
	Judge関数で定めた条件を満たす最小のものを返す

	cf. 配列やリストに対して二分探索を行いたい場合には、
	MinとMaxにそれぞれインデックスの最小値・最大値を渡せば良い。
	*/
	static long ExtendedBinarySearch(long Min, long Max)
	{
		//両端を初期化
		long min = Min;
		long max = Max;

		//二分探索（条件を満たすまで探索）
		while(max >= min){
			//中央を更新
			long mid = min + (max-min)/2;

			//条件を満たさない場合
			if(!Judge(mid)){
					min = mid + 1;
			}
			//満たす場合
			else{
					max = mid - 1;
			}
		}

		//条件を満たす最小の整数を出力
		return min;
	}

	//探索対象が満たすべき条件の充足性を判定する関数
	/*
	条件を満たすかどうかをboolで返す
	*/
	static bool Judge(long tempo){
		//最長の丸太の長さをtempo以下にできるかどうかを、boolで返す
		//全ての丸太をtempo以下にするのに必要な回数をカウント
		long cnt = 0;

		//各丸太について、必要な最低回数を計算
		for(int i=0; i<N; i++){
			//Aiをtempo以下に分割する為に必要な回数
			long cut = An[i] / tempo;
			if(An[i] % tempo == 0){
				cut --;
			}

			cnt += cut;

			//必要な回数がKを超えた場合、終了（不可能）
			if(cnt > K){
				return false;
			}
		}

		return true;
	}

	static int N;
	static long K;
	static long[] An;

	//Main
	static void Main(string[] args)
	{
		//読み込む
		string[] S = Console.ReadLine().Split(' ');
		N = int.Parse(S[0]);
		K = long.Parse(S[1]);
		An = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

		//二分探索
		//cf. Anは最大で10^9。
		long ans = ExtendedBinarySearch(1, 1000000000);

		//出力
		Console.WriteLine(ans);
	}
}



Measured memory_bytes: 39828
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main(){
	int n,h,w;cin>>n>>h>>w;
	cout<<(n-h+1)*(n-w+1)<<endl;
}

Measured memory_bytes: 764
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll INF = 1e+18;
const ld EPS = 1e-12L;
const ld PI = acos(-1.L);
inline ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
inline ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
inline bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
inline bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll a, b;
  cin >> a >> b;
  print(LCM(a, b));
}


Measured memory_bytes: 256
N, D = [int(_) for _ in input().split()]

X = [[int(_) for _ in input().split()] for i in range(N)]

ans = 0
for j in range(N):
    for i in range(j):
        s = 0
        for k in range(D):
            s += (X[j][k] - X[i][k]) ** 2
        if int(s ** 0.5) ** 2 == s:
            ans += 1
print(ans)


Measured memory_bytes: 3188
//Ruthless Coding 
#include <bits/stdc++.h>

#define uni(x)      (x).resize(unique(ALL(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    string s;
    cin >> s;
    if(s == "ABC"){
        cout << "ARC";
    }else{
        cout << "ABC";
    }
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <vector>

using namespace std;


int main(void){
    int N,K;
    vector<int> Count;
    string S;
    cin >> N >> K;
    cin >> S;
    string tmp = S;
    S += " ";

    Count.resize(N+1,0);

    for(int i=1;i<N;i++){
        Count[i] = Count[i-1];
        if(S[i-1] != S[i]) Count[i]++;
    }

    int ans = 0;
    int cnt = 0;
    int r = 0;
    for(int l=0;l<N;l++){
        while(true){
            if(S[l] == '0' && !(Count[r]-Count[l] <= 2*K-1 && r < N)) break;
            if(S[l] == '1' && !(Count[r]-Count[l] <= 2*K && r < N)) break;

            r++;
            cnt = max(cnt, r-l);
        }
        cnt = max(cnt, r-l);
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 896
using System;


 class Sample25{
        static void Main(string[] args){
           while(true){

            string[] record = Console.ReadLine().Split();
            int midtermExam = int.Parse(record[0]);
            int finalExam = int.Parse(record[1]);
            int reexam = int.Parse(record[2]);
            int total = midtermExam + finalExam;
            int count = 1;
            
            //得点チェック
            if(midtermExam < -1 || 50 < midtermExam || finalExam < -1 || 50 < finalExam || reexam < -1 ||  100 < reexam ){
                Console.WriteLine("{0}番目の生徒の点数は範囲外の値です。データセットを確認してください。",count);
                Environment.Exit(0);
            }
            
            //成績処理
            if (midtermExam == -1 && finalExam == -1 && reexam == -1){
                break;
            }
            else if (total > 79){
               Console.WriteLine("A");
            }
            else if (total <= 79 && total > 64){
                Console.WriteLine("B");
           }
            else if (total > 49 && total <= 64){
                Console.WriteLine("C");
            }
            else if (total > 29 && total < 49 && reexam > 49){
                Console.WriteLine("C");
           }
            else if (total > 29 && total < 49 && reexam <= 49){
                Console.WriteLine("D");
            }
            else{
                Console.WriteLine("F");
            }
            
            //データセットの数が50を超えたら終了
            if(50 < count){
                Console.WriteLine("データセットの数が50を超えています。");
                Environment.Exit(0);
            }
            count++;
        }
    }
}


Measured memory_bytes: 15956
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i=0;i< int (n);i++)

int main(void)
{
    int Q;    
    int  b;
    string n;
    bool ques = true;
    
    cin >> n;

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

   

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    int N;
    cin >> N;
    vector<int> v(N);
    rep(i, N) cin >> v.at(i);

    int ans = 0;

    for(int i = 1; i < N - 1; i++) {
        int pre = v.at(i - 1);
        int now = v.at(i);
        int next = v.at(i + 1);

        if(((next > now) && (now > pre)) || ((pre > now) && (now > next))) {
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
maxNum = -10 ** 10
minNum = 0
n = int(input())

line = []
for i in range(n):
    tmp = int(input())
    if i == 0:
        minNum = tmp
    line.append(tmp)
for i in range(1, len(line)):
    maxNum = max(maxNum, line[i] - minNum)
    minNum = min(minNum, line[i])

print(maxNum)



Measured memory_bytes: 13592
#include <string>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <cmath>

using namespace std;
typedef long long ll;

int main()
{
	int N, A;
	cin >> N >> A;
	bool ans = (N%500) <= A;
	cout << (ans?"Yes":"No") << endl;
	return 0;
}


Measured memory_bytes: 256
n,k,c=map(int, input().split())
s = input()
leftmost = []
cursor = 0
for _ in range(k):
    while s[cursor] == 'x':
        cursor += 1
    leftmost.append(cursor)
    cursor += c+1
rightmost = []
cursor = n-1
for _ in range(k):
    while s[cursor] == 'x':
        cursor -= 1
    rightmost.append(cursor)
    cursor -= c+1
rightmost.reverse()
for l, r in zip(leftmost, rightmost):
    if l == r:
        print(l+1)
#print(leftmost, rightmost)

Measured memory_bytes: 58104
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define YY cout << "Yes" << endl;
#define NN cout << "No" << endl;
#define ve vector
#define pint pair<int,int>
const int INF = 1000000007;
const long double EPS = 1e-15;
const long double PI = acos(-1);
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
map<ll,ll>ans;
void bfs(int now_v,Graph &G){
  queue<int>q;
  vector<int>dist(5000,-1);
  dist[now_v] = 0;
  q.push(now_v);
  while(!q.empty()){
    int now = q.front();
    q.pop();
    for(auto i : G[now]){
      if(dist[i] != -1)continue;
      dist[i] = dist[now] + 1;
      if(i > now_v)ans[dist[i]]++;
      q.push(i);
    }
  }
  return;
}
int solve(){
  int n,x,y;
  cin >> n >> x >> y;
  Graph G(n);
  rep(i,n - 1){
    G[i].push_back(i + 1);
    G[i + 1].push_back(i);
  }
  x--;
  y--;
  G[x].push_back(y);
  G[y].push_back(x);
  rep(i,n)bfs(i,G);
  REP(i,1,n)cout << ans[i] << endl;
  return 0;
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  // cout << fixed;cout << setprecision(16);
  solve();
  return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

int main()
{ios_base::sync_with_stdio(false);
int n;
cin>>n;
map<ll,ll> m;
m[0]=1;
ll s=0,ans=0;
rep(i,1,n)
{
	ll x;
	cin>>x;
	s+=x;
	if(present(m,s))ans+=m[s];
	
	m[s]++;
}
ol(ans);

return 0;
}



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

int main(){
  int64_t x,a;
  a=0;
  cin>>x;
for(int64_t i=-1000;i<=1000;i++){
for(int64_t j=-1000;j<=1000;j++){
if(i*i*i*i*i-j*j*j*j*j==x){cout<<i<<" "<<j<<endl;
                           a=1;
                          break;}
}
  if(a==1){break;}
}
}

Measured memory_bytes: 3632
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {

	public static void main(String[] args) throws IOException {
		Main main = new Main();
		main.run();
	}

	private void run() throws IOException {
		PrintWriter out = new PrintWriter(System.out);
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int S = Integer.parseInt(br.readLine());
		int x = S / 500;
		S -= x*500;
		int y = S/5;
		long result = x*1000+y*5;
		out.println(result);
		out.flush();
		br.close();
	}
}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;

// 原点から時計回りに 0*X:上辺, 1*X:右辺, 2*X:下辺, 3*X:左辺
const ll X=10101010101;

int main(){
  ll R,C; int N; cin>>R>>C>>N;
  vector<pair<ll,int> > V;
  rep(i,N){
    ll r[2],c[2]; cin>>r[0]>>c[0]>>r[1]>>c[1];
    bool flag[2]={};
    rep(j,2){
      if(r[j]==0||r[j]==R||c[j]==0||c[j]==C) flag[j]=1;
    }
    if(flag[0]&&flag[1]){
      rep(j,2){
        if(r[j]==0) V.push_back({c[j],i});
        else if(r[j]==R) V.push_back({-c[j]+2*X,i});
        else if(c[j]==0) V.push_back({-r[j]+3*X,i});
        else if(c[j]==C) V.push_back({r[j]+X,i});
      }
    }
  }
  sort(V.begin(),V.end());
  stack<int> st;
  rep(i,V.size()){
    if(st.empty()) st.push(V[i].second);
    else{
      if(st.top()==V[i].second) st.pop();
      else st.push(V[i].second);
    }
  }
  if(st.empty()) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}


Measured memory_bytes: 6384
#include <iostream>
#include <vector>
#define ll long long
using namespace std;

ll dfs(int key, vector<vector<int>> &v, vector<ll> &t, vector<ll> &u){
    u[key] += t[key];
    for(int i=0; i<v[key].size(); ++i){
        if(u[v[key][i]]<0){
            u[v[key][i]]=0;
            u[v[key][i]] += u[key];
            dfs(v[key][i], v, t, u);
        }
    }
}

int main() {
	int N, Q;
	cin >> N >> Q;
	vector<vector<int>> g(N+1);
	for(int i=1; i<N; ++i){
	    int a, b;
	    cin >> a >> b;
	    g[a].push_back(b);
	    g[b].push_back(a);
	}
	vector<ll> sum(N+1, 0), ans(N+1, -1);
	for(int i=0; i<Q; ++i){
	    int p;
	    ll x;
	    cin >> p >> x;
	    sum[p] += x;
	}
	ans[1]=0;
	dfs(1, g, sum, ans);
	cout << ans[1];
	for(int i=2; i<=N; ++i) cout << ' ' << ans[i];
	cout << endl;
	return 0;
}


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

int main(){
	long long int a[7];
	long long int res;
	for(int i = 0;i < 7;i++) cin >> a[i];
	res += a[1];
	int x = a[0] % 2 + a[3] % 2 + a[4] % 2;
	if(x == 0){
		res += a[0] + a[3] + a[4];
	}else if(x == 1){
		int a0 = a[0] / 2;
		int a3 = a[3] / 2;
		int a4 = a[4] / 2;
		res += (a0 + a3 + a4) * 2;
	}else if(x == 2){
		int a0 = (a[0] - 1) / 2;
		int a3 = (a[3] - 1) / 2;
		int a4 = (a[4] - 1) / 2;
		if(a[0] == 0 || a[3] == 0 || a[4] == 0) res -= 3;
		res += 3 + (a0 + a3 + a4) * 2;
	}else{
		res += a[0] + a[3] + a[4];
	}
	cout << res << endl;
	return 0;	
}

Measured memory_bytes: 256
n, m = map(int,input().split())
l = []
menu_count = []

for i in range(m + 1):
    menu_count.append(0)

ans = 0

for i in range(n):
    l.append(list(map(int,input().split())))

for i in range(n):
    for j in range(1, l[i][0] + 1):
        for k in range(1, m + 1):
            if l[i][j] == k:           #全部の数字に対して調べてない
                #print('menu_count',k,'up')  #この辺の何かがおかしい
                menu_count[k] += 1


for i in range(1, m + 1):
    if menu_count[i] == n:
        ans += 1


#print('l\t\t', l)
#print('menu_count\t', menu_count)
#print('ans\t\t', ans)
print(ans)


Measured memory_bytes: 3064
using System;
using System.Linq;

public class Program
{
    private static long Gcd(long a, long b)
    {
        if (a == b) return a;
        return a > b ? Gcd(a - b, a) : Gcd(a, b - a);
    }

    private static void Main(string[] args)
    {
        string readLine;
        while (!string.IsNullOrEmpty(readLine = Console.ReadLine()))
        {
            var line = readLine.Split().Select(long.Parse).ToList();
            var gcd = Gcd(line[0], line[1]);
            Console.WriteLine("{0} {1}", gcd, line[0] * line[1] / gcd);
        }
    }
}

Measured memory_bytes: 9568
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int A, B, K;
  cin >> A >> B >> K;
  int k = 0;
  for (int i = 100; i >= 1; --i) {
    if (A%i==0 && B%i==0) ++k;
    if (k==K) {
      cout << i << endl;
      return 0;
    }
  }
  return 1;
}

Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VP = vector<P>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    int a, b;
    string s;
    cin >> a >> b >> s;
    if (s[a] != '-'){
        cout << "No" << endl;
        return 0;
    }
    string ss = s.substr(0, a) + s.substr(a+1, b);
    rep(i, ss.size()){
        if (ss[i] < '0' || ss[i] > '9'){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3592
/*
Cerberus97
Hanit Banga
*/

#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

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

const int N = 1e5 + 10;

int solve(int a, int b, int n);

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	if (solve(a, b, n) == 1) {
		cout << "Alice\n";
	} else {
		cout << "Borys\n";
	}
}

int solve(int a, int b, int n) {
	return ((a - b) % 2) + 1;
}


Measured memory_bytes: 256
func main() {
    let input = readLine()!.split(separator: " ").map {Int($0)!}
    let input_L = input[0]
    let input_R = input[1]
    let input_d = input[2]
    var counts = 0
    for it in input_L...input_R {
        if it % input_d == 0 {
            counts += 1
        }
    }
    print(counts)
}

main()

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

int main(){
    float pai = 3.14159265358979;
    int R;
    cin >> R;

    cout << 2*pai*R <<endl;


}

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

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

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

    sort(h.begin(), h.end());
    auto a = lower_bound(h.begin(), h.end(), k);
    cout << distance(a, h.end()) << endl;
    return 0;
}

Measured memory_bytes: 640