akhauriyash/Code-Regression huggingface dataset:
int N[]={ 6,10,18,14,  2,13,22,11,  3, 5,21,19,  1,17,23, 7,  0, 9,20,15,  4,12,16, 8};
int E[]={15, 7,11,19,  8, 3,14,23, 16, 0, 6,22,  4, 2,18,20, 12, 1,10,21,  9, 5,13,17};
int W[]={ 9,17,13, 5, 12,21,10, 1,  4,20,18, 2, 16,22, 6, 0,  8,23,14, 3, 15,19,11, 7};
int S[]={16,12, 4, 8, 20, 9, 0,15, 23,17, 1, 7, 21, 5, 3,19, 22,13, 2,11, 18,10, 6,14};
int R[]={ 1, 2, 3, 0,  5, 6, 7, 4,  9,10,11, 8, 13,14,15,12, 17,18,19,16, 21,22,23,20};
int L[]={ 3, 0, 1, 2,  7, 4, 5, 6, 11, 8, 9,10, 15,12,13,14, 19,16,17,18, 23,20,21,22};
n,a,d;
char s[9];
int main()
{
for(;;)
{
scanf("%d",&n);
if(!n)
break;
a=1;
d=0;
for(;n--;)
{
scanf("%s",s);
d=
(*s-78?0:N[d])+
(*s-69?0:E[d])+
(*s-87?0:W[d])+
(*s-83?0:S[d])+
(*s-82?0:R[d])+
(*s-76?0:L[d]);
a+=d/4+1;
}
printf("%d\n",a);
}
}

Measured memory_bytes: 0
#include <stdio.h>
#include <iostream>

using namespace std;

int main()
{
	int a = 0, b = 0;

	cin >> a >> b;

	if (a == b)
	{
		printf("a == b\n");
		return 0;
	}
	if (a > b)
	{
		printf("a > b\n");
		return 0;
	}
	if (a < b)
	{
		printf("a < b\n");
		return 0;
	}
}

Measured memory_bytes: 1116
#define _USE_MATH_DEFINES
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <string.h>
#include <math.h>

using namespace std;

int main(){
	int A, B;
	cin >> A >> B;

	cout << (A - 1) * (B - 1) << endl;

	return 0;
}

Measured memory_bytes: 256
import numpy as np

def isPrimeNum(x):
    if type(x) is not int: return False
    if x <= 1: return False
    if x <= 3: return True
    max = int(np.sqrt(x))
    for i in range(2, max+1):
        if x % i == 0: return False
    return True
    
def isNumLike2017(x):
    if isPrimeNum(x) == False: return False
    if isPrimeNum(int((x+1)/2)) == False: return False
    return True
        
N = 10**5
X = np.zeros(N, dtype='int64')
for i in range(1, N+1):
    if isNumLike2017(i): X[i-1] += 1
X = X.cumsum()

Q = int(input())
for _ in range(Q):
    l, r = input().split()
    l, r = int(l), int(r)
    if l == 1: L = 0
    else: L = X[l-2]
    R = X[r-1]
    print(R - L)

Measured memory_bytes: 28204
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vl vector<ll>
#define pl pair<ll,ll>
#define rep(i,b) for(ll i=0;i<b;i++)
#define all(v) (v).begin(),(v).end()

int main() {
    vl a(3);
    cin>>a[0]>>a[1]>>a[2];
    sort(all(a));
    cout<<a[0]<<" "<<a[2]<<endl;
}


Measured memory_bytes: 3164
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define pb push_back
const ll mod = 1000000007;
void solve(){
    string s,t;int a,b,c,d;
    cin>>s>>t;
    int q;cin>>q;
    int prefs[100010]={0};
    int preft[100010]={0};
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='A') prefs[i]=1;
        else prefs[i]=2;
    }
    for(int i=0;i<t.length();i++)
    {
        if(t[i]=='A') preft[i]=1;
        else preft[i]=2;
    }
    for(int i=1;i<100010;i++)
    prefs[i]+=prefs[i-1];
    for(int i=1;i<100010;i++)
    preft[i]+=preft[i-1];
    for(int i=0;i<q;i++)
    {
        cin>>a>>b>>c>>d;
        if((prefs[b-1]-prefs[a-2])%3==(preft[d-1]-preft[c-2])%3)
        cout<<"YES\n";
        else
        cout<<"NO\n";
        
    }
}
int  main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t;
    //cin>>t;
	t=1;
	while(t--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 1744
#include<bits/stdc++.h>
#define ll          long long int
#define lld          long double
#define pb          push_back
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define vec         vector<ll>
#define all(a)     (a).begin(),(a).end()
#define F           first
#define S           second
#define mod         998244353//1000000007
#define rep(i,a,b)	for(ll  i=a;i<b;i++)
#define repi(i,a,b)	for(ll  i=a;i<=b;i++)
#define per(i,a,b)  for(ll i=a;i>=b;i--)
#define mp          make_pair
#define mit         map<ll,ll>::iterator
#define sit         set<ll>::iterator
#define pit         pair<ll,ll>::iterator
#define xxx          exit(0);
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;
ll xo(ll x, ll y) 
{ 
   return (x | y) & (~x | ~y); 
}  
ll bin_Expo(ll x,ll n)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return bin_Expo(x*x,n/2);
    else                             //n is odd
        return x*bin_Expo(x*x,(n-1)/2);
}
ll mod_Expo(ll x,ll n,ll M)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return mod_Expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*mod_Expo((x*x)%M,(n-1)/2,M))%M;
 
}
bool prime_check(ll x)
{
    bool prime = (x >= 2);
    for (ll i = 2; i * i <= x; i++) 
    {
        if (x % i == 0) 
        {
            prime = false;
            break;
        }
    }
    return prime;
}
ll logg(ll base,ll x) 
{
    return (ll)(log(x) / log(base));
}
ll fact[300005],inv_fact[300005];
ll inv_fac(ll x)
{
	return mod_Expo(x,mod-2,mod);
}
ll nCr(ll x,ll y)
{
	if(y>x || x<0 || y<0)
	return 0;
	return (fact[x]*((inv_fact[y]*inv_fact[x-y])%mod))%mod;
}
ll m[100005],h[100005],a[100005];
bool cmp(int i, int j)
{
    return (abs(m[i]-h[i])<abs(m[j]-h[j]));
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
    while(TESTS--)
    {
    	ll i,j,W,k1,k,n,ans,p,t,n1,n2,x,y,w;
    	cin>>n;
    	rep(i,0,n) cout<<"ACL";
	}
	return 0;
}































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

using namespace std;

using ll = long long;

int main(){
   ll h, w;
   cin >> h >> w;
   if(h == 1 || w == 1){
    cout << 1;
   }else
    cout << (h * w  + 1)/ 2;
   return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
 
public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder st = new StringBuilder();
         
        int i = 1;
         
        while(true){
            int line = Integer.parseInt(br.readLine());
            if(line == 0){
                break;
            }
             
            st.append("Case ").append(i).append(": ").append(line).append("\n");
            i++;
        }
         
        System.out.print(st);
    }
}

Measured memory_bytes: 30332
#include <stdio.h>

int main(void) {
	int a,b;
	while(scanf("%d%d",&a,&b) , a != 0){
		if(!((a * b) % 2)){
			printf("yes\n");
		}
		else{
			printf("no\n");
		}
	}
	return 0;
}

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

int main() { /* ここに書く */

  int L,M;
  
  cin >> L;
  M = L/3;
  
  double N,Ans;
  
  N = L-3*M;
  
  N = N/3;
  
  Ans = N*N*N + 3*N*N*M + 3*N*M*M + M*M*M ;
  
  std::cout << std::fixed;
  std::cout << std::setprecision(12) << Ans << endl;
}

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

a = [0] * n
a[0] = b[0]
for i in range(1, n - 1):
    a[i] = min(b[i - 1], b[i])
ans = 0
for i in range(n):
    ans += a[i]
print(ans + b[-1])


Measured memory_bytes: 38384
#include<stdio.h>
#include<stdlib.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)

char ans[100010],s[100010];
int n;

void f(){
	rep(i,2,n){
		if((ans[i-1]=='S')^(s[i-1]=='o'))ans[i]=-ans[i-2]+'S'+'W';
		else ans[i]=ans[i-2];
	}
	if(((ans[n-2]==ans[0])^(s[n-1]=='o')^(ans[n-1]=='S'))
		&&((ans[n-1]==ans[1])^(s[0]=='o')^(ans[0]=='S'))){
		puts(ans);
		exit(0);
	}
}

int main(){
	scanf("%d%s",&n,s);
	ans[0]='S';ans[1]='S';f();
	ans[0]='S';ans[1]='W';f();
	ans[0]='W';ans[1]='S';f();
	ans[0]='W';ans[1]='W';f();
	puts("-1");
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int ans,n,a[100005],k,t=1;
int main() {
	cin>>n>>k;
	for(int i=0;i<n;i++) cin>>a[i];
	if(k>=n) {cout<<1;return 0;}
	n-=k;
	while(1) {
		n-=k-1;
		t++;
		if(n<=0) {cout<<t;return 0;}
	}
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a;
  cin >> a;
  bool ok=false;
  for(int i=0;i<26;i++){
    for(int j=0;j<15;j++){
      if(a==i*4+j*7){
        cout << "Yes" << endl;
        ok=true;
        break;
      }
    }
    if(ok)break;
  }
  if(ok==false)cout << "No" << endl;
}


Measured memory_bytes: 256
/*
h3110_fr13nd,
 
AUTHOR : @sam_jn
*/
 
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
using namespace std;
// using namespace __gnu_pbds;
// typedef tree<pair<int, int>, null_type, less_equal<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define boost ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll long long
#define MOD 1000000007
#define pb push_back
#define ff first
#define ss second
#define in(a, n) for(int i = 0; i < n; i++) cin >> a[i];
#define ot1(a, n) for(int i = 0; i < n; i++) cout << a[i] << " "; cout << endl;
#define ot2(a, n) for(int i = 0; i < n; i++) cout << a[i] << "\n";
ll pwr(ll a, ll b);
ll pwr(ll a, ll b, ll m);
int baap[200002];
int find(int i);  
bool Union(int x, int y);
ll inv(ll x) {return pwr(x, MOD - 2, MOD);}

//----------------------------------SOLUTION-BELOW-------------------------------------------// 
void solve(){       
    ll x;
  cin >> x;
  cout << 1000 * (x / 500LL) + 5 * ((x % 500) / 5LL);
}
int main(){
                                                            // #ifndef ONLINE_JUDGE    
                                                            // freopen("../input", "r", stdin);
                                                            // freopen("../output", "w", stdout);
                                                            // #else
                                                            // // online submission
                                                            // #endif
    boost
    int _ = 1;
    // cout << 0 << endl;
    // cin >> _;
    while(_--){
        solve();
        cout << endl;
    }
}
 
 
//--------------------------------------DEFININTIONS---------------------------------------
ll pwr(ll a, ll b){
    if(b == 0)
        return 1 ;
    ll c = pwr(a, b/2) ;
    c = c * c;
    if(b % 2)
        return c*a;
    return c ;
}
ll pwr(ll a, ll b, ll m){
    if(b == 0)
        return 1;
    ll c = pwr(a, b/2, m) % m ;
    c = (c * c) % m;    
    if(b % 2)
        return (c * a%m) % m;
    return c ;
}
int find(int i)  
{  
    if (baap[i] != i)  
        baap[i] = find(baap[i]);  
  
    return baap[i];  
}
 
bool Union(int x, int y)
{
    x = find(x);
    y = find(y);
    if(x == y) return false;
    baap[x] = y;
    return true;
}

Measured memory_bytes: 384
#include<iostream>
#include<math.h>
#include<stdlib.h>

using namespace std;

int main(){
	int a,b;

	cin >> a >> b;
	if(a == b){
		cout << (2*a) << endl;
	}else{
		cout << (2*max(a,b)-1) << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

int main(void){

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

	ll A,B,C;
	cin >> A >> B >> C;
	ll x=(A/2)*B*C,y=(A-A/2)*B*C;
	ll d=llabs(x-y);
	ll x1=(B/2)*A*C,y1=(B-B/2)*A*C;
	ll d1=llabs(x1-y1);
	ll x2=(C/2)*B*A,y2=(C-C/2)*B*A;
	ll d2=llabs(x2-y2);

	cout << min(d,min(d1,d2)) << endl;

	return 0;
}


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

int main() {
    string S;
    cin >> S;
    if (S.at(0)!='A' || isupper(S.at(1)) || isupper(S.at(S.size()-1))) {
        cout << "WA\n";
        return 0;
    }
    int nc=0;
    for (int i=2; i<S.size()-1; i++) {
        if (S.at(i)=='C') nc++;
        else if (isupper(S.at(i))) {
            cout << "WA\n";
            return 0;
        }
    }
    if (nc==1) cout << "AC\n";
    else cout << "WA\n";
}

Measured memory_bytes: 256
//
//  main.cpp
//  CP-C++
//
//  Created by ALOK KUMAR THAKUR on 05/05/20.
//  Copyright © 2020 ALOK KUMAR THAKUR. All rights reserved.
//

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define tc() ll T;cin>>T;while(T--)
#define pb push_back
#define Max3(a,b,c) max(a,max(b,c))
#define Min3(a,b,c) min(a,min(b,c))
#define all(v) v.begin(),v.end()

struct cmp {
    bool operator() (const ll& a, const ll& b){
        return a < b;
    }
};

int main() {
    
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    
    /*-----------------Code Begins Here------------------*/
    
    ll n,x,t; cin>>n>>x>>t;
    cout<<((n-1)/x+1)*t;

    /*------------------Code Ends Here-------------------*/
    
    return 0;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int main(){
    int A, B, C, ans=0;
    string S;
    cin >> A >> B;
    if(B==1)
	cout << 0 << endl;
    else
	cout << A-B << endl;
    // cout << ans<<endl;
    
    // if(A==12)
    // 	cout << 1<<endl;
    // else
    // 	cout << A+1<<endl;
    

    // string S;
    // cin >>S;
    // cout << S + "pp"<<endl;

    // if(A == 1)
    // 	puts("ABC");
    // else
    // 	puts("chokudai");
    	
}


Measured memory_bytes: 256
from collections import deque
S = deque(input())
S2 = deque([])
counter = 0
while True:
    if len(S) == 0:
        break
    s = S.popleft()
    if len(S2) == 0:
            S2.append(s)
            continue
    
    elif s!=S2[-1]:
            S2.pop()
            counter +=2
    else:
        S2.append(s)
print(counter)

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

using namespace std;

typedef long long ll;

const int INF = 0x3f3f3f3f;
const int Maxn = 2e3+10;
const int Mod = 1e9+7;

ll a[Maxn];

int main(void)
{
	ios::sync_with_stdio(false);
	cin.tie(false); cout.tie(false);
	ll n, k;
	cin >> n >> k;
	for(int i = 0; i < n; ++i) cin >> a[i];
	ll ans = 0, t = k*(k-1)/2;
	t %= Mod;
	for(int i = 0; i < n; ++i) {
		for(int j = i+1; j < n; ++j) if(a[i] > a[j]) ans++;
	}
	
	ans = ans * k % Mod;
	ll tmp = 0;
	for(int i = 0; i < n; ++i) {
		for(int j = 0; j < n; ++j) {
			if(a[i] > a[j]) tmp++;
		}
	}
	ans += tmp * t % Mod;
	cout << ans % Mod << endl;
	return 0;
}


Measured memory_bytes: 256
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int solve()
{
	int n;
	cin>>n;
	mii mp;
	int ans=0;
	for(int i=0;i<n;i++)
	{
		int x;
		cin>>x;
		mp[x]++;
		if(mp[x]>1)
			ans=1;
	}
	if(ans)	cout<<"NO"<<endl;
	else	cout<<"YES"<<endl;


}
signed main()
{
	fastio;
//	test
		solve();
}




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

A = []
for _ in range(H):
    A.append(list(map(int,input().split())))

M = [[0 for _ in range(W)] for i in range(H)]

num = [[] for _ in range(H*W+1)]
for i in range(H):
    for j in range(W):
        num[A[i][j]].append([i,j])

dist = [0]*(H*W+1)

for i in range(D,H*W+1):
    if i <= D:
        continue
    else:
        dist[i] = dist[i-D] + abs(num[i][0][0]-num[i-D][0][0]) + abs(num[i][0][1]-num[i-D][0][1])

##print(dist)
Q = int(input())

for _ in range(Q):
    l,r = map(int,input().split())
    print(dist[r]-dist[l])

Measured memory_bytes: 31420
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main()
{
    int N;
    cin >> N;
    vector<vector<int>> A(2, vector<int>(N, -1));
    rep(i, 2) rep(j, N) cin >> A.at(i).at(j);
    int num = -1;
    for (int i = 0; i < N;i++){
        int n = 0;
        for (int j = 0; j < N;j++){
            int a = j < i ? 0 : 1;
            n += A.at(a).at(j);
            if(i==j)
                n += A.at(0).at(j);
        }
        if(num<n)
            num=n;
    }
    cout << num << endl;
}

Measured memory_bytes: 256
def bfs_01(v,mod):
    q = deque(); q.append(v)
    visited = [False] * mod
    cur = 0
    while cur == 0:
        s, x = q.popleft()
        if visited[x]:
            continue
        visited[x] = True
        if x == 0:
            cur = s
            return cur
        q.appendleft((s, (10 * x) % mod))
        q.append((s + 1, (x + 1) % mod))
def examD():
    K = I()
    ans = bfs_01((1,1),K)
    print(ans)

import sys,copy,bisect,itertools
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examD()


Measured memory_bytes: 14568
#include<bits/stdc++.h>
#define rg register
#define il inline
#define cn const
#define fp(i,a,b) for(rg int i=(a),ed=(b);i<=ed;++i)
using namespace std;
typedef cn int cint;
cint inf=0x3f3f3f3f,maxn=2010,maxm=4000010,mod=1000000007;
int n,k,f[maxn][maxn];
int fac[maxm],inv[maxm],ifac[maxm];
il int c(cint &n,cint &m){
	return 1ll*fac[n]*ifac[m]%mod *ifac[n-m]%mod;
}
int main(){
	scanf("%d %d",&n,&k);
	if(k==1){puts("1");return 0;}
	fac[0]=1; fp(i,1,n*k)fac[i]=1ll*fac[i-1]*i%mod;
	inv[1]=1; fp(i,2,n*k)inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
	ifac[0]=1; fp(i,1,n*k)ifac[i]=1ll*ifac[i-1]*inv[i]%mod;
	f[0][0]=1;
	fp(i,0,n)fp(j,0,n)if(i+j){
		if(i) f[i][j]=1ll*f[i-1][j]*c(i*(k-1)+j-1,k-2)%mod;
		if(j&&i>=j)f[i][j]=(f[i][j]+f[i][j-1])%mod;
	}
	printf("%d\n",1ll*f[n][n]*fac[n]%mod);
	return 0;
}

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

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1) cout << 0 << endl;
    else if (a == b && b == c) cout << -1 << endl;
    else {
        int cnt = 0;
        for (int i = 0; i < 10000000; i++) {
            if (a % 2 == 1 || b % 2 == 1 || c % 2 == 1) break;
            else {
                cnt++;
                int ta = a, tb = b;
                a = b / 2 + c / 2;
                b = ta / 2 + c / 2;
                c = ta / 2 + tb / 2;
            }
        }
        cout << cnt << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long int ll;
const ll mod = 1e9+7;
const ll mod1 = 998244353;
#define rep(i,a,b) for(ll i=a;i<b;i++)

//*********Debugger template starts***********************//
#define n_l '\n'
#define dbg(...) cout << "[" << #__VA_ARGS__ << "]: "; cout << to_string(__VA_ARGS__) << endl
template <typename T, size_t N> int SIZE(const T (&t)[N]){ return N; } template<typename T> int SIZE(const T &t){ return t.size(); } string to_string(const string s, int x1=0, int x2=1e9){ return '"' + ((x1 < s.size()) ? s.substr(x1, x2-x1+1) : "") + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(const bool b) { return (b ? "true" : "false"); } string to_string(const char c){ return string({c}); } template<size_t N> string to_string(const bitset<N> &b, int x1=0, int x2=1e9){ string t = ""; for(int __iii__ = min(x1,SIZE(b)),  __jjj__ = min(x2, SIZE(b)-1); __iii__ <= __jjj__; ++__iii__){ t += b[__iii__] + '0'; } return '"' + t + '"'; } template <typename A, typename... C> string to_string(const A (&v), int x1=0, int x2=1e9, C... coords); int l_v_l_v_l = 0, t_a_b_s = 0; template <typename A, typename B> string to_string(const pair<A, B> &p) { l_v_l_v_l++; string res = "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; l_v_l_v_l--; return res; } template <typename A, typename... C> string to_string(const A (&v), int x1, int x2, C... coords) { int rnk = rank<A>::value; string tab(t_a_b_s, ' '); string res = ""; bool first = true; if(l_v_l_v_l == 0) res += n_l; res += tab + "["; x1 = min(x1, SIZE(v)), x2 = min(x2, SIZE(v)); auto l = begin(v); advance(l, x1); auto r = l; advance(r, (x2-x1) + (x2 < SIZE(v))); for (auto e = l; e != r; e = next(e)) { if (!first) { res += ", "; } first = false; l_v_l_v_l++; if(e != l){ if(rnk > 1) { res += n_l; t_a_b_s = l_v_l_v_l; }; } else{ t_a_b_s = 0; } res += to_string(*e, coords...); l_v_l_v_l--; } res += "]"; if(l_v_l_v_l == 0) res += n_l; return res; } void dbgm(){;} template<typename Heads, typename... Tails> void dbgm(Heads H, Tails... T){ cout << to_string(H) << " | "; dbgm(T...); }
#define dbgm(...) cout << "[" << #__VA_ARGS__ << "]: "; dbgm(__VA_ARGS__); cout << endl
//*********Debugger template ends ***********************//

void swap(ll &a , ll &b){
    ll t = a;
    a = b;
    b = t;
}

ll min(ll a, ll b){
    if(a<b)return a;
    return b;
}

ll max(ll a, ll b){
    if(a>b)return a;
    return b;
}

 ll pow(ll a, ll b) {
    a %= mod;
    ll ans = 1;
    while (b > 0) {
        if (b & 1)
            ans = ans * a % mod;
        a = a * a % mod;
        b /= 2;
    }
    return ans;
}




int main(){
    #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
   #endif

  ios_base :: sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin>>s;
  for(int i = 0 ; i <3;i++){
    if(s[i] == '7'){
        cout<<"Yes";
        return 0;
    }
  }
  cout<<"No";

}


Measured memory_bytes: 3652
#include <cstdio>
const int SIZE = 33554432;
#define HASH(A) char* c = A; Hash = 1; while(*c){ Hash <<= 2; Hash += Key[*c]; c++; }
using namespace std;

int main() {
  bool dic[SIZE];
  int Hash;
  char Key[85]; Key['A'] = 0; Key['C'] = 1; Key['G'] = 2; Key['T'] = 3;
  int n; scanf("%d\n", &n);
  char str[21];
  for( int i = 0; i < n; i++ ) {
    fgets(str, 21, stdin);
    if( str[0] == 'i' ) {
      HASH(str+7);
      dic[Hash] = 1;
    } else {
      HASH(str+5);
      puts(dic[Hash] ? "yes" : "no");
    }
  }
  return 0;
}


Measured memory_bytes: 8100
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define puts(i) cout<<i<<endl
#define pi 3.14159265358979323846264338
#define pb push_back
#define mp make_pair
#define inf 10000
using ll = long long;
using P = pair<int,int>;
using Pll = pair<ll,ll>;

ll divisor=1000000007;
int main(){
	int h,w;
	cin>>h>>w;
	char s[h][w];
	int dp[h][w]={};
	rep(i,h)rep(j,w)dp[i][j]=divisor;
	rep(i,h){
		rep(j,w){
			cin>>s[i][j];
		}
	}
	dp[0][0]=1;
	for(int i=1;i<h;i++){
		if(s[i-1][0]!=s[i][0])
			dp[i][0]=dp[i-1][0]+1;
		else
			dp[i][0]=dp[i-1][0];
	}
	for(int i=1;i<w;i++){
		if(s[0][i-1]!=s[0][i])
			dp[0][i]=dp[0][i-1]+1;
		else
			dp[0][i]=dp[0][i-1];
	}
	rep(i,h){
		rep(j,w){
			if(dp[i][j]!=divisor)continue;
			dp[i][j]=min(dp[i-1][j]+(s[i-1][j]!=s[i][j]),dp[i][j-1]+(s[i][j-1]!=s[i][j]));
		}
	}
  	/*rep(i,h){
		rep(j,w){
			cout<<dp[i][j];}
      	cout<<endl;
    }*/
      
	int ans=dp[h-1][w-1]/2;
	if(s[0][0]=='#'&&s[h-1][w-1]=='#')ans++;
	cout<<ans<<endl;
	
}


Measured memory_bytes: 256
# C - Walk on Multiplication Table
N = int(input())

# nの約数列挙
def divisor(n):
    ass = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            ass.append(i)
            ass.append(n//i)
    return ass  # sortされていない

dv = divisor(N)
dv.sort()
num = len(dv)
pos1 = dv[int(num/2) - 1]
pos2 = dv[int(num/2)]
dist = pos1 + pos2 - 2
print(dist)

Measured memory_bytes: 3264
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_map>
#include<iomanip>
#include<bitset>
#define mod 998244353
using namespace std;
typedef long long ll;
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)
#define mad(a,b) a=(a+b)%mod
#define mul(a,b) a=a*b%mod


int main(){
    string s; cin>>s;
    if(s.size()==2){
	if(s[0]!=s[1])cout<<2<<endl;
	else cout<<1<<endl;
    }
    else if(s.size()==3){
	if(s[0]==s[1]&&s[1]==s[2])cout<<1<<endl;
	else if(s[0]!=s[1]&&s[1]!=s[2]&&s[0]!=s[2])cout<<3<<endl;
	else if(s[0]!=s[1]&&s[1]!=s[2])cout<<7<<endl;
	else cout<<6<<endl;
    }
    else{
	set<char> st;
	for(int i=0;i<s.size();i++){
	    st.insert(s[i]);
	}
	if(st.size()==1)cout<<1<<endl;
	else{
	    ll f[200010][3][3];
	    for(int p=0;p<3;p++)for(int q=0;q<3;q++){
		f[0][p][q]=(p==q);
	    }
	    for(int i=0;i<s.size()-1;i++){
		for(int p=0;p<3;p++)for(int q=0;q<3;q++){
		    f[i+1][p][q]=0;
		}
		for(int p=0;p<3;p++)for(int q=0;q<3;q++){
		    for(int k=0;k<3;k++){
			if(k==q)continue;
			mad(f[i+1][(p+k)%3][k],f[i][p][q]);
		    }
		}
	    }
	    ll res=1;
	    for(int i=0;i<s.size()-1;i++)mul(res,3LL);
	    ll sum=0;
	    for(int i=0;i<s.size();i++)sum+=(s[i]-'0');
	    sum%=3;
	    for(int i=0;i<3;i++)mad(res,-f[s.size()-1][sum][i]);
	    bool th=0;
	    for(int i=0;i<s.size()-1;i++){
		th|=(s[i]==s[i+1]);
	    }
	    mad(res,(th==0));
	    if(res<0)res+=mod;
	    cout<<res<<endl;
	}
    }
}



Measured memory_bytes: 14596
N, W = map(int, input().split())
vs = [[] for _ in range(4)]
w1, v1 = map(int, input().split())
vs[0].append(v1)
for i in range(N - 1):
    w, v = map(int, input().split())
    vs[w - w1].append(v)
#print(vs)
for i in range(4):
    vs[i].sort()
#print(vs)
ans = 0
for i in range(N + 1):
    if i * w1 > W:
        break
    if i == 0:
        si = 0
    else:
        si = sum(vs[0][-i:])
    for j in range(N + 1 - i):
        if i * w1 + j * (w1 + 1) > W:
            break
        sj = si
        if j > 0:
            sj += sum(vs[1][-j:])
        for k in range(N + 1 - i - j):
            if i * w1 + j * (w1 + 1) + k * (w1 + 2) > W:
                break
            sk = sj
            if k > 0:
                sk += sum(vs[2][-k:])
            for l in range(N + 1 - i - j - k):
                if i * w1 + j * (w1 + 1) + k * (w1 + 2) + l * (w1 + 3) > W:
                    break
                sl = sk               
                if l > 0:
                    sl += sum(vs[3][-l:])
                ans = max(ans, sl)
print(ans)

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

using namespace std;

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

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void __print(vector<bool> x){cerr<<"{";int f=x.size();for(auto i:x){cerr<<i;(--f !=0)?cerr<<",":cerr<<"";}cerr<<"}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
//void __print(vector<bool> x) {int f = 0; cerr << '{'; for (auto i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
//void _print() {cerr << "]\n";}

#ifndef ONLINE_JUDGE
#define ANTHRO(x...) cerr << "[" << #x << "] = [", _print(x)
#else
#define ANTHRO(x...)
#endif

template<typename... T>
void read(T&... args) {
	((cin >> args), ...);
}

template<typename... T>
void writ(T&&... args) {
	((cout << args << " "), ...);
}
#define ll long long
#define MOD 1000000007
#define INF (ll)1e18
#define EPS 1e-9
/*
	XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    No, nothing good starts in a getaway car
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
*/

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll x; read(x);
    ll an=0,gi=100;
    double g=100;
	while(gi<x){
		ll gx=(g/100);
		g+=gx;
		gi=(ll)g;
		//ANTHRO(gi);
		an++;
		//in.get();
	}
	writ(an);
    return 0;
}


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

using namespace std;

int main()
{int a,b,c;
cin>>a>>b>>c;
a=a*100;
b*=10;
a=a+b+c;
if(a%4==0)
cout<<"YES";
else
cout<<"NO";
cout<<endl;
return 0;
}


Measured memory_bytes: 256
struct TreeDP<Edge> {
    size: usize,
    edge: Vec<(usize, usize, Edge)>,
}

impl<Edge>  TreeDP<Edge> {
    fn new(size: usize) -> Self {
        TreeDP {
            size: size,
            edge: vec![],
        }
    }
    fn add_edge(&mut self, a: usize, b: usize, c: Edge) {
        assert!(a < self.size && b < self.size && a != b);
        self.edge.push((a, b, c));
    }
    fn solve<Init, Merge, Value>(&self, root: usize, init: Init, merge: Merge) -> Value
    where Init: Fn(usize) -> Value, 
          Merge: Fn(Value, Value, &Edge) -> Value,
    {
        let size = self.size;
        let mut graph = vec![vec![]; size];
        for (i, e) in self.edge.iter().enumerate() {
            graph[e.0].push((e.1, i));
            graph[e.1].push((e.0, i));
        }
        let mut topo = vec![];
        let mut stack = vec![(root, root)];
        while let Some((v, p)) = stack.pop() {
            topo.push(v);
            if let Some(k) = graph[v].iter().position(|e| e.0 == p) {
                graph[v].remove(k);
            }
            for e in graph[v].iter() {
                stack.push((e.0, v));
            }
        }
        assert!(topo.len() == size);
        let mut dp: Vec<Option<Value>> = (0..size).map(|_| None).collect();
        for &v in topo.iter().rev() {
            let mut now = init(v);
            for &(u, k) in graph[v].iter() {
                let b = dp[u].take().unwrap();
                now = merge(now, b, &self.edge[k].2);
            }
            dp[v] = Some(now);
        }
        dp[root].take().unwrap()
    }
}

use std::io::Read;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let m: usize = it.next().unwrap().parse().unwrap();
    const MOD: u64 = 998_244_353;
    let mut solver = TreeDP::new(n);
    for _ in 1..n {
        let x: usize = it.next().unwrap().parse::<usize>().unwrap() - 1;
        let y: usize = it.next().unwrap().parse::<usize>().unwrap() - 1;
        solver.add_edge(x, y, ());
    }
    type Value = Vec<(u64, u64)>;
    type Edge = ();
    let init = |_v: usize| -> Value {
        vec![(1, 0), (0, 1)]
    };
    let merge = |a: Value, b: Value, _e: &Edge| -> Value {
        let mut next = vec![(0, 0); a.len() + b.len() - 1];
        for (i, a) in a.iter().enumerate() {
            for (j, b) in b.iter().enumerate() {
                next[i + j].0 = (next[i + j].0 + a.0 * (b.0 + b.1)) % MOD;
                next[i + j].1 = (next[i + j].1 + a.1 * (b.0 + b.1)) % MOD;
                if i > 0 {
                    next[i + j - 1].1 = (next[i + j - 1].1 + a.1 * b.1) % MOD;
                }
            }
        }
        next.truncate(m + 1);
        next
    };
    let res = solver.solve(0, init, merge);
    let ans = *res.last().unwrap();
    println!("{}", (ans.0 + ans.1) % MOD);
}

fn main() {
    run();
}



Measured memory_bytes: 22024
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
    x=0;char c=getchar();bool f=0;
    while(!isdigit(c)) f|=c=='-',c=getchar();
    while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
    if(f) x=-x;return  x;
}
template<class t> inline void write(t x){
    if(x<0){putchar('-'),write(-x);}
    else{if(x>9)write(x/10);putchar('0'+x%10);}
}

#define int long long

const int N=55,M=25;
int en,f[N],d[N],h[N],s[M],n,m,ans;

struct edge{
	int n,v;
}e[N<<1];

void add(int x,int y){
	e[++en]=(edge){h[x],y};
	h[x]=en;
}

void dfs(int x){
	d[x]=d[f[x]]+1;
	for(int i=h[x];i;i=e[i].n){
		int y=e[i].v;
		if(y==f[x]) continue;
		f[y]=x;
		dfs(y);
	}
}

signed main(){
	read(n);
	for(int i=1,x,y;i<n;i++){
		read(x);read(y);
		add(x,y);add(y,x);
	}
	dfs(1);
	read(m);
	for(int i=0,x,y;i<m;i++){
		read(x);read(y);
		if(d[x]<d[y]) swap(x,y);
		while(d[x]^d[y]) s[i]|=1ll<<x-1,x=f[x];
		while(x^y) s[i]|=(1ll<<x-1)|(1ll<<y-1),x=f[x],y=f[y];
	}
	int lim=1<<m;
	for(int i=1;i<lim;i++){
		int cnt=0,now=0,tot=0;
		for(int j=0;j<m;j++) if(i>>j&1) cnt++,now|=s[j];
		for(int j=0;j<n;j++) if(now>>j&1) tot++;
		tot=1ll<<(n-1-tot);
		if(cnt&1) ans+=tot;
		else ans-=tot;
	}
	write((1ll<<n-1)-ans);
}

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

int f(int x){
    int cnt = 0;
    for(int i=1; i*i<=x; ++i){
        if(x%i==0){
            cnt++;
            if(x/i!=i){cnt++;}
        }
    }
    return cnt;
}

int main(){
    int n; cin >> n;
    vector<int> num(n+1);
    for(int i=1; i<=n; ++i){
        num[i] = f(i); //cout << num[i] << ",";
    }
    int res = 0;
    for(int i=1; i<n; ++i){
        int j = n-i;
        res += num[i];
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 7208
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main (){

        int c = 0;
        int add1,add2;
        int *ptr = new int[3];
        cin >> ptr[0] >> ptr[1] >>ptr[2];

        sort(ptr,ptr+3);

        add2 = (ptr[1]-ptr[0]+1)/2;

        if (ptr[0] == ptr[1] ) {
                c = ptr[2] - ptr[0];
        }else if (ptr[1] == ptr[2]) {

                if ((ptr[0]%2==0 &&ptr[1]%2==0 ) ||(ptr[0]%2==1 &&ptr[1]%2==1)) {
                        c = (ptr[2]+1 - ptr[0])/2;
                }else{
                        c = (ptr[2]+1 - ptr[0])/2 +1;
                }
        }else{
                if ((ptr[0]%2==0 &&ptr[1]%2==0 ) ||(ptr[0]%2==1 &&ptr[1]%2==1 )) {
                        add1 = ptr[2] - ptr[1];
                }else{
                        add1 = ptr[2] - ptr[1]+1;
                }

                c = add1 + add2;
        }


        cout << c << endl;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class EAllYouCanEat {
public:
    static constexpr int kStressIterations = 0;

    static void generateTest(std::ostream& test) {
    }


    void solve(std::istream& cin, std::ostream& cout) {
        int N, T;
        cin >> N >> T;
        vector<int> A(N), B(N);
        REP(i, N) cin >> A[i] >> B[i];

        vector<P> v(N);
        REP(i, N) {
            v[i] = {A[i], B[i]};
        }
        sort(v.begin(), v.end());

        vector<vector<int>> dp(N + 1, vector<int>(T + 1));
        REP(i, N) {
            REP(j, T) {
                int a = v[i].first;
                int b = v[i].second;
                dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);

                int nt = min(T, j + a);
                dp[i + 1][nt] = max(dp[i + 1][nt], dp[i][j] + b);
            }
            dp[i + 1][T] = max(dp[i + 1][T], dp[i][T]);
        }

        int res = 0;
        REP(j, T + 1) {
            res = max(res, dp[N][j]);
        }
        cout << res << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    EAllYouCanEat solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 70784
# 2とNのどちらでも割り切れる最小の整数

N=int(input())

N_MAX = int(10e9)

start = N
interval = N

ans = 0

for x in range(N,N_MAX,N):
	# print(x)
	if x % N == 0 and x % 2 == 0:
		ans = x
		break

print(ans)


Measured memory_bytes: 2940
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := NewIo(os.Stdin, os.Stdout)
	defer io.Flush()
	n := io.NextInt()
	a, b := make([]int, n-1), make([]int, n-1)
	for i := 0; i < n-1; i++ {
		ai, bi := io.NextInt(), io.NextInt()
		if ai > bi {
			ai, bi = bi, ai
		}
		a[i], b[i] = ai, bi
	}
	ans := solve(n, a, b)
	io.Println(ans)
}

// O(n)
// 連結成分数 = 頂点数 - 辺数 (閉路がないため)
func solve(n int, a, b []int) (ans int) {
	v, e := 0, 0
	for i := 1; i <= n; i++ {
		v += i * (n - i + 1)
	}
	for i := 0; i < n-1; i++ {
		e += a[i] * (n - b[i] + 1)
	}
	return v - e
}

// Io is I/O object
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

// NewIo returns a new Io instance
func NewIo(r io.Reader, w io.Writer) *Io {
	return &Io{
		reader: bufio.NewReader(r),
		writer: bufio.NewWriter(w),
	}
}

// Flush flushes writer
func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

// NextLine scans a line from stdin
func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

// Next return a word from stdin
func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

// NextInt returns an integer from stdin
func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

// Println is a wrapper of fmt.Fprintln
func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


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

using namespace std;

int main() {
    int n, m, a;
    cin >> n >> m;
    if (n > 1) {
        vector<int> v;
        for (int i=0; i<n;i++){
            cin >> a;
            v.push_back(a);
        }
        sort(v.begin(), v.end());
        make_heap(v.begin(), v.end()); 
        while (m > 0) {
            a = v.front();
            pop_heap(v.begin(), v.end());
            v.pop_back();
            
            while (a >= v.front() and m > 0) {
                a = a / 2;
                m--;
            }
            v.push_back(a);
            push_heap(v.begin(), v.end());
        }
        cout << accumulate(v.begin(), v.end(), (long long)0);
    }
    else {
        cin >> a;
        cout << ((unsigned long long)a >> m);
    }
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

void yes() { cout << "Yes" << endl; exit(0); }
void no() { cout << "No" << endl; exit(0); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> void amax(T &x, T y) { x = max(x, y); }
template <typename T> void amin(T &x, T y) { x = min(x, y); }
template <typename T> T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

const int INF = 1001001001;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};

void solve() {
  i64 n, m, k;
  cin >> n >> m >> k;
  vi64 a(n), b(m);
  cin >> a >> b;
  vi64 asum(n + 1);
  vi64 bsum(m + 1);
  rep(i, n) asum[i + 1] += asum[i] + a[i];
  rep(i, m) bsum[i + 1] += bsum[i] + b[i];
  int ans = 0;
  repc(i, n) {
    i64 rest = k - asum[i];
    int ok = -1, ng = m + 1;
    while (abs(ok - ng) != 1) {
      int x = (ok + ng) >> 1;
      (rest - bsum[x] >= 0 ? ok : ng) = x;
    }
    if (ok >= 0) amax(ans, i + ok);
  }
  cout << ans << endl;
}


Measured memory_bytes: 9504
import java.util.Scanner;

public class Main {

    private static final int MOD = 1_000_000_007;

    private static int H;
    private static int W;

    private static char[][] S;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        H = sc.nextInt();
        W = sc.nextInt();

        S = new char[H][W];

        for (int i = 0; i < H; i++) {
            S[i] = sc.next().toCharArray();
        }

        int[][] left = new int[H][W];
        int[][] right = new int[H][W];
        int[][] up = new int[H][W];
        int[][] down = new int[H][W];


        for (int i = 0; i < H; i++) {
            int cnt = 0;
            for (int j = W - 1; j >= 0; j--) {
                if (S[i][j] == '#') {
                    cnt = 0;
                } else {
                    cnt++;
                }

                left[i][j] = cnt;
            }
        }
        for (int i = 0; i < H; i++) {
            int cnt = 0;
            for (int j = 0; j < W; j++) {
                if (S[i][j] == '#') {
                    cnt = 0;
                } else {
                    cnt++;
                }

                right[i][j] = cnt;
            }
        }
        for (int j = 0; j < W; j++) {
            int cnt = 0;
            for (int i = H - 1; i >= 0; i--) {
                if (S[i][j] == '#') {
                    cnt = 0;
                } else {
                    cnt++;
                }

                up[i][j] = cnt;
            }
        }
        for (int j = 0; j < W; j++) {
            int cnt = 0;
            for (int i = 0; i < H; i++) {
                if (S[i][j] == '#') {
                    cnt = 0;
                } else {
                    cnt++;
                }

                down[i][j] = cnt;
            }
        }

        int max = 0;

        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                max = Math.max(max, left[i][j] + right[i][j] + up[i][j] + down[i][j] - 3);
            }
        }

        System.out.println(max);
    }

}


Measured memory_bytes: 144060
n = int(input())
a_list = list(map(int, input().split()))
flag = "ok"
for i in a_list:
  #print(i)
  if i%2 == 0: 
    if i%3 != 0 and i%5 != 0:
      flag = "ng"
if flag == "ok":
  print("APPROVED") 
else:
  print("DENIED")


Measured memory_bytes: 2940
package main

import (
	"bufio"
	"fmt"
	"io"
	"log"
	"os"
	"strconv"
)

func main() {
	a, b, c := readString(), readString(), readString()
	if a == b && b == c {
		fmt.Println("No")
		return
	}
	if a == b || b == c || c == a {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

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

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	log.SetFlags(log.Lshortfile)
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 640
// Code for A - Don't be late
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define FOR(i,x,y) for(ll i=x;i<(ll)(y);i++)

#define MOD 1000000007
#define mod(x) ( (x) % MOD + MOD ) % MOD

#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<typename T, typename U> void view(const std::map<T, U>& m){ for(const auto& e : m){ std::cout << e.first << "=>" << e.second << " "; } std::cout << std::endl; }

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

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

  return 0;
}


Measured memory_bytes: 3616