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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define show(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define show(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<62;
const double eps=1e-5;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    int d,n,b;
    cin >> d >> n >> b;
    vector<long double> p(n),h(n);
    rep(i,0,n) cin >> p[i] >> h[i];

    auto ok=[&](long double vx,long double vy){
        bool res=true;
        rep(i,0,n){
            int l=p[i]/(2*vx*vy);
            long double t=(long double)p[i]/vx-2*vy*l;
            if((long double)-t*t/2+vy*t>=h[i]) continue;
            res=false;
            break;
        }
        return res;
    };

    long double pi=3.14159265359,ans=infll;
    rep(i,0,b+1){
        long double lb=pi/4,ub=pi/2;
        rep(j,0,64){
            long double m=(lb+ub)/2;
            long double v=sqrtl(d/sinl(2*m)/(i+1));
            long double vx=v*cosl(m),vy=v*sinl(m);
            if(ok(vx,vy)){
                ub=m;
                ans=min(ans,v);
            }else lb=m;
        }
    }
    cout << ans << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define endl '\n'

using namespace std;
struct custom_hash 
{
    static unsigned long long splitmix64(unsigned long long x) 
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(unsigned long long x) const 
    {
        static const unsigned long long FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
mt19937 random_generator(chrono::steady_clock::now().time_since_epoch().count());

int h1, m1, h2, m2, k; 
void read()
{
	cin >> h1 >> m1 >> h2 >> m2 >> k; 
}

void solve()
{
	int time = (h2 - h1) * 60 + m2 - m1;
    cout << time - k << endl; 
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	
	read();
	solve();
}


Measured memory_bytes: 3696
#include "bits/stdc++.h"
using namespace std;

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


int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);

    int a, b, t;
    cin >> a >> b >> t;
    int bs   = 0;
    int time = 1;
    while (1) {
        if (time * a < t + 0.5) {
            bs += b;
            time++;
        } else {
            break;
        }
    }
    cout << bs << endl;

    return 0;
}


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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) ll(x.size()) //sizeをsize_tからllに直しておく
#define LEN(x) ll(x.length()) //lengthをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB emplace_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set

long long modPow(long long x, long long a) {
    if (a == 1) return x;
    if (a % 2) return (x * modPow(x, a - 1)) % MOD;
    long long t = modPow(x, a / 2);
    return (t * t) % MOD;
}

long long modInv(long long x) {
    return modPow(x, MOD - 2);
}

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    REP(i, n) cin >> a[i];
    ll sum = 0, ans = 0;
    REP(i, n){
        sum += a[i];
        sum %= MOD;
    }
    ans = sum * sum;
    ans %= MOD;
    REP(i, n){
        ans -= a[i] * a[i];
        ans %= MOD;
    }
    ans *= modInv(2);
    ans %= MOD;
    while(ans < 0) ans += MOD;
    ans %= MOD;
    cout << ans;
    return 0;
}

Measured memory_bytes: 4848
#include <iostream>
#include <string>
#include <string.h>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    ll D, T, S;
    cin >> D >> T >> S;

    if(D <= T * S){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;
#define all(v) (v).begin(),v.end()
#define fi first
#define se second
set<string> c;
map<ll,ll> mp;
const ll inf=(1e18);
const ll mod=1000000007;
const ll mod2=998244353;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
ll dp[200000];
int main(){
int n,m;
cin>>n>>m;
vector<int> k(m),p(m);
vector<vector<int>> s(m);
for(int i=0;i<m;i++){
    cin>>k[i];
    for(int j=0;j<k[i];j++){
        int a;cin>>a;
        s[i].push_back(--a);
    }
}
for(int i=0;i<m;i++)cin>>p[i];
int ans=0;
for(int bit=0;bit<(1<<n);bit++){
    bool check=true;
    for(int i=0;i<m;i++){
        int cnt=0;
        for(int j=0;j<k[i];j++){
            if(bit&(1<<s[i][j]))cnt++;
        }
        if(p[i]!=cnt%2)check=false;
    }
    if(check)ans++;
}
cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m;char a[101][101];
int main()
{
   
    char a[101][101];
    int b[101][101],n,m,i,j;
    cin>>n>>m;
    for(i=0;i<101;i++)
        for(j=0;j<101;j++)
            b[i][j]=0;
    for(i=0;i<n;i++)
        for(j=0;j<m;j++)
        {
            cin>>a[i][j];
            if(a[i][j]=='#')
            {
                b[i+1][j+1]++;
                b[i+1][j-1]++;
                b[i+1][j]++;
                b[i][j+1]++;
                b[i][j-1]++;
                b[i-1][j]++;
                b[i-1][j+1]++;
                b[i-1][j-1]++;              
            }
        }
    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
        {
            if(a[i][j]=='#')
                cout<<a[i][j];
            else
                cout<<b[i][j];
        }    
        cout<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        s: chars,
    }
    let n = s.len();
    for i in 0 .. min(n, 7) + 1 {
        for j in i .. n + 1 {
            let mut ans = Vec::new();
            for k in 0 .. i { ans.push(s[k]); }
            for k in j .. n { ans.push(s[k]); }
            if ans == "keyence".chars().collect::<Vec<_>>() {
                puts!("YES\n");
                return;
            }
        }
    }
    puts!("NO\n");
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
#include<bits/stdc++.h>
#define int long long
#define N 305
#define maxn 10000000000
using namespace std;
int f[N][N];
int d[N][N];
int m[N];
int u[N];
int n;
int ans;
signed main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			f[i][j]=d[i][j]=maxn;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			{                                                                                                                                                           
			cin>>f[i][j];
			d[i][j]=f[i][j];
			}	
	for(int k=1;k<=n;k++)
		for(int i=1;i<=n;i++)
			for(int j=1;j<=n;j++)
				d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
		{
		if(i!=j&&d[i][j]!=f[i][j])
		{cout<<-1<<endl;return 0;}	
		}
	for(int i=1;i<=n;i++)
		d[i][i]=maxn;
	bool flag;
	for(int i=1;i<=n-1;i++)
		for(int j=i+1;j<=n;j++)
			{
			flag=1;
			for(int k=1;k<=n;k++)
			if(i!=j&&k!=j&&i!=k)
			{
			if(d[i][j]<d[i][k]+d[k][j])continue;
			else
				flag=0;	
			}	
			if(flag==1)
			ans+=d[i][j];
			}
	cout<<ans<<endl;
	return 0;
	
		
}


Measured memory_bytes: 1664
//cup of hot tea
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int c=0;
	string a;
	string b;
	cin>>a;
	cin>>b;
	for(int i=0;i<a.length();i++)
	{
		if(a[i]==b[i])
		{
			continue;
		}
		else{
			c++;
		}
	}
	cout<<c;
}


Measured memory_bytes: 3792
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def perm(n,mod=None):
    ans = 1
    for i in range(1,n+1):
        ans *= i
        if mod!=None:
            ans %= mod
    return ans
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    return C

N,X,Y=mint()
C=[0]*(N)
for i in range(1,N):
    for j in range(i+1,N+1):
        tmp = min(j-i, abs(i-X)+1+abs(j-Y))
        C[tmp] += 1
lprint(C[1:])

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

int A[21];
int n;

int solve(int i, int m){
    if(m == 0) return 1;
    if(i >= n) return 0;
    
    int res = solve(i + 1, m) || solve(i + 1, m - A[i]);
    return res;
}

int main(){
    int q;
    
    int m;
    
    scanf("%d", &n);
    for(int i = 0; i < n; i++) scanf("%d",&A[i]);
    
    scanf("%d", &q);
    for(int i = 0; i < q; i++){
        scanf("%d", &m);
        
        if (solve(0, m)) printf("yes\n");
        else printf("no\n");
    }
    return 0;
}


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

int main() {
  string S;
  cin >> S;
  
  cout << S[0];
  
  for (int i = 2; i < S.size(); i++) {
    if (i % 2 == 0) {
      cout << S[i];
    }
  }
  
  cout << endl;
}

Measured memory_bytes: 512
import java.util.Scanner;

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

        for(int i=0; i<n; i++) {
            a[i] = sc.nextLong();
        }

        int oddCnt = 0;
        int evenCnt = 0;
        for(long l: a) {
            if(l % 2 == 0) {
                evenCnt++;
            } else {
                oddCnt++;
            }
        }

        if(oddCnt % 2 == 0) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 60272
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
#include <math.h>
#include <set>
#include <string>
#include <bitset>
#include <fstream>
#include <stack>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> T;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define revrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define f first
#define s second
#define pb push_back

ll mod = 1000000007;
const ll INF = 100000000000010000;
//const ull B = 998244353;
//ll kai[3010];

//void pres(double A, ll x = 20) { printf("%.20f\n", x); }

vector<ll> dx = { 0, 1, 0, -1, 1, -1, 1, -1, 0};
vector<ll> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0};

void chmin(ll& x, ll y) {
	x = min(x, y);
}

void chmax(ll& x, ll y) {
	x = max(x, y);
}

ll pow_long(ll x, ll y) {
	ll res = 1;
	while (y > 0) {
		if (y % 2 == 1) res *= x;
		x *= x;
		y /= 2;
	}
	return res;
}

void test() {
	cout << "888888888888888888888888" << endl;
}

ll gcd(ll x, ll y) {
	if (y == 0) return x;
	return gcd(y, x % y);
}

ll pow_mod(ll x, ll k) {
	x %= mod;
	ll res = 1;
	while (k > 0) {
		if (k % 2) {
			res *= x; res %= mod;
		}
		x *= x; x %= mod;
		k /= 2;
	}
	return res;
}

ll div_mod(ll x) {
	return pow_mod(x, mod - 2);
}

//コンビネーション
const int MAXcomb = 1000010;
ll fac[MAXcomb], finv[MAXcomb], inv[MAXcomb];
//facはn!,finvは1/n!
//invは逆元
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAXcomb; 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;
	}
}
ll comb(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * finv[k] % mod * finv[n - k] % mod;
}

ll n, k;
ll a[100010];
ll ans;

void solve() {
	cin >> n >> k;
	for (ll i = 1; i <= k; i++) {
		ll nu = k / i;
		a[i] = pow_mod(nu, n);
	}
	for (ll i = k; i >= 1; i--) {
		ll nu = a[i];
		ans += i * a[i] % mod;
		ans %= mod;
		for (ll j = 1; j * j <= i; j++) if (i % j == 0) {
			if (j * j == i) {
				a[j] += mod - nu;
				a[j] %= mod;
			}
			else {
				a[j] += mod - nu;
				a[i / j] += mod - nu;
				a[j] %= mod, a[i / j] %= mod;
			}
		}
	}
	cout << ans << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll T = 1;
	//cin >> T;
	rep(i, T) solve();
}


Measured memory_bytes: 3888
#include <cstdio>
int N; 
int main() { 
  scanf("%d",&N); 
  int res=N; 
  for(int i=0;i<=N;i++) {
    int cc=0; int t=i; 
    while(t>0)cc+=t%6,t/=6;
    t=N-i;
    while(t>0)cc+=t%9,t/=9;
    if(res>cc)res=cc;
  } 
  printf("%d\n",res); 
}
      


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ri register int
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long Ull;
#define fi first
#define se second
#define pb push_back
const int rlen=1<<18|1;
char buf[rlen],*ib=buf,*ob=buf;
#define gc() (((ib==ob)&&(ob=(ib=buf)+fread(buf,1,rlen,stdin)),ib==ob)?-1:*ib++)
inline int read(){
	int ans=0;
	char ch=gc();
	while(!isdigit(ch))ch=gc();
	while(isdigit(ch))ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
	return ans;
}
namespace modular{
	const int mod=1e9+7;
	inline int add(int a,int b){return a+b<mod?a+b:a+b-mod;}
	inline int dec(int a,int b){return a<b?a-b+mod:a-b;}
	inline int mul(int a,int b){return (ll)a*b%mod;}
	inline void Add(int&a,int b){a=a+b<mod?a+b:a+b-mod;}
	inline void Dec(int&a,int b){a=a<b?a-b+mod:a-b;}
	inline void Mul(int&a,int b){a=(ll)a*b%mod;}
	inline int ksm(int a,int p){int ret=1;for(;p;p>>=1,Mul(a,a))(p&1)&&(Mul(ret,a),1);return ret;}
}
using namespace modular;
int vl[3]={100000,200000,300000};
int main(){
	#ifdef ldxcaicai
	freopen("lx.in","r",stdin);
	#endif
	int a=3-read(),b=3-read();
	cout<<(a>=0?vl[a]:0)+(b>=0?vl[b]:0)+(a==b&&a==2?400000:0);
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String ans = "Christmas";
    int d = sc.nextInt();
    if(d == 24) ans = "Christmas Eve";
    if(d == 23) ans = "Christmas Eve Eve";
    if(d == 22) ans = "Christmas Eve Eve Eve";
    System.out.println(ans);
  }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define lc 2 * v
#define rc 2 * v + 1
#define mid (s + e) / 2
#define ll long long
#define int long long
#define ld long double
#define pii pair <int , int>
#define pll pair <long long , long long>
#define FAST ios::sync_with_stdio(false);cin.tie(0);
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")

const int maxn = 3000 + 10 , N = 1e5 + 5 , SQ = 600 , base = 1999 , mod = 1e9 + 7 , INF = 1e18 , lg = 17;

int n , m , dp[maxn][maxn];
char a[maxn][maxn];

int32_t main() {
    FAST
    cin >> n >> m;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            cin >> a[i][j];
        }
    }
    dp[0][0] = 1;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            if(i - 1 >= 0 && a[i - 1][j] == '.') {
                dp[i][j] = (dp[i][j] + dp[i - 1][j]) % mod;
            }
            if(j - 1 >= 0 && a[i][j - 1] == '.') {
                dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod;
            }
        }
    }
    cout << dp[n - 1][m - 1] << '\n';
 }


Measured memory_bytes: 18364
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include <numeric>
#include<map>
 
 
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
 
typedef long long int ll;
#define MOD 1000000007

/*mod Mでの割り算は割る数aのM-2をかける*/
/*ここではaのb乗をpで割った余りを返す*/
ll calc(ll a,ll b,ll p){

   if(b == 0){
       return 1;
   }else if(b % 2 == 0){
       ll tmp = (calc(a,b/2,p)) % p;
       return ((tmp%p)*(tmp%p))%p;
   }else{
       return ((a%p)*(calc(a,b-1,p)%p)) % p;
   }
}



/*素因数分解*/
map<ll,ll> prime_factorization(ll m){

    map<ll,ll> tmp;
    for(ll i = 2;i * i <= m;i++){
        while (m % i == 0) {
            tmp[i]++;
            m /= i;
        }
    }
    if(m != 1){
        tmp[m] = 1;
    }
    return tmp;
}

/*nCrの計算*/
ll nCr(ll n,ll r){

    if(n < r){
        return 0;
    }else if(n == r){
        return 1;
    }else{
        ll total = n,under1 = n-r,under2 = r;
        /*n!を求める*/
        for(ll i = n-1; i > 0;i--){
            total *= i;
            total %= MOD;
        }
        /*(n-r)!を求める*/
        for(ll i = n-r-1; i > 0;i--){
            under1 *= i;
            under1 %= MOD;
        }
        /*r!を求める*/
        for(ll i = r-1; i > 0;i--){
            under2 *= i;
            under2 %= MOD;
        }
        //cout << total << " " << under1 << " " << under2 << endl;
        /*(n-r)! * r!を求める*/
        ll under = (under1*under2) % MOD;
        return ((total % MOD) * calc(under,MOD-2,MOD)) % MOD;
    }
}





int main(){


    ll n,m;
    cin >> n >> m;
    map<ll,ll> prime_number = prime_factorization(m);

    map<ll,ll>::iterator ite;

    ll ans = 1;
    /*nHr = (n+r-1)Cr*/
    for(ite = prime_number.begin();ite != prime_number.end();ite++){
        ans *= nCr(n+ite->second-1,ite->second);
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
# ABC067C - Splitting Pile
def main():
    n = int(input())
    lst = tuple(map(int, input().rstrip().split()))
    l, r, ans = 0, sum(lst), float("inf")
    for i in lst[:-1]:
        l += i
        r -= i
        ans = min(ans, abs(l - r))
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 24960
import sys

input = sys.stdin.readline
 
n = int(input())
a = list(map(int, input().strip().split()))
if(0 in a):
 print(0)
 sys.exit()
else:
 ans = a[0]
 for i in range (1,n):
  ans = ans*a[i]
  if(ans > 10**18):
   print(-1)
   sys.exit()
 print(ans)

Measured memory_bytes: 21784
n, k = map(int, input().split())
# 最大ケース・うに: (n - 1) * (n - 2) // 2
# 最小ケース・完全グラフ: 0

if k <= (n - 1) * (n - 2) // 2:
    # つくれる
    hen = []
    for i in range(2, n + 1):
        hen.append((1, i))
    m = (n - 1) * (n - 2) // 2 - k
    while m:
        for i in range(2, n + 1):
            for j in range(i + 1, n + 1):
                hen.append((i, j))
                m -= 1
                if m == 0:
                    break
            if m == 0:
                break
    print(len(hen))
    for a, b in hen:
        print(a, b)

else:
    print(-1)


Measured memory_bytes: 9444
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:1024000000")
#pragma warning( disable : 6031)
#pragma warning( disable : 4244)
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <chrono>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-15)

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef vector< pii > vpii;
typedef vector<ll> vll;
typedef vector<vector<long long>> vvll;
typedef tuple<int, int, int> tiii;
const long long mod = int(1e9) + 7;
const double eps9 = 1e-9;



int main() {
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cout << setprecision(18) << fixed;
	int n;
	cin >> n;
	int r = 100 * n / 108;
	bool found = false;
	for (int i = r - 2; i <= r + 2; i++)
	{
		if (i * 108 / 100 == n)
		{
			cout << i;
			return 0;
		}
	}
	cout << ":(";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define all(v) v.begin(),v.end()
#define PB push_back
#define PI 3.1415926535897932384626433832795
#define what(x) cout<<#x<<" is "<<x<<endl;
using namespace std;


template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

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

ll powmod(ll a,ll b,ll mod) {
    ll res=1;a%=mod;
    //assert(b>=0);
    for(;b;b>>=1){
        if(b&1)res=res*a%mod;a=a*a%mod;
    }
    return res;
}

void solve(){
	string s;
	cin>>s;
	ll ans=0;
	for(char ch:s){
		ans+=(ch-'0');
	}
	cout<<((ans%9==0)?"Yes\n":"No\n");
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int tc=1;
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	#endif
	// cin>>tc;
    while(tc--)solve();
}


Measured memory_bytes: 3788
#include<stdio.h>
#define INFTY 100000
#define MAX 100


int main(){

  int m,n,i,j,k,r,c,R[MAX+2],C[MAX+1][MAX+1],B[MAX+1][MAX+1],d;

  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&R[i]);
    if(i!=n)
      scanf("%d",&d);
    else scanf("%d",&R[i+1]);
  }

  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      C[i][j]=INFTY;
    }}

  for(i=1;i<=n;i++){
    C[i][i]=0;
  }

  for(j=1;j<=n-1;j++){
    for(i=1;i<=n-j;i++){
      for(k=i+1;k<=i+j;k++){
	m=C[i][k-1]+C[k][i+j]+R[i]*R[k]*R[i+j+1];
	if(m<C[i][i+j]){
	  C[i][i+j]=m;
	  B[i][i+j]=k;
	}
      }
    }
  }

  printf("%d\n",C[1][n]);
  return 0;
}

Measured memory_bytes: 636
/*
  ID: oodt
  PROG:
  LANG:C++
*/
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<set>

using namespace std;

const int maxx=10005;
int n,m,k;
int a[maxx];
int ans = 0,cnt = 0,pos = 0;
int l = 0,r = 0;

int main()
{
#ifdef LOCAL
//    freopen("","r",stdin);
#endif
    string s;
    cin>>s;
    int t = 0;
    for(int i = 0; i < s.size(); i++)
    {
        t += s[i]-'0';
    }
    int temp = stoi(s);
    if(!(temp % t)) printf("Yes\n");
    else printf("No\n");
    return 0;
}


Measured memory_bytes: 256
// #pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#include<iostream>
#include<fstream>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int mod=1e9+7;
const ll infll=1e18+9;
const int infint=1e9+7;
const int MAXN=1e6+7;
const double eps=1e-9;
const long double pi=3.1415926535897932384626433832795;
const long double e=2.71828182845904523536028747135266;
inline ll read()
{
    ll kr=1,xs=0;char ls;ls=getchar();
    while(!isdigit(ls)){
        if(!(ls^45)) kr=-1;ls=getchar();
    }
    while(isdigit(ls)){
        xs=(xs<<1)+(xs<<3)+(ls^48);ls=getchar();
    }
    return xs*kr;
}
// inline __int128 read128()
// {
//     __int128 kr=1,xs=0;char ls;ls=getchar();
//     while(!isdigit(ls)){
//         if(!(ls^45)) kr=-1;ls=getchar();
//     }
//     while(isdigit(ls)){
//         xs=(xs<<1)+(xs<<3)+(ls^48);ls=getchar();
//     }
//     return xs*kr;
// }
inline ull readull()
{
    ull xs=0;char ls;ls=getchar();
    while(!isdigit(ls)) ls=getchar();
    while(isdigit(ls)){
        xs=(xs<<1)+(xs<<3)+(ls^48);ls=getchar();
    }
    return xs;
}
inline void writeull(ull x){
    if(x<0){x*=-1;putchar('-');}
    if(x>=10) writeull(x/10);
    putchar('0'+x%10);
}
inline void write(ll x){
    if(x<0){x*=-1;putchar('-');}
    if(x>=10) write(x/10);
    putchar('0'+x%10);
}
// inline void write(__int128 x){
//     if(x<0){x*=-1;putchar('-');}
//     if(x>=10) write(x/10);
//     putchar('0'+x%10);
// }
///////////////////////////////////////////////////////////////////////////////////////


int main()
{
    int t=1;
    // t=read();
    while(t--){
        int a,b,c;
        a=read(),b=read(),c=read();
        if(a<=b*c) puts("Yes");
        else puts("No");

    }
    return 0 ;
}

/*
6
011000010010000001100001011000010000101001100001
*/


Measured memory_bytes: 3668
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <deque>
#include <stack>

using namespace std;

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

	int n;
	cin >> n;

	long long a = 2, b = 1;
	for (int i = 3; i <= n + 1; i++) {
		if (i % 2 == 1) {
			a += b;
		} else {
			b += a;
		}
	}

	if (n % 2 == 0) {
		cout << a << endl;
	} else {
		cout << b << endl;
	}
}

Measured memory_bytes: 256
n=int(input())
mod=10**9+7

al=pow(4,n,mod)

import itertools
itr=itertools.product([0,1,2,3],repeat=4)
itr=list(itr)
dic1={} #dec
dic2={} #enc
for i in enumerate(itr):
    dic1[i[0]]=[i[1]]
    dic2[i[1]]=[i[0]]

    

dp=[[0 for i in range(4**3)] for q in range(n+1)]

for i in range(4**3):
    if i!=9 and i!=33 and i!=6:
        dp[3][i]=1


for i in range(3,n):
    for q in range(4**3):
        for r in range(4):
            p1=q//16%4
            p2=q//4%4
            p3=q%4
            
            if p2==0 and p3==2 and r==1:
                continue
            if p1==0 and p3==2 and r==1:
                continue
            if p1==0 and p2==2 and r==1:
                continue
            if p2==0 and p3==1 and r==2:
                continue
            if p2==2 and p3==0 and r==1:
                continue
        
            ck=q%16*4
            dp[i+1][ck+r]+=dp[i][q]
            dp[i+1][ck+r]%=mod

print(sum(dp[n])%mod)
  
                

Measured memory_bytes: 9280
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iomanip> 
#define pb push_back
#define mp make_pair
#define fi first 
#define se second
#define rep(i, a, b) for (long long i = a; i < b; i++)
#define per(j, a, b) for (long long j = a; j >= b; j--)
using namespace std;
int main(){
	double n, d, s;
	cin >> d >> n >> s;
	if(d/s<=n){
		cout << "Yes" << endl;
		
	}else{
		cout << "No" << endl;
	}
	
}



Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
using namespace std::literals::chrono_literals;
using namespace std::literals::string_literals;
using ll = long long;

#define repi(i, s, n) for (long long i {s}, i##_len{n}; i < i##_len; ++i)
#define rep(i, n) repi(i, 0, n)
#define all(x) std::begin(x), std::end(x)

namespace xmaho
{
inline namespace input
{
template<typename T>
T get_value(std::istream& is = std::cin);
template<typename C>
C get_container(std::istream& is = std::cin, typename C::size_type length = std::numeric_limits<typename C::size_type>::max());
}
}
namespace xmaho
{
inline namespace integer
{
template<typename C>
constexpr auto ssize(const C& c) noexcept(noexcept(c.size()))
  -> typename std::common_type<std::ptrdiff_t, typename std::make_signed<decltype(c.size())>::type>::type;
template <class T, ptrdiff_t N>
constexpr std::ptrdiff_t ssize(const T (&)[N]) noexcept;
}
}
using namespace xmaho;

int main()
{
  const auto s {get_value<string>()};
  const auto t {get_value<string>()};
  cout << t << s << '\n';
  return 0;
}

class initalization
{
  class custom_numpunct: public std::numpunct<char>
  {
  public:
    using numpunct::numpunct;
  protected:
    std::string do_truename() const override { return "Yes"; }
    std::string do_falsename() const override { return "No"; }
  };

public:
  initalization()
  {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.imbue(std::locale(std::cout.getloc(), new custom_numpunct{}));
    std::cout << std::boolalpha << std::fixed << std::setprecision(15);
  }
} initalize;

template<typename T>
T xmaho::input::get_value(std::istream& is)
{ T v {}; is >> v; return v; }

template<typename C>
C xmaho::input::get_container(std::istream& is, typename C::size_type length)
{
  C v {};
  if (length != std::numeric_limits<typename C::size_type>::max())
    v.reserve(length);
  typename C::value_type e {};
  for (auto i {length}; i != 0 && is >> e; --i)
    v.push_back(std::move_if_noexcept(e));
  return v;
}

template<typename C>
constexpr auto xmaho::integer::ssize(const C& c) noexcept(noexcept(c.size()))
  -> typename std::common_type<std::ptrdiff_t, typename std::make_signed<decltype(c.size())>::type>::type
{ return c.size(); }

template <class T, ptrdiff_t N>
constexpr std::ptrdiff_t xmaho::integer::ssize(const T (&)[N]) noexcept
{ return N; }


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
//#include "atcoder/all"
//using namespace atcoder;
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) (((n) >> (k)) & 1) /*nのk bit目*/
namespace mydef {
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
bool dbg = true;
}  // namespace mydef
using namespace mydef;
#define pb push_back
//#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define asn ans
 
int N;
int A[202020], B[202020], cntA[202020], cntB[202020];
 
 
void solve() {
    bool flag = true;
    for (int i = 0; i <= N; i++) {
        if (cntA[i] + cntB[i] > N)
            flag = false;
    }
    Yes(flag);
    if (!flag)
        return;
 
    int cnt = 0;
    int s1 = 0, s2 = 0;
    for (int i = 1; i <= N + 1; i++) {
        chmax(cnt, s1 - s2);
        s1 += cntA[i];
        s2 += cntB[i - 1];
    }
    for (int i = 0; i < N; i++) {
        cout << B[(i + N - cnt) % N] << " ";
    }
    cout << endl;
}
 
signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
 
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        cntA[A[i]]++;
    }
    for (int i = 0; i < N; i++) {
        cin >> B[i];
        cntB[B[i]]++;
    }
 
    solve();
    return 0;
}

Measured memory_bytes: 9828
roll_dict = dict(E = (3, 1, 0, 5, 4, 2), W = (2, 1, 5, 0, 4, 3), S = (4, 0, 2, 3, 5, 1), N = (1, 5, 2, 3, 0, 4))

dices = []
dices.append(list(map(int, input().split())))
q = int(input())

for i in "EWSN":
  dice = dices[0]
  new_dice = []
  for j in range(6):
    new_dice.append(dice[ roll_dict[i][j] ])
  dices.append(new_dice)

dice = dices[1]
new_dice = []
for i in range(6):
  new_dice.append(dice[ roll_dict["E"][i] ])
dices.append(new_dice)

for i in range(q):
  upper, front = map(int, input().split())
  for j in range(6):
    if dices[j][0] == upper:
      if dices[j][1] == front:
        print(dices[j][2])
      elif dices[j][2] == front:
        print(dices[j][4])
      elif dices[j][4] == front:
        print(dices[j][3])
      elif dices[j][3] == front:
        print(dices[j][1])



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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  string ans;
  if(a==b){
    if(a!=c){
      ans = "Yes";
    }else{
      ans = "No";
    }
  }else if(a==c){
    ans = "Yes";
  }else if (b==c){
    ans = "Yes";
  }else{
    ans = "No";
  }
  cout << ans;
  
}



Measured memory_bytes: 256
n = int(input())
m = [input() for l in range(n)]
x = []
a = 0
b = 0
c = 0
d = 0
for i in range (0,n):
    if m[i] == "AC":
        a = a + 1
    if m[i] == "WA":
        b = b + 1
    if m[i] == "TLE":
        c = c + 1
    if m[i] == "RE":
        d = d + 1
t = [0,0,0,0]
t[0] = "AC x " +str(a)
t[1] = "WA x " +str(b)
t[2] = "TLE x " +str(c)
t[3] = "RE x " +str(d)
for i in t:
    print(i)

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

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

    int price = 700;
    if(s[0] == 'o') price += 100;
    if(s[1] == 'o') price += 100;
    if(s[2] == 'o') price += 100;

    cout << price << endl; return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;

typedef pair<long long int, int> P;

long long int INF = 100000000000000000LL;

long long int N, K;

long long int w[200000], d[200000];

bool check(long long int thr){
	
	long long int sum = 0;
	
	for(int i = 0; i < N; i++){
		if(thr >= w[i]){
			sum += (thr - w[i]) / d[i] + 1;
		}
	}
	if(sum >= K){
		return true;
	}else{
		return false;
	}
}

long long int bin_search(long long int lef, long long int rig){
	long long int middle = (lef + rig) / 2;
	//cout << middle << " ";
	if(rig - lef <= 1){
		if(check(lef)){
			return lef;
		}else{
			return rig;
		}
	}
	if(check(middle)){
		rig = middle;
	}else{
		lef = middle;
	}
	return bin_search(lef, rig);
}

int main(){
	
	cin >> N >> K;
	
	for(int i = 0; i < N; i++){
		cin >> w[i] >> d[i];
	}
	
	cout << bin_search(0, 2000000000000000000LL) << endl;;
	
	return 0;
}

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

int main() {
    int n, x;
    cin >> n >> x;
    int l[n];
    for (int i = 0; i < n; i++) cin >> l[i];

    int d[n + 1];
    d[0] = 0;
    for (int i = 1; i < n + 1; i++) {
        d[i] = d[i - 1] + l[i - 1];
    }

    int cnt = 0;
    for (int i = 0; i < n + 1; i++) {
        if (d[i] <= x) cnt++;
    }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
//
//  main.cpp
//  ABC154D2
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, const char * argv[]) {
    // insert code here...
    int N,K;
    cin>>N>>K;
    vector<int>p(N+1);
    for (int i=0; i<N; i++) {
        cin>>p.at(i);
    }
    p.at(N)=0;
    int tmp=0;
    for (int i=0; i<K; i++) {
        tmp+=p.at(i); // 初めのK個を足して、tmpを作る
    }
    int left=0;
    int max=tmp; // 初期値
    while(left+K-1<N){
        tmp=tmp-p.at(left)+p.at(left+K); // leftを移動させて、tmpを再計算する
        if(tmp>max)max=tmp; // tmpがmaxより大きいならkmaxを更新する
        left++;
    }
    printf("%.12lf\n",(double)(max+K)/2.0); // 書式付き出力
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
const int c=1e5;
const ll mod=1e9+7;
/*bool p[1000];
void sieve(){
p[0]=p[1]=1;
for(int i=2;i<=100;i++){
    for(int j=i*i;j<=100;j+=i){
        p[j]=1;
    }
}
}*/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    ll a[n+5]={},b[n+5]={},c[n+5]={};
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i]>>c[i];
    }
    ll dp[n][5]={};
    dp[0][1]=a[0];
    dp[0][2]=b[0];
    dp[0][3]=c[0];
    for(int i=1;i<n;i++){
        dp[i][1]+=(a[i]+max(dp[i-1][2],dp[i-1][3]));
        dp[i][2]+=(b[i]+max(dp[i-1][3],dp[i-1][1]));
        dp[i][3]+=(c[i]+max(dp[i-1][2],dp[i-1][1]));
    }
    cout<<max(dp[n-1][2],max(dp[n-1][1],dp[n-1][3]));
    return 0;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); i++)
int main()
{
    int a, b;
    cin >> a >> b;
	
  	if(a <= b)
      cout << a << endl;
  	else
      cout << a-1 << endl;


    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define   ll          long long int
#define   sz          200010
#define   sc(a)       scanf("%lld",&a)
#define   sc2(a,b)    scanf("%lld %lld",&a,&b)
#define   py          printf("Yes\n")
#define   pn          printf("No\n")
using namespace std;


int main()
{

    ll n;
    cin>>n;
    cout<<n*n<<endl;
    
    return 0;
}



Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    long a=sc.nextInt();
    long b=sc.nextInt();
    System.out.println(a*b/gcd(a,b));
  }
  public static long gcd(long x,long y){
    if(y==0) return x;
    else return gcd(y,x%y);
  }
}

Measured memory_bytes: 35632
#include <bits/stdc++.h>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;
ll max(ll a, ll b) {return a>b?a:b;}
ll min(ll a, ll b) {return a<b?a:b;}

static const double PI=acos(-1);

double a, b, x;
ll C(double th) {
  if(a*a*b-a*a*a*tan(th)/2>x)
    return 0;
  else
    return 1;
}

ll D(double th) {
  if(a*b*b*tan(PI/2-th)/2>x)
    return 0;
  else
    return 1;
}

int main() {
  cin >> a >> b >> x;
  double ans=0;
  if(x>a*a*b/2) {
    
    double l=0, r=PI/2;
    for(ll _=0; _<100; _++) {
      double m=(l+r)/2;
      if(C(m)) {
        r=m;
      }else {
        l=m;
      }
    }
    
    printf("%.10f\n", l*180/PI);
  }else {
    
    double l=0, r=PI/2;
    for(ll _=0; _<100; _++) {
      double m=(l+r)/2;
      if(D(m)) {
        r=m;
      }else {
        l=m;
      }
    }
    
    printf("%.10f\n", l*180/PI);
  }
  

  
  
  
}

















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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

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

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){

    bool flag=false;
    ll ans=0,sum=0;

    string str;
    cin>>str;
    map<char,bool> d;

    d['N']=false;
    d['S']=false;
    d['E']=false;
    d['W']=false;

    rep(i,str.length())d[str[i]]=true;

    if(d['N'] == d['S'] && d['W'] == d['E'])flag = true;
    if(flag)cout << "Yes" <<endl;
    else cout << "No" <<endl;

    return 0;
}


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

int main() {
	int B, R, G, C, S, T;
	for(;cin >> B >> R >> G >> C >> S >> T, B || R || G || C || S || T;) {
		int coin = 100;
		
		coin += 2 * C;
		coin += 7 * G;
		coin += 15 * R;
		coin += 15 * B;

		coin += 3 * R * (15 - 2);
		coin += 5 * B * (15 - 2);

		T -= S;
		T -= 5 * B + 3 * R;

		coin -= 3 * T;

		cout << coin << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, x, n) for (int i = x; i < (int)(n); i++)
#define sc(x) scanf("%d",&x)
#define scll(x) scanf("%lld",&x)
const long double PI = (acos(-1));
int main(){
    long double a, b, x;
    cin >> a >> b >> x;
    long double v = a * a * b;
    long double z, ans;
    if (x >= v/2){
        z = 2 * (v-x);
        z = z / (a*a*a);
        ans = atan(z) * 180.0 / PI;
        cout << fixed << setprecision(15) << ans << endl;
    }else{
        z = 2 * x;
        z = b*b*a / z;
        ans = atan(z) * 180.0 / PI;
        cout << fixed << setprecision(15) << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256