akhauriyash/Code-Regression huggingface dataset:
#include "iostream"
#include "vector"
#include "algorithm"
#include <math.h>
using namespace std;

int main()
{
    // 人数
    long long N;  cin >> N; 
    // 各乗り物の収容人数
    vector<long long> v(5);
    for( int i=0 ; i<5 ; i++ ) cin >> v[i];

    // 一番詰まる場所を検索
    long long temp = v[0];

    for( int i=1 ; i<5 ; i++ )
    {
        if( temp > v[i] )  temp = v[i];
    }

    // 最終出力
    cout << ( ( N + temp - 1 ) / temp  + 4 ) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  int counter=0;
  cin>>a>>b;
  for(a;a<=b;a++){
    if(a/10000==a%10&&(a%100)/10==(a%10000)/1000)
      counter++;
    else
      continue;
  }
  cout<<counter;
}

Measured memory_bytes: 3544
N, K = map(int, input().split())
As = list(map(int, input().split()))

c = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        if As[i] > As[j]:
            c += 1

cp = 0
for i in range(N):
    for j in range(N):
        if As[i] > As[j]:
            cp += 1

if K == 1:
    print(c)
elif K == 2:
    print(c * 2 + cp)
else:
    print((c * K + (K * (K - 1) // 2) * cp) % (10 ** 9 + 7))

Measured memory_bytes: 41836
# cf16-exhibition-final-openB - Inscribed Bicycle
def main():
    x1, y1, x2, y2, x3, y3 = map(int, open(0).read().split())
    a = ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
    b = ((x1 - x3) ** 2 + (y1 - y3) ** 2) ** 0.5
    c = ((x2 - x3) ** 2 + (y2 - y3) ** 2) ** 0.5
    x2 -= x1
    y2 -= y1
    x3 -= x1
    y3 -= y1
    a = ((x2 - x3) ** 2 + (y2 - y3) ** 2) ** 0.5
    b = (x3 ** 2 + y3 ** 2) ** 0.5
    c = (x2 ** 2 + y2 ** 2) ** 0.5
    r = abs(x2 * y3 - x3 * y2) / (a + b + c)
    d = max(a, b, c)
    ans = r * d / (2 * r + d)
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main()
{
    #define int long long
    int n;
    int ga,sa,ba,gb,sb,bb;
    cin>>n>>ga>>sa>>ba>>gb>>sb>>bb;
    int r1 = n;
    if(ga < gb && sa < sb && ba < bb)
        for(int i=0;ga*i<=n;i++)
        {
            for(int j=0;ga*i+sa*j<=n;++j)
            {
                int k = (n-ga*i-sa*j)/ba;
                r1 = max(r1,i*(gb-ga)+j*(sb-sa)+k*(bb-ba) + n);
            }
        }
    else if(ga < gb && sa < sb)
    {
        for(int i=0;ga*i<=n;i++)
        {
            int j = (n - i*ga) / sa;
            r1 = max(r1,i*(gb-ga)+j*(sb-sa)+n);
        }
    }else if(ga < gb && ba < bb)
    {
        for(int i=0;ga*i<=n;i++)
        {
            int j = (n - i*ga) / ba;
            r1 = max(r1,i*(gb-ga)+j*(bb-ba)+n);
        }
    }else if(sa < sb && ba < bb)
    {
        for(int i=0;sa*i<=n;++i)
        {
            int j = (n-i*sa)/ba;
            r1 = max(r1,i*(sb-sa)+j*(bb-ba)+n);
        }
    }else if(ga < gb)
    {
        int i = n/ga;
        r1 = max(r1,i*(gb-ga)+n);
    }else if(sa < sb)
    {
        int i = n/sa;
        r1 = max(r1,i*(sb-sa)+n);
    }else if(ba < bb)
    {
        int i = n/ba;
        r1 = max(r1,i*(bb-ba)+n);
    }
    if(ga <= gb && sa <= sb && ba <= bb) //一轮结束
    {
        cout<<r1<<endl;
        return 0;
    }
    int r2 = r1;
    if(gb < ga && sb < sa && bb < ba) //啥都不买，r1作废
    {
        for(int i=0;gb*i<=n;i++)
        {
            for(int j=0;gb*i+sb*j<=n;++j)
            {
                int k = (n-gb*i-sb*j)/bb;
                r2 = max(r2,i*(ga-gb)+j*(sa-sb)+k*(ba-bb)+r1);
            }
        }
        cout<<r2<<endl;
        return 0;
    }
    if(gb < ga && sb < sa) // 前面可能买了铜，现在买金银
    {
        for(int i=0;gb*i<=r1;++i)
        {
            int j = (r1 - i*gb) / sb;
            r2 = max(r2,i*(ga-gb) + j*(sa-sb)+r1);
        }
        cout<<r2<<endl;
        return 0;
    }
    if(gb < ga && bb < ba) // 前面可能买了银，现在买金铜
    {
        for(int i=0;gb*i<=r1;++i)
        {
            int j = (r1 - i*gb) / bb;
            r2 = max(r2,i*(ga-gb) + j*(ba-bb)+r1);
        }
        cout<<r2<<endl;
        return 0;
    }
    if(sb < sa && bb < ba) // 前面可能买了金，现在买银铜
    {
        for(int i=0;sb*i<=r1;++i)
        {
            int j = (r1 - i*sb) / bb;
            r2 = max(r2,i*(sa-sb) + j*(ba-bb)+r1);
        }
        cout<<r2<<endl;
        return 0;
    }
    if(gb < ga)//现在买金
    {
        int i = r1 / gb;
        r2 = max(r2, i*(ga-gb)+r1);
        cout<<r2<<endl;
        return 0;
    }
    if(sb < sa)//现在买yin
    {
        int i = r1 / sb;
        r2 = max(r2, i*(sa-sb)+r1);
        cout<<r2<<endl;
        return 0;
    }
    if(bb < ba)//现在买cu
    {
        int i = r1 / bb;
        r2 = max(r2, i*(ba-bb)+r1);
        cout<<r2<<endl;
        return 0;
    }
    //如果找不到现在能买的，在前面已经处理掉了
}

Measured memory_bytes: 256
r = int(input())
A = list(map(int, input().split()))

print(" ".join(map(str, A)))

for i in range(1, r):
    j = i - 1
    v = A[i]
    while j >= 0 and A[j] > v:
        A[j+1] = A[j]
        j-=1
    A[j+1] = v
    print(" ".join(map(str, A)))


Measured memory_bytes: 5596
#include<iostream>
#include<iomanip>
#include<stack>
#include<queue>
#include<list>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<ctime>
#define ll long long
#define ld double
#define inf 100001
#define mod 2147483647
#define INF (int)(1e9) 
#define pi acos(-1)
#define rd(n) {n=0;char ch;int f=0;do{ch=getchar();if(ch=='-'){f=1;}}while(ch<'0'||ch>'9');while('0'<=ch&&ch<='9'){n=(n<<1)+(n<<3)+ch-48;ch=getchar();}if(f)n=-n;}
using namespace std;

int n,L,T;

struct ant{
	int x,d;
}a[inf];

int to[inf];

int main(){
	rd(n) rd(L) rd(T)
	for (int i=1;i<=n;i++){
		rd(a[i].x) rd(a[i].d)
		if (a[i].d==2){
			a[i].d=-1;
		}
	}
	if (L==1){
		for (int i=1;i<=n;i++){
			printf("%d\n",0);
		}
		return 0;
	}
	for (int i=1;i<=n;i++){
		to[i]=((a[i].x+a[i].d*T)%L+L)%L;
	}
	int pos=0;
	for (int i=1;i<=n;i++){
		int tmp=a[i].x+a[i].d*T;
		if (tmp>0){
			pos=(pos+tmp/L)%n;
		}
		else if (tmp<0){
			pos=(pos+(tmp+1)/L-1)%n;
		}
	}
	pos=(pos+n)%n;
	sort(to+1,to+n+1);
	for (int i=pos+1;i<=n;i++){
		printf("%d\n",to[i]);
	}
	for (int i=1;i<=pos;i++){
		printf("%d\n",to[i]);
	}
	return 0;
}

Measured memory_bytes: 2432
#include <iostream>

using namespace std;
int n, tmax, t, c;
int main()
{
    cin >> n >> tmax;

    int mini = 2000;
    for(int i = 1; i <= n; i++)
    {
        cin >> c >> t;
        if(t <= tmax)
            if(c < mini)
                mini = c;
    }

    if(mini != 2000)
        cout << mini;
    else
        cout << "TLE";

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  char s[102];
  int i,n=0,count=0;

  scanf("%s", s);

  for(i=0;;i++){
    if(s[i] !='\0')
      n++;
    else
      break;
    }

  for(i=0; i < n/2; i++)
  {
    if(s[i] != s[n-1-i])
      count++;
  }

  printf("%d",count );

    return 0;
}


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

using namespace std;

int main(void){
  string S;
  cin >> S;
  vector<bool> v(26, false);
  for(char &c : S) v[c - 'a'] = true;
  for(int i = 0; i < 26; i++){
    if(!v[i]){
      cout << (char)('a' + i) << endl;
      return 0;
    }
  }
  cout << "None" << endl;
  return 0;
}


Measured memory_bytes: 512
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int ans = 0;

    for(int i=0; i<s.length(); i++){
      ans += Integer.parseInt(s.substring(i, i+1));
    }
    int num = Integer.parseInt(s);
    if(num%ans==0){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}

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

const long long INF=1LL<<60;
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;}
#define rep(i,a,n) for(int i=a;i<n;i++)

int main(){
    int D,N;cin>>D>>N;
    vector<int> T(D),A(N),B(N),C(N);
    rep(i,0,D) cin>>T[i];
    rep(i,0,N) cin>>A[i]>>B[i]>>C[i];
    vector<vector<int>> dp(D+5,vector<int>(N+10,0));
    rep(i,1,D+1){
        rep(j,0,N){
            if(A[j]<=T[i-1]&&T[i-1]<=B[j]){
                rep(k,0,N){
                    if(i>=2&&A[k]<=T[i-2]&&T[i-2]<=B[k]){
                        chmax(dp[i][j],dp[i-1][k]+abs(C[j]-C[k]));
                    }
                    chmax(dp[i][j],dp[i-1][k]);
                }
            }
        }
    }
    int res=0;
    rep(i,0,N) res=max(res,dp[D][i]);
    cout<<res<<endl;
    return 0;
}					


Measured memory_bytes: 3260
/*
 _    _    _______   _    _
| |  / /  |  _____| | |  / /
| | / /   | |       | | / /
| |/ /    | |_____  | |/ /
| |\ \    |  _____| | |\ \
| | \ \   | |       | | \ \
| |  \ \  | |_____  | |  \ \
|_|   \_\ |_______| |_|   \_\

*/
/*#include <iostream>
#include <cstdio>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <cstring>
#include <string>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <assert.h>*/

#include <bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair <int, int> PII;
typedef pair <ll, ll> PLL;

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define right(x) x << 1 | 1
#define left(x) x << 1
#define forn(x, a, b) for (int x = a; x <= b; ++x)
#define for1(x, a, b) for (int x = a; x >= b; --x)
#define mkp make_pair
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define y1 kekekek

const ll ool = 1e18 + 9;
const int oo = 1e9 + 9, base = 1e9 + 7;
const ld eps = 1e-7;
const int N = 2e6 + 6;

int n;
vector < int > g[N];

int calc(int x) {
    vector < int > vec;
    for (auto it : g[x]) {
        vec.eb(calc(it));
    }
    sort(all(vec));
    int mx = 0;
    forn(i, 0, sz(vec) - 1) {
        mx = max(mx, sz(vec) - i + vec[i]);
    }
    return mx;
}

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

	cin >> n;
	forn(i, 2, n) {
	    int x;
	    cin >> x;
	    g[x].eb(i);
	}

    cout << calc(1) << "\n";

	return 0;
}



Measured memory_bytes: 58112
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <bitset>
using namespace std;

typedef long long ll;
const int MAX_N = 51;
ll layers[MAX_N];
ll patty[MAX_N];

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

  ll N, X;
  cin >> N >> X;

  layers[0] = 1;
  for (int i = 1; i <= MAX_N; i++) {
    layers[i] = layers[i - 1]*2 + 3;
  }

  patty[0] = 1;
  for (int i = 1; i <= MAX_N; i++) {
    patty[i] = patty[i-1] * 2 + 1;
  }

  ll total = 0;
  
  while (N > 0) {
      
    ll n_layers = layers[N];
    ll mid = n_layers/2 + 1;

    if (X == 1) {
      cout << total << endl;
      return 0;
    }
    if (1 < X && X < mid) {
      if (N == 1) {
	total += 1;
      } else {
      	X--;
      }
      
    }
    else if (X == mid) {
      total += patty[N-1];
      total += 1;
      cout << total << endl;
      return 0;
    }
    else if (mid < X && X < n_layers) {
      if (N == 1) {
	total += 3;
      } else {
	total += patty[N-1];
	total += 1;
	X -= (layers[N-1] + 2);
      }
    }
    else if (X == n_layers){
      total += patty[N];
      cout << total << endl;
      return 0;
    }
    
    N--;
  }

  cout << total << endl;
  return 0;
}



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

int main() {
    string s,t;
    cin >> s >> t;
    sort(all(s));
    sort(all(t),greater<char>());
    if(s < t) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using namespace std;

struct Lab {
	double L, a, b;
};

double sqsum(Lab a, Lab b) {
	return (a.L - b.L) * (a.L - b.L) +
		(a.a - b.a) * (a.a - b.a) + (a.b - b.b) * (a.b - b.b);
}

int main() {
	int n, m; cin >> n >> m;
	vector<Lab> Labs(n);
	for (auto& a : Labs) cin >> a.L >> a.a >> a.b;
	double ans = 0;
	for (int bit = 0; bit < (1 << n); ++bit) {
		if (__builtin_popcount(bit) != m) continue;
		vector<Lab> tLab;
		for (int flag = 0; flag < n; ++flag)
			if (bit & (1 << flag)) tLab.push_back(Labs[flag]);
		double tmp = 0;
		for (int i = 0; i < m; ++i)
			for (int j = i + 1; j < m; ++j)
				tmp += sqsum(tLab[i], tLab[j]);
		ans = max(ans, tmp);
	}
	printf("%.20f\n", ans);

	return 0;
}


Measured memory_bytes: 3324
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N,M;
  cin >> N >> M;
  vector<int> H(N);
  for(int i=0;i<N;i++){
    cin >> H.at(i);
  }
  vector<int> goodSee(N); //goodSeeが0ならいい展望台
  
  for(int j=0;j<M;j++){
    int a,b;
    cin >> a >> b;
    if(H.at(a-1) <= H.at(b-1)){
      goodSee.at(a-1)++;
    }
    if(H.at(a-1) >= H.at(b-1)){
      goodSee.at(b-1)++;
    }
  }
  int counter =0;
  for(int i=0;i<N;i++){
    if(goodSee.at(i)==0){
      counter++;
    }
  }
  cout << counter << endl;
}

Measured memory_bytes: 4024
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int N, M;

  cin >> N >> M;
  vector<pair<int, int>> v(N);
  for (int i = 0; i < N; ++i) {
    int a, b;
    cin >> a >> b;
    v[i] = {a, b};
  }
  sort(v.begin(), v.end(),
       [](const pair<int, int>& x, const pair<int, int>& y) -> bool {
         return x.first < y.first;
       });

  size_t f = 0;
  int rem = M;
  for (const auto& e : v) {
    if (rem == 0) break;
    const int x = min(rem, e.second);
    rem -= x;
    f += static_cast<size_t>(e.first) * x;
  }
  cout << f << endl;
  return 0;
}


Measured memory_bytes: 1024
#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 mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
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; }

const ll INF=1e18;

int main(){
    int n;
    cin>>n;
    vector<ll> a(n),s(n+1,0);
    rep(i,n){
        cin>>a[i];
        s[i+1]=s[i]+a[i];
    }
    ll ans=INF;
    for(int i=2;i<n-1;i++){
        vector<ll> b(4);
        int j=lb(s.begin(),s.begin()+i,s[i]/2)-s.begin();
        int k=j-1;
        b[0]=s[i]-s[j];
        b[1]=s[j];
        if(abs(s[i]-2*s[j])>abs(s[i]-2*s[j-1])){
            j--;
            b[0]=s[i]-s[j];
            b[1]=s[j];
        }
        j=lb(s.begin()+i,s.end(),(s[n]+s[i])/2)-s.begin();
        b[2]=s[j]-s[i];
        b[3]=s[n]-s[j];
        if(abs(s[n]-2*s[j]+s[i])>abs(s[n]-2*s[j-1]+s[i])){
            j--;
            b[2]=s[j]-s[i];
            b[3]=s[n]-s[j];
        }
        sort(all(b));
        chmin(ans,b[3]-b[0]);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3328
import java.util.*;
import java.lang.*;

class Main {

	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] xs = new int[n];
		for (int i = 0; i < n; i++) {
			xs[i] = sc.nextInt();
		}

		int L = sc.nextInt();
		int num = 1;
		int t = 1;
		while (num < n) {
			num <<= 1;
			t++;
		}

		int[][] next = new int[t][n];
		for (int i = 0; i < n; i++) {
			next[0][i] = lowerBound(xs, xs[i] + L);
		}

		for (int k = 0; k < t - 1; k++) {
			for (int i = 0; i < n; i++) {
				next[k + 1][i] = next[k][next[k][i]];
			}
		}

		StringBuilder sb = new StringBuilder();
		int q = sc.nextInt();
		while (q-- > 0) {
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			if (a > b) {
				int c = a;
				a = b;
				b = c;
			}

			int answer = 1;
			for (int i = t - 1; i >= 0; i--) {
				if (xs[b] > xs[next[i][a]]) {
					a = next[i][a];
					answer += Math.pow(2, i);
				}
			}
			sb.append(answer).append("\n");
		}

		System.out.print(sb);
	}

	private static int lowerBound(int[] a, int x) {
		int l = 0, r = a.length;
		while (r - l > 1) {
			int m = (l + r) / 2;
			if (a[m] <= x) l = m;
			else r = m;
		}
		return l;
	}
}


Measured memory_bytes: 105336
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;
using P = pair<int, int>; 
using ll = long long;

int main()
{
  int n;
  cin >> n;
  int a[n];
  int b = 0;
  int ans = 0;
  rep(i, n){
    cin >> a[i];
    if(a[i] == 2) b = 1;
  }
  map<int, int> mp;
  if(b == 0){
    cout << -1 << endl;
  }
  else{
    int cnt = 0;
    int x = 1;
    b = 0;
    while(cnt < n){
      ans++;
      if(a[x - 1] == 2){
        b = 1;
        break;
      }
      x = a[x - 1];
      cnt++;
    }
    cout << (b ? ans : -1) << endl;
  
  }
      
    
    
    
  

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


Measured memory_bytes: 4020
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;

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

int main()
{
    ll a, b;
    cin >> a >> b;
    cout << a * b / gcd(a, b) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main(void){
  int H,W;
  scanf("%d%d",&H,&W);
  char data[H][W];
  char sample[W];
  int gyou[H];
  int retu[W];

  for(int i = 0;i < W;i++){
    retu[i] = 0;
  }

  for(int i = 0;i < H;i++){
    scanf("%s",sample);
    gyou[i] = 0;
    for(int j = 0;j < W;j++){
      if(sample[j] == '#'){
        retu[j] = 1;
        gyou[i] = 1;
      }
      data[i][j] = sample[j];
    }
  }

  int flag;
  for(int i = 0;i < H;i++){
    flag = 0;
    for(int j = 0;j < W;j++){
      if(retu[j] && gyou[i]){
        printf("%c",data[i][j]);
        flag = 1;
      }
    }
    if(flag){
      printf("\n");
    }
  }

  return 0;
}

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

#define rep(i, N) for (int i = 0; i < (N); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back

using ll = long long;
using i_i = tuple<int, int>;

const int N = 20000001;
const int MOD = 1e9 + 7;

ll inv[N + 1], f[N + 1], fi[N + 1];

ll C(int x, int y) {
    if (x < 0 || y < 0) return 0;
    if (x < y) return 0;
    return f[x] * fi[y] % MOD * fi[x - y] % MOD;
}

int main() {
    int H, W, K;
    cin >> H >> W >> K;
    inv[1] = 1;
    for (int i = 2; i <= N; i++)
        inv[i] = -MOD / i * inv[MOD % i] % MOD;
    f[0] = fi[0] = 1;
    for (int i = 1; i <= N; i++) {
        f[i] = f[i - 1] * i % MOD;
        fi[i] = fi[i - 1] * inv[i] % MOD;
    }
    ll L = C(K, 2);
    ll M = C(K, 3);
    ll ans = 0;
    for (int n = 0; n <= K; n++) {
        int m = K - n;
        if (0 <= n && n <= H && 0 <= m && m <= W);
        else continue;
        ll z = 1;
        z = z * f[H] % MOD;
        z = z * fi[H - n] % MOD;
        z = z * f[W] % MOD;
        z = z * fi[W - m] % MOD;
        ll sum = K * C(K, n) % MOD;
        sum = (sum + (K + L) * C(K - 1, n)) % MOD;
        sum = (sum + (K + L) * C(K - 1, n - 1)) % MOD;
        sum = (sum + (L + M) * C(K - 2, n - 1) * 2) % MOD;
        // cout << n << ' ' << m << ' ' << (sum + MOD) % MOD << endl;
        ans = (ans + sum * z) % MOD;
    }
    cout << (ans + MOD) % MOD << endl;
}


Measured memory_bytes: 468992
#define _USE_MATH_DEFINES
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <list>
#include <algorithm>
#include <sstream>
#include <set>
#include <math.h>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <stdio.h>
#include <string.h>
#include <numeric>
 
using namespace std;

int N,A,B; string S;

int P,Q;
 
int main(){
 
cin>>N>>A>>B;

cin>>S; Q=1;

for(int i=0; i<S.size(); i++){

  if(S[i]=='a'){
    if(P<A+B){ P++; printf("%s\n","Yes");}
    else if(P>=A+B) printf("%s\n","No");
  }
  if(S[i]=='b'){
    if(P<A+B&&Q<=B){ P++; Q++; printf("%s\n","Yes");}
    else printf("%s\n","No");
  }
  if(S[i]=='c') printf("%s\n","No");

}

return 0;
 
}

Measured memory_bytes: 896
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <string>
#include <utility>
#include <map>
#include <deque>

using namespace std;
#define rep(i,n) for(int i=1;i<=(int)(n);i++)
#define Rep(i,n) for(int i=0;i<=(int)(n-1);i++)
typedef long long ll;
typedef map<int,int> mint;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef deque<pair<ll,ll>> dep;

int inf=1e9+1000;
const int mod=1e9+7;
ll infi=1e18+100;

//x=10111;
//x<<2 = 1011100 (右シフト),x>>2 = 101 (左シフト)
//(x>>2)&1 = 101 & 001 = 1
//iビット目は、(x>>i) & 1 でわかる(x>>i)%2 でもよい


////////////1


int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(abs(a-c)<=d ||(abs(a-b)<=d &&abs(b-c)<=d)){
		cout<<"Yes"<<endl;
	}
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
    string ans,s,t;
    int flag=0;
    cin >> s >> t;
    for(int i=s.size()-t.size();i>=0;i--){//iはｓの何文字目から比べるか（後ろから部分文字列が入る個所を探していく
        for(int j=0;j < t.size();j++){//jは比べる部分の先頭から何文字目か
            if(t.at(j)==s.at(i+j)||s.at(i+j)=='?'){
                flag++;
            }
        }
        
        if(flag == t.size()){//部分文字列が入るとき
            for(int j=0;j < t.size();j++){//jは比べる部分の先頭から何文字目か
                s.at(i+j)=t.at(j);
            }
            for(int i=0;i < s.size();i++){
                if(s.at(i)=='?'){
                    s.at(i) = 'a';
                }
            }
            cout << s << endl;
        return 0;
        }
        flag =0;
    }

    cout << "UNRESTORABLE" << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main(){
    string S;
    cin >> S;
   if (S.at(2) == S.at(3) && S.at(4) == S.at(5)) {
     cout << "Yes" << endl;
   }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3588
# Union Find 木
from sys import setrecursionlimit


def find(parent, i):
    t = parent[i]
    if t < 0:
        return i
    t = find(parent, t)
    parent[i] = t
    return t


def unite(parent, i, j):
    i = find(parent, i)
    j = find(parent, j)
    if i == j:
        return
    parent[j] += parent[i]
    parent[i] = j


setrecursionlimit(10 ** 6)


N, M = map(int, input().split())
p = list(map(int, input().split()))

parent = [-1] * N
for _ in range(M):
    x, y = map(int, input().split())
    unite(parent, x - 1, y - 1)

result = 0
for i in range(N):
    if find(parent, i) == find(parent, p[i] - 1):
        result += 1
print(result)


Measured memory_bytes: 20320
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>
#include<tuple>
#include<stack>


using namespace std;

int main() {

	int R, G;
	cin >> R >> G;
	int x;
	x = 2*G - R;
	cout << x << endl;

	


	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>

typedef long long ll;

using namespace std;

int main()
{
    ll n, k;
    cin >> n >> k;

    for (ll i=k-n+1; i<k+n; i++)
        cout << i << ' ';

    cout << endl;

    return 0;
}


Measured memory_bytes: 256
[N,M] = list(map(int,input().split()))
students = [list(map(int,input().split())) for i in range(N)]
check_points = [list(map(int,input().split())) for i in range(M)]
for sy,sx in students:
    min_dis = 10**9
    ans = -1
    for i,[gy,gx] in enumerate(check_points):
        dis = abs(sy-gy) + abs(sx-gx)
        if dis < min_dis:
            min_dis = dis
            ans = i+1
    print(ans)
    

Measured memory_bytes: 3064
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 w: usize = it.next().unwrap().parse().unwrap();
    let a: Vec<usize> = it.map(|s| s.parse().unwrap()).collect();
    const MOD: u64 = 998_244_353;
    let mut ans = 0u64;
    let mut dp = vec![0u64; w + 1];
    for a in a.chunks(32) {
        for &a in a.iter() {
            dp[0] += 1;
            for i in (a..(w + 1)).rev() {
                dp[i] += dp[i - a];
            }
            ans = (ans + dp[w]) % MOD;
        }
        for v in dp.iter_mut() {
            *v %= MOD;
        }
    }
    println!("{}", ans);
}

fn main() {
    run();
}


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

#define int long long
#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define reps(i, n) for (int (i) = 1; (i) <= (n); (i)++)
#define all(x) (x).begin(), (x).end()
#define bit(n) (1LL << (n))
typedef vector<int> vint;
typedef pair<int, int> pint;
constexpr double PI = 3.1415926535897932384626433832795028;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template<typename T, typename U> inline bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> inline bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
struct SetUp {
    SetUp() {
        cout << fixed << setprecision(20);
        cerr << fixed << setprecision(20);
    };
} setUp;

int N, D;
int X[110][110];
signed main() {
    cin >> N >> D;
    rep(i, N)rep(j, D) { cin >> X[i][j]; }
    int ans = 0;
    rep(i, N)rep(j, i) {
            int d = 0;
            rep(k, D) { d += (X[i][k] - X[j][k]) * (X[i][k] - X[j][k]); }
            if (round(sqrt(d)) * round(sqrt(d)) == d) { ans++; }
        }
    cout << ans << endl;
}

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

int main()
{
    int A, B;
    cin >> A >> B;
    if(A<B) swap(A, B);
    if((A-B)%2==0) cout<<(A+B)/2<<endl;
    else           cout<<"IMPOSSIBLE"<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int INF = 0x3f3f3f3f;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const ll mod = 1e9 + 7;
const int N = 1e6 + 10;
int n, k;
int cp, cn;
typedef pair<ll, int>pii;
vector<pii>vc;
vector<pii>vv;
int main() {
	scanf("%d%d", &n, &k);
	for (int i = 1; i <= n; i++) {
		ll x;
		scanf("%lld", &x);
		if (x < 0)vc.push_back(pii(-x, 1)), cn++;
		else vc.push_back(pii(x, 0)), cp++;
	}
	if (k == n && (k & 1) != (cp & 1) || cp == 0 && (k & 1)) {
		ll ans = 1ll;
		sort(vc.begin(), vc.end());
		for (int i = 0; i < k; i++)ans = ans * vc[i].first % mod;
		ans = (mod - ans) % mod;
		printf("%lld\n", ans);
	}
	else {
		ll ans = 1ll;
		int cnt = 0;
		sort(vc.begin(), vc.end(), greater<pii>());
		for (int i = 0; i < k; i++) {
			vv.push_back(vc[i]);
			cnt += vc[i].second;
		}
		if (cnt & 1) {
			ll tmp1 = vv.back().first, tmp2;
			int p1 = -1, p2 = -1, q = -1;
			int t = vv.back().second;
			for (int i = (int)vv.size() - 2; i >= 0; i--) {
				if (vv[i].second != t) {
					tmp2 = vv[i].first;
					q = i;
					break;
				}
			}
			if (q == -1) {
				for (int i = k; i < (int)vc.size(); i++) {
					if (vc[i].second != t) {
						vv.pop_back();
						vv.push_back(vc[i]);
						break;
					}
				}
			}
			else {
				for (int i = k; i < (int)vc.size() && (p1 == -1 || p2 == -1); i++) {
					if (vc[i].second != t) {
						if (p1 == -1) {
							p1 = i;
							tmp2 *= vc[i].first;
						}
					}
					else {
						if (p2 == -1) {
							p2 = i;
							tmp1 *= vc[i].first;
						}
					}
				}
				if (p2 == -1 || p1 != -1 && tmp1 < tmp2) {
					vv.pop_back();
					vv.push_back(vc[p1]);
					
				}
				else {
					vv.erase(vv.begin() + q);
					vv.push_back(vc[p2]);
				}
			}
		}
		for (pii p : vv)ans = ans * p.first%mod;
		printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 12372
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int a[1005];
int main()
{
    int n;
    cin >>n;
    for(int i=0;i<n;i++)
        cin >> a[i];
    sort(a,a+n);
    double ans =a[0];
    for(int i=1;i<n;i++){
        ans=(ans+a[i])/2;
    }
    cout << ans<<endl;
    return 0;
}


Measured memory_bytes: 256
X = int(input())
arr = [0,1]
i = 2
while arr[-1]-arr[-2] <= 10**9:
    arr.append(i**5)
    i += 1

def printans(a,b,x,y):
    i = arr.index(a)
    j = arr.index(b)
    print(i*x,j*y)
    exit()

for a in arr:
    for b in arr:
        if a-b==X:
            printans(a,b,1,1)
        elif a+b==X:
            printans(a,b,1,-1)
        elif -a-b==X:
            printans(a,b,-1,1)
        elif -a+b==X:
            printans(a,b,-1,-1)

Measured memory_bytes: 9220
#include<iostream>
#include<string>

using namespace std;

int main(){
  string S,T;
  int x=0;
  
    cin >> S >>T;
  for(int i=0;i<3;i++){
  if(S[i]==T[i]){
    x =x+1;
  }
  }
  cout <<x;


 return 0;
}


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



int main() {
    pair<string,string> s;
    cin>>s.first>>s.second;

    int co=0;

    for(int i=0;i<3;i++){
        if(s.first.at(i)==s.second.at(2-i)){
            co++;
        }
    }

    if(co==3){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }


}






Measured memory_bytes: 256
a,b,c,d = map(int,input().split())
if b<=0:
    if d<=0:
        print(a*c)
    elif c<=0:
        print(a*c)
    else:
        print(b*c)
elif a<=0:
    if d<=0:
        print(a*c)
    elif c<=0:
        print(max(a*c,b*d))
    else:
        print(b*d)
else:
    if d<=0:
        print(a*d)
    elif c<=0:
        print(b*d)
    else:
        print(b*d)

Measured memory_bytes: 9204
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll = long long;
using P = pair<int,int>;
int main(void) {
    int a, b;
    char op;
    cin >> a >> op >> b;
    //printf("%c\n", op);
    int ans = 0;
    if(op == '+')
    ans = a + b;
    else
    ans = a - b;
    cout << ans;
}


Measured memory_bytes: 256
import decimal
a, b = map(decimal.Decimal, input().split())
r = int(a*b)
print(r)

# # a = int(a)

# print(float(b)*100)
# print(float(b)*1000)

# b = int(float(b)*1000)
# r = int((a*b)//1000)
#print(r)


Measured memory_bytes: 9900
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
const int MOD = 1e9 + 7;
 
vector<long long> fact_inv, inv, Com;
 
/*  init_nCk :二項係数のための前処理
    計算量:O(n)
*/
void init_nCk(int n, int SIZE) {
    fact_inv.resize(SIZE + 5);
    inv.resize(SIZE + 5);
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < SIZE + 5; i++) {
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD;
    }
    Com.resize(SIZE + 5);
    Com[0] = 1;
    for (int i = 1; i < SIZE + 5; i++) {
        Com[i] = Com[i - 1] * ((n - i + 1) * inv[i] % MOD) % MOD;
    }
}
 
/*  nCk :MODでの二項係数を求める(前処理 int_nCk が必要)
    計算量:O(1)
*/
long long nCk(int k) {
    assert(!(k < 0));
    return Com[k];
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
int main() {
	ll n,a,b;
	cin>>n>>a>>b;
	init_nCk(n,10000000);	
	ll ans=modpow(2,n,inf)-nCk(a);
	if(ans<0){
		ans+=inf;
	}
	ans-=nCk(b);
	if(ans<0){
		ans+=inf;
	}	
	cout <<ans-1;
	// your code goes here
	return 0;
}

Measured memory_bytes: 234624
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
typedef pair<int,int> P;
template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}
signed main(signed argc, char* argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    const int MOD = 1000000007;
	int x;
	cin>>x;
	int mon=100;
	int i=0;
	while(true){
		mon*=1.01;
		i++;
		if(mon>=x){
			cout<<i<<endl;
			return 0;
		}
	}
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a[1005];
ll sum[1005];
ll bea[1000005];
vector<ll> wei[50];
ll qpow(ll a,ll b){
	ll ans=1;
	while(b){
		if(b&1)
			ans=ans*a;
		a=a*a;
		b>>=1;
	}
	return ans;
}
void add(ll b,ll num){
	ll pos=0;
	while(b!=0){
		if(b&1)
			wei[pos].push_back(num);
		b>>=1;
		pos++;
	}
}
void copy(vector<ll>t,set<ll>&ans){
	ans.clear();
	for(ll i=0;i<t.size();i++)
		ans.insert(t[i]);
}
set<ll>ans,tmp;
vector<ll>s,as;
int main(){
	ll n,k;
	scanf("%lld%lld",&n,&k);
	for(ll i=1;i<=n;i++){
		scanf("%lld",a+i);
		sum[i]=sum[i-1]+a[i];
	}
	ll num=0;
	for(ll i=0;i<n;i++){
		for(ll j=i+1;j<=n;j++){
			bea[num]=sum[j]-sum[i];
			//cout<<bea[num]<<endl;
			add(bea[num],num);
			num++;
		}
	}	
	/*for(int i=0;i<10;i++){
		for(int j=0;j<wei[i].size();i++)
			cout<<wei[i][j]<<" ";
		cout<<endl;
	}*/
	
	ll out=0;
	ll i=45;
	for(;i>=0;i--){
		if(wei[i].size()>=k){
			if(out==0){
				copy(wei[i],ans);
				out+=qpow(2,i);
			} 
			else{
				s.clear();
				set_intersection(ans.begin(),ans.end(),wei[i].begin(),wei[i].end(),back_inserter(s));
				if(s.size()<k)
					continue;
				copy(s,ans);
				out+=qpow(2,i);
			}
		}
	}
	printf("%lld",out);
}

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

int main()
{
  string s;
  cin >> s;
  
  char prev, curr;
  prev = s.at(0);
  
  for (int i = 1; i < 3; i ++)
  {
    curr = s.at(i);
    if (prev != curr)
    {
      cout << "Yes" << endl;
      return 0;
    }
    prev = curr;
  }
  
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
L = list(map(int, input().split()))
L2 = [L[i]-i-1 for i in range(n)]
L3 = [i for i in L2 if i != 0]
if len(L3) == 0 or len(L3) == 2:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 3060
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;
use proconio::*;
use std::collections::VecDeque;
use std::io::stdin;
use std::str::FromStr;
use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let mut sc = Scanner::new();
    let n = sc.next_usize();
    let ans = if n == 0 { 1 } else { 0 };
    println!("{}", ans);
}

pub struct Scanner {
    buf: VecDeque<String>,
}

impl Scanner {
    pub fn new() -> Self {
        Self {
            buf: VecDeque::new(),
        }
    }

    fn scan_line(&mut self) {
        let mut flag = 0;
        while self.buf.is_empty() {
            let mut s = String::new();
            stdin().read_line(&mut s).unwrap();
            let mut iter = s.split_whitespace().peekable();
            if iter.peek().is_none() {
                if flag >= 5 {
                    panic!("There is no input!");
                }
                flag += 1;
                continue;
            }

            for si in iter {
                self.buf.push_back(si.to_string());
            }
        }
    }

    pub fn next<T: FromStr>(&mut self) -> T {
        self.scan_line();
        self.buf
            .pop_front()
            .unwrap()
            .parse()
            .unwrap_or_else(|_| panic!("Couldn't parse!"))
    }

    pub fn next_usize(&mut self) -> usize {
        self.next()
    }

    pub fn next_isize(&mut self) -> isize {
        self.next()
    }

    pub fn next_chars(&mut self) -> Vec<char> {
        self.next::<String>().chars().collect_vec()
    }

    pub fn next_string(&mut self) -> String {
        self.next()
    }

    pub fn fill_vec_line<T: FromStr>(&mut self, v: &mut Vec<T>) {
        for vi in v {
            *vi = self.next();
        }
    }

    pub fn fill_vec<T: FromStr>(&mut self, v: &mut Vec<Vec<T>>) {
        for vi in v {
            for vii in vi {
                *vii = self.next();
            }
        }
    }

    pub fn make_vec_line<T: FromStr + Default + Clone>(&mut self, i: usize) -> Vec<T> {
        let mut v = vec![Default::default(); i];
        self.fill_vec_line(&mut v);
        v
    }

    pub fn make_vec<T: FromStr + Default + Clone>(&mut self, i: usize, j: usize) -> Vec<Vec<T>> {
        let mut v = vec![vec![Default::default(); j]; i];
        self.fill_vec(&mut v);
        v
    }
}


Measured memory_bytes: 2132
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  l=[]

  for _ in range(n):
    a,b=LI()
    l.append([a-b,a+b])

  l=sorted(l,key=lambda x:x[1])

  t=-inf
  ans=0
  for a,b in l:
    if t<=a:
      t=b
      ans+=1

  return ans

# main()
print(main())


Measured memory_bytes: 24636
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; ( iter = $ iter : ident , $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s ) . unwrap ( ) ; s } ; let mut $ iter = s . split_whitespace ( ) ; input_inner ! { $ iter , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s ) . unwrap ( ) ; s } ; let mut iter = s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; }
macro_rules ! input_inner { ( $ iter : expr ) => { } ; ( $ iter : expr , ) => { } ; ( $ iter : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , mut $ var : ident $ ( $ r : tt ) * ) => { input_inner ! { $ iter , mut $ var : usize $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident $ ( $ r : tt ) * ) => { input_inner ! { $ iter , $ var : usize $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ iter : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ iter , $ t ) ) ,* ) } ; ( $ iter : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ iter , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ iter : expr , { chars : $ base : expr } ) => { read_value ! ( $ iter , String ) . chars ( ) . map ( | c | ( c as u8 - $ base as u8 ) as usize ) . collect ::< Vec < usize >> ( ) } ; ( $ iter : expr , { char : $ base : expr } ) => { read_value ! ( $ iter , { chars : $ base } ) [ 0 ] } ; ( $ iter : expr , chars ) => { read_value ! ( $ iter , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ iter : expr , char ) => { read_value ! ( $ iter , chars ) [ 0 ] } ; ( $ iter : expr , usize1 ) => { read_value ! ( $ iter , usize ) - 1 } ; ( $ iter : expr , $ t : ty ) => { $ iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) } ; }
pub fn divisors(n: usize) -> Vec<usize> {
    let mut res = vec![];
    for i in 1..(n as f32).sqrt() as usize + 1 {
        if n % i == 0 {
            res.push(i);
            if i * i != n {
                res.push(n / i);
            }
        }
    }
    res.sort();
    res
}
fn main() {
    input! { n };
    let mut ans = divisors(n - 1).len();
    for i in divisors(n).into_iter() {
        if i == 1 {
            continue;
        }
        let mut m = n;
        while m > 0 && m % i == 0 {
            m /= i;
        }
        if m % i == 1 {
            ans += 1;
        }
    }
    println!("{}", ans - 1);
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
//#pragma GCC optimize("Ofast")  //デバッグ時にoptimized-outされて邪魔だった
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define invar(typ, var) typ var; cin >> var;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX / 2;
const ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  int K, X;
  cin >> K >> X;
  if(K*500 >= X) {
    fin("Yes");
  } else {
    fin("No");
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>

using namespace std;

const string no = ":(";

int main(){
  int N;
  cin >> N;
  int tmp = floor(N / 1.08);
  if ((N != floor(tmp * 1.08)) && (N != floor((tmp + 1) * 1.08))){
    cout << no << endl;
  }
  else{
    cout << (N == floor(tmp * 1.08) ? tmp : tmp + 1) << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e5+50;
int main(){
	ll ans=0;int n;scanf("%d",&n);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			for(int k=1;k<=n;k++){
				int x=__gcd(i,j);
				ans+=__gcd(x,k);
			}
		}
	}printf("%lld\n",ans);
}

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

using namespace std;
long long x,y;
int main()
{
    cin>>x>>y;
    long long ans=x;
    int sum=0;
    while(ans<=y)
    {
        if(ans<=y){
        sum++;ans=(long long)ans*2;}
        else break;
    }
    cout<<sum;
}


Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

int main()
{
  int n,a,b;
  char str[1000005]={};
  int i,j;

  cin>>n>>a>>b;
  cin>>str;
  int na=0,nb=0;

  rep(i,n){
    if(str[i]=='a' && na+nb<a+b){
      na++;
      cout<<"Yes"<<endl;
    }else if(str[i]=='b' && na+nb<a+b && nb<b){
      nb++;
      cout<<"Yes"<<endl;
    }else{
      if(na+nb>a+b){
	for(j=i;j<n;j++)
	  cout<<"No"<<endl;
	return 0;
      }
      cout<<"No"<<endl;
    }
  }
}


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

int main(){
  int h, w;
  string ci;
  
  cin >> h >> w;
  
  for (int i=0; i<h; i++) {
    cin >> ci;
    cout << ci << endl;
    cout << ci << endl;
  }
  
  return 0;  
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 100
#define WHITE 3000
#define BLACK 3001
#define INF 3002
#define NIL -1

int prim(int);
int d[MAX+1], G[MAX+1][MAX+1];

int main(){
  int n, i, j;

  scanf("%d",&n);
  for(i = 1; i <= n; i++){
    for(j = 1; j <= n; j++){
      scanf("%d",&G[i][j]);
    }
  }
  printf("%d\n",prim(n) );
  return 0;
}

int prim(int n){
  int parent[n+1], color[n+1], mincost, weight_sum=0, u, v, i=0, j;
  
  for(i = 1; i <= n; i++){
      d[i] = INF;
      parent[i] = NIL;
      color[i] = WHITE;
  }
  d[1] = 0;

  while( 1 ){
    mincost = INF;
    for(i = 1; i <= n; i++){
      if( color[i] != BLACK && d[i] < mincost ){
	mincost = d[i];
	u = i;
      }
    }
    if( mincost == INF ) break;
    color[u] = BLACK;
    for(j = 1; j <= n; j++){
      if( G[u][j] != NIL ){
	v = j;
	if( color[v] != BLACK && G[u][v] < d[v] ){
	  parent[v] = u;
	  d[v] = G[u][v];
	}
      }
    }
  }
  for(i = 1; i <= n; i++) weight_sum += d[i];
  return weight_sum;
}





Measured memory_bytes: 2108
#include "bits/stdc++.h"

#define rep(i,n) for(int i = 0;i<n;i++)
#define cint(a) int a; cin >> a;
#define cstr(str) string str; cin >> str;
#define vv(Type, n,m,d)vector<vector<Type>> vv(n, vector<Type>(m, d));

using namespace std;
using ll = long long;

const ll mod = 1e9 + 7;

int main(void) {

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

	ll n; cin >> n;

	ll ans = 0;
	ll m;// kousuu
	ll a; //最後の項
	for (ll i = 1; i <= n; i++) {
		m = n / i;
		ans += m * (m+1)* i / 2;
	}

	cout << ans << endl;




	return 0;
}


Measured memory_bytes: 3620
#include <stdio.h>

int main(){
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  int dd;
  if(a>b){
    dd=a;
    a=b;
    b=dd;
  }
  if(b>c){
    dd=b;
    b=c;
    c=dd;
  }
  if(a>b){
    dd=a;
    a=b;
    b=dd;
  }
  if(a<=5 && b<=5 && c<=7){
    printf("YES");
  }else{
    printf("NO");
  }

  return 0;
}

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

typedef pair<int, int> P;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

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

  int N, M;
  bool flag = true;
  cin >> N >> M;
  vector<int> S(N);
  int s, c;
  rep(i, N)
    S[i] = 10;
  rep(i, M) {
    cin >> s >> c;
    s--;
    if (s == 0 && c == 0 && N != 1) {
      cout << "-1" << endl;
      flag = false;
      break;
    }
    if (S[s] == 10 || S[s] == c)
      S[s] = c;
    else {
      cout << "-1" << endl;
      flag = false;
      break;
    }
  }
  if (flag) {
    rep(i, N) {
      if (S[i] == 10) {
        if (i == 0 && N != 1)
          S[i] = 1;
        else
          S[i] = 0;
      }
      cout << S[i];
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
from fractions import gcd
from functools import reduce
from collections import deque
# from math import factorial
import sys
sys.setrecursionlimit(2000000)
# import math
# import itertools
# import statistics
# import numpy as np
# import collections
n = int(input())
# = list(map(int, input().split()))
t = []
for i in range(n):
    t.append(int(input()))


def lcm_base(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


print(lcm_list(t))


Measured memory_bytes: 5076