akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<cassert>
#include<numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
const int INF = 1001001001;
const long long LINF = 1001002003004005006ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int,int> P;

struct Sieve {
  int n;
  vector<int> f, primes;
  Sieve(int n=1):n(n), f(n+1) {
    f[0] = f[1] = -1;
    for (ll i = 2; i <= n; ++i) {
      if (f[i]) continue;
      primes.push_back(i);
      f[i] = i;
      for (ll j = i*i; j <= n; j += i) {
        if (!f[j]) f[j] = i;
      }
    }
  }
  bool isPrime(int x) { return f[x] == x;}
  vector<int> factorList(int x) {
    vector<int> res;
    while (x != 1) {
      res.push_back(f[x]);
      x /= f[x];
    }
    return res;
  }
  vector<P> factor(int x) {
    vector<int> fl = factorList(x);
    if (fl.size() == 0) return {};
    vector<P> res(1, P(fl[0], 0));
    for (int p : fl) {
      if (res.back().first == p) {
        res.back().second++;
      } else {
        res.emplace_back(p, 1);
      }
    }
    return res;
  }
};

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main(){
  int n;
  cin >> n;
  int a[n];
  rep(i,n)cin >> a[i];
  Sieve sieve(1000005);
  map<int,int> LCM;
  rep(i,n){
    auto f = sieve.factor(a[i]);
    for(auto p:f){
      chmax(LCM[p.first],p.second);
    }
  }
  mint ans = 0;
  mint all = 1;
  for(auto p:LCM){
    all *= mint(p.first).pow(p.second);
  }
  rep(i,n){
    ans += all/a[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 4984
//C
#include <cassert>
//#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//ここまで標準include

using namespace std;

long aCb(long a, long b) {
	long out = 1;
	for (long i = 1; i <= b; i++) {
		out = out * (a + 1 - i) / i;
	}
	return out;
}

long long gcd(long long a, long long b) {
	long long r = -1;
	if (a < b) {
		swap(a, b);
	}
	while (r != 0) {
		r = a % b;
		if (r == 0) {
			return b;
		}
		else {
			a = b;
			b = r;
		}
	}
}

long long lcm(long long a, long long b) {
	return a * b / gcd(a, b);
}

int main() {
	int X, A, B;
	cin >> X >> A >> B;
	if (B <= A) {
		cout << "delicious" << endl;
		return 0;
	}
	if (B - A <= X) {
		cout << "safe" << endl;
		return 0;
	}
	else {
		cout << "dangerous" << endl;
		return 0;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 1; i < n; i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define P pair<int, int>
typedef long long ll;
const ll mod = 1e9+7;

//繰り返し自乗法による累乗計算
//a**n
ll pow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = pow(a, n/2);
    return res * res;
  }
  return a * pow(a, n-1);
}
//繰り返し自乗法によるmod累乗計算
//a**n (mod)
ll modpow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = modpow(a, n/2);
    return res * res % mod;
  }
  return a * modpow(a, n-1) % mod;
}
//組み合わせ
//nCa
ll com(ll n, ll a){
  ll x = 1, y = 1;
  rep(i,a){
    x *= n-i;
    y *= i+1;
  }
  ll res = x / y;
  return res;
}
//組み合わせ(mod)
//nCa (mod)
ll modcom(ll n, ll a){
  ll x = 1, y = 1;
  rep(i, a){
    x = x * (n-i) % mod;
    y = y * (i+1) % mod;
  }
  ll ans = x * modpow(y, mod-2) % mod;
  return ans;
}
//gcd 最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x%y);
}
//lcm 最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//ngcd n個の最大公約数
ll ngcd(vector<ll> a){
  ll res;
  res = a[0];
  for(ll i = 1; i < a.size() && res != 1; i++) {
    res = gcd(a[i], res);
  }
  return res;
}
//nlcm n個の最小公倍数
ll nlcm(vector<ll> a) {
  ll res;
  res = a[0];
  for (ll i = 1; i < a.size(); i++) {
    res = lcm(res, a[i]);
  }
  return res;
}
// 素数判定
bool isprime(ll x){
  ll i;
  if(x < 2) return false;
  else if(x == 2) return true;
  if(x % 2 == 0) return false;
  for(i = 3; i*i <= x; i += 2){
    if(x % i == 0) return false;
  }
  return true;
}
// 桁和
ll digsum(ll x){
  ll res = 0;
  while(x > 0){
    res += x % 10;
    x /= 10;
  }
  return res;
}


int main(){
  string s;
  cin >> s;
  rep(i, s.size()){
    if(i % 2 == 0) cout << s[i];
  }
  cout << endl;
}

Measured memory_bytes: 512
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
if n == 1:
    print("Hello World")
    
else:
    a = ni()
    b = ni()
    print(a+b)

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
using namespace std;

void dfs(string s,int n){
    if(n==0){
        cout<<s<<endl;
    }else{
        char k[3]={'a','b','c'};
        rep(i,3)dfs(s+k[i],n-1);
    }
}

int main(void){
    string s;
    string t;
    int q;
    int a[110000];
    int b[110000];
    int c[110000];
    int d[110000];
    int ss[110000];
    int tt[110000];
    cin>>s>>t;
    cin>>q;
    rep(i,q)cin>>a[i]>>b[i]>>c[i]>>d[i];    
    
    rep(i,s.size()){
        if(s[i]=='A'){
            ss[i+1]+=ss[i]+1;
        }else{
            ss[i+1]+=ss[i]+2;
        }
    }
    rep(i,t.size()){
        if(t[i]=='A'){
            tt[i+1]+=tt[i]+1;
        }else{
            tt[i+1]+=tt[i]+2;
        }
    }
    
    rep(i,q){
        int m=ss[b[i]]-ss[a[i]-1]-tt[d[i]]+tt[c[i]-1];
        //cout<<ss[b[i]]<<ss[a[i]-1]<<'|'<<tt[d[i]]<<tt[c[i]-1];
        if(m%3==0){
            cout<<"YES"<<endl;
        }else{
            cout<<"NO"<<endl;
        }
        
    }
    

}



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

typedef long long ll;

int main() {
    string S;
    cin >> S;
    int N = S.size(), T = 1;
    vector<int> A(N + 1, 0), B(2019, 0);
    rep(i, N) {
        T = (T * 10) % 2019;
        A[i + 1] = (A[i] + (S[N - 1 - i] - '0') * T) % 2019;
    }
    rep(i, N + 1) {
        B[A[i]]++;
    }
    ll ans = 0;
    rep(i, 2019) {
        ans += B[i] * (B[i] - 1) / 2;
    }
    cout << ans << "\n";
    //rep(i, N + 1) cout << A[i] << "\n";
}

Measured memory_bytes: 4448
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define cOut(i) cout<<i<<endl

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

    int yukichi=-1,ichiyo=-1,hideyo=-1;
    bool flag=false;
    rep(yn,0,n+1){
        rep(in,0,n-yn+1){
            int hn=n-yn-in;
            if(hn>=0 && yn*10000+in*5000+hn*1000==y){
                yukichi=yn;
                ichiyo=in;
                hideyo=hn;
                flag=true;
            }
            if(flag) break;
        }
        if(flag) break;
    }
    cout<<yukichi<<" "<<ichiyo<<" "<<hideyo<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,m;cin>>n>>m;
  lvector A(n,0);rep(i,n) cin>>A[i];
  ll s=accumulate(ALL(A),0);
  sort(ALL(A));reverse(ALL(A));
  if(A[m-1]*4*m<s) puts("No");else puts("Yes");
  return 0;
}


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

using namespace std;

int main(){
	string word,lit;
	cin >> word;
	for(string::iterator it=word.begin();it!=word.end();++it){
		if(*it>='A' && *it<='Z'){
			*it+='a'-'A';
		}
	}
	int ans=0;
	while(cin >> lit,lit!="END_OF_TEXT"){
		for(string::iterator it=lit.begin();it!=lit.end();++it){
			if(*it>='A' && *it<='Z'){
				*it+='a'-'A';
			}
		}
		if(lit==word)ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3168
import sys

sys.setrecursionlimit(10 ** 9)
def solve(pick, idx):

    if pick == 0: return 0
    if idx >= n: return -float('inf')
    if (pick, idx) in dp: return dp[pick, idx]
    if n-idx+2 < pick*2: return -float('inf')
    total = max(A[idx] + solve(pick-1, idx+2), solve(pick, idx+1))

    dp[(pick, idx)] = total
    return total

n = int(input())
A = list(map(int, input().split()))
dp = {}
pick = n//2

print(solve(pick, 0))

Measured memory_bytes: 142872
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,m;

ll gcd(ll a,ll b){
  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
return b;
}


int main(){
  ll ans=0;
  ll saidaikou=1;

  cin >> n >> m;
  vi a(n);
  REP(i,n) cin>>a[i];

  REP(i,n)
  {
    saidaikou=saidaikou*a[i]/gcd(saidaikou,a[i]);
    if (saidaikou>=m*2+1){cout<<0<<endl;return 0;}
  }

  ll line=saidaikou/2;
  REP(i,n){
    if ((line-a[i]/2)%a[i]!=0){cout<<0<<endl;return 0;}
  }

  //cout<<line<<endl;
  if (line<=m){
    ans=(m-line)/saidaikou+1;
  }else{
    cout<<0<<endl;return 0;
  }



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

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define fi first
#define se second
#define REP(i, a, b) for (int i = (a); i <= (b); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORD(i, a, b) for(int i = (a); i > (b); --i)
#define REPD(i, a, b) for(int i = (a); i >=(b); --i)
#define TR(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define endl '\n'
#define mp make_pair
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define unmap unordered_map
#define lb lower_bound //first pos >= val
#define ub upper_bound // first pos > val
#define debug(a) cout << a << endl
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;
typedef vector <int> vi;
typedef vector <ll> vll;

const ll maxN = 1e18;
const ll minN = -1e18;
const ll MOD = 1e9 + 7;
const ll MOD1 = 998244353;
const int bignumlen = 2200;
const int Blen = 8;
const ll base = 100000000;
const int baseHash = 31;
const ld PI = acos(-1);

//Remember limit for IT, etc...
const ll limit = 2e5 + 5;
const ll limit1 = 1e6 + 5;
//If TLE let's use int instead of ll

ll n, m;
ll a[limit];
ll s = 0;

void solveProblem() {
    ld temp = (ld)1 / (ld)(4 * m);
    //cout << temp;
    sort(a + 1, a + n + 1);
    REPD(i, n, n - m + 1) {
        ld temp1 = (ld)a[i] / (ld)s;
        //cout << temp1 << endl;
        if (temp1 < temp) {cout << "No";return;}
    }

    cout << "Yes";
}

void fastInput() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

void readInput() {
    cin >> n >> m;
    REP(i, 1, n) {
        cin >> a[i];
        s += a[i];
    }
}

int main() {
    fastInput();
    readInput();
    solveProblem();
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    long long a, b, c, k; cin >> a >> b >> c >> k;
    long long sum = 0;
    while(a && k) a--,k--,sum++;
    while(b && k) b--, k--;
    while(c && k) c--, k--,sum--;
    cout << sum << endl;
}

Measured memory_bytes: 3636
def readInt():
    return list(map(int, input().split()))

n = int(input())
a = readInt()

# print(n)
# print(a)
b = 0
ans = 0
for i in a:
    i %= 10**9+7 
# print(a)

s = sum(a)
s2 = sum(map(lambda x:x**2,a))

ans = (s**2 - s2 ) // 2

ans %= (10**9+7)

print(ans)


Measured memory_bytes: 105592
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//String s = sc.next();
		int N = sc.nextInt();
		//String S = sc.next();
		double sum=0;
		double sum2=1;
		//char buff=S.charAt(0);
		double[] array=new double[N];
		for(int i=0;i<N;i++) {
			array[i] = 1.0/sc.nextInt();
			sum += array[i];
			sum2 *= array[i];
		}
		System.out.println(1/sum);
	}


	public static int sample() {
		return 1;
	}

}


Measured memory_bytes: 23764
N = int(input())
s = []
t = []
for i in range(N):
    sp, tp = input().split(" ")
    s.append(sp)
    t.append(int(tp))

X = input()

cnt = 0
ans = 0

for i in range(N):
    if cnt == 1:
        ans += t[i]
    if s[i] == X:
        cnt = 1

print(ans)


Measured memory_bytes: 3060
#include<iostream>
using namespace std;
 
int main(){
	int a,b,c,k;
  	cin>>a>>b>>c;
  	cin>>k;
  	for(int i=0;i<k;i++){
    	if(b<=a){
        	b*=2;
        }
      	else if(c<=b){
        	c*=2;
        }
      	else{
        	c*=2;
        }
    }
  	if(a<b&&b<c){
    	cout<<"Yes";
    }
  	else{
    	cout<<"No";
    }
 
}

Measured memory_bytes: 3548
#include<stdio.h>
int main()
{
	int N,X,T;
	scanf("%d%d%d",&N,&X,&T);
	if(N%X!=0)
	{
		printf("%d\n",((N/X)+1)*T);
	}
	else
		{
			printf("%d\n",(N/X)*T);
		}
}

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

int main(){
    ll n, d;
    cin >> n >> d;
    int ans = 0;
    for(int i = 0; i < n; i++){
        ll x, y;
        cin >> x >> y;
        if(x*x + y*y <= d*d){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
#define MOD 1000000007LL
#define PI 3.141592653589793
#define endl "\n"

struct COM{
  ll modpow(ll x, ll nn){
    ll res = 1;
    while(nn > 0){
      if(nn & 1) res = res * x % MOD;
      x = x * x % MOD;
      nn >>= 1;
    }
    return res;
  }
  vll fact, ifact;
  COM(ll n): fact(n+1), ifact(n+1){
    assert(n < MOD);
    fact[0] = 1LL;
    for(ll i = 1; i <= n; i++) fact[i] = fact[i-1]*i%MOD;
    ifact[n] = modpow(fact[n], MOD-2);
    for(ll i = n; i >= 1; i--) ifact[i-1] = ifact[i]*i%MOD;
  }
  ll operator()(int n, int k){
    if(k < 0 || k > n) return 0;
    return fact[n]*ifact[k]%MOD*ifact[n-k]%MOD;
  }

  ll query(int n, int k){
    if(k < 0 || k > n) return 0;
    return fact[n] * ifact[n-k] % MOD;
  }
};

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  COM c(100010);

  ll N, K;
  cin >> N >> K;
  vvll G(N, vll(0));
  for(int i = 0; i < N-1; i++){
    ll a, b;
    cin >> a >> b;
    a--; b--;
    G.at(a).push_back(b); G.at(b).push_back(a);
  }

  queue<ll> que;
  vll flag(N, -1);
  flag.at(0) = 0;
  que.push(0);
  ll ans = K;
  while(!que.empty()){
    ll v = que.front(); que.pop();
    ll num = G.at(v).size();
    if(flag.at(v) == 0){
      ans *= c.query(K-1, num);
      ans %= MOD;
    }
    else{
      ans *= c.query(K-2, num-1);
      ans %= MOD;
    }
    for(int i = 0; i < num; i++){
      ll next = G.at(v).at(i);
      if(flag.at(next) != -1) continue;
      flag.at(next) = flag.at(v) + 1;
      que.push(next);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 9716
A, B = gets.split.map(&:to_i)
g = A.gcd(B)
require 'prime'
cnt = 1
Prime.each do |p|
    cnt += 1 if g % p == 0
    g /= p while g % p == 0
    break if p >= 2*10**6
end
cnt += 1 if g > 1

p cnt

Measured memory_bytes: 10968
import java.io.*;

class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] f=br.readLine().split(" ");
        int n=Integer.parseInt(f[0]);
        int m=Integer.parseInt(f[1]);
        int l=Integer.parseInt(f[2]);
        int[][] A=new int[n][m];
        int[][] B=new int[m][l];
        for(int i=0;i<n;i++){
        	String[] s=br.readLine().split(" ");
        	for(int j=0;j<m;j++){
        		A[i][j]=Integer.parseInt(s[j]);
        	}
        }
        for(int i=0;i<m;i++){
        	String[] t=br.readLine().split(" ");
        	for(int j=0;j<l;j++){
        		B[i][j]=Integer.parseInt(t[j]);
        	}
        }
        for(int nc=0;nc<n;nc++){
        	StringBuilder sb = new StringBuilder();
        	for(int lc=0;lc<l;lc++){
        		long b=0;
            	for(int mc=0;mc<m;mc++){
            		b+=A[nc][mc]*B[mc][lc];
            	}
            	sb.append(b+" ");
        	}
        	System.out.println(sb.substring(0,sb.length()-1));
        }
	}
}

Measured memory_bytes: 28788
#include <iostream>
#include <cmath>

using namespace std;

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);
    ll n, k;
    cin >> n >> k;
    if (n > k)
    {
        n -= (n - k) / k * k;
        if (n >= k)
            n -= k;
    }
    cout << min(n, (ll) abs(n - k));
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
using namespace std;
int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(abs(a-c)<=d){
    cout<<"Yes"<<endl;
    return 0;
  }
  else if(abs(a-b)<=d&&abs(b-c)<=d){
    cout<<"Yes"<<endl;
    return 0;
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

using pi = pair<int,int>;
using P = pair<ll,pi>;

struct edge{ int to,cost,time; };

const int N = 50;
const int C = 2525;
const ll INF = LLONG_MAX/3;

vector<edge> G[N];
ll dp[N][C];

int main(){
    int n,m,s;
    cin >>n >>m >>s;
    s = min(s,2500);

    rep(i,m){
        int u,v,a,b;
        cin >>u >>v >>a >>b;
        --u;
        --v;
        G[u].pb({v,a,b});
        G[v].pb({u,a,b});
    }

    vector<int> c(n),d(n);
    rep(i,n) cin >>c[i] >>d[i];

    rep(i,N)rep(j,C) dp[i][j] = INF;
    dp[0][s] = 0;

    priority_queue<P, vector<P>, greater<P>> pq;
    pq.push({0,{0,s}});
    while(!pq.empty()){
        P p = pq.top();
        pq.pop();

        int pos = p.se.fi, cur = p.se.se;
        if(p.fi > dp[pos][cur]) continue;
        ll now = dp[pos][cur];

        // exchange
        if(cur+1 < C){
            int nj = min(cur+c[pos], C-1);
            if(dp[pos][nj] > now+d[pos]){
                dp[pos][nj] = now+d[pos];
                pq.push({dp[pos][nj], {pos,nj}});
            }
        }

        // move
        for(const auto &e:G[pos])if(cur >= e.cost){
            int nj = cur - e.cost;
            if(dp[e.to][nj] > now+e.time){
                dp[e.to][nj] = now+e.time;
                pq.push({dp[e.to][nj], {e.to,nj}});
            }
        }
    }


    for(int i=1; i<n; ++i){
        ll ans = INF;
        rep(j,C) ans = min(ans, dp[i][j]);
        cout << ans << "\n";
    }
    return 0;
}


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

using namespace std;

int main(){
	double A, B;

	cin >> A >> B;

	if(A < B){
		cout << "LESS" << endl;
	}else if(A > B){
		cout << "GREATER" << endl;
	}else{
		cout << "EQUAL" << endl;
	}

	return 0;
}


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

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

	int tot= 0;
	for( int i=0; i< 6; ++i ){
		if(s[i] == '1' )
			tot++;
	}
	cout << tot << endl;
	return 0;
	
}

Measured memory_bytes: 256
//071A
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int x, a, b=0;
    cin >> x >> a >> b;
    if (abs(x-a) < abs(x-b)){
        cout << 'A';
    }else if (abs(x-a) > abs(x-b)){
        cout << 'B';
    }
}

Measured memory_bytes: 256
n, m = map(int, input().split())

cakes = [[0] * n for i in range(1 << 3)]

for j in range(n):
    x, y, z = map(int, input().split())
    for i in range(1 << 3):
        s = 0
        s += x if i & (1 << 0) == 0 else -x
        s += y if i & (1 << 1) == 0 else -y
        s += z if i & (1 << 2) == 0 else -z
        cakes[i][j] = s

max_ = 0
for i in range(1 << 3):
    n = sum(sorted(cakes[i], reverse=True)[:m])
    # print(bin(i), n)
    max_ = max(max_, sum(sorted(cakes[i], reverse=True)[:m]))
print(max_)


Measured memory_bytes: 3316
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
using namespace std;
ll h, w; char a[114][114];
signed main() {
	cin >> h >> w;
	rep(i, h) { rep(j, w)cin >> a[i][j]; }
	rep(i, h) {
		rep(j, w) {
			if (a[i][j] == '#') {
				if (a[i - 1][j] == '.'&&a[i + 1][j] == '.'&&a[i][j - 1] == '.'&&a[i][j + 1] == '.') {
					puts("No");
					return 0;
				}
			}
		}
	}
	puts("Yes");
	getchar(); getchar(); return 0;
}

Measured memory_bytes: 256
n,k=map(int,input().split())
prob=0.0
if n>=k:
  prob+=(n-k+1)/n
mn=min(n+1,k)
for i in range(1,mn):
  check=i
  count=0
  while True:
    check*=2
    count+=1
    if check>=k:
      break
  prob+=pow(0.5,count)/n
print(prob)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int n,m;
struct node
{
	int l,r,d;
}order[200005];
int father[200005];
int dis[200005];

inline int find(int x){
	if(father[x]==0) return x;
	//cerr<<x<<"-->"<<endl;
	int t=father[x];
	father[x]=find(father[x]);
	dis[x]+=dis[t];
	return father[x];
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)
	 scanf("%d%d%d",&order[i].l ,&order[i].r ,&order[i].d );
	
	for(int i=1;i<=m;i++){
		int tx,ty;
		tx=find(order[i].l );
		ty=find(order[i].r );
		if(tx!=ty){
			father[ty]=tx;
			dis[ty ]=dis[order[i].l ]-dis[order[i].r ]+order[i].d  ;
		} 
		else{
			if(dis[order[i].r ]-dis[order[i].l ]!=order[i].d ){
				printf("No");
				return 0;
			}
		}
	} 
	printf("Yes");
	return 0;
 } 

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

#define ll long long
#define pll pair<ll,ll>
#define all(x) x.begin(), x.end()

#define MOD 500005

ll v[200][5];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	ll n;
	cin >> n;

	for(int i=1;i<=n;i++)
	{
		cin >> v[i][1] >> v[i][2];
	}


	for(int i=1;i<=n;i++)
	{
		if(i+2<=n)
		if(v[i][1] == v[i][2] && v[i+1][1] == v[i+1][2] && v[i+2][1] == v[i+2][2])
		{
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;

	return 0;
}

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

int main() {
  int A, B, K;
    int count = 0;
    cin >> A >> B >> K;

        for (int i=100; i>0 ; i--) {
        
            if (A%i == 0 && B%i == 0) {
                count += 1;
                if (count == K) {
                    cout << i << endl;

                    break;
                }
            }
        }
}

Measured memory_bytes: 256
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <cstdlib>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	int n; cin >> n;
	ll res = 0;
	ll sum = 0;
	bool ok = true;
	vector<ll> a(n), b(n), c;
	rep(i, n)
	{
		cin >> a[i] >> b[i];
		sum += a[i];
		if (a[i] > b[i])c.push_back(b[i]);
	}
	if (c.size() == 0)
	{
		cout << 0 << endl;
		return 0;
	}
	sort(all(c));
	cout << sum - c[0] << endl;
}

Measured memory_bytes: 768
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		label:for(;;){
			String s = cin.nextLine();
			if(s.equals("."))break;
			int[] a = new int[1100];
			int idx=1;
			for(int i=0;i<s.length();i++){
				if(s.charAt(i)=='['){
					a[idx]=1;
					idx++;
				}
				if(s.charAt(i)==']'){
					idx--;
					if(a[idx]==1){
						a[idx]=0;
					}
					else{
						System.out.println("no");
						continue label;
					}
				}
				if(s.charAt(i)=='('){
					a[idx]=2;
					idx++;
				}
				if(s.charAt(i)==')'){
					idx--;
					if(a[idx]==2){
						a[idx]=0;
					}
					else{
						System.out.println("no");
						continue label;
					}
				}
			}
			for(int i=0;i<a.length;i++){
				if(a[i]!=0){
					System.out.println("no");
					continue label;
				}
			}
				System.out.println("yes");
			
		}

	}

}

Measured memory_bytes: 47120
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
	public Program() { }

	static void Main(string[] args)
	{
		new Program().prog();
	}
	Scanner cin;
	const int MOD = 1000000007;
	const int INF = int.MaxValue;
	const double EPS = 1e-7;
	const double PI = 3.1415926536;

	void prog()
	{
		cin = new Scanner();
		int[,] dir8 = new int[8, 2] { { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -1 }, { 0, 1 }, { 1, -1 }, { 1, 0 }, { 1, 1 } };
		int[,] dir4 = new int[4, 2] { { -1, 0 }, { 0, -1 }, { 0, 1 }, { 1, 0 } };

		long A = cin.nextInt();
		long B = cin.nextInt();
		long C = cin.nextInt();
		if (A % 2 == 0 || B % 2 == 0 || C % 2 == 0)
		{
			Console.WriteLine(0);
			return;
		}
		long max = Math.Max(A, Math.Max(B, C));
		if (max == A)
		{
			Console.WriteLine(B * C);
			return;
		}else if (max == B)
		{
			Console.WriteLine(A * C);
			return;
		}
		else
		{
			Console.WriteLine(A * B);
			return;
		}
	}
}

class Scanner
{
	string[] s;
	int i;

	char[] cs = new char[] { ' ' };

	public Scanner()
	{
		s = new string[0];
		i = 0;
	}

	public string next()
	{
		if (i < s.Length) return s[i++];
		string st = Console.ReadLine();
		while (st == "") st = Console.ReadLine();
		s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
		i = 0;
		return next();
	}

	public int nextInt()
	{
		return int.Parse(next());
	}

	public long nextLong()
	{
		return long.Parse(next());
	}

	public double nextDouble()
	{
		return double.Parse(next());
	}
}

Measured memory_bytes: 2904
module ArrayL = ArrayLabels
module ListL = ListLabels

let dbg = Printf.printf "[debug]%s"

let max_num = 100_000_000_000

let id = fun x -> x
let tuple2 x y = (x,y)
let tuple3 x y z = (x,y,z)
let succ x = x + 1
let pred x = x - 1

let (++) n m =
  let rec aux i =
    if i = m then [m]
    else i :: aux (i+1) in
  if n > m then [] else aux n

let (++^) n m = n ++ (m-1)

let scan fmt f = Scanf.sscanf (read_line ()) fmt f

let scan_lines n fmt f =
  List.map (fun _ -> scan fmt f) (0++^n)

let scan_matrix n m e conv =
  let arr = Array.make_matrix n m e in
  Array.iteri (fun i line ->
      let s = Scanf.Scanning.from_string @@ read_line () in
      Array.iteri (fun j _ ->
          arr.(i).(j) <- Scanf.bscanf s " %s" conv;
        ) line) arr; arr

let between n x m = n <= x && x < m

let string_to_list s =
  List.map (String.get s) (0 ++^ String.length s)

module Heap = Set.Make(struct
    type t = int * int
    let compare = compare
  end)

let (v, e) = scan "%d %d" tuple2
let edges =
  let ed = Array.make v [] in
  let l = scan_lines e "%d %d %d" tuple3 in
  ListL.iter l ~f:(fun (s,t,d) ->
      ed.(s) <- (t,d) :: ed.(s);
      ed.(t) <- (s,d) :: ed.(t);); ed

let visited = Array.make v false

let prim =
  let rec aux n h =
    if Heap.is_empty h then n
    else
      let (d, s) = Heap.min_elt h in
      if visited.(s) then aux n (Heap.remove (d, s) h)
      else
        (visited.(s) <- true;
         aux (d+n) @@
         ListL.fold_left edges.(s) ~init:(Heap.remove (d,s) h)
           ~f:(fun h (t,d) ->
               if visited.(t) then h
               else Heap.add (d, t) h))
  in
  aux 0 @@ (Heap.empty |> Heap.add (0, 0))

let () =
  prim  |> Printf.printf "%d\n"



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

int main() {
  int n;
  cin >> n;
  string W[n];
  for (int i = 0; i < n; i ++) cin >> W[i];
  
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j ++) {
      if (i >= j) continue;
      if(W[i] == W[j]) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  
  for (int i = 1; i < n; i++) {
    if(W[i][0] != W[i - 1].back()) {
      cout << "No" << endl;
      return 0;
    }
  }
  
  cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  ll N;
  cin >> N;
  vl X(N), Y(N);  
  rep(i, N){
    cin >> X[i];
    Y[i] = X[i];
  }

  stable_sort(Y.begin(), Y.end());

  ll ord;

  rep(i, N){
    ord = lower_bound(Y.begin(), Y.end(), X[i]) - Y.begin();
    if((ord + 1) <= N / 2) cout << Y[N / 2] << endl;
    else cout << Y[N / 2 - 1] << endl;
  }
  
  
  return 0;
}


Measured memory_bytes: 5360
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {
        //  Left を、釣り合うなら Balanced を、右に傾くなら Right を出力せよ
        int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
        int left = inpt.Take(2).Sum();
        int right = inpt.Skip(2).Sum();
        string ans = "Balanced";
        if(left > right) {
            ans = "Left";
        } else if(left < right) {
            ans = "Right";
        }
        Console.WriteLine(ans);
    }


    public class Reader
    {
        private static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"







";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}


Measured memory_bytes: 13396
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <string>
#include <cmath>
#include <cassert>
#define SIZE 100005

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int A[SIZE];
int B[SIZE];

int main()
{
	int n;
	scanf("%d",&n);
	vector <int> vx;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&A[i]);
		vx.push_back(A[i]);
	}
	sort(A,A+n);
	sort(vx.begin(),vx.end());
	vx.erase(unique(vx.begin(),vx.end()),vx.end());
	if(vx.size()>3)
	{
		puts("No");
		return 0;
	}
	for(int i=0;i<vx.size();i++)
	{
		for(int j=0;j<vx.size();j++)
		{
			int a=vx[i],b=vx[j];
			B[0]=a,B[1]=b;
			for(int k=2;k<n;k++) B[k]=B[k-2]^B[k-1];
			bool up=true;
			for(int k=0;k<n;k++)
			{
				int S=B[k];
				int T=B[(k-1+n)%n]^B[(k+1)%n];
				if(S!=T) up=false;
			}
			if(up)
			{
				sort(B,B+n);
				for(int k=0;k<n;k++) if(B[k]!=A[k]) up=false;
				if(up)
				{
					puts("Yes");
					return 0;
				}
			}
		}
	}
	puts("No");
	return 0;
}


Measured memory_bytes: 1528
#include <algorithm>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  int K, X; std::cin >> K >> X;
  if (500*K >= X) std::cout << "Yes" << std::endl;
  else            std::cout << "No" << std::endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#define rep(i, n) for(int i = 0; i < n; ++i)

int main(void) {
  int n, ans = 0, max = 0, m;
  scanf("%d%d", &n, &m);
  rep(i, m) {
    int a, b;
    scanf("%d%d", &a, &b);
    if(a < n) {
      ans += n - a;
      if(max < n - a) max = n - a;
    }
  }
  ans -= max;
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 2724
#include <iostream>

using namespace std;

const int MAX = 10e5;

int main() {
  int N; cin >> N;
  int dp[MAX];
  for (int i = 0; i < MAX; i++) {
    dp[i] = -1;
  }
  for (int i = 0; i < N; i++) {
    int A; cin >> A;
    auto it = lower_bound(dp + MAX - N, dp + MAX, A);
    *--it = A;
  }
  
  int ans = 0;
  for (int i = 1; i <= MAX; i++) {
    if (dp[MAX - i] == -1) {
      ans = i - 1;
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 7536
#include <bits/stdc++.h>
 
#define INF INT_MAX
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
 
typedef long long ll;
typedef std::pair<int,int> pii;
 
using namespace std;
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n,w;
    cin >> n >> w;
    vector<vector<ll>> wv(n,vector<ll>(2,0)),dp(n+1,vector<ll>(w+1,0));
    REP(i,n)cin >> wv[i][0] >> wv[i][1];

    for(int i = 1;i <= n;i++){
        for(int j = 0;j <= w;j++){
            ll ww = wv[i-1][0], vv = wv[i-1][1];
            if(j - ww < 0){
                dp[i][j] = dp[i-1][j];
            }else{
                dp[i][j] = max(dp[i-1][j],dp[i-1][j - ww] + vv);
            }
        }
    }

    ll ans = 0;
    REP(i,w+1){
        ans = max(dp[n][i],ans);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 80256
#include<bits/stdc++.h>
 
using namespace std;
using S = set<long long>;
using D = deque<long long>; //pop_back pop_front push_back push_front front back clear empty
using L = vector<long long>;
using M = map<int,long long>;  //erase  (でキーごと削除) 追加削除検索O(log(N))
using A = vector<vector<long long>>;
using U = unordered_map<int,long long>; //map  (との違いはkeyの順番を保持していない)
using PQL = priority_queue<long long>; //erase  (でキーごと削除) push pop top 
using PQG = priority_queue<long long,L,greater<long long>>; //erase  (でキーごと削除) push pop top 

#define sorted(vector) sort(vector.begin(),vector.end()) //O(nlongn)
#define sortedreverce(vector) sort(vector.rbegin(),vector.rend()) //O(nlongn)
#define vdel(vector,a) vector.erase(vector.begin()+a)
#define vmin(vector) *min_element(vector.begin(),vector.end()) //O(N)
#define vmax(vector) *max_element(vector.begin(),vector.end()) //O(N)
#define vsum(vector) accumulate(vector.begin(),vector.end(),0) //O(N)
#define vcount(vector,a) count(vector.begin(), vector.end(),a) //O(N)
#define vfind(vector,a) find(vector.begin(), vector.end(), a) != vector.end() //遅いからあんまり使うな
#define bisect_left(vector,a) (lower_bound(vector.begin(),vector.end(),a)-vector.begin())
#define bisect_right(vector,a) (upper_bound(vector.begin(),vector.end(),a)-vector.begin())
#define max max<unsigned long>
#define min min<unsigned long>
#define inf 1000000000000000000+10
#define setans long long ans=0;

long long MOD=1000000007;

template <typename PQ>
long long pqsum(PQ pq){long long tmp=0;while(!pq.empty()){tmp+=pq.top();pq.pop();};return tmp;};

template <typename T>
void print(T a){for (auto b:a){cout<<b<<" ";};cout<<endl;}
template <>
void print(unsigned long a){cout<<a<<endl;}
template <>
void print(char a){cout<<a<<endl;}
template <>
void print(bool a){cout<<a<<endl;}
template <>
void print(long long a){cout<<a<<endl;}
template <>
void print(A a){for (auto b:a){for (auto c:b){cout<<c<<" ";}cout<<endl;};cout<<endl;}
template <>
void print(string a){cout<<a<<endl;}



//存在確認はmap!!!!!!!!!!!!!か配列に埋め込んでcontinueで回避
//__gcd(a,b)はコンパイラがGCC時のみ
//printf("%.16f", ans); 誤差落ち対応君



int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    long long b;
    double a;
    cin>>a>>b;
    setans;
    b-=a;
    ans+=1;
    ans+=ceil(b/(a-1.0));
    print(ans);
}



Measured memory_bytes: 256
def check():
    A = [[int(i) for i in input().split()] for _ in range(3)]
    N = int(input())
    
    for _ in range(N):
        num = int(input())
        for i in range(3):
            for j in range(3):
                if A[i][j] == num:
                    A[i][j] = '*'
    checklist = [a for a in A]
    checklist2 = [[a[i] for a in A] for i in range(3)]
    checklist3 = [[A[0][0], A[1][1], A[2][2]], [A[0][2], A[1][1], A[2][0]]]
    
    a = [checklist, checklist2, checklist3]
    
    for aaa in a:
        for check in aaa:
            if check == ['*', '*', '*']:
                return 'Yes'
    return 'No'
print(check())

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

#pragma GCC optimuze("Ofast")
#pragma GCC optimuze("03")
#pragma GCC optimuze("unroll-loops")

#define F first
#define S second
#define pb push_back
#define llong long long
#define ld long double
#define int llong
#define endl '\n'

using namespace std;

const int N = 2e5 + 5;
const int M = 2e3 + 5;
const int MOD = 1e9 + 7;
const int rx[] = {1, 0, -1, 0};
const int ry[] = {0, 1, 0, -1};

int a[3][N];
int dp[N][3][3];

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifdef ARINOCHKA
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
//    freopen(".in", "r", stdin);
//    freopen(".out", "w", stdout);
#endif // ARINOCHKA

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

    for(int i = 0; i < n; i++) {
        for(int j = 0; j < 3; j++) {
            for(int k = 0; k < 3; k++) {
                dp[i][j][k] = -2e9;
            }
        }
    }
    for(int j = 0; j < 3; j++) {
        dp[0][j][0] = 0;
    }



    for(int i = 0; i < n; i++) {
        for(int j = 0; j < 3; j++) {
            for(int k = 0; k < 2; k++) {
                if (dp[i][j][k] < 0) continue;
                for(int now = 0; now < 3; now++) {
                    if (now == j && !k) {
                        dp[i + 1][j][k + 1] = max(dp[i + 1][j][k + 1], dp[i][j][k] + a[now][i]);
                    } else if (now != j) {
                        dp[i + 1][now][1] = max(dp[i + 1][now][1], dp[i][j][1] + a[now][i]);
                    }
                }

            }
        }
    }

    int wynnik = 0;
    for(int i = 0; i < 3; i++) {
        for(int j = 0; j < 3; j++) {
            wynnik = max(wynnik, dp[n][i][j]);
        }
    }
    cout << wynnik;

    return 0;


}


Measured memory_bytes: 14592
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
using namespace std;

#define N 500000
int key[N];
int rt[N];
int lt[N];
int parent[N];
int np = 0;
int root = -1;

int find_saiki(int x, int k){
	if(x==-1) return 0;
	if(k==key[x]) return 1;

	if(k<key[x]){
		return find_saiki(lt[x], k);
	}else{
		return find_saiki(rt[x], k);
	}
	return 0;
}

int find(int k){
	return find_saiki(root, k);
}

void insert(int k){
	int y = -1;
	int x = root;
	while(x!=-1){
		y = x;
		if(k < key[x]){
			x = lt[x];
		}else{
			x = rt[x];
		}
	}
	if(y==-1){
		root = np;
	}else{
		if(k<key[y]){
			lt[y] = np;
		}else{
			rt[y] = np;
		}
	}
	key[np] = k;
	parent[np] = y;
	np++;
}

void print_saiki1(int x){
	if(lt[x]!=-1) print_saiki1(lt[x]);
	cout << " " << key[x];
	if(rt[x]!=-1) print_saiki1(rt[x]);
}

void print_saiki2(int x){
	cout << " " << key[x];
	if(lt[x]!=-1) print_saiki2(lt[x]);
	if(rt[x]!=-1) print_saiki2(rt[x]);
}
void print(){
	print_saiki1(root);
	cout << endl;
	print_saiki2(root);
	cout << endl;
}


int main(){

	for(int i=0; i<N; i++){
		key[i] = -1;
		parent[i] = -1;
		lt[i] = -1;
		rt[i] = -1;
	}

	int n;
	cin >> n;
	for(int i=0; i<n; i++){
//		cout << i << endl;
		string s;
		cin >> s;
		if(s=="print"){
			print();
		}else if(s=="insert"){
			int k;
			cin >> k;
			insert(k);
		}else if(s=="find"){
			int k;
			cin >> k;
			if(find(k)){
				cout << "yes" << endl;
			}else{
				cout << "no" << endl;
			}
		}
	}


	return 0;
}

Measured memory_bytes: 9028
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef tuple<int, int, int> T;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
ll a[88];

ll solve() {
    int idx = 0;
    while (idx < n && a[0] > a[idx]) idx++;
    ll m = 1000;
    while (idx+1 < n) {
        ll temp0 = a[idx];
        while (idx+1 < n && a[idx] < a[idx+1]) idx++;
        ll temp1 = a[idx];
        ll k = m / temp0;
        m = m - temp0*k + temp1*k;
        while (idx+1 < n && a[idx] >= a[idx+1]) idx++;
    }
    return m;
}

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

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

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 3152
#include <iostream>
#include <map>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

typedef long long ll;

int main () {
	int N;
	cin >> N;
	ll ans = 0;
	for (int j=1; j<=N; j++) {
		ll tmp = N/j;
		ans += tmp*(tmp+1)*j/2;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3588
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int sum = 0;
        for (int i = 0; i < n; i++) {
            sum += sc.nextInt();
        }
        
        System.out.println(sum - n);
    }
}


Measured memory_bytes: 28112
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int N,K;
  cin >> N >> K;
  ll x[N],y[N];
  char c[N];
  int B[K][K];
  int W[K][K];
  int BR[K+1][K+1];
  int WR[K+1][K+1];
  for (int i = 0; i < K; i++) {
    for (int j = 0; j < K; j++) {
      B[i][j] = 0;
      W[i][j] = 0;
    }
  }
  for (int i = 0; i <= K; i++) {
    for (int j = 0; j <= K; j++) {
      BR[i][j] = 0;
      WR[i][j] = 0;
    }
  }
  for (int i = 0; i < N; i++) {
    cin >> x[i] >> y[i] >> c[i];
    x[i] %= (2 * K);
    y[i] %= (2 * K);
  }
  for (int i = 0; i < N; i++) {
    if (x[i] < K && y[i] < K) {
      if (c[i] == 'W') {
        W[x[i]][y[i]]++;
      } else {
        B[x[i]][y[i]]++;
      }
    } else if (K <= x[i] && K <= y[i]) {
      if (c[i] == 'W') {
        W[x[i]%K][y[i]%K]++;
      } else {
        B[x[i]%K][y[i]%K]++;
      }
    } else {
      if (c[i] == 'W') {
        B[x[i]%K][y[i]%K]++;
      } else {
        W[x[i]%K][y[i]%K]++;
      }
    }
  }
  for (int i = 0; i < K; i++) {
    for (int j = 0; j < K; j++) {
      BR[i+1][j+1] = BR[i][j+1] + BR[i+1][j] - BR[i][j] + B[i][j];
    }
  }
  for (int i = 0; i < K; i++) {
    for (int j = 0; j < K; j++) {
      BR[i+1][j+1] = BR[i][j+1] + BR[i+1][j] - BR[i][j] + B[i][j];
    }
  }
  for (int i = 0; i < K; i++) {
    for (int j = 0; j < K; j++) {
      WR[i+1][j+1] = WR[i][j+1] + WR[i+1][j] - WR[i][j] + W[i][j];
    }
  }
  int ans = 0;
  for (int i = 0; i < K; i++) {
    for (int j = 0; j < K; j++) {
      int res = BR[i+1][j+1];
      res += BR[K][K] - BR[i+1][K] - BR[K][j+1] + BR[i+1][j+1];
      res += WR[K][j+1] - WR[i+1][j+1];
      res += WR[i+1][K] - WR[i+1][j+1];
      res = max(N-res,res);
      ans = max(ans,res);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 20868