akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int D, G; cin >> D >> G;
  vector<int> p(D), c(D);
  for (int i = 0; i < D; i++) cin >> p.at(i) >> c.at(i);
  int ans = 10000;
  for (int bit = 0; bit < (1<<D); bit++) {
    int score = 0;
    vector<int> used;
    int answered = 0;
    for (int i = 0; i < D; i++) {
      if (bit & (1<<i)) {
        score += 100 * (i+1) * p.at(i) + c.at(i);
        used.push_back(i);
        answered += p.at(i);
      }
    }
    if (score < G) continue;
    for (int i = 0; i < used.size(); i++) {
      int j = 0;
      int score0 = score;
      while (j < p.at(used.at(i)) && score0 >= G) {
        if (j == 0) score0 -= c.at(used.at(i));
        score0 -= 100 * (used.at(i)+1);
        j++;
      }
      ans = min(ans, answered - j + 1);
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
a,b,k = gets.chomp.split(" ").map(&:to_i)

a_div = [1]
b_div = [1]

2.upto(a/2) do |i|
  if a % i == 0
    a_div << i
  end
end

2.upto(b/2) do |i|
  if b % i == 0
    b_div << i
  end
end

a_div << a
b_div << b

puts (a_div & b_div).reverse[k-1]

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
// ==================================================
using i64 = int64_t; using u64 = uint64_t;
#define rep(i,a,b) for(i64 i=(int64_t)(a);i<(int64_t)(b);i++)
#define repn(i,n) rep(i,0,n)
#define din(t, ...) t __VA_ARGS__;_din(__VA_ARGS__)
#define v(t,n) vector<t> n
void _din() {} void dout() { cout << endl; }
template <typename T, typename ... Args> inline void _din(T& head, Args& ... rest) { cin >> head; _din(rest...); }
template <typename T, typename ... Args> inline void dout(T head, Args ... rest) { cout << head; if (sizeof...(rest)) cout << ' '; dout(rest...); }
template <typename T>inline void vsortg(vector<T>& v) { sort(v.begin(), v.end(), greater<T>()); }
template <typename T>inline void vsortl(vector<T>& v) { sort(v.begin(), v.end(), less<T>()); }
template <typename T> inline T nmax(T f1, T f2) { return max(f1, f2); }
template <typename T, typename ... Args> inline T nmax(T first, Args ... rest) { return nmax(first, nmax(rest...)); }
template <typename T> inline T nmin(T f1, T f2) { return min(f1, f2); }
template <typename T, typename ... Args> inline T nmin(T first, Args ... rest) { return nmin(first, nmin(rest...)); }
// ==================================================
int main()
{
	din(i64, n, k);
	v(i64, tree);
	repn(i, n)
	{
		din(i64, p);
		tree.push_back(p);
	}
	vsortl(tree);
	i64 t = i64(10e9);
	repn(i, tree.size() - k + 1)
	{
		i64 tmp = tree[i + k - 1] - tree[i];
		if (tmp < t)t = tmp;
	}
	dout(t);
}

Measured memory_bytes: 1400
import java.util.Scanner;

public class Main {
   public static void main(String[] args) {
      Scanner scan = new Scanner(System.in);
	  int iter = 0;
	  
	  while(scan.hasNextLine()) {
	     int i = Integer.parseInt(scan.nextLine());
		 if(i == 0) break;
		 System.out.println("Case " + ++iter + ": " + i);
	  }
   }
}




Measured memory_bytes: 59460
import java.io.*;
import java.util.*;

public class Main {
  private static void execute(ContestReader reader, PrintWriter out) {
    int k = reader.nextInt();
    int x = reader.nextInt();
    out.println(500 * k >= x ? "Yes" : "No");
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public String[] next(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }
  
  public int[] nextInt(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLong(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
  
  public double[] nextDouble(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }
  
  public char[] nextCharArray() {
    return next().toCharArray();
  }
  
  public int[][] nextInt(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }
  
  public long[][] nextLong(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }
  
  public double[][] nextDouble(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
  
  public char[][] nextCharArray(int n) {
    char[][] matrix = new char[n][];
    for (int i = 0; i < n; i++) {
      matrix[i] = next().toCharArray();
    }
    return matrix;
  }
}


Measured memory_bytes: 21460
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
class Program
{     
    public void Slove()
    {
        string[] inputs = Console.ReadLine().Split('/');
        int year = int.Parse(inputs[0]);
        int month = int.Parse(inputs[1]);
        bool heisei = 
            (year <= 2018 ||
            (year == 2019 && month < 5));
        Console.WriteLine(heisei ? "Heisei" : "TBD");
    }
    
    static void Main(string[] args)
    {
        new Program().Slove();
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;

ull F(int x)
{
    if (x < 500) {
        return (x / 5) * 5;
    } else {
        int r = x % 500;
        return (x/500)*1000 + F(r);
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    int x;
    cin >> x;
    cout << F(x) << endl;
}



Measured memory_bytes: 256
K = int(input())
A = [int(i) for i in input().split()]

def solve() :            
    m, M = 2, 2
    for a in A[::-1] :
        if (m - 1) // a == M // a :
            return [-1]
            
        M = M // a * a + a - 1
        x = (m + a - 1) // a
        m = a * x
        
    return [m, M]
    
print(*solve())

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(pi c, pi d){
	return c.S < d.S;
}

int main() {
	string s;
	ll b=0, ans = 0;
	cin >> s;
	for(char c: s){
		if(c== 'B') ++b;
		else{
			ans += b;
		}
	}
	cout << ans;
}


Measured memory_bytes: 640
x,y,nr,ng,nm=map(int,input().split())
r=list(map(int,input().split()))
g=list(map(int,input().split()))
m=list(map(int,input().split()))
r.sort(reverse=True)
g.sort(reverse=True)
a=r[:x]+g[:y]+m
a.sort(reverse=True)
print(sum(a[:x+y]))


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

using namespace std;

int main(){
  int n,p;
  
  while(1)
    {
      cin >> n >> p;
      if(n + p == 0) break;
      
      int man[n];
      for(int i=0;i < n;i++)
	{
	  man[i] = 0;
	}
      int stone = p;
      int i=0;

      while(1){
	
	if(stone == 0 && man[i] == 0)
	  {
	    i++;
	  }
	else if(stone == 0 && man[i] != 0)
	  {
	    stone = man[i];
	    man[i] = 0;
	    i++;
	  }
	else if(stone != 0)
	  {
	    man[i]++;
	    stone--;
	    i++;
	  }
	
	if(i == n) i = 0;

	if(man[i] == p)
	  {
	    cout << i << endl;
	    break;
	  }
      }
    }
  return 0;
}



Measured memory_bytes: 2996
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<stack>
#include<map>
#include<list>
#include<string>
#include<algorithm>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back

#define ll __int64
#define P pair<ll,ll>
//#define __int64 long long
string s,t,a;
string r;
int n,m;


bool che(int p){


	r=s;

	rep(i,m){
		if(s[i+p]!='?'&&t[i]!=s[i+p])return 0;
		if(s[i+p]=='?')r[i+p]=t[i];
	}

	rep(i,n)if(r[i]=='?')r[i]='a';
	return 1;
}


int main(){	
	cin>>s>>t;
	bool ok=0;
	n=s.size(),m=t.size();


	rep(i,n-m+1){
		if(che(i)){
			if(!ok){ok=1;a=r;}
			a=min(a,r);
		}
	}
	if(ok)
	cout<<a<<endl;
	else cout<<"UNRESTORABLE"<<endl;
	
	return 0;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (b % a == 0) {
            System.out.println(a + b);
        } else {
            System.out.println(b - a);
        }
    }
}

Measured memory_bytes: 22100
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
void normalize(vector<P> &num)
{
    if(num.size() > 1)
    {
        if(num.back().first == num[num.size()-2].first)
        {
            num[num.size()-2].second += num.back().second;
            num.pop_back();
        }
    }
}
void inc(vector<P> &num)
{
    if(num.back().second == 1)
    {
        num.back().first++;
    }
    else
    {
        num.back().second--;
        num.push_back(P(num.back().first+1, 1));
    }
    normalize(num);
}

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

    ll low = 0;
    ll high = n + 1;
    while(high - low > 1)
    {
        vector<P> num;
        bool ok = true;
        ll mid = (low + high) >> 1;
        num.push_back(P(0, a[0]));
        for(int i = 1; i < n; i++)
        {
            if(a[i] > a[i-1])
            {
                num.push_back(P(0, a[i]-a[i-1]));
            }
            else
            {
                int sum = 0;
                while(sum + num.back().second <= a[i-1] - a[i])
                {
                    sum += num.back().second;
                    num.pop_back();
                }
                num.back().second -= a[i-1] - a[i] - sum;
                if(num.back().first != mid-1)
                {
                    inc(num);
                }
                else
                {
                    if(num.size() == 1)
                    {
                        ok = false;
                        break;
                    }
                    else
                    {
                        ll tmp = num.back().second;
                        num.pop_back();
                        inc(num);
                        num.push_back(P(0, tmp));
                    }
                }
            }
            normalize(num);
        }
        if(ok) high = mid;
        else low = mid;
    }
    cout << high << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <map>
using namespace std;
typedef long long int ll;

#define MOD 998244353


ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}

bool primeNumber(ll n){
    if(n < 2) return false;
    else{
        for(ll i = 2; i * i <= n; i++){
            if(n % i == 0) return false;
        }
        return true;
    }
}
  
  

int main(){
    ll n,k;
    cin>>n>>k;
    vector<ll> h(n);
    
    for(ll i = 0; i<n; i++){
        cin>>h[i];
    }
    sort(h.begin(),h.end(),greater<ll>());
    
    ll total = 0;
    for(ll i = 0; i<n; i++){
        total += h[i];
    }
    
    for(ll i = 0; i<min(k,n); i++){
        total -= h[i];
    }
    
    cout<< total << endl;
    return 0;
}




Measured memory_bytes: 1792
// #pragma GCC optimize("O3")
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace ::std;
// clang-format off
template<typename T> T nxt() {T res; cin >> res; return res;}
#define tests() for (int _ = nxt<int>(); _ >= 0; _--)
#define nxt1(t,n) t (n); cin >> n
#define nxt2(t,n,m) t (n),(m); cin >> n >> m
#define nxt3(t,n,m,k) t (n),(m),(k); cin >> n >> m >> k
#define rep(i, A) for (int i = 0 ; i < A ; i++)
#define ll long long
typedef pair<int,int> pii;typedef pair<ll, ll> pll;typedef vector<int> vi;typedef vector<vi> vvi;typedef vector<ll> vl;typedef vector<vl> vvl;
#define dbg(vari) cerr<<#vari<<" = "<<(vari)<<endl;
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){for(T ti : t)s<<ti<<" ";return s; }
#define all(x) (x).begin(), (x).end()
#define last(vec) vec[vec.size()-1]
#define has(c,x) ((c).find(x) != (c).end())
// clang-format on

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

    nxt2(ll, N, W);

    vector<pll> items(N);
    rep(i, N) {
        cin >> items[i].first >> items[i].second;
    }

    vvl dp(N + 1);
    rep(i, N + 1) {
        dp[i].assign(W + 1, 0);
    }

    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= W; j++) {
            if (j < items[i - 1].first) {
                dp[i][j] = dp[i - 1][j];
            } else {
                dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - items[i - 1].first] + items[i - 1].second);
            }
        }
    }

    cout << dp[N][W] << endl;

    return 0;
}


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

int main() {
  string S;
  cin >> S;
  bool ans = false;
  if(S.at(0) == S.at(1) && S.at(2) == S.at(3) && S.at(0) != S.at(2)) {
    ans = true;
  }
  else if(S.at(0) == S.at(2) && S.at(1) == S.at(3) && S.at(0) != S.at(1)) {
    ans = true;
  }
  else if(S.at(0) == S.at(3) && S.at(1) == S.at(2) && S.at(0) != S.at(1)) {
    ans = true;
  }
  if(ans) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int64_t A,B,V,W,T;
  cin >> A >> V >> B >> W >> T;
  if(W>=V){
    cout << "NO" << endl;
  }else{
    int64_t dis = abs(B-A);
    int64_t spe = abs(W-V);
    if(spe*T<dis){
      cout << "NO" << endl;
    }else{
      cout << "YES" << endl;
    }
  }
}

Measured memory_bytes: 3636
n = int(input())
a = [int(x) for x in input().split()]
dp = [10 **100 for x in range(n)]
dp[0] = 0
for i in range(0, n):
    if i + 1 < n:
        dp[i + 1] = min(dp[i + 1], dp[i] + abs(a[i] - a[i + 1]))
    if i + 2 < n:
        dp[i + 2] = min(dp[i + 2], dp[i] + abs(a[i] - a[i + 2]))
print(dp[n - 1])

Measured memory_bytes: 53192
///******* In the name of Allah *******///

#include <bits/stdc++.h>
using namespace std;

//long int ar[10013];
//long int gcd(long int a, long int b)
//{
//    if(b==0)
//        return a;
//    return gcd(b,a%b);
//}
//void sieve()
//{
//    long long int i,j,k = 0;
//    memset(ar,0,sizeof(ar));+
//    ar[1] = 1;
//    for(i=2; i<=713; i++)
//    {
//        if(ar[i]==0)
//        {
//            for(j=i+i; j<=713; j+=i)
//            {
//                ar[j] = 1;
//            }
//        }
//    }
//}

char aaa[1013];
void Ok()
{
    long int a,b,c,d,e,f,g,h,t,i,j,k,l,m,n,Min,Max;
    long int ans_1,ans_2,ans_3,cnt_1,cnt_2,cnt_3,flag_1,flag_2,flag_3,temp,sum;
    double aa,bb,cc,dd,ee,ff,gg;
    char bbb,ccc,ddd;
    string spc,in,store;

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cnt_1 = c = 0;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>a>>b;
        if(a==b)
        {
            cnt_1++;
            if(cnt_1==3)
                c = cnt_1;
        }
        else
            cnt_1 = 0;
    }
    (c==3) ? cout<<"Yes"<<endl : cout<<"No"<<endl;

    return;
}

int main()
{
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    Ok();

    return 0;
}


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

using namespace std;

const int INF = 1e9 + 5;

void a()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
}

int main()
{
    a();

    int n;
    cin >> n;
    vector<int> dp(3);

    for(int i = 0; i < n; i++){
        vector<int> aux(3, 0), c(3);

        for(int j = 0; j < 3; j++) cin >> c[j];

        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 3; k++){
                if(j != k){
                    aux[k] = max(aux[k], dp[j] + c[k]);
                }
            }
        }
        dp = aux;
    }

   cout << max({dp[0], dp[1], dp[2]});
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define all(x) begin((x)), end((x))
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 998244353;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) { a = b; return true;}
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) { a = b; return true;}
    return false;
}


int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,s;cin>>n>>s;
    vector<ll> a(n);
    rep(i,n) {
        cin>>a[i];
    }
    vector<vector<ll>> dp(n+1,vector<ll>(s+1,0));
    dp[0][0] = 1;
    rep(i,n) {
        
        rep(j,s+1) {
            // cout << i << " " << j << endl;
            if (j >= a[i]) {
                dp[i+1][j] += dp[i][j-a[i]];
            }
            dp[i+1][j] += dp[i][j] * 2;
            dp[i+1][j] %= MOD;
        }
    }
    // rep(i,n+1) {
    //     rep(j,s+1) {
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    cout << dp[n][s] << endl;
    return 0;
}


Measured memory_bytes: 73676
#AGC013-A
n = int(input())
a = list(map(int,input().split()))
cnt = 0
first = True
up = False
down = False
for i in range(n):
    #print(i)
    if first:
        cnt += 1
        now = a[i]
        if i < n-1:
            #upのとき
            if a[i+1] > now:
                #print('up')
                up = True
                down = False
                first = False
            elif a[i+1] < now:
                #print('down')
                down = True
                up = False
                first = False
            else:
                #print("equal")
                up = False
                down = False
                first = True
                cnt -= 1

            
    else:
        now = a[i]
        if i < n-1:
            if up:
                if now > a[i+1]:
                    first = True

            elif down:
                if now < a[i+1]:
                    first = True

print(cnt)


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n);

  vector<vector<int>> activities(n, vector<int>(3));
  for (int i = 0; i < n; ++i) {
    cin >> activities[i][0] >> activities[i][1] >> activities[i][2];
  }
  vector<vector<int>> dp(n, vector<int>(3, INT_MIN));
  for (int a = 0; a < 3; ++a) {
    dp[0][a] = activities[0][a];
  }
  // dp[0][0] = activities[0][0];
  // dp[0][1] = activities[0][1];
  // dp[0][2] = activities[0][2];
  for (int day = 1; day < n; ++day) {
    for (int activity = 0; activity < 3; ++activity) {
      for (int a = 0; a < 3; ++a) {
        if (activity == a) continue;
        dp[day][activity] =
            max(dp[day][activity], dp[day - 1][a] + activities[day][activity]);
      }
    }
  }
  int ret = INT_MIN;
  for (int v : dp.back()) {
    ret = max(ret, v);
  }
  cout << ret << endl;
  return 0;
}


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

using ll = long long;
ll n, ans;

void dfs(ll a, ll b, ll c, ll x) {
    if (x > n) return;
    if (a && b && c) ans++;

    dfs(1, b, c, x * 10 + 3);
    dfs(a, 1, c, x * 10 + 5);
    dfs(a, b, 1, x * 10 + 7);
}


int main() {
    cin >> n;

    dfs(0, 0, 0, 0);
    cout << ans << endl;

    return 0;
}

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

int main() {
  int N; cin>>N;
  vector<vector<int>> Graph(N);
  vector<pair<int, int>> vp(N-1);
  for(int i=1; i<N; ++i) {
    int a,b; cin>>a>>b;
    a--; b--;
    Graph[a].push_back(b);
    Graph[b].push_back(a);
    vp[i-1]=make_pair(a,b);
  }
  map<pair<int,int>, int> I;
  vector<int> color(N,-1);
  queue<int> que;
  que.push(0);
  color[0]=0;
  int K=0;
  while(!que.empty()) {
    int v=que.front();
    que.pop();
    int colorCnt = 1;
    K=max(K,(int)Graph[v].size());
    for(int u:Graph[v]) {
      if(color[u]!=-1) continue;
      else {
        if(colorCnt==color[v]) colorCnt++;
        que.push(u);
        color[u]=I[{u,v}]=I[{v,u}]=colorCnt;
        colorCnt++;
      }
    }
  }
  cout << K << endl;
  for(auto v:vp) cout << I[v] << endl;
}


Measured memory_bytes: 22468
# -*- coding: utf-8 -*-
from collections import Counter
# input
n = int(input())
s = []
for i in range(n):
    s.append(input())
c = Counter(s)
# output
ma = c.most_common()[0][1]
#o = list(k for k, v in c.items() if v == c.most_common()[0][1])
o = [k for k, v in c.items() if v == ma]
# o.sort()
# print('\n'.join(o))
for i in sorted(o):
    print(i)


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

using namespace std;
int main(){
	string s;
	cin>>s;
	int ans=1e9;
	for(int i=0;i+2<s.size();i++){
		int res=0;
		res=(s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0');
		ans=min(ans,abs(753-res));
	}
	cout<<ans;
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <map>
using namespace std;


int main(){
	/*input*/
	long long n;
	cin >> n;
	map<string,int> ma;
	int i = 0;

	while(i < n){
		string tmp;
		cin >> tmp;
		ma[tmp]++;
		++i;
	}
	map<string,int>::iterator ans = ma.begin();
	int max = ans->second;
	/*calc*/
	for(auto it = ma.begin(); it != ma.end(); ++it){
		if(max < it->second) max = it->second;
//		cout << it->first << " : " << it->second << endl;
	}
	for(auto it = ma.begin(); it != ma.end(); ++it){
		if(max == it->second) cout << it->first << endl;
	}
	
    /*output*/
//	cout<< ans <<endl;
    return 0;
}


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

long rec(vector<int> adj[], int n, int id, bool vis[], long mem[])
{
  if(id==n+1)
    return 0;
  if(vis[id])
    return mem[id];
  if(mem[id]!=-1)
    return mem[id];
  vis[id]=true;
  long ans=-1;
  for(int i=0;i<adj[id].size();i++)
  {
    long a=rec(adj,n,adj[id][i],vis,mem);
    ans=max(ans,a);
  }
  mem[id]=ans+1;
  return mem[id];
}

int main(){
  int n,m;
  cin>>n>>m;
  vector<int> adj[n+1];
  for(int i=0;i<m;i++)
  {
    int x,y;
    cin>>x>>y;
    adj[x].push_back(y);
  }
  bool vis[n+1];
  for(int i=0;i<=n;i++)
	vis[i]=false;
  long mem[n+1];
  for(int i=0;i<=n;i++)
    mem[i]=-1;
  long mx=0;
  for(int i=1;i<=n;i++)
  {
  	if(!vis[i])
  	  mx=max(mx,rec(adj,n,i,vis,mem));
  }
  
  cout<<mx;
	
  
}

Measured memory_bytes: 9984
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
using namespace std ;

typedef long long ll ;
#define rep (i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	int N;
	
	cin >> N;
	int sum = 0;
	for (int i = 1; i <= N; i++)
	{
		sum += i;
	}
	

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
loop do
  n,m = gets.split.map(&:to_i)
  exit if n == 0 and m == 0
  hs = n.times.map{gets.to_i}
  ws = m.times.map{gets.to_i}
  hcount = Hash.new(0)
  hss = hs.inject([0]){|s,i| x = s.last + i; hcount[x] += 1; s << x}[1..-1]
  (0...hs.length).each do |i|
    hss = hss[1..-1].map{|x| x = x - hs[i]; hcount[x] += 1; x}
  end

  wcount = Hash.new(0)
  wss = ws.inject([0]){|s,i| x = s.last + i; wcount[x] += 1; s << x}[1..-1]
  (0...ws.length).each do |i|
    wss = wss[1..-1].map{|x| x = x - ws[i]; wcount[x] += 1; x}
  end
  puts 1.upto(hs.inject(:+)).inject(0){|s,x| s += hcount[x] * wcount[x]}
end

Measured memory_bytes: 48544
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <string>
#include <map>
#include <algorithm>
#include <stack>
#include <cstdlib>
#include <iomanip>
#include <ctime>
using namespace std;
using ll = long long;
using ull = unsigned long long;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
  	cin >> n;
  	vector<int> l(n);
  	for (int i = 0; i < n; i++)
    	cin >> l[i];
  	int ans = 0;
  	for (int i = 0; i < n; i++) {
    	for (int j = i + 1; j < n; j++) {
        	for (int k = j + 1; k < n; k++) {
            	if (l[i] == l[j] || l[i] == l[k] || l[j] == l[k])
                	continue;
              	if (l[i] + l[j] <= l[k])
                  	continue;
              	if (l[i] + l[k] <= l[j])
                  	continue;
              	if (l[k] + l[j] <= l[i])
                  	continue;
              	ans++;
            }
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3668
use std::io;
use std::cmp;
fn main() {
    let mut s = String::new();
    let mut s2 = String::new();
    io::stdin().read_line(&mut s).unwrap();
    let mut s_spl:Vec<&str> = s.trim().split(' ').collect();
    let k: i32 = s_spl[0].to_string().parse().unwrap();
    let mut max = -1;
    let mut a_first = -1;
    let mut a_old = -1;
    io::stdin().read_line(&mut s2).unwrap();
    for s_loop in s2.trim().split(' ') {
        let a:i32 = s_loop.parse().unwrap();
        if a_old == -1 {
            a_first = a;
        }else {
                max = cmp::max(max, a-a_old);
        }
        a_old = a;
    }
    max = cmp::max(max, k + a_first - a_old);
    println!("{}", k-max);
}


Measured memory_bytes: 6396
def solve():
    p = int(input())
    *A, = map(int, input().split())

    L = p-1
    fact = [1]*(L+1)
    rfact = [1]*(L+1)
    r = 1
    for i in range(1, L+1):
        fact[i] = r = r * i % p
    rfact[L] = r = pow(r, p-2, p)
    for i in range(L, 0, -1):
        rfact[i-1] = r = r * i % p
    V = [(-fact[p-1] * rfact[k] * rfact[p-1-k]) % p for k in range(p)]

    R = [0]*p
    I = [i for i, a in enumerate(A) if a]
    C = [a for a in A]

    for k in range(p):
        R[k] = V[k] * sum(C) % p

        for i in I:
            C[i] = C[i] * -i % p
    R[-1] = (R[-1] + len(I)) % p
    R.reverse()
    print(*R)
solve()

Measured memory_bytes: 4088
#include<bits/stdc++.h>
using namespace std;
int main(){
  char a[100];
  cin>>a;
  if(a[1]=='U' && a[0]=='S')
    cout<<"7"<<endl;
  else if(a[0]=='M')
    cout<<"6"<<endl;
  else if(a[1]=='U')
    cout<<"5"<<endl;
  else if(a[0]=='W')
    cout<<"4"<<endl;
  else if(a[2]=='U')
    cout<<"3"<<endl;
  else if(a[0]=='F')
    cout<<"2"<<endl;
  else
    cout<<"1"<<endl;
  return(0);
}
    

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include <bits/stdc++.h>
#include <fstream>
#include<string.h>
#include <algorithm>
#include<math.h>
#include<vector>
#include <queue>
#include <deque> 
#define ll long long
#define M 1000000007 
#define MM 998244353
#define INF 4e18
using namespace std;

ll pwr(ll x,ll y,ll p)
{
    ll res=1;
    x = x % p;
    while(y>0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}

int main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /*ll t,tcitr;
    cin>>t;
    tcitr=0;
    while(tcitr<t)
    {*/
        //cout<<"Case #"<<tcitr+1<<": ";
        ll n;
        cin>>n;
        ll ans=pwr(10,n,M);
        ans+=(M-(2*pwr(9,n,M))%M);
        ans%=M;
        ans+=pwr(8,n,M);
        if(ans>=M)ans-=M;
        cout<<ans<<"\n";
        /*tcitr++;
    }*/
    return 0;
}


Measured memory_bytes: 3648
#include<cstdio>
#include<iostream>
#include<string>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
	string s;
	cin>>s;
	if(s=="ABC")printf("ARC\n");
	else printf("ABC\n");
	return 0;
}


Measured memory_bytes: 3592
#include <stdio.h>

int main(void)
{
  int a, b, c;
  scanf("%d %d %d", &a, &b, &c);
  
  if ((a == b && b != c) || (b == c && c != a) || (c == a && a != b))
  {
    printf("Yes");
  }
  else
  {
    printf("No");
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	for(int n;cin>>n;){
		vvi a(n,vi(n));
		int i=n/2+1,j=n/2;
		rep(k,n*n){
			while(a[i][j]){
				i=(i+1)%n;
				j=(j+n-1)%n;
			}
			a[i][j]=k+1;
			i=(i+1)%n;
			j=(j+1)%n;
		}
		rep(i,n){
			rep(j,n)
				printf("%4d",a[i][j]);
			puts("");
		}
	}
	
	return 0;
}

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

int main() {
	ll n,k;
	cin>>n>>k;
	if((n-2)*(n-1)<2*k){
		cout << "-1";
		return 0;
	}
	ll m=n-1+(n-1)*(n-2)/2-k;
	cout << m<<endl;
	for(int i=0;i<n-1;i++){
		cout << 1<<" "<<i+2<<endl;
	}
	ll cnt= m-(n-1);
	for(int i=0;i<n-1;i++){
		for(int j=i+1;j<n-1;j++){
			if(cnt==0){
				return 0;
			}
			cnt--;
			cout << i+2<< " "<< j+2<<endl;
		}
	}
	return 0;
}

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

/* メモリ食い過ぎ注意 */
#define int long long

typedef long long ll;

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

signed main()
{
    int t;
    vector<int> v;
    cin >> t;
    v.push_back(t);
    cin >> t;
    v.push_back(t);
    cin >> t;
    v.push_back(t);
    sort(v.begin(), v.end());
    cout << v[0] + v[2] * 10 + v[1] << endl;
}


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

int main(){
    int N,K; cin>>N>>K;
    vector<int> l(N);
    for(int i=0;i<N;i++) cin>>l[i];

    int ans=0;
    sort(l.begin(),l.end());
    for(int i=N-1;i>=N-K;i--) ans+=l[i];
    cout<<ans<<endl;
}

Measured memory_bytes: 256
/*author: hyperion_1724
  date: 
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	

	int A,P;
	cin>>A>>P;
	cout<<(3*A+P)/2<<endl;
	

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>

using namespace std;

int main(){
	while (true){
		string str = ""; cin >> str;
		if (str == "-") break;
		int m; cin >> m;
		for (int i = 0; i < m; ++i){
			int h; cin >> h;
			string head = str.substr(0, h);
			string tail = str.substr(h, str.length() - h + 1);
			str = tail + head;
		}
		cout << str << '\n';
	}
}

Measured memory_bytes: 1212
#include <iostream>
#include <vector>
#include <cmath>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)

using namespace std;
typedef long long ll;

int main(){
    
    int X;
    cin>>X;
    
    if(X>=400&&X<=599){
        cout<<8<<endl;
    }else if(X>=600&&X<=799){
        cout<<7<<endl;
    }else if(X>=800&&X<=999){
        cout<<6<<endl;
    }else if(X>=1000&&X<=1199){
        cout<<5<<endl;
    }else if(X>=1200&&X<=1399){
        cout<<4<<endl;
    }else if(X>=1400&&X<=1599){
        cout<<3<<endl;
    }   else if(X>=1600&&X<=1799){
        cout<<2<<endl;
    }else if(X>=1800&&X<=1999){
        cout<<1<<endl;
    }
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
#define ll long long
ll dp[50][50][72];


int main(){
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    
    int n;
    long long k;
    cin>>n>>k;
    memset(dp, 0, sizeof(dp));
    int a[n][n];
    for(int i = 0 ; i < n ; i++){
        for(int j = 0 ; j < n ; j++){
            cin>>a[i][j];
            dp[i][j][0] = a[i][j];
        }
    }
    for(int l = 1 ; l < 72 ; l++){
        for(int i = 0 ; i < n ; i++){
            for(int j = 0 ; j < n ; j++){
                for(int k =  0 ; k < n ; k++){
                    dp[i][j][l] += (dp[i][k][l-1] * dp[k][j][l-1])%mod;
                    dp[i][j][l] = dp[i][j][l]%mod;
                }
            }
        }
    }
   // int i = 0;
    
   vector<int> z;
   int x = 0;
   while(k > 0){
       if(k%2){
           z.push_back(x);
       }
       x++;
       k/=2;
   }

   long long ans[n][n][z.size()];
   memset(ans, 0, sizeof(ans));
   for(int i = 0 ; i  < n ; i++){
       for(int j = 0 ; j < n ; j++){
           ans[i][j][0] = dp[i][j][z[0]];
       }
   }
   for(int k = 1; k < z.size() ; k++){
       for(int i = 0 ; i  < n ; i++){
       for(int j = 0 ; j < n ; j++){
           for(int l = 0 ; l < n ; l++ ){
               ans[i][j][k] += (ans[i][l][k-1]*dp[l][j][z[k]])%mod;
               ans[i][j][k] = ans[i][j][k]%mod;
           }
       }
     }
   }


   long long sum = 0;
   for(int i = 0 ; i < n ; i++){
       for(int j = 0 ; j < n ; j++){
           sum += ans[i][j][z.size()-1];
           sum = sum%mod;
       }
   }
   cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 2816
import math

a,b,c=map(int,input().split())

s=a*b*(1/2)*math.sin(c*math.pi/180)
x=a**2+b**2-2*a*b*math.cos(c*math.pi/180)
x=math.sqrt(x)
L=a+b+x
h=b*math.sin(c*math.pi/180)

print(s,L,h)


Measured memory_bytes: 5712
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)
#define setp(X,Y) cout<<fixed<<setprecision(Y)<<X;
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N;
int A[300010];
int B[300010];

signed main(){
	cin>>N;
	int sum=0;
	REP(i,N){
		cin>>A[i];
	}
	int ans=0;
	for(int i=59;0<=i;i--){
		int num=1LL<<i;
		REP(j,N){
			B[j]=0;
		}
		REP(j,N){
			if(A[j]&num){
				B[j]=1;
			}
			else{
				B[j]=0;
			}
		}
		int cnt=0,cnt2=0;
		REP(j,N){
			if(B[j]==1){
				cnt++;
			}
			else{
				cnt2++;
			}
		}
		int M=0;
		M=(cnt*cnt2)%MOD;
		M=(M*(num%MOD))%MOD;
		ans+=M;
		ans%=MOD;
	}
	cout<<ans<<endl;
	return 0;
}
//1 0 1
//0 1 1

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define mk make_pair
#define pb push_back
#define mod 1000000007

/*int main(){
   int d,t,s;
   cin>>d>>t>>s;
   int time=d/s;
   int ed=d%s;
   if(t<time)cout<<"No"<<endl;
   else if(t>time)cout<<"Yes"<<endl;
   else if(t==time && ed==0)cout<<"Yes"<<endl;
   else if(t==time && ed!=0)cout<<"No"<<endl;
    return 0;
}*/
int main(){
    ll n;cin>>n;
    ll a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    ll pre[n];
    pre[0]=a[0]%mod;
    for(int i=1;i<n;i++)pre[i]=(pre[i-1]%mod+a[i]%mod)%mod;
    ll ans=0;
    for(int i=1;i<n;i++){
    ans=(ans%mod+((pre[i-1]%mod)*(a[i]%mod))%mod)%mod;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 6684
S=input()
K=int(input())
if S[0]!='1':
    print(S[0])
else:
    flag=True
    for i in range(len(S)):
        if S[i]!='1':
            if K<=i:
                print('1')
            else:
                print(S[i])
            flag=False
            break
    if flag:
        print(1)

Measured memory_bytes: 3060
def main():
    N = int(input())
    A = list(map(int, input().split()))
    c = 0
    ans = 0
    while c < 1:
        for i in range(len(A)):
            if A[i] % 2 != 0:
                print(ans)
                return
            A[i] = A[i] // 2
        ans += 1
main()

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

#define _GLIBCXX_DEBAC
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/

using namespace std;

int gcd(int a, int b) {
	int c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

int sort_greater(int m,int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(),greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
		return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

map<string, int> memo;
int main() {
	//sort(a.begin(),a.end());
	int n, r;
	cin >> n >> r;
	if (n < 10) {
		cout << 100 * (10 - n)+r;
	}
	else {
		cout << r;
	}
	
	return 0;
}









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

#define INF (1 << 30)
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define out(x) cout << x << endl;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    int ac = a - b;
    out(max(0, c-ac));
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

ll mpow(ll a, ll b){
	if(b==0){
		return 1;
	}else if(b%2==0){
		ll memo = mpow(a,b/2);
		return memo*memo%MOD;
	}else{
		return mpow(a,b-1) * a % MOD;
	}
}

ll gcd(ll a, ll b){
	if(b==0){
		return a;
	}else{
		return gcd(b, a%b);
	}
}

int main(void){
	ll n,k;
	cin>>n>>k;
	ll ans1,ans2;
	ans1 = n-k+1;
	ans2 = 1;


	reps(i,k){
		cout<<ans1*ans2%MOD<<endl;
		ans1 *= n-k+1-i;
		ans1 %= MOD;
		ans1 *= mpow(i+1, MOD-2);
		ans1 %= MOD;

		ans2 *= k-1-i+1;
		ans2 %= MOD;
		ans2 *= mpow(i, MOD-2);
		ans2 %= MOD;
	}

	return 0;
}


Measured memory_bytes: 256
H, W, N = input().split(" ")
H, W, N = int(H), int(W), int(N)
A = []
for i in range(N):
    A.append([int(j) for j in input().split(" ")])


import itertools
from collections import defaultdict, Counter

c = defaultdict(int)
for a, b in A:
    # そのセルを含む正方形の中心を記録
    for dx,dy in itertools.product([-1,0,1],repeat = 2):
        aa = a + dx
        bb = b + dy
        if 2 <= aa <= H-1 and 2 <= bb <= W-1:
            c[(aa,bb)] += 1
            
result = Counter(c.values())
result[0] = (H-2)*(W-2) - sum(result.values())
 
for j in range(10):
    print(result[j])

Measured memory_bytes: 154104
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            int ac = 0;
            int wa = 0;
            int tle = 0;
            int re = 0;

            for (int i = 0; i < n; i++)
            {
                var input = Console.ReadLine();
                if (input == "AC")
                    ac++;
                else if (input == "WA")
                    wa++;
                else if (input == "TLE")
                    tle++;
                else
                    re++;
            }

            Console.WriteLine($"AC x {ac}");
            Console.WriteLine($"WA x {wa}");
            Console.WriteLine($"TLE x {tle}");
            Console.WriteLine($"RE x {re}");
        }


    }
}


Measured memory_bytes: 30696
def examA():
    N = I()
    ans = N + N**2 + N**3
    print(ans)
    return

def examB():
    S = SI()
    T = SI()
    ans = 0
    for s,t in zip(S,T):
        if s!=t:
            ans += 1
    print(ans)
    return

def examC():
    N, M, K = LI()
    A = LI()
    B = LI()
    SA = 0
    b = 0
    SB = 0
    for i in range(M):
        if SB+B[i]>K:
            break
        SB += B[i]
        b += 1
    #print(b,SB)
    ans = 0
    ans = max(ans,b)
    for i in range(N):
        SA += A[i]
        if SA+SB>K:
            while(b>=0):
                if SA+SB<=K:
                    break
                SB -= B[b-1]
                b -= 1
        if b==-1:
            break
        #print(i,b,SA,SB)

        ans = max(ans,b+i+1)
    print(ans)
    return

def examD():
    def primes(n):
        is_prime = [True] * (n + 1)
        is_prime[0] = False
        is_prime[1] = False
        for i in range(2, int(n ** 0.5) + 1):
            if not is_prime[i]:
                continue
            for j in range(i * 2, n + 1, i):
                is_prime[j] = False
        return [i for i in range(n + 1) if is_prime[i]]
    N = I()
    P = primes(N)
    #print(P)
    D = [1]*(N+1)
    for p in P:
        for i in range(1,1+N//p):
            cnt = 1
            cur = i
            while(cur%p==0):
                cnt += 1
                cur //= p
            D[p*i] *= (1+cnt)

    ans = 0
    for i in range(1,N+1):
        ans += i*D[i]
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examD()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

const ll M = 1000000000000000000;
int main()
{
    int N;
    cin >> N;
    ll sum = 1;
    vector<ll> a(N);
    rep(i, N)
    {
        cin >> a[i];
        if (a[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
    }

    rep(i, N)
    {
        ll t = M / sum;
        if (t < a[i]) {
            cout << -1 << endl;
            return 0;
        }
        sum *= a[i];
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 3996
#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007


 int main(){

  int t;
  cin>>t;

  set<string>ani;

  while(t--){

    string s;
    cin>>s;

    ani.insert(s);
  }

  cout<<ani.size()<<endl;

 return 0;
 }



Measured memory_bytes: 19144
#include<bits/stdc++.h>
#define REP(i, n) for(int i=0; i<n; i++)

using namespace std;

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

	int A, B;
    cin >> A >> B;
	double al = A / 0.08;
	double bl = B / 0.1;
	int c;
	if(al<bl){
	c = int(al);
	}else{
	c = int(bl);
	}
	int ans = -1;
	if(al > bl+10.0 || al+12.5 < bl){
		ans = -1;
	}else if(al<bl){
		int s = c;
		double e = c+12.5;
		while(double(c) < e){
			if(double(c) >= bl && double(c) < bl + 10.0){
				ans = c;
				break;
			}
			c++;
		}
	}else{
        int s = c;
      	double e = c+10.0;
		while(double(c) < e){
			if(double(c) >= al && double(c) < al + 12.5){
				ans = c;
				break;
			}
			c++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int w, h, n, x, y, a, x1, x2, y1, y2;
    cin >> w >> h >> n;
    x1 = 0;
    x2 = w;
    y1 = 0;
    y2 = h;
    while (n--) {
        cin >> x >> y >> a;
        if (a == 1) {
            x1 = max(x1, x);
        } else if (a == 2) {
            x2 = min(x2, x);
        } else if (a == 3) {
            y1 = max(y1, y);
        } else {
            y2 = min(y2, y);
        }
    }
    cout << max(0, x2 - x1) * max(0, y2 - y1);
}


Measured memory_bytes: 256
def find(parent, i)
  t = parent[i]
  return i if t < 0
  t = find(parent, t)
  parent[i] = t
end

def unite(parent, i, j)
  i = find(parent, i)
  j = find(parent, j)
  return if i == j
  parent[j] += parent[i]
  parent[i] = j
end

n, m = gets.split.map(&:to_i)
parent = [-1] * n
m.times do
  a, b = gets.split.map{ |e| e.to_i - 1 }
  unite(parent, a, b)
end
puts -parent.min

Measured memory_bytes: 15908