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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

//最大公約数
ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}

//階乗
ll ka(ll i){
    ll res=1;
    while(i>0){
        res=res*i;
        i--;
    }
    return res;
}
 
//ncr
ll ncr(ll x,ll y){
    ll a = x;
    ll b = 1;
    if(y>(x/2)){
        y=x-y;
    }
    for(ll i=1;i<y;i++){
        a*=x-i;
        b*=i+1;
    }
    return a/b;
}

//フィボナッチ数列
ll f(ll x){
    ll dp[x+1];
    dp[1]=1;
    dp[2]=1;
    for(ll i=3;i<=x;i++){
        dp[i]=dp[i-1]+dp[i-2];
    }
    return dp[x];
}

//char->int
int ctoi(char c){
    return c-'0';
}

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}



int main(){
    int a,b,c,k;
    cin >> a >> b >> c >> k;

    for(int i=0;i<k;i++){
        if(a>=b){
            b = b*2;
        }else{
            c = c*2;
        }

        if(b>a&&c>b){
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 N;
	cin >> N;
	int64 res = 0;
	FOR (i, 1, N+1) {
		if (i * i > N) break;
		int64 rest = N-i;
		if (rest % i == 0) {
			if (rest / i > i) res += rest/i;
		}
	}
	cout << res << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#define N 2000
#define M 8000010
#define ls x << 1
#define rs x << 1 | 1
#define inf 0x3f3f3f
#define inc(i) (++ (i))
#define dec(i) (-- (i))
#define mid ((l + r) >> 1)
// #define int unsigned __int128
//#define ll long long
#define XRZ 19260817
#define pai acos(-1)
#define debug() puts("XRZ TXDY");
#define mem(i, x) memset(i, x, sizeof(i));
#define Next(i, u) for(register int i = head[u]; i ; i = e[i].nxt)
#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout);
#define Rep(i, a, b) for(register int i = (a) , i##Limit = (b) ; i <= i##Limit ; inc(i))
#define Dep(i, a, b) for(register int i = (a) , i##Limit = (b) ; i >= i##Limit ; dec(i))
using namespace std;
inline int read() {
    register int x = 0, f = 1; register char c = getchar();
    while(c < '0' || c > '9') {if(c == '-') f = -1;c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c 	- 48, c = getchar(); 
    return x * f;
}
inline int read_plus() {
    register int res = 0, ch = getchar();
    while(!isdigit(ch) and ch != EOF) ch = getchar();
    while(isdigit(ch)) res = ((res << 3) + (res << 1) + (ch - '0')) % XRZ, ch = getchar();
    return res;
}	
int dx[10] = {0, 1, 1, 2, 2, -1, -1, -2, -2};
int dy[10] = {0, 2, -2, 1, -1, 2, -2, 1, -1};
char s;
signed main() { scanf("%c", &s);
	if(s >= 'a' && s <= 'z') puts("a");
	else puts("A");
	return 0;
}// 

Measured memory_bytes: 3760
#include <stdio.h>
#include <iostream>
#include <algorithm>

using namespace std;
int main(){
  	int N, tmp, flag = 1, mid;
  	int d[100000];
  
  	scanf("%d\n",&N);
  
  	for(int i = 0; i < N; i++){
    	scanf("%d\n",&d[i]);
    }
  
  	sort(d,d+N);
  
  	mid = N/2;
  
  	if(d[mid-1] == d[mid]){
    	printf("0\n");
    }else{
    	printf("%d\n",d[mid] - d[mid-1]);
    }
  	
	return 0;
}

Measured memory_bytes: 640
S = str(input())
N = int(input())
Ones = 0
nxt = ""
for i in range(len(S)):
  if S[i] == "1":
    Ones += 1
  else:
    nxt = S[i]
    break
if N <= Ones:
  print(1)
else:
  print(nxt)
        

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

int main () {
    int N, K, s = 0;
    cin >> N >> K;

     for (int i = 0; i < N; i++){
         int x;
         cin >> x;

        if (x <= x - K || x <= K - x){
             s += 2 * x;
             continue;
         }
         if (x > x - K && x - K > 0){
             s += 2 * (x- K);
             continue;
         }

         if (x > K - x && K - x > 0){
             s += 2 * (K - x);
         }
         
     }
     cout << s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
 int N,K;
 string S; 
  cin>>N>>K;
  cin>>S;
  if(S.at(K-1)=='A'){
    S.at(K-1)='a';
  }else if(S.at(K-1)=='B'){
    S.at(K-1)='b';
  }else if(S.at(K-1)=='C'){
   S.at(K-1)='c';
  }
  cout<<S<<endl;
  return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
PY = [list(map(int, input().split())) + [i] for i in range(M)]
PY.sort(key=lambda x: [x[0], x[1]])
ans = []
P = [0] * (N + 1)
for p, y, i in PY:
    P[p] += 1
    tmp = str(p).zfill(6) + str(P[p]).zfill(6)
    ans.append([i, tmp])
ans.sort()
for i, a in ans:
    print(a)

Measured memory_bytes: 42248
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <functional>
#include <utility>
#include <queue>
#include <vector>
using namespace std;
typedef long long int ll;
const ll  MOD = 1000000007;

ll ans=0;
ll k_table[200100];
ll pow(ll x, ll n){
  ll ret = 1;
  while(n>0){
    if(n & 1){
      ret = (ret * x) % MOD;
    }
    x = (x*x) % MOD;
    n >>= 1;
  }
  return ret;
}
int main(){
  ll H,W,A,B;
  cin >> H >> W >> A >> B;
  H--;
  W--;
  A--;
  B--;
  k_table[0] = 1;
  for(ll i=1;i<=200000;i++){
    k_table[i] = (k_table[i-1] * i) % MOD;
  }
  ll hab = k_table[(H-A)+B];
  ll wab = k_table[A+(W-B)];
  ll m = min(W-B,H-A);
  for(ll i=0;i<m;i++){
    //cout << (hab*h_ab)%MOD << endl;
    //cout << (wab*w_ab)%MOD << endl;
    ll h_ab = pow( (k_table[H-A-1-i]*k_table[B+1+i])%MOD , MOD-2);
    ll w_ab = pow( (k_table[A+1+i]*k_table[W-B-1-i])%MOD , MOD-2);
    ans = (ans + (((hab*h_ab)%MOD) * ((wab*w_ab)%MOD))%MOD)%MOD;
  }
  cout << ans << endl;

}

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


int main(){
    int N;
    cin >> N;
    vector<int> t(N+1), x(N+1), y(N+1);
    for(int i=1; i<=N; i++) cin >> t[i] >> x[i] >> y[i];
    
    t[0]=x[0]=y[0]=0;
    bool flag=true;
    int T, D;
    
    for(int i=1; i<=N; i++){
        T = t[i]-t[i-1];
        D = abs(x[i]-x[i-1])+abs(y[i]-y[i-1]);
        if(T<D){
            flag=false;
            break;
        }
        if((T%2==0&&D%2==1) || (T%2==1&&D%2==0)){
            flag = false;
            break;
        }
    }
    
    cout << (flag?"Yes":"No") << endl;
}


Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
typedef long long int ll;
using namespace std;

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

ll lcm(ll a, ll b) {
    ll g = gcd(a,b);
    return (a/g)*(b/g)*g;
}

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

    long long ans, tmp;
    cin >> ans;
    for (int i = 0; i < n-1; i++) {
        cin >> tmp;
        ans = lcm(ans, tmp);
    }

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

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


#define li			long long int
#define rep(i,to)	for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)	for(li i=(li)(start);i<((li)(to));i++)
#define pb			push_back
#define sz(v)		((li)(v).size())
#define bgn(v)		((v).begin())
#define eend(v)		((v).end())
#define allof(v)	(v).begin(), (v).end()
#define dodp(v,n)		memset(v,(li)n,sizeof(v))
#define bit(n)		(1ll<<(li)(n))
#define mp(a,b)		make_pair(a,b)
#define rin	rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)		idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)		idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)		idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)	for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)		idp p2((x).F, (x).S)
#define dump(x,n)	idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)	idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)	idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)	idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)	rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)	rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

string s;

li ju[12];

int main() {
	// construct ju
	ju[0] = 1;
	repp(i, 1, 12) {
		ju[i] = ju[i - 1] * 10;
	}

	cin >> s;
	li n = sz(s);
	li res = 0;
	rep(i, n) {
		li x = s[i] - '0';
		repp(j, i, n - 1) {
			res += x * ju[j - i] * bit(n - 2 - j) * bit(i);
		}
		res += x * ju[n - i - 1] * bit(i);
	}
	cout << res << endl;


	return 0;
}

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

using namespace std;

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

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

int lcm(int a,int b)
{
	return a/__gcd(a,b)*b;
}

int main()
{
	for(int n,m;cin>>n>>m,n|m;){
		vi ps(m);
		rep(i,m) cin>>ps[i];
		ll sum=ll(n+1)*n/2;
		int cnt=n;
		repi(i,1,1<<m){
			int mul=1;
			rep(j,m) if(1<<j&i) mul=lcm(mul,ps[j]);
			if(__builtin_popcount(i)&1)
				sum-=ll(n/mul+1)*n/2,cnt-=n/mul;
			else
				sum+=ll(n/mul+1)*n/2,cnt+=n/mul;
		}
		if(cnt==0)
			printf("%f\n",0.0);
		else
			printf("%f\n",(double)sum/cnt);
	}
	
	return 0;
}

Measured memory_bytes: 952
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
#define INF 1e18
#define MOD 1000000007
#define N 1000005
#define BB(V) V[V.size()-2]
#define ex(V) return printf(V),0
using namespace std;
ll sum(ll x){
	ll ret=0;
	while(x){
		ret+=x%10;
		x/=10;
	}
	return ret;
}
vector<ll>v;
int main(){
	int n;
	scanf("%d",&n);
	ll dec=1;
	for(int i=0;i<15;i++){
		for(int j=2;j<=9*(i+1)+1;j++){
			v.pb(dec*j-1);
		}
		dec*=10;
	}
	sort(v.begin(),v.end());
	int k=unique(v.begin(),v.end())-v.begin();
	for(int i=0;i<k;i++){
		for(int j=i+1;j<k;j++){
			if(v[i]*sum(v[j])>v[j]*sum(v[i])){
				v.erase(v.begin()+i--);
				break;
			}
		}
	}
	for(int i=0;i<n;i++)printf("%lld\n",v[i]);
}

Measured memory_bytes: 256
n,a=map(int,input().split())
x=list(map(int,input().split()))
dp=[[[0]*(n*a+1) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0]=1
for i in range(1,n+1):
    for j in range(i+1):
        for k in range(n*a+1):
            if k+x[i-1]<=n*a:
                if j>=1:
                    dp[i][j][k+x[i-1]]+=dp[i-1][j-1][k]
            dp[i][j][k]+=dp[i-1][j][k]
ans=0
for i in range(1,n+1):
    ans+=dp[n][i][i*a]
print(ans)

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

int main()
{
	int x1=0,x2=0,x3=0,x4=0;
	int y1=0,y2=0,y3=0,y4=0;
	scanf("%d %d %d %d",&x1,&y1,&x2,&y2);
	int dy=y2-y1;
	int dx=x2-x1;
	x3=x2-dy;
	y3=y2+dx;
	x4=x1-dy;
	y4=y1+dx;
	printf("%d %d %d %d\n",x3,y3,x4,y4);
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)

  val n = sc.nextInt
  val ar = Range(0, n).map(_ => sc.nextInt - 1)
    .toArray

  println(solve(ar))

  def solve(ar: Array[Int]): Int = {
    var p = 0
    for (i <- 0 to ar.length) {
      p match {
        case 1 =>
          return i
        case _ if ar(p) < 0 => return -1
        case _ =>
          val n = ar(p)
          ar(p) = -1
          p = n
      }
    }
    return -1
  }
}


Measured memory_bytes: 54332
#include<bits/stdc++.h>
using namespace std;
#define int ll
#define ll long long
const ll mod = 998244353;
const ll modinf = 100000000000031ll;
ll power(ll x, ll y, ll p) {
	ll res = 1ll;
	x = x % p;
	while (y) {
		if (y & 1ll)res = (res * x) % p;
		y = y >> 1ll;
		x = (x * x) % p;
	}
	return res;
}
struct dat{
  int x,y;
};

int fact(int n){return n>1?n*fact(n-1):1;}

#define np(a) next_permutation(a.begin(),a.end())

signed main(){
  int n;
  double res=0;
  cin>>n;
  vector<dat> v(n);
  for(auto& i:v)cin>>i.x>>i.y;
  vector<int> p(n);
  for(int i=0;i<n;++i)p[i]=i;
  for(int i=0;i<fact(n);++i){
    double resp=0;
    for(int j=1;j<n;++j)resp+=sqrt(pow(v[p[j]].x-v[p[j-1]].x,2)+pow(v[p[j]].y-v[p[j-1]].y,2));
    res+=resp;
    np(p);
  }
  cout<<setprecision(15)<<res/fact(n);
}

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

using namespace std;

int main(){
  string s;
  cin >> s;
  int N = s.size();
  int cnt = 0;
  for(int i = 1; i < N; i++){
    if(s[i-1] != s[i]) cnt++;
  }

  cout << cnt << endl;
}


Measured memory_bytes: 512
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    mod=10**9+7
    N,K=map(int,readline().split())
    A=list(range(N+1))
    s1=A[:]
    s2=A[:]
    for i in range(1,N+1):
        s1[i]+=s1[i-1]
    for i in range(N-1,-1,-1):
        s2[i]+=s2[i+1]
    
    res=0
    for l in  range(K-1,N+1):
        a=s2[N-l]-s1[l]+1
        res+=a
        res%=mod
    print(res)

if __name__=="__main__":
    main()

Measured memory_bytes: 38048
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}

#define D1(a) cerr<<#a<<":"<<a<<endl
#define D2(a,b) cerr<<#a<<":"<<a<<","<<#b<<":"<<b<<endl
#define D3(a,b,c) cerr<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c <<endl
#define D4(a,b,c,d) cerr<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c<<","<<#d<<":"<<d<<endl
#define DH(c) do{rep(__i, c.size())cerr<<c[__i]<<(__i==c.size()-1?'\n':' ');}while(0)

int main()
{
    string S; cin >> S;
    int N = S.size();
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        A[i] = S[i] - '0';
    }
    vector<int> X(N);
    X[N-1] = 1;
    for (int i = 1; i < N; i++) {
        X[N-1-i] = (X[N-i] * 10) % 2019;
    }
    // DH(X);

    vector<int> L(N);
    vector<int> R(N);
    L[0] = (A[0] * X[0]) % 2019;
    for (int i = 1; i < N; i++) {
        L[i] = (L[i-1] + A[i] * X[i]) % 2019;
    }
    // DH(L);

    // R[N-1] = A[N-1] % 2019;
    // for (int i = 1; i < N; i++) {
    //     R[N-1-i] = (R[N-i] + A[N-1-i] * X[N-1-i]) % 2019;
    // }
    // DH(R);

    vector<int> cnt(2019, 0);
    cnt[0] = 1;
    for (int l : L) {
        cnt[l]++;
    }
    int ans = 0;
    for (int c : cnt) {
        if (c >= 2) {
            ans += c * (c-1) / 2;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 6756
s = gets.to_str
ans = true
if s[0] != "A"
  ans = false
end
if !(/C/ =~ s[2...(s.size - 2)])
  ans = false
end
if s.count("A-Z") != 2
#if s.count("a-z") == s.size - 2
  ans = false
end
if ans ==true
  puts "AC"
else
  puts "WA"
end


Measured memory_bytes: 1916
#include <bits/stdc++.h>
#define f first
#define s second
#define pl pair < long long , long long >
#define ll long long

using namespace std;

const long long MOD = 2e19 ;
const long long BIG = 1e7 + 9 ;

int main()
{
    ll n , sum = 0 ;
    cin >> n ;
    for ( ll i = 1 ; i <= n ; i++ )
        if ( ! ( i % 3 == 0 || i % 5 == 0 ) )
        {
            sum += i ;
        }
    cout << sum ;
    return 0 ;


}


Measured memory_bytes: 3608
# A
h1, m1, h2, m2, k = map(int, input().split())

if m2 > m1:
    time = (h2 - h1)*60 + (m2 - m1)
    print(time-k)
else:
    time = (h2 - h1)*60 - (m1 - m2)
    print(time-k)

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

using namespace std;
using ll = long long;
using ld = long double;
using Vec = vector<int>;


bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}


int Gcd(int x,int y)              //最大公約数
{
  int large = max(x,y);
  int small = min(x,y);

  while(small!=0){
      int amari =large%small;

      large = small;

      small = amari;  
  }
  return large;
}

int soin(int a)
{
  int  ans = 1;

  for (int i = 2; i <= sqrt(a); i++) {
    int cnt = 0;
    while (a % i == 0) {
      cnt++;
      a /= i;
    }
    ans *= (cnt + 1);
    if (a == 1) break;
  }
  if (a != 1) ans *= 2;

  return ans;
}

const int MOD = 1000000007;




//メイン関数--------------------------------------------



int main(){

int n;
cin>>n;
ll ans=0;
for(int i=1;i<n;i++){

 int plus= soin(i);

 ans+=plus;
}
cout<<ans<<endl;



}

Measured memory_bytes: 3672
import java.util.Scanner;

public class Main {
  public static void main(String args[]) {
    
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    int A[] = new int[n];
    int rc = 0;
    boolean execFlg = true;
    
    for (int i=0;i<n;i++) {
      A[i] = sc.nextInt();
    }
    
    while (execFlg) {      
      for (int j=0;j<n;j++) {
        if (A[j]%2 == 0) {
          A[j] = A[j]/2;
        } else {
          execFlg = false;
          break;
        }
      }
      
      if (execFlg) {
        rc = rc + 1;
      }
    }
    
    System.out.println(rc);
  }
}

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

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>

#define GET_ARRAY_SIZE(a)   (sizeof(a)/sizeof(a[0]))

using namespace std;

void print_func(int *array, int size){
    for (int j = 0; j < size; ++j) {
        cout << ( j ? " " : "" ) << array[j];
    }
    cout << endl;
}

int main(){
    int N;
    cin >> N;

    int A[N];
    for (int j = 0; j < N; ++j) {
        cin >> A[j];
    }


    bool flag = true;
    int tmp, cnt=0;
    while(flag) {
        flag = false;
        for (int i = N - 1; i > 0; --i) {
            if (A[i] < A[i - 1]) {
                tmp = A[i - 1];
                A[i - 1] = A[i];
                A[i] = tmp;


                flag = true;
                cnt++;
            }
        }
    }

    print_func(A, GET_ARRAY_SIZE(A));
    cout << cnt << endl;
}

Measured memory_bytes: 3108
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
#include<stdio.h>
#include<cmath>
#include<limits>
#include<iomanip>

using namespace std;
 
template <class T> using V = vector<T>;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = long double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
using graph = V<V<int>>;
using pq = priority_queue<ll>;


 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
#define pb(a) push_back(a);
  
 

ll sum(ll n) {
ll m=0;
  while(n){
    m+=n%10;
    n/=10;
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}




 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 

signed main(){
  ll n;
    ci(n);
  vll A(0);
  for(ll i=1;i*i<=n;i++){
    if(n%i==0){
      A.push_back(i);
      if(i*i!=n){
        A.push_back(n/i);
      }
    }
  }
  SORT(A);
  ll a=A.sz;
  ll ans=INF;
  FOR(i,0,a){
    chmin(ans,A[i]+n/A[i]);
  }
  co(ans-2)
}


Measured memory_bytes: 384
import sys
from collections import defaultdict, Counter

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    H, W = in_nn()
    a = []
    for i in range(H):
        a += list(in_s())

    mH = -(-H // 2)
    mW = -(-W // 2)
    nums = defaultdict(int)
    for y in range(mH):
        for x in range(mW):
            if x == W - x - 1 and y == H - y - 1:
                n = 1
            elif x == W - x - 1:
                n = 2
            elif y == H - y - 1:
                n = 2
            else:
                n = 4
            nums[n] += 1

    count = Counter(a)
    td = defaultdict(int)
    for v in count.values():
        for n in (4, 2, 1):
            if v >= n:
                if td[n] < nums[n]:
                    c = min(v // n, nums[n] - td[n])
                    td[n] += c
                    v -= n * c

    # print(nums)
    # print(td)

    ans = 'Yes'
    for n in (4, 2, 1):
        if td[n] != nums[n]:
            ans = 'No'
            break

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9552
n, m = map(int, input().split())
h = list(map(int, input().split()))
mh = [0] * n
for i in range(m):
    a, b = map(int, input().split())
    mh[a - 1] = max(mh[a - 1], h[b - 1])
    mh[b - 1] = max(mh[b - 1], h[a - 1])
print(sum(h[i] > mh[i] for i in range(n)))

Measured memory_bytes: 19924
n = []
while n == [] or n[-1] != [0, 0]:
    n.append(list(map(int, input().split())))
l = len(n)
for i in range(l-1):
    ans = 0
    for j in range(1,n[i][0]-1):
        for k in range(j+1, n[i][0]):
            if n[i][1] - j - k >= k+1 and n[i][1] - j - k <= n[i][0]:
                ans += 1
    print(ans)


Measured memory_bytes: 5596
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
    int N, L, T;
    int X[100000], W[100000], ans[100000];
    int cnt = 0;
    cin >> N >> L >> T;
    for(int i = 0; i < N; i++){
        cin >> X[i] >> W[i];
        if(W[i] == 1){
            if(T >= (L-X[i])){
                cnt -= (1+(T-(L-X[i]))/L);
            }
            X[i] = (X[i]+T)%L;
        }else{
            if(T > X[i]){
                cnt += (1+(T-X[i]-1)/L);
            }
            X[i] = ((X[i]-T)%L+L)%L;
        }
    }
    cnt = ((cnt%N)+N)%N;
    //cout << cnt << endl;
    sort(X, X+N);
    
    for(int i = 0; i < N; i++){
        ans[i] = X[(i-cnt+N)%N];
    }
    for(int i = 0; i < N; i++){
        cout << ans[i] << '\n';
    }
}

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

using namespace std;

int main(){
	int a,b,c,d,e,k;
	cin>>a>>b>>c>>d>>e>>k;
	if(e-a > k){
		cout<<":("<<endl;
	} else {
		cout<<"Yay!"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <string>
#include <sstream>
#include <algorithm>
#include <climits>
#include <cmath>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int x;
	cin >> x;
	if(x >= 30) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}
	return 0;
}


Measured memory_bytes: 3104
N = int(input())
array = [_**5 for _ in range(0,120)]

for x in array[:]:
    for y in array[:]:
        if x - y == N:
            print(array.index(x),array.index(y))
            exit()
        elif x + y == N:
            print(array.index(x),-array.index(y))
            exit()

Measured memory_bytes: 9192
#include <stdio.h>
#define MAX 100000
#define SENTINEL 2000000000

struct Card {
  char suit;
  int value;
};

struct Card L[MAX/2+2], R[MAX/2+2];

void merge(struct Card A[], int n, int left, int mid, int right) {
  int i, j, k;
  int n1 = mid - left;
  int n2 = right - mid;
  for(int i=0;i<n1;i++) L[i] = A[left + i];
  for(int i=0;i<n2;i++) R[i] = A[mid  + i];
  L[n1].value = R[n2].value = SENTINEL;
  i = j = 0;
  for(k=left; k<right; k++) {
    if(L[i].value <= R[j].value) {
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
    }
  }
}

void mergeSort(struct Card A[], int n, int left, int right) {
  if(left+1 < right) {
    int mid = (left+right) / 2;
    mergeSort(A,n,left,mid);
    mergeSort(A,n,mid, right);
    merge(A,n,left,mid,right);
  }
}

int partition(struct Card A[], int n, int p, int r) {
  int i, j;
  struct Card t, x;
  x = A[r];
  i = p-1;
  for(j=p; j<r; j++) {
    if(A[j].value <= x.value) {
      i++;
      t=A[i]; A[i]=A[j]; A[j]=t;
    }
  }
  t=A[i+1]; A[i+1]=A[r]; A[r]=t;
  return i+1;
}

void quickSort(struct Card A[], int n, int p, int r) {
  int q;
  if(p<r) {
    q = partition(A,n,p,r);
    quickSort(A,n,p,q-1);
    quickSort(A,n,q+1,r);
  }
}

int main() {
  int n, i, v;
  struct Card A[MAX], B[MAX];
  char S[10];
  int stable = 1;

  scanf("%d", &n);

  for(i=0;i<n;i++) {
    scanf("%s %d",S,&v);
    A[i].suit =  B[i].suit  = S[0];
    A[i].value = B[i].value = v;
  }

  mergeSort(A,n,0,n);
  quickSort(B,n,0,n-1);

  for(i=0;i<n;i++) {
    // ????????????????????¨??????????????????????????????????????????
    if(A[i].suit != B[i].suit) stable = 0;
  }

  if(stable==1) printf("Stable\n");
  else printf("Not stable\n");
  for(i=0;i<n;i++) {
    printf("%c %d\n",B[i].suit,B[i].value);
  }

  return 0;
}

Measured memory_bytes: 4040
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		for (; solver.hasNext();) {
			solver.readBody(in.readLine());
		}
	}
}

class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split(" ");
		N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
	}

	public boolean hasNext() {
		return cnt < 1;
		// return cnt < N;
	}

	public void readBody(String str) {
		// System.out.println(str);
		String[] strArr = str.split(" ");
		int min = 1001;
		int max = -1;
		for (int i = 0; i < N; i++) {
			int a = Integer.parseInt(strArr[i]);
			if (a < min)
				min = a;
			if (a > max)
				max = a;
		}
		System.out.println(max - min);
		cnt++;
	}
}


Measured memory_bytes: 23124
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
//usage
//input! {
//  h: i32;
//  v: [i32; n]
//  x: [[i32; n]; m]
//  f: chars <- Vec<char>
//}

fn main() {
    input! {
        n: usize
    }
    let mut dp_table = vec![0; n + 1];
    dp_table[0] = 1;
    dp_table[1] = 1;
    for i in 2..n + 1{
        dp_table[i] = dp_table[(i - 1) as usize] + dp_table[(i - 2) as usize];
    }
    println!("{}", dp_table[n]);
}


Measured memory_bytes: 5032
#include<bits/stdc++.h>
using namespace std;
int dp[100005][3];
int a[100005][3];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d %d %d",&a[i][0],&a[i][1],&a[i][2]);
	}
	dp[0][0]=a[0][0];
	dp[0][1]=a[0][1];
	dp[0][2]=a[0][2];
	for(int i=1;i<n;i++){
		for(int j=0;j<3;j++){
			dp[i][j]=-2e9;
			for(int k=0;k<3;k++){
				if(j^k){
					dp[i][j]=max(dp[i][j],dp[i-1][k]+a[i][j]);
				}
			}
		}
	}
	cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
	return 0;
}

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

long long power( long long x, long long n, long long m )
{
	long long res = 1;
	while ( n > 0 ) {
		if( n % 2 ) res = res * x % m;
		x = x * x % m;
		n /= 2;
	}
	return res;
}

int main()
{
	long long N;
	cin >> N;

	long long MOD = 1000000000 + 7;
	long long ans10 = power( 10, N, MOD );
	long long ans9 = power( 9, N, MOD );
	long long ans8 = power( 8, N, MOD );
	long long ans = (ans10 - ans9 + MOD) % MOD;
	ans = (ans - ans9 + MOD) % MOD;
	ans += ans8;
	ans %= MOD;

	cout << ans << endl;
}


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

int n, map[10][10], use[10][10];
int ax[12], ay[12], as[12];

int sdx[5] = {0, -1, 0, 1, 0};
int sdy[5] = {0,  1, 1, 1, 2};
int mdx[9] = {0, 1, 2, 0, 1, 2, 0, 1, 2};
int mdy[9] = {0, 0, 0, 1, 1, 1, 2, 2, 2};
int ldx[13] = {0, -1, 0, 1, -2, -1, 0, 1, 2, -1, 0, 1, 0};
int ldy[13] = {0,  1, 1, 1,  2,  2, 2, 2, 2,  3, 3, 3, 4};

bool solve(int c, int x, int y) {
	bool solved=false;
	if(c==n) {
		for(int i=0; i<10; ++i) for(int j=(i==y?x:0); j<10; ++j) {
			if(map[i][j]-use[i][j]>0) return false;
		}
		return true;
	}
	for(int i=y; i<10; ++i) {
		for(int j=(i==y?x:0); j<10; ++j) {
			if(map[i][j]-use[i][j]>0) {
				if(1<j&&j<8&&i<6&&!solved) {
					for(int k=0; k<13; ++k) {
						if(map[i+ldy[k]][j+ldx[k]]-use[i+ldy[k]][j+ldx[k]]<=0) break;
						if(k==12) {
							for(int l=0; l<13; ++l) use[i+ldy[l]][j+ldx[l]]++;
							ax[c] = j; ay[c] = i+2; as[c] = 3;
							solved = solve(c+1, j, i);
							for(int l=0; l<13; ++l) use[i+ldy[l]][j+ldx[l]]--;
						}
					}
				}
				if(j<8&&i<8&&!solved) {
					for(int k=0; k<9; ++k) {
						if(map[i+mdy[k]][j+mdx[k]]-use[i+mdy[k]][j+mdx[k]]<=0) break;
						if(k==8) {
							for(int l=0; l<9; ++l) use[i+mdy[l]][j+mdx[l]]++;
							ax[c] = j+1; ay[c] = i+1; as[c] = 2;
							solved = solve(c+1, j, i);
							for(int l=0; l<9; ++l) use[i+mdy[l]][j+mdx[l]]--;
						}
					}
				}
				if(0<j&&j<9&&i<8&&!solved) {
					for(int k=0; k<5; ++k) {
						if(map[i+sdy[k]][j+sdx[k]]-use[i+sdy[k]][j+sdx[k]]<=0) break;
						if(k==4) {
							for(int l=0; l<5; ++l) use[i+sdy[l]][j+sdx[l]]++;
							ax[c] = j; ay[c] = i+1; as[c] = 1;
							solved = solve(c+1, j, i);
							for(int l=0; l<5; ++l) use[i+sdy[l]][j+sdx[l]]--;
						}
					}
				}
				return solved;
			}
		}
	}
	return false;
}

int main() {
	cin >> n;
	for(int i=0; i<10; ++i) for(int j=0; j<10; ++j) {
		cin >> map[i][j];
		use[i][j] = 0;
	}
	solve(0, 0, 0);
	for(int i=0; i<n; ++i) cout << ax[i] << " " << ay[i] << " " << as[i] << endl;
	return 0;
}

Measured memory_bytes: 1168
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
//#define mod 998244353
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline void out(T a){ cout << a << '\n'; }
void YN(bool ok){if(ok) cout << "Yes" << endl; else cout << "No" << endl;}
//void YN(bool ok){if(ok) cout << "YES" << endl; else cout << "NO" << endl;}


const ll INF=1e18;
const int mx=200005;

ll mod_pow(ll x,ll n,ll m){
    if(n==0) return 1;
    ll res=mod_pow(x*x%m,n/2,m);
    if(n&1) res=res*x%m;
    return res;
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    V<ll> a(n);
    cinf(n,a);
    ll ans=0;
    rep(i,n) ans=(ans+a[i])%mod;
    ans=ans*ans%mod;
    rep(i,n){
        ll b=a[i]*a[i]%mod;
        ans-=b;
        if(ans<0) ans+=mod;
    }
    ans=ans*mod_pow(2LL,mod-2,mod)%mod;
    
    out(ans);
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
//どうしてもわからないときはサンプルで実験　何か見えてくるかも
//頭で考えてダメなら紙におこせ！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
{
    ・全探索できるなら全探索しろ
    ・異常な制約ならそこに注目
}
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'¥n'
グリッド上では行先が範囲内におさまるかif文で確認(RE注意)
if文ではちゃんと比較演算子==を使え('='でもエラー出ない)
配列(vector)の大きさが0か1以上かで場合分けせよ(RE注意)
(vector<int> a(m)でm==0というものはできない)
modはなるべく最後に取れ！
doubleを扱うときには(abs)ではなく'fabs'!!!
*/

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

const long long MOD = 1000000007;

map<long long, long long> prime_factor(long long n){
	map<long long, long long> res;
	for(long long i = 2; i*i <= n; i++){
		while(n%i == 0){
			res[i]++;
			n /= i;
		}
	}
	if(n != 1) res[n] = 1;
	return res;
}

long long f[1000002], fi[1000002];

long long mod_pow(long long x, long long n, long long mod){
	long long res = 1;
	while(n > 0){
		if(n & 1) res = res * x % mod;
		x = x * x % mod;
		n >>= 1;
	}
	return res;
}

void init(int n){
	f[0] = 1;
	for(int i = 1; i <= n; i++){
		f[i] = f[i-1] * i % MOD;
	}
	fi[n] = mod_pow(f[n], MOD-2, MOD);
	for(int i = n; i > 0; i--){
		fi[i-1] = fi[i] * i % MOD;
	}
}

long long comb(int r, int c){
	if(r < c) return 0;
	return f[r] * fi[c] % MOD * fi[r-c] % MOD;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	long long m;
	cin >> n >> m;
	init(1000000);
	map<long long, long long> pri = prime_factor(m);
	long long ans = 1;
	for(auto q : pri){
		ans = (ans * comb(q.second+n-1, q.second)) % MOD;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 15872
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt() / 1000;
        
        for (int i = n; i >= 0; i--) {
            for (int j = n - i; j >= 0; j--) {
                if (10*i + 5*j + 1*(n-i-j) == y) {
                    System.out.println(i + " " + j + " " + (n-i-j));
                    return;
                }
            }
        }
        System.out.println("-1 -1 -1");
    }
}

Measured memory_bytes: 21972
#include<iostream>

using namespace std;

long long gcm(long long a, long long b) {
	if (b == 0)
		return a;
	return gcm(b, a % b);
}


long long log2(long long a[], int i) {
	long long r = 1;
	while(a[i] % 2 == 0) {
		a[i] /= 2;
		r *= 2;
	}
	return r;
}

int main() {
	long long n, m, a[100000];

	cin >> n >> m;
	for(int i = 0; i < n; i++)
		cin >> a[i];
	for(int i = 0; i < n; i++)
		a[i] /= 2;
	long long lmin = 10000000000, lmax = -1;
	for(int i = 0; i < n; i++) {
		long long lt = log2(a, i);
		if (lmax < lt) lmax = lt;
		if (lt < lmin) lmin = lt;
	}
	if (lmin != lmax) {
		cout << 0 << endl;
		return 0;
	}
	long long l = a[0];
	for(int i = 1; i < n; i++) {
		l = a[i] * l / gcm(a[i], l);
	}
	l *= lmin;
	long long res = m / l;
	res = (res + 1) / 2;
	cout << res;
	return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
long long a[200005]; 
int main(){
int tmp;
int n;
scanf("%d",&n);
long long sum =0;
for(int i=0;i<n;i++){
   cin>>tmp;
   a[i]=tmp;
      sum += a[i]*1LL;
}
long long big = 2e15;
long long as=0;
for(int i=0;i<n-1;i++){
      as+= a[i];
      long long tt = labs(as*2 - sum);
      if(tt <= big){
            big = tt;

      }
}
cout<<big<<endl;

             
return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define ll long long
//#define cccgift
//#define getchar()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
//char buf[1<<21],*p1=buf,*p2=buf;
template<typename T>
inline void read(T &x)
{
    static char ch;bool f=1;
    for(x=0,ch=getchar();!isdigit(ch);ch=getchar()) if(ch=='-') f=0;
    for(;isdigit(ch);x=(x<<1)+(x<<3)+(ch^48),ch=getchar());x=f?x:-x;
}
template<typename T>
void print(T x)
{
    if (x<0) x=-x,putchar('-');
    if (x>9) print(x/10);
    putchar(x%10+48);
}
template<typename T>
inline void print(T x,char ap) {print(x);if (ap) putchar(ap);}
template<typename T>
inline void chkmax(T &x,const T &y) {x=x<y?y:x;}
template<typename T>
inline void chkmin(T &x,const T &y) {x=x<y?x:y;}
int n,a[200001],minn,tot;
int main()
{
	ios::sync_with_stdio(false);
	cin>>n;minn=1e9;
	for(res i=1;i<=n;++i) cin>>a[i];
	for(res i=1;i<=n;++i) {
		if(minn>=a[i]) ++tot;
		chkmin(minn,a[i]);
	}
	cout<<tot<<'\n';
	cout<<flush;
	return 0;
}
/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * do something instead of nothing and stay organized
*/ 

Measured memory_bytes: 1024
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n) 
#define SIZE(x) ((int)(x).size())
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef pair<int, int> pint;
typedef pair<lint, lint> plint;
typedef vector<lint> vec;
typedef vector<vector<lint>> matrix;
typedef priority_queue<lint> p_que;
typedef priority_queue<lint, vector<lint>, greater<lint>> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};


lint power(lint x, lint n, lint mod = MOD) {
    lint ret = 1;
    while(n > 0) {
        if(n & 1){
            (ret *= x) %= mod;
        }
        (x *= x) %= mod;
        n >>= 1;
    }
    return ret;
}

void solve(int n, int m, vector<lint> &a, vector<lint> &b, vector<vector<lint>> &c){
    lint k = power(2, n);
    lint dp[m+1][k];
    REP(i, m+1){
        REP(j, k){
            dp[i][j] = (i == 0 && j == 0) ? 0 : INF;
        }
    }
    REP(i, m){
        REP(j, k){
            dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
            int open = 0;
            REP(l, b[i]){
                open |= power(2, c[i][l]-1); 
            }
            dp[i+1][j | open] = min(dp[i][j] + a[i], min(dp[i+1][j | open], dp[i][j | open]));
        }
    }
    if(dp[m][k-1] == INF){
        cout << -1 << endl;
    }
    else {
        cout << dp[m][k-1] << endl;
    }
    return;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<lint> a(m+1);
    vector<lint> b(m+1);
    vector<vector<lint>> c(m+1);
    for(int i=1; i<=m; ++i){
        cin >> a[i] >> b[i];
        c[i].resize(b[i]);
        REP(j, b[i]){
            cin >> c[i][j];
        }
    }
    solve(n, m, a, b, c);
    return 0;
}

Measured memory_bytes: 32384
# https://atcoder.jp/contests/abc157/tasks/abc157_b

A = [list(map(int, input().split())) for a in range(3)]
N = int(input())

for _ in range(N):
    B = int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j] == B:
                A[i][j] = -1

is_bingo = False
is_bingo = is_bingo or (A[0][0] == -1 and A[0][1] == -1 and A[0][2] == -1)
is_bingo = is_bingo or (A[1][0] == -1 and A[1][1] == -1 and A[1][2] == -1)
is_bingo = is_bingo or (A[2][0] == -1 and A[2][1] == -1 and A[2][2] == -1)
is_bingo = is_bingo or (A[0][0] == -1 and A[1][0] == -1 and A[2][0] == -1)
is_bingo = is_bingo or (A[0][1] == -1 and A[1][1] == -1 and A[2][1] == -1)
is_bingo = is_bingo or (A[0][2] == -1 and A[1][2] == -1 and A[2][2] == -1)
is_bingo = is_bingo or (A[0][0] == -1 and A[1][1] == -1 and A[2][2] == -1)
is_bingo = is_bingo or (A[0][2] == -1 and A[1][1] == -1 and A[2][0] == -1)

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


Measured memory_bytes: 3064
#include <iostream>

using namespace std;

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

    while(x != 0 || y != 0){
        if (x < y){
            cout << x << " " << y << endl;
        }
        else{
            cout << y << " " << x << endl;
        }
        cin >> x >> y;
    }
    return 0;
}


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

int main() {
   long long N;
   cin >> N;
   long long count=0;
   int a;
   for (int i=1; ; i++) {
       count+=pow(26,i);
       if (count>=N) {
           a=i;break;
       }
   }
   char b[a];
   for (int i=0; i<a; i++) {
       if (N%26==0) {
       b[a-i-1]='z';
       N/=26;
       N--;
       }
       else {
       b[a-i-1]=(char)('a'+N%26-1);
       N/=26;
       }
   }
   for (int i=0; i<a; i++) {
       cout << b[i] ;
   }
   cout << endl;
}

Measured memory_bytes: 4056