akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<static_cast<int>(n);++i)
#define per(i, n) for(int i=static_cast<int>(n)-1;i>=0;--i)
#define eee(a) (cerr<<"[@"<<__LINE__<<"] "<<(#a)<<": "<<(a)<<'\n');
#define ppp(a) (cout<<(a)<<'\n'); 
#define cop(a) for(auto x:(a)){cerr<<(x)<<'\n';}
using ll = long long;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
constexpr ll MOD = 1e9+7;
constexpr ll Mod = 998244353;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;
constexpr double phi = (1+sqrt(5))/2;
constexpr double pi = 3.14159265358979323846264338327950288;
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;}
inline ll inverse(ll n,ll m=MOD){ll a=n,b=m,x=1,y=0;while(b){ll t=a/b;a-=t*b;swap(a,b);x-=t*y;swap(x,y);}return (a%m+m)%m;}
inline void Yes(){puts("Yes");}
inline void No(){puts("No");}
inline void Judge(bool b){b?Yes():No();}
inline void YES(){puts("YES");}
inline void NO(){puts("NO");}
inline void JUDGE(bool b){b?YES():NO();}
inline ll powmod(ll b, ll e, ll m=MOD){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
inline double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));}
inline double d2r(double d){return d*pi/180;}
inline double r2d(double r){return r*180/pi;}
template<class T>inline bool chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
template<typename T>inline int bs(int g,int k,T c){while(abs(k-g)>1){int m=(g+k)/2;(c(m)?k:g)=m;}return k;}
template<typename T1,typename T2>ostream& operator<<(ostream& s,const pair<T1, T2>& p){return s <<"("<<p.first<<", "<<p.second<<")";}
template<typename T> ostream& operator<<(ostream& s,const vector<T>& v){s<<'[';for(size_t i=0;i<v.size();++i){s<<v[i];if(i<v.size()-1)s<<", ";}s<<']';return s;}
template<typename T> istream& operator>>(istream& s,vector<T>& v){for(T& x:v)s>>x;return s;}

int main(){
    cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    
    int n;
    cin >> n;
    vector<int> a(n);
    cin >> a;
    
    int cnt = 1;
    for(int i = 0; i < n; ++i){
        if(a[i]%2 == 0){
            cnt *= 2;
        }
    }
    cout << powmod(3, n, LINF)-cnt << '\n';
    
    
    
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>

static const size_t x_max = 100, n_max = 9, s_max = 1000;
static unsigned long long dp[n_max+1][s_max+1];

int main() {
  for (;;) {
    size_t n, s;
    scanf("%zu%zu", &n, &s);
    if (!n && !s)
      return 0;
    for (size_t i = 0; i <= n; i++)
      for (size_t j = 0; j <= s; j++)
        dp[i][j] = 0;
    dp[0][0] = 1;
    size_t l = std::min(s, x_max);
    for (size_t x = 1; x <= l; x++)
      for (size_t i = n; i <= n; i--)
        for (size_t j = s; j <= s; j--) {
          dp[i][j] = dp[i][j];
          if (i && x <= j)
            dp[i][j] += dp[i-1][j-x];
        }
    printf("%llu\n", dp[n][s] + dp[n-1][s]);
  }
}

Measured memory_bytes: 2768
#include<iostream>
using namespace std;
#define MAX 1000000
typedef long long llong;
int n, k;
llong T[MAX];

int check(llong p){
  int i = 0;
  for (int j = 0; j < k; ++j)
  {
    llong s= 0;
    while( s+ T[i] <= p){
      s += T[i];
      i++;
    }
      if( i == n ) return n;
  }
  return i;
}

int solve(){
  llong left = 0;
  llong right = 100000 * 10000;
  llong mid;
  while (right - left > 1) {
    mid = (left + right)/2;
    int v = check(mid);
    if ( v >= n)right = mid;
    else left = mid;
  }

  return right;
}

int main(){

  cin >> n >> k;

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

  llong ans = solve();
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 6044
#include<iostream>
#include<cmath>
#include<iomanip>

using namespace std;

int main()
{
	ios::sync_with_stdio(0);

	int r;
	cin>>r;

	cout<<fixed<<setprecision(10)<<(long double)(2.0 * M_PI * (long double)(r));

	return 0;
}

Measured memory_bytes: 3800
N,K=map(int,input().split())
A=list(map(int,input().split()))
# せいぜいO(|A|)回=O(10^5)のジャンプでループするよね．
# ループしたかどうかの判定（いままで訪れたノードを再び訪れたかの判定はset,dictを使えば高速なはず）

# とりあえずKとか関係なくループするまでの数を調べる
visited = {}  # 訪れたノードの番号-1と訪れたときを保存しているノード
visited[0] = 0 # 初期化
next_node = A[0]-1
count=1
while True:
    if next_node in visited:
        loop_node = next_node
        break
    visited[next_node]=count
    count+=1
    next_node = A[next_node] - 1

loop_width = count-visited[loop_node]
first_loop = visited[loop_node]

if K<=first_loop:
    now_node = 0
    for _ in range(K):
        now_node = A[now_node] -1
    print(now_node + 1)
    exit()
rest = (K-first_loop)%loop_width
now_node=loop_node
for _ in range(rest):
    now_node = A[now_node] - 1
print(now_node + 1)










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

using namespace std;

long long power(long long p, long long n) {
	long long res = 1LL;
	while (n) {
		if (n & 1LL) {
			res *= p;
		}
		p *= p;
		n >>= 1;
	}
	return res;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);                        
	long long n, num;
	cin >> n >> num;
	if (n == 1LL || num == 1LL) {
		cout << num << endl;
	} else {
		vector<long long> a;
		vector<long long> p;
		long long prime = 2LL;
		long long alpha = 0LL;
		while (prime * prime <= num) {
			while (num % prime == 0LL) {
				num /= prime;
				alpha++;
			}
			if (alpha >= 1LL) {
				a.emplace_back(alpha);
				p.emplace_back(prime);
			}
			alpha = 0LL;
			prime++;
		}
		if ((int) p.size() == 0) {
			a.emplace_back(1LL);
			p.emplace_back(num);
		}
		long long ans = 1LL;
		for (int i = 0; i < (int) a.size(); i++) {
			ans *= power(p[i], a[i] / n);
		}
		cout << ans << endl;
	}
	return 0;
}




Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
using namespace std;

#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)

#define FOR(i,a,b) for(ll i = (a);i<(b);i++)
#define REP(i,a) FOR(i,0,(a))
#define MP make_pair

int main() {
	int a, b;
	cin >> a >> b;
	if(a + b >= 10) cout << "error" << endl;
	else cout << a + b << endl;
	return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  
  vector<int64_t> H(N);
  for (int i = 0; i < N; i++) cin >> H[i];
  
  if (K >= N) {
    cout << 0 << endl;
  }
  else {
    int64_t count = 0;
    sort(H.begin(), H.end());
    for (int i = 0; i < N - K; i++) {
      count += H[i];
    }
    
    cout << count << endl;
    
  }
  
  return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
typedef long long int ll;
using namespace std;
#define P 1000000007
#define rep(i,n) for(i=0;i<n;++i)
#define repp(i,a,n) for(i=a;i<n;++i)
#define repr(i,a,n) for(i=a;i>=n;--i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second

ll binpowmod(ll a, ll b, ll m) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

ll binpow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

ll modInverse(ll n, ll p)
{
    return binpowmod(n, p-2, p);
}

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t,m,n,i,f=0,j,ans=0,k,x,r;
    cin >> n ;
    k=n%10;
    n/=10;
    x=n%10;
    n/=10;
    r=n%10;
    if(k==7||x==7||r==7) cout << "Yes " ;
    else cout << "No" ;
    
    
    return 0;
}


Measured memory_bytes: 3608
n = input()
a = []
for i in range(n):
	x,y = raw_input().split()
	z = int(y)
	if x == 'S':
		pass
	elif x == 'H':
		z += 13
	elif x == 'C':
		z += 26
	else:
		z += 39
	a.append(z)
a.sort()
b = []
for j in range(1,53):
	if j in a:
		pass
	else:
		b.append(j)
for k in range(0, int(len(b))):
	i = 0
	while True:
		if b[k] <= 13: break
		i += 1
		b[k] = b[k] - 13
	if i == 0:	print 'S %d' %b[k]
	elif i == 1:print 'H %d' %b[k]
	elif i == 2:print 'C %d' %b[k]	
	else:print 'D %d' %b[k]

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

#############
# Libraries #
#############

import math
from functools import lru_cache

#############
# Constants #
#############

MOD = 10**9 +7
INF = float('inf')

#############
# Functions #
#############

kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#############
# Main Code #
#############

a,b,c = list(map(int,input().split()))
d,e,f = list(map(int,input().split()))
g,h,i = list(map(int,input().split()))

bingo = [a,b,c,d,e,f,g,h,i]


check = [0,0,0,0,0,0,0,0,0]

N = int(input())
for i in range(N):
  z = int(input())
  for j in range(9):
    if bingo[j] == z:
      check[j] = 1
      
is_bingo = 0

if check[0] and check[1] and check[2]:
  is_bingo = 1
if check[3] and check[4] and check[5]:
  is_bingo = 1
if check[6] and check[7] and check[8]:
  is_bingo = 1
if check[0] and check[3] and check[6]:
  is_bingo = 1
if check[1] and check[4] and check[7]:
  is_bingo = 1
if check[2] and check[5] and check[8]:
  is_bingo = 1
if check[0] and check[4] and check[8]:
  is_bingo = 1
if check[2] and check[4] and check[6]:
  is_bingo = 1

  
if is_bingo:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 38384
H,W = map(int,input().split())

a=[list(map(int,list(input().split()))) for i in range(H)]

for i in range(H):
    for j in range(W):
        print(a[i][j],end=' ')
    print(sum(a[i]))

for i in range(W):
    print(sum([row[i] for row in a]),end=' ')
print(sum(map(sum, a)))


Measured memory_bytes: 6228
#include<bits/stdc++.h>
using namespace std;
int n,m;
int ans;
vector<int> vec[9];
void dfs(int now,int bit){
    if(bit==((1<<(n+1))-1)){
        ans++;
    }
    for(int i=0;i<vec[now].size();i++){
        if(!(bit&(1<<vec[now][i]))){
            dfs(vec[now][i],bit|(1<<vec[now][i]));
        }
    }
}
int main(){
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        vec[a].push_back(b);
        vec[b].push_back(a);
    }
    vec[0].push_back(1);
    dfs(0,1);
    cout<<ans<<endl;
    return 0;
}

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

int main() {
	int m = 0, f = 0, r = 0;
	while (1) {
		cin >> m >> f >> r;
		if (m == -1 && f == -1 && r == -1)
			break;
		else if (m == -1 || f == -1)
			cout << "F" << endl;
		else if ((m + f) >= 80)
			cout << "A" << endl;
		else if ((m + f) >= 65)
			cout << "B" << endl;
		else if ((m + f) >= 50)
			cout << "C" << endl;
		else if ((m + f) >= 30) {
			if (r >= 50)
				cout << "C" << endl;
			else
				cout << "D" << endl;
		}
		else
			cout << "F" << endl;
	}
}

Measured memory_bytes: 3092
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		sc.close();
		
		if (Math.abs(m-n) > 1){
			System.out.println(0);
			return;
		}
		else{
			int res = amari(kaijyo(m),kaijyo(n));
			System.out.println(res);
			return;
		}
	}
	
	static int kaijyo(int a){
		long ans = 1;
		for (int i=1; i<=a; i++){
			ans *= i;
			ans = ans % (int)(Math.pow(10, 9)+7);
		}
		return (int)ans;
	}
	
	static int amari(int a, int b){
		long ans;
		if (a == b){
			ans = (long)a*b*2 % (int)(Math.pow(10, 9)+7);	
		}
		else{
			ans = (long)a*b % (int)(Math.pow(10, 9)+7);
		}
		return (int)ans;
	}
}


Measured memory_bytes: 23892
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass : Scanner
{
    static void Main()
    {
        var (N, x) = ReadStream<int, long>();
        var A = RLongs();
        long ans = 0;
        for (int i = 0; i < N-1; i++)
        {
            var dif = (A[i] + A[i + 1]) - x;
            if (dif>0)
            {
                if (dif > A[i + 1])
                {
                    ans += dif;
                    A[i + 1] = 0;
                }
                else
                {
                    ans += dif;
                    A[i + 1] -= dif;
                }
            }
        }
        WriteLine(ans);
    }
}

class Scanner
{
    public static int RInt() => int.Parse(Console.ReadLine());
    public static long RLong() => long.Parse(Console.ReadLine());
    public static string RString() => Console.ReadLine();
    public static double RDouble() => double.Parse(Console.ReadLine());

    public static int[] RInts() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
    public static int[] RInts(Func<string, int> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static long[] RLongs() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
    public static long[] RLongs(Func<string, long> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static double[] RDoubles() => Array.ConvertAll(Console.ReadLine().Split(), double.Parse);
    public static double[] RDoubles(Func<string, double> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static string[] RStrings() => Console.ReadLine().Split();
    //public static string[] RStrings(Func<string, string> func) => Console.ReadLine().Split().Select(func).ToArray();
    private static T TypeConverter<T>(string r)
    {
         return(T)Convert.ChangeType(r, typeof(T));
    }
    public static T1 ReadStream<T1>()
    {
        var r = RStrings();
        return TypeConverter<T1>(r[0]);
    }
    public static (T1, T2) ReadStream<T1, T2>()
    {
        var r = RStrings();
        var r1 = TypeConverter<T1>(r[0]);
        var r2 = TypeConverter<T2>(r[1]);
        return (r1, r2);
    }
    public static (T1, T2, T3) ReadStream<T1, T2, T3>()
    {
        var r = RStrings();
        var r1 = TypeConverter<T1>(r[0]);
        var r2 = TypeConverter<T2>(r[1]);
        var r3 = TypeConverter<T3>(r[2]);
        return (r1, r2, r3);
    }
    public static (T1, T2, T3, T4) ReadStream<T1, T2, T3, T4>()
    {
        var r = RStrings();
        var r1 = TypeConverter<T1>(r[0]);
        var r2 = TypeConverter<T2>(r[1]);
        var r3 = TypeConverter<T3>(r[2]);
        var r4 = TypeConverter<T4>(r[3]);
        return (r1, r2, r3, r4);
    }
}

Measured memory_bytes: 38892
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
using ll = long long;
using ld = long double;
long double pi = 2*acos(0.0);

void solve() {
    ll a, b, h, m;
    cin >> a >> b >> h >> m;
    h %= 12; m %= 60;
    ld am = m * 6, ah = h * 30 + (ld)m / 2, diff = am - ah;
    if(diff < 0) diff = -diff;
    if(diff > 180) diff = 360 - diff;
    cout << setprecision(15) << sqrt(a * a + b * b - (2 * a * b * cos((pi * diff) / 180)));
}

int main() {
    ios_base :: sync_with_stdio(false); 
    cin.tie(NULL);
    ll t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 4136
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<stack>
#include<iostream>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define MOD 1000000007
#define vec(a) vector<int>a
using namespace std;


int main()
{
#ifndef ONLINE_JUDGE
	freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);
#endif
	fastio
	ll n,i,j,k,l;
	cin>>n;
	map<string,ll> m;
	while(n--)
	{
		string str;
		cin>>str;
		m[str]++;
	}
	map<string,ll>::iterator it;
	k=0;
	for(it=m.begin();it!=m.end();it++)
	{
		if(it->second>k)
			k=it->second;
	}
	for(it=m.begin();it!=m.end();it++)
	{
		if(it->second==k)
			cout<<it->first<<"\n";
	}
	return 0;
}


Measured memory_bytes: 19220
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define pi pair<int,int> 
#define pii pair<pi,int>
#define ull unsigned long long
#define vi vector<int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
	if(b==0)return a;
	return gcd(b,a%b);
}
ll fastexp(ll x,ll a){
    ll res = 1;
    while(a>0){
        if(a&1){
            res = (res*x)%mod;
        }
        a=a>>1;
        x=(x*x)%mod;
    }
    return res;
}
ll inverse(ll n){
    return fastexp(n,mod-2);
}
template <typename T>
void add(T &a, T b){
	a += b;
	if(a >= mod)a -= mod;
}
template <typename T>
void sub(T &a, T b){
	a -= b;
	if(a < 0)a += mod;
}
template <typename T>
void mul(T &a, T b){
	a *= b;
	if(a >= mod)a %= mod;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	string s;
	cin>>s;
	int c = 0;
	rep(i,n){
		int j = i;
		c++;
		while(j+1 < n && s[j+1] == s[i]){
			j++;
		}
		i = j;
	}
	cout<<c;
	return 0;
}

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

using namespace std;

int main() {
#ifdef _DEBUG
	freopen("_in" , "r", stdin );
	freopen("_out", "w", stdout);
#endif
	int n; cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a.begin(), a.end());
	int ans = 0;
	for (int i = 0; i < n - 2; i++)
	for (int j = i + 1; j < n - 1; j++) {
		int dk1 = upper_bound(a.begin() + j + 1, a.end(), a[i] - a[j]) - a.begin();
		int dk2 = upper_bound(a.begin() + j + 1, a.end(), a[j] - a[i]) - a.begin();
		int dk3 = lower_bound(a.begin() + j + 1, a.end(), a[i] + a[j]) - a.begin();
		ans += dk3 - max(dk1, dk2);
	}
	cout << ans << '\n';
}


Measured memory_bytes: 3620
#include<stdio.h>
int main(void){
    int i,n,m;
scanf("%d",&n);
for(i=3;i<n+1;i++){
    m=i;
 if(i%3==0) printf(" %d",i);
else
 while(m>0){


    if(m%10==3) 
    {printf(" %d",i);
break;
}

      m/=10;
 }

}
printf("\n");
 return 0;
}


Measured memory_bytes: 2132
//============================================================================
//Everyone has a different way of thinking, so God Created us
//   Hope You Respect My Way..,Thank You ):
// Author      : Murad
// Name        : Codeforces.cpp & Atcoder.cpp
// Description : Problem name
//============================================================================
#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define pi 3.1415926536
#define forn(i,a,b)for(int i=a;i<b;i++)
#define LL long long
#define ULL unsigned long long
#define MP make_pair
#define SZ(c) int(c.size())
#define ff first
#define ss second
#define INF INT32_MAX
#define _INF INT32_MIN
#define PQ priority_queue
#define MM multimap
#define PB push_back
#define vii vector<int>
#define ipair pair<int,int>
#define lpair pair<LL,LL>
#define MAXN 100004
#define El3zba ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define modd 1000000007
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'
//std::transform(s1.begin(), s1.end(), s1.begin(),::tolower);
char alphz[27] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };
int main() {
	El3zba;
	int n,m,c;
	cin>>n>>m>>c;
	vector<int>b(m);
	int ans=0;
	for(int i=0;i<m;i++)
		cin>>b[i];
	for(int i=0;i<n;i++)
	{
		int sum=0;
		for(int j=0;j<m;j++)
		{
			int x;
			cin>>x;
			sum+=b[j]*x;
		}
		if(sum+c>0)
			ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int k=0,i;
  for(i=1;i<=n;i++)
  {
    if(i%2!=0)
      k++;
  }
  double res;
  res=(double)k/(double)n;
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI acos(-1.0)
#define test() int t; cin>>t; while(t--)
#define ll long long int

int main()
{
	IOS;
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll x, k, d;
	cin >> x >> k >> d;
	x = abs(x);
	ll a = min(k, x / d);
	k -= a;
	x -= a * d;
	if (k & 1) {
		cout << d - x << endl;
	}
	else	cout << x << endl;
	return 0;
}


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

int main(){
    long long N;
    cin >> N;
    long long count=0;
    long long val;
    long long min_val = N;
    for(int i=0; i<N; i++){
        cin >> val;
        if(val <= min_val){
            count += 1;
            min_val = val;
        }
    }

    cout << count << endl;
    return 0;


}

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

int main(void){
    
    int a,b; cin >> a >> b;
    
    if(a < b) cout << "a < b" << endl;
    else if (a == b) cout << "a == b" << endl;
    else cout << "a > b" << endl;
    
    return 0;
    
}


Measured memory_bytes: 3112
from collections import Counter

N, *A = map(int, open(0).read().split())

s = [0] * (N + 1)
for i in range(N):
    s[i + 1] = s[i] + A[i]

ctr = Counter(s)
ans = 0
for v in ctr.values():
    if v == 1:
        continue
    ans += v * (v - 1) // 2
    
print(ans)


Measured memory_bytes: 102220
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
using namespace std;

int main(){
	int N;
	while(cin>>N,N){
		int chart[11][11]={};
		for(int i=0;i<N;i++)for(int j=0;j<N;j++) cin>>chart[i][j];
		for(int i=0;i<=N;i++){
			int sumW=0,sumH=0;
			for(int j=0;j<N;j++){
				sumW += chart[i][j];
				sumH += chart[j][i];
			}
			chart[i][N] = sumW;
			chart[N][i] = sumH;
		}
		for(int i=0;i<=N;i++){
			for(int j=0;j<=N;j++){
				printf("%5d",chart[i][j]);
			}puts("");
		}
	}
    return 0;
}

Measured memory_bytes: 1160
# define _CRT_SECUREj_NO_WARNINGS 1
# define _USE_MATH_DEFINES
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <forward_list>
# include <map>
# include <stack>
using namespace std;
# define INF ((int)(1<<25))
# define REP(i,n) for(int i=0;i<(int)n;i++)
# define FOR(i,n) REP(i,n)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define TORAD 2.0*M_PI/360.0
# define INT(x) int x;cin>>x;
# define ALL(x) (x).begin(),(x).end()
# define RALL(x) (x).rbegin(),(x).rend()
# define DEBUG(x) cout<<#x<<":"<<x<<endl;
# define EPS 1e-12
#ifdef _MSC_VER
#include <intrin.h>
#define __builtin_popcount __popcnt
#endif
#define int long long
typedef long long lint;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
const int dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 };
template<class T> void debug(T a) { for (auto i : a)cout << i << endl; }

const int M = 110;
int f[M][M];
int v, e, r;

signed main()
{
	cin >> v >> e;
	FOR(i, M)FOR(j, M)f[i][j] = INT_MAX;
	FOR(i, M)f[i][i] = 0;
	FOR(i, e)
	{
		int s, t, d;
		cin >> s >> t >> d;
		f[s][t] = d;
	}

	FOR(k, M)
	{
		FOR(i, M)
		{
			FOR(j, M)
			{
				if (f[i][k] == INT_MAX || f[k][j] == INT_MAX)continue;
				f[i][j] = min(f[i][j], f[i][k] + f[k][j]);
			}
		}
	}
	FOR(i, M)if (f[i][i] < 0) { cout << "NEGATIVE CYCLE" << endl; return 0; }

	FOR(i, v)
	{
		FOR(j, v)
		{
			if (j)cout << " ";
			if (f[i][j] == INT_MAX)cout << "INF";
			else cout << f[i][j];
		}
		cout << endl;
	}
}

Measured memory_bytes: 3208
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
double ans=0;
for(int i=0;i<n;i++)
{
	string x;
	double wl;
	cin>>wl>>x;
	if(x=="JPY")
	{
		ans+=wl;
	}
	else
	{
		ans+=wl*380000;
	}
}
cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                    \
  ifstream in("abc157/abc157_a.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE;
  CIN_OPTIMIZE;

  int K, X;
  cin >> K >> X;

  string ans;
  if (K * 500 >= X) {
    ans = "Yes";
  } else {
    ans = "No";
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
  std::vector<int> v(3);
  std::cin >> v[0] >> v[1] >> v[2];
  std::sort(v.begin(), v.end());
  std::cout << (v[2] & 1) * (long long) v[0] * v[1] << '\n';
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		long c = scanner.nextLong();
		long xs[] = new long[n+1];
		xs[0]=0;
		long vSum1[] = new long[n+1];
		vSum1[0]=0;
		long e1[] = new long[n+1];
		long e2[] = new long[n+1];	//逆周り

		ArrayList<long[]> max1 = new ArrayList<>();
		ArrayList<long[]> max2 = new ArrayList<>();


		for (int i=1; i<=n; i++) {
			xs[i] = scanner.nextLong();
			vSum1[i] = scanner.nextInt() + vSum1[i-1];
			e1[i] = vSum1[i] - xs[i];
			if (max1.isEmpty() || e1[i] >= max1.get(max1.size()-1)[1]) {
				long[] tmp = {xs[i], e1[i]};
				max1.add(tmp);
			}
		}
		for (int i=n; i>=1; i--) {
			e2[i] = (vSum1[n] - vSum1[i-1]) - (c-xs[i]);
			if (max2.isEmpty() || e2[i] >= max2.get(max2.size()-1)[1]) {
				long[] tmp = {xs[i], e2[i]};
				max2.add(tmp);
			}
		}


		long max = 0;
		int ind = max2.size()-1;
		big1:for (long[] data: max1) {
			while (max2.get(ind)[0] <= data[0]) {
				if (ind==0) {
					max = Math.max(max, data[1]);
					break big1;
				}
				ind--;
			}
			if (data[0] >= max2.get(ind)[1]) {
				max = Math.max(max, data[1]);
			}else {
				max = Math.max(max, data[1]-data[0]+max2.get(ind)[1]);
			}
		}
		ind = max1.size()-1;
		big2:for (long[] data: max2) {
			while (max1.get(ind)[0] >= data[0]) {
				if (ind==0) {
					max = Math.max(max, data[1]);
					break big2;
				}
				ind--;
			}
			if (c-data[0] >= max1.get(ind)[1]) {
				max = Math.max(max, data[1]);
			}else {
				max = Math.max(max, data[1]-(c-data[0])+max1.get(ind)[1]);
			}
		}

		System.out.println(max);
	}

}

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

int main() {
  int groupCount, a;
  cin >> groupCount;
  
  int ans = 0;
  for(int i = 0; i < groupCount; i++) {
    int from, to;
    cin >> from >> to;
    ans += to - from + 1;
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sn = new Scanner(System.in);
		while (true) {
			int n = sn.nextInt();
			if (n == 0) {
				break;
			}
			int[] point = new int[n];
			for (int i = 0; i < n; i++) {
				point[i] = sn.nextInt();
			}

			Arrays.sort(point);

			int sum = 0;
			for (int i = 1; i < point.length - 1; i++) {
				sum += point[i];
			}
			System.out.println(sum / (n - 2));
		}
	}
}

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

s = []
for i in range(n):
  a, b = input().split()
  if a == b:
    s.append(True)
  else:
    s.append(False)

flag = 'No'

for i in range(n - 2):
  if s[i] and s[i+1] and s[i+2]:
    flag = 'Yes'

print(flag)


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

int main (){
	int n, a, b, c, d;
	int people[120] = { 0 };
	while ( cin >> n){
		for ( int i = 0; i < n; i++){
			cin >> a >> b >> c >> d;
			people[ ( 30 * ( a - 1)) + ( 10 * ( b - 1)) + c - 1] += d;
		}
		for ( int o = 0; o < 12; o++){
			if ( o == 3 || o == 6 || o == 9){
				cout << "####################" << endl;
			}
			for ( int p = 0; p < 10; p++){
				cout << " " << people[ p + ( o * 10)];
			}
			cout << endl;
		}
	}
	return 0;
}


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

int main() {

  while( true ) {

    long long int n;
    cin >> n;
    if ( n == 0 ) break;

    char d[256];
    for ( long long int i = 0; i < 256; i++ ) {
      d[i] = i;
    }

    for ( long long int i = 0; i < n; i++ ) {
      char in, out;
      cin >> in >> out;
      d[in] = out;
    }

    long long int m;
    cin >> m;

    for ( long long int i = 0; i < m; i++ ) {
      char in;
      cin >> in;
      cout << d[in];
    }
    cout << endl;

  }

  return 0;

}

Measured memory_bytes: 1152
x, y = map(int, input().split())

if x == 2 or x == 11:
	print('No')
elif x == 4 or x == 6 or x == 9:
	if y == 6 or y == 9 or y == 11:
		print('Yes')
	else:
		print('No')
else:
	if y == 3 or y == 5 or y == 7 or y == 8 or y == 10 or y == 12:
		print('Yes')
	else:
		print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++) 
#define all(v) begin(v),end(v)
using ll = long long;

int main() {
  int n;string s;cin>>n>>s;
  int ans=0;
  rep(i,1000){
    string t;int x=i;
    rep(j,3){
      t+='0'+x%10;
      x/=10;
    }
    int a=0;
    rep(j,n){
      if(s[j]==t[a])a++;
      if(a==3){
        ans++;
        break;
      }
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3688
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9+7;

int a, b, c, x, y;
int pyen(int x, int y){
  if(x==y) return min(a, b);
  else if(x>y) return a;
  else return b;
}
 
int main(){
  cin >> a >> b >> c >> x >> y;

  cout << min({a*x+b*y, 2*c*max(x, y), 2*c*min(x, y)+abs(x-y)*pyen(x, y)}) << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    string s, t;
    cin >> s >> t;
    string ans = "YES";
    rep(i, 3) {
        if (s[i]!=t[2-i]) ans = "NO";
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,K;
    int ans=1;

    cin>>N;
    cin>>K;

    for(int i=0;i<N;i++){
        if(ans*2>ans+K){
            ans=ans+K;
        }
        else{
            ans=ans*2;
        }
    }

    cout<<ans<<endl;

}

Measured memory_bytes: 256
import java.util.Scanner;
class Main
{
    public static void main(String args[])
    {
	Scanner scan=new Scanner(System.in);
	int a,b,temp;
	a=scan.nextInt();
	b=scan.nextInt();
	if(b>a)
	    {
		temp=a;
		a=b;
		b=temp;
	    }
	while(a%b!=0)
	    {
		int tmp=b;
		b=a%b;
		a=tmp;
		
		
	    }
	System.out.println(b);
    }
}

Measured memory_bytes: 17284
results = []
grades = []

while True:
    result = list(map(int, input().split()))
    if result == [-1, -1, -1]:
        break
    results.append(result)
    
#print(results)

for i in range(len(results)):
    mid = results[i][0]
    ret = results[i][2]
    fin = results[i][1]
    if mid == -1 or fin == -1:
        grades.append("F")
    elif mid + fin >= 80:
        grades.append("A")
    elif mid + fin >= 65 and mid + fin < 80:
        grades.append("B")
    elif mid + fin >= 50 and mid + fin < 65:
        grades.append("C")
    elif mid + fin >= 30 and mid + fin < 50:
        if ret >= 50:
            grades.append("C")
        else:   
            grades.append("D")
    else:
        grades.append("F")
    
for i in range(len(results)):
    print(grades[i])
         


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


def get_input() -> int:
    """
    標準入力の取得

    Returns:\n
        int: 標準入力
    """
    N = int(input())

    return N


def main(N: int) -> None:
    """
    求解処理.

    Args:\n
        N (int): 999以下の整数
    """
    """
    Nの1桁目で場合分け.
    """
    result = str()
    first_place = N % 10
    if first_place in [2, 4, 5, 7, 9]:
        result = "hon"
    elif first_place in [0, 1, 6, 8]:
        result = "pon"
    else:
        result = "bon"

    # 求解処理
    print(result)


if __name__ == "__main__":
    N = get_input()
    main(N)


Measured memory_bytes: 9216
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;

//#define int long long
using bll = boost::multiprecision::cpp_int;
using ll = long long;
//constexpr int INF = 1e9;//INT_MAX=(1<<31)-1=2147483647
constexpr ll INF = (ll)1e18;//(1LL<<63)-1=9223372036854775807
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-9;
constexpr int dx[4]={1,0,-1,0};
constexpr int dy[4]={0,1,0,-1};
#ifdef LOCAL_ENV
	#define debug(var) std::cout<<#var" = "<<var<<std::endl
#else
	#define debug(var)
#endif
#define p(var) std::cout<<var<<std::endl
#define rep(i, n)   for(ll i=0, i##_length=(n); i< i##_length; ++i)
#define repeq(i, n) for(ll i=1, i##_length=(n); i<=i##_length; ++i)
#define all(a) (a).begin(), (a).end()
#define PI (acos(-1))
template<typename T> inline T power(T x, T n){ return n ? power(x*x%MOD,n/2)*(n%2?x:1)%MOD : 1; }
template<typename T> inline T gcd(T a, T b) { return b ? gcd(b,a%b) : a; }
template<typename T> inline T lcm(T a, T b) { return a / gcd(a,  b) * b; }
template<typename T1, typename T2>inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2>inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	for (int i = 0, len = v.size(); i < len; ++i){
		s << v[i]; if (i < len - 1) s << "\t";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
	for (int i = 0, len = vv.size(); i < len; ++i){
		s << vv[i] << endl;
	}
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
	s << "{" << endl;
	for (typeof(m.begin()) itr = m.begin(); itr != m.end(); ++itr){
		s << "\t" << (*itr).first << " : " << (*itr).second << endl;
	}
	s << "}" << endl;
	return s;
}

/*-----8<-----8<-----*/

signed main() {
	ll N;
	scanf("%lld", &N);

	rep(i,N){
		for(ll j=i+1;j<N;j++){
			ll k=0;
			while(1){
				ll a=i & 1<<k;
				ll b=j & 1<<k;
				if(a^b){
					printf("%lld ",k+1);
					break;
				}else{
					k++;
				}
			}
		}
		puts("");
	}

	return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <vector>
using namespace std;
#define INF 2000000000
#define pb push_back
int N,M,P,a,b;
int t[10];
struct edge
{
	int to;
	double cost;
	edge(int to,double cost):to(to),cost(cost){}
};
vector<edge> g[40];
double dp[40][1<<8];
double rec(int v,int bit)
{
	if(dp[v][bit]!=-1)return dp[v][bit];
	double res = INF;
	for(int i=0;i<g[v].size();i++)
	{
		int u = g[v][i].to;
		double cost = g[v][i].cost;
		for(int j=0;j<N;j++)
		{
			if(!((bit>>j)&1))
			{
				res=min(res,rec(u,bit|(1<<j))+cost/t[j]);
			}
		}
	}
	return dp[v][bit]=res;
}
int main()
{
	while(1)
	{
		for(int i=0;i<40;i++)g[i].clear();
		scanf("%d %d %d %d %d",&N,&M,&P,&a,&b);
		if(N==0&&M==0&&P==0&&a==0&&b==0)break;
		a--;b--;
		for(int i=0;i<N;i++)scanf("%d",&t[i]);
		for(int i=0;i<P;i++)
		{
			int x,y;
			double z;
			scanf("%d %d %lf",&x,&y,&z);
			x--;y--;
			g[x].pb(edge(y,z));
			g[y].pb(edge(x,z));
		}
		for(int i=0;i<M;i++)for(int j=0;j<(1<<N);j++)dp[i][j]=-1;
		dp[a][(1<<N)-1]=0;
		double ans = INF;
		for(int i=0;i<(1<<N);i++)ans = min(ans,rec(b,i));
		if(ans == INF)printf("Impossible\n");
		else printf("%f\n",ans);
	}
	return 0;
}

Measured memory_bytes: 1168
// #include C/C++ {
#include <bits/stdc++.h>
// }
using namespace std;
// #typedef {
typedef long long int64;
typedef pair <int, int> PII;
typedef pair <int64, int64> PLL;
// }

// #parameter{
#ifdef _DEBUG

#define TYPE decltype
#define RF(filename) {freopen((filename), "r", stdin);}
#define WF(filename) {freopen((filename), "w", stdout);}
#define DF(filename) {freopen((filename), "w", stderr);}
#define eprintf printf

#else

#define TYPE __typeof
#define RF(filename) {;}
#define WF(filename) {;}
#define DF(filename) {;}
#define eprintf(...)
#define fprintf(...)

#endif

// #define {
#define SZ(a) ((int)(a).size())
#define X first
#define Y second
#define MP make_pair
#define L(x) ((x)<<1)
#define R(x) ((x)<<1 | 1)
#define max3(x, y, z) (max(max((x), (y)), (z)))
#define min3(x, y, z) (min(min((x), (y)), (z)))
#define BIT(x, i) (((x) >> (i)) & 1)
#define ALL(it) (it).begin(), (it).end()
#define FILL(__space, __val) memset(__space, __val, sizeof(__space))
#define MOVE(__spaceTo, __spaceFrom) memmove(__spaceTo, __spaceFrom, sizeof(__spaceTo))
#define UNIQUE(__vector) sort(ALL(__vector)), __vector.resize(unique(ALL(__vector)) - __vector.begin())
#define FOR(it, c) for( TYPE((c).begin()) it = (c).begin(); it != (c).end(); it++)
/////////////////////////////////////////////////////////////
const double PI = acos(-1.0);
const double EPS = 1e-6;

#define MAX_N 100005
#define MAX_M 55
#define MOD (int)(1e9+7)
#define INF ((1 << 30) - 1)
#define BINF ((1LL << 62) - 1LL)
#define NONE -1
#define NIL 0
// }

/////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////
int main() {
	RF("input.txt");
	// WF("output.txt");
	DF("err.txt");

	int N, K;
	scanf("%d %d", &N, &K);
	vector <int> fac;
	for (int i = 1; i * i <= N; i++) {
		fac.push_back(i);
		if (i * i != N) fac.push_back(N / i);
	}
	fac.push_back(0);
	int m = fac.size() - 1;
	sort(ALL(fac));
	vector <vector <int>> dp(K + 1, vector <int>(m));
	dp[0][0] = 1;
	for (int i = 0; i < K; i++) {
		for (int j = 1; j < m; j++) dp[i][j] = (dp[i][j] + dp[i][j - 1]) % MOD;
		for (int j = 0; j < m; j++) dp[i + 1][j] = (dp[i + 1][j] + 1LL * dp[i][m - 1 - j] * (fac[j + 1] - fac[j]) % MOD) % MOD;
	}
	int res = 0;
	for (int j = 0; j < m; j++) res = (res + dp[K][j]) % MOD;
	printf("%d\n", res);
	return 0;
}

Measured memory_bytes: 25852
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<random>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
typedef vector<vt>vvt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

const int MOD=1000000007;
const int M=300000;
vi fact,rev;
bool do_init=false;
ll powmod(ll a,ll b,ll m=MOD){
	ll out=1;
	ll p=a%m;
	while(b){
		if(b&1)out=out*p%m;
		p=p*p%m;
		b>>=1;
	}
	return out;
}
int gcd(int a,int b){
	if(b==0)return a;
	else return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n;
	cin>>n;
	vi m(1000100);
	vi in(n);
	rep(i,n){
		cin>>in[i];
		int t=in[i];
		loop(j,2,1010)if(t%j==0){
			int c=0;
			while(t%j==0){
				c++;
				t/=j;
			}
			cmax(m[j],c);
		}
		if(t-1)cmax(m[t],1);
	}
	int w=1;
	rep(i,1000100)rep(j,m[i])(w*=i)%=MOD;

	int out=0;
	rep(i,n){
		(out+=w*powmod(in[i],MOD-2,MOD)%MOD)%=MOD;
	}
	cout<<out<<endl;
}


Measured memory_bytes: 8192
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) begin(x), end(x)
#define debug(x) cout << #x " => " << (x) << endl
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
#endif
using lint = long long;
constexpr int MOD = (int)1e9 + 7;
constexpr double EPS = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int x, y, z;
  cin >> x >> y >> z;
  cout << z << " " << x << " " << y << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int  long long
#define N 666666
int arr[N],f[N];
signed main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(4*a*b>=((a+b-c)*((a+b-c)))){
		cout<<"No";return 0;
	}
	if(a+b>c){
		cout<<"No";
	}else{
		cout<<"Yes";
	}
	return 0;
}

/*


*/


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

bool isEven(int x){return x%2==0;}
bool solve(vector<int> a){
    int n=a.size();
    int oneCnt=count(a.begin(),a.end(),1);
    int evenCnt=count_if(a.begin(),a.end(),isEven);
    if(oneCnt || evenCnt<n-1){
        return !isEven(evenCnt);
    }
    else{
        int g=a[0];
        for(int i=0;i<n;i++) g=__gcd(a[i]/2,g);
        for(int i=0;i<n;i++) a[i]/=(g*2);
        return !solve(a);
    }
}
void output(bool x){
    cout<<(x ? "First" : "Second")<<endl;
}
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    if(n==1){
        output(a[0]!=1);
    }
    else if(n==2){
        output(isEven(a[0]) || isEven(a[1]));
    }
    else{
        output(solve(a));
    }
    
    return 0;
}

Measured memory_bytes: 9984
#include <bits/stdc++.h>
using namespace std;
vector<int>v[100010];
int visit[100010];
int Color[100010];
long long n,m;
long long num1,num2;
bool dfs(int i,int color)
{
    visit[i]=1;
    Color[i]=color;
    if(color==1)
    {
        num1++;
    }
    else
    {
        num2++;
    }
    for(int j=0;j<v[i].size();++j)
    {
        if(Color[v[i][j]]==Color[i])
        {
            return false;
        }
        else if(!visit[v[i][j]])
        {
            if(!dfs(v[i][j],1-color))
            {
                return false;
            }
//            else
//            {
//                return false;
//            }
        }
    }
    return true;
}
int main(void)
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>m;
    memset(Color,-1,sizeof(Color));
    int a,b;
    for(int i=0;i<m;++i)
    {
        cin>>a>>b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    num1=0;
    num2=0;
    if(dfs(1,0))
    {
        cout <<num1*num2-m<<endl;
    }
    else
    {
        cout <<n*(n-1)/2-m<<endl;
    }
    return 0;
}


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

int main(void){
    int ans = 700;
    char s[4]; 

    scanf("%s", s);

    if(s[0] == 'o'){
        ans += 100;
    }
    if(s[1] == 'o'){
        ans += 100;
    }
    if(s[2] == 'o'){
        ans += 100;
    }
    printf("%d\n", ans);
    return 0;

} 


Measured memory_bytes: 256
N=int(input())
print(0,flush=True)
s=input()
if s=="Vacant":
    exit()
cap=0
if s=="Female":
    cap=1
lo=0
hi=N
while(1):
    mid=(lo+hi)//2
    print(mid,flush=True)
    s=input()
    if s=="Vacant":
        exit()
    gen=0
    if s=="Female":
        gen=1
    if (cap+mid)%2==gen:
        lo=mid
    else:
        hi=mid

Measured memory_bytes: 3660
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  std::string s;
  cin>>s;
  int result=s.size();
  std::vector<int> wall{0};
  for(int i=0;i<s.size()-1;i++){
    if(s[i]!=s[i+1]){
      wall.push_back(i+1);

    }
  }
  wall.push_back(s.size());
  for(int center=1;center+1<wall.size();center++){
    int lastswap=std::max(wall[center],(int)(s.size()-wall[center]));
    result=std::min(result,lastswap);
  }
  cout<<result<<endl;

  return 0;
}


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

typedef long long ll;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m;i>=n;i--)

int main(){
    int A,B,C;
    cin >> A >> B >> C;
    if(A+B+C <= 21) cout << "win" << endl;
    else cout << "bust" << endl;
    return 0;
}

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

const int MAX = 1000000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(llong n, llong k) {
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

    llong X, Y;
    cin >> X >> Y;
    COMinit();
    if ((X + Y) % 3 == 0) {
        // nCk
        llong n = (X + Y) / 3;
        if (X >= n && Y >= n) {
            llong k = X - n;
            cout << COM(n, k) << endl;
            return 0;
        }
    }

    cout << 0 << endl;

    return 0;
}


Measured memory_bytes: 23680