akhauriyash/Code-Regression huggingface dataset:
//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);
const long double PI=3.14159265358979;

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

int main()
{
    #ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r"))
    {
        freopen ("INPUT.txt" , "r" , stdin);
        //freopen ("OUTPUT.txt" , "w" , stdout);
    }
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    clock_t clk;
    clk = clock();
//-----------------------------------------------------------------------------------------------------------//

    ll A,B;
    ld b;
    cin>>A>>b;
    b=b*100.0;
    B=(ll)b;
    b=b/100.0;
    cout<<max((ll)floor(A*b),(A*B)/100)<<endl;


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


    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

    return 0;
}


Measured memory_bytes: 3796
#include <vector>
#include <list>
#include <map>
#include <set>
#include "queue"
#include <deque>
#include <stack>
#include <numeric>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <complex>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <climits>
#include <cassert>
#include <iostream>
#include "fstream"
using namespace std;
#define PI acos(-1)
#define MOD 1000000007
#define pii pair<long long ,long long >
#define ll  long long int
#define loop(i,n) for(ll i=0;i<n;i++)
#define loop2(i,n) for(ll i = 1;i<=n;i+=1)
#define pb push_back
#define EPS 1e-8
inline ll gcd(ll a, ll b){ ll t; while (b){ a = a%b; t = a; a = b; b = t; }return a; }
using namespace std;





int main()
{
//    freopen("/Users/ashish/Desktop/manic_moving.txt", "r", stdin);
//    freopen("/Users/ashish/Desktop/A-large-practice.out.txt", "w", stdout);
    //cout<<cool(8, 2);
    
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max(a*b,c*d);
    
    return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Isize1, Usize1},
};
#[fastout]
fn main() {
    input!(mut a: [isize;4]);

    let aa = a[1] * a[3];
    let bb = a[0] * a[3];
    let cc = a[1] * a[2];
    let dd = a[0] * a[2];

    println!(
        "{}",
        std::cmp::max(std::cmp::max(aa, bb), std::cmp::max(cc, dd))
    );
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

using namespace std;
using ll = long long;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N; cin >> N;
  string S; cin >> S;
  vector<vector<int>> lcp(N + 1, vector<int>(N + 1));
  int ans = 0;
  repr(i, N) {
    repr(j, N) {
      if (S[i] != S[j]) {
        lcp[i][j] = 0;
      } else {
        lcp[i][j] = lcp[i + 1][j + 1] + 1;
      }
      if (i < j) {
        ans = max(ans, min(j - i, lcp[i][j]));
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 98176
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k, x, y;
    cin >> n >> k >> x >> y;
    cout << x * min(k, n) + y * max(n - k, 0) << endl;
    return 0;
}


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

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

int calcGCD(int a, int b, int c) {
	int result1 = gcd(a,b);
    int result2 = gcd(result1,c);
    return result2;
}

int main() {
  int x;
  cin >> x;
  int result = 0;
  for (int i=0; i<x; i++) {
      for (int j=0; j<x; j++) {
        for (int k=0; k<x; k++) {
        	int gcd = calcGCD(i+1,j+1,k+1);
              result += gcd;
        }
      }
  }
  cout << result << endl;
}

Measured memory_bytes: 3216
#pragma region
#include <bits/stdc++.h>

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

using namespace std;

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

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

void solve() {
  int n, k;
  cin >> n >> k;
  vi32 a(n);
  cin >> a;
  vi64 lst;
  vi64 sums(n + 1);
  rep(i, n) sums[i + 1] += sums[i] + a[i];
  repc(i, n - 1) repic(j, i + 1, n) {
    lst.emplace_back(sums[j] - sums[i]);
  }
  int m = lst.size();
  vi32 f(m, 1);
  i64 ans = 0;
  rrep(i, 50) {
    int cnt = 0;
    rep(j, m) {
      if (f[j] && (lst[j] & bit64(i))) cnt++;
    }
    if (cnt >= k) {
      ans += bit64(i);
      rep(j, m) {
        if (f[j] && !(lst[j] & bit64(i))) f[j] = 0;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 6256
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
using namespace std;
int a[123456], n, k, ans = 0;
int f1(int a, int p) {
	if (p == 1)return a;
	if (p % 2)return f1(a, p - 1) * a % mod;
	else return f1(a * a % mod, p / 2) % mod;
}
signed main() {
	cin >> n >> k;
	for0(i, n)cin >> a[i]; sort(a, a + n);
	int p = 1;
	for0(i, n - k + 1) {
		ans += p * (a[k - 1 + i] - a[n - k - i]);
		ans %= mod;
		p *= k + i; p %= mod;
		p *= f1(1 + i, mod - 2); p %= mod;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void){
	int num[3];
	int i, j, tmp;

	scanf("%d %d %d", &num[0], &num[1], &num[2]);
	for (i = 0; i < 3; i++) {
		for (j = 0; j < 2; j++) {
			if (num[j] > num[j + 1]) {
				tmp = num[j];
				num[j] = num[j + 1];
				num[j + 1] = tmp;
			}
		}
	}

	printf("%d %d %d\n", num[0], num[1], num[2]);

	return 0;
}

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

using namespace std;

int main() {
  int c[3][3];
  
  for (int i = 0; i < 3; i++) {
    cin >> c[i][0] >> c[i][1] >> c[i][2]; 
  }
  int a1, b1, b2, b3;
  a1 = 0;
  b1 = c[0][0];
  b2 = c[0][1];
  b3 = c[0][2];
  
  int a2 = c[1][0] - b1;
  int a3 = c[2][0] - b1;
  
  if (a2 + b2 == c[1][1] && a2+ b3 == c[1][2] && a3 + b2 == c[2][1] && a3 + b3 == c[2][2]) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  	int d,a;
  	cin>>d>>a;
  	int days[a];
  	int sum=0;
  	for(int i=0;i<a;i++)
    {
      cin>>days[i];
      sum+=days[i];
    }
  	if(sum>d)
    {
      cout<<"-1"<<endl;
    }
  	else
    {
      cout<<d-sum<<endl;
    }
  return 0;
}

Measured memory_bytes: 3672
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int s,a[1000];

void b(int );

int c();

int main()
{
    int i,j;
    s = 0;
    char n[100];
    while(scanf("%s",n)!=EOF)
    {
        if(n[0]=='+')
        {
            i=c();
            j=c();
            b(i+j);
        }
	else if(n[0]=='-')
        {
            j=c();
            i=c();
            b(i-j);
        }
	else if(n[0]=='*')
        {
            i=c();
            j=c();
            b(i*j);
        }
	else
        {
            b(atoi(n));
        }
        
        
    }
    printf("%d\n",c());
    
    return 0;
    
}

void b(int d)
{
    a[++s]=d;
    
}
int c()
{
    s--;
    
    return a[s+1];
}



Measured memory_bytes: 2052
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
int main()
{

  int n;
  cin>>n;
  int ans=0;
  rep(i,0,n)
  {
    int l,r;
    scanf("%d%d",&l,&r);
    ans+=(r-l)+1;
  }
  cout<<ans;


  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef int in;
typedef long long ll;
typedef vector<in> VI;
typedef vector<VI> VVI;
const in mdl=1000000007;
in p2(in a){
  return 1<<a;
}
VI pcnt;
vector<ll> reswys;
vector<ll> wys;
vector<ll> owys;
in n;
void goup(){
  forv(i,wys){
    owys[i]=wys[i];
    wys[i]=0;
    reswys[i]=0;
  }
  in pn=p2(n);
  in pi;
  forn(s,n+1){
    forv(i,owys){
      if(pcnt[i]==s)
	wys[i]=owys[i];
    }
    forn(i,n){
      pi=p2(i);
      in pl=p2(n-1-i);
      in pr=p2(i);
      in msk;
      forn(ml,pl){
	forn(mr,pr){
	  msk=(ml<<(i+1))+mr;
	  if(pcnt[msk]<=s-1){
	    wys[msk|pi]+=wys[msk];
	  }
	  else
	    wys[msk|pi]=wys[msk]=wys[msk]+wys[msk|pi];
	}
      }
    }
    forv(i,wys){
      reswys[i]+=wys[i];
      wys[i]=0;
    }
  }
  forv(i,wys){
    wys[i]=reswys[i];
  }
}

VI condmembers;
VI condvalue;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  in m,k;
  cin>>n>>m>>k;
  --n;
  reswys.resize(p2(n));
  wys.resize(p2(n));
  owys.resize(p2(n));
  pcnt.resize(p2(n));
  forv(i,pcnt){
    forn(j,n){
      pcnt[i]+=!!(i&p2(j));
    }
  }
  wys[0]=1;
  condmembers.resize(m);
  condvalue.resize(m);
  in a,b,c;
  forn(z,k){
    cin>>a>>b>>c;
    --a;
    --b;
    condmembers[a]|=p2(b);
    condvalue[a]|=c*p2(b);
  }
  forn(z,m){
    goup();
    forn(msk,p2(n)){
      if((msk&condmembers[z])!=condvalue[z])
	wys[msk]=0;
      wys[msk]%=mdl;
    }
  }
  ll sm=0;
  forn(i,p2(n))
    sm+=wys[i];
  sm%=mdl;
  if(sm<0)
    sm+=mdl;
  cout<<sm<<endl;
  return 0;
}


Measured memory_bytes: 16640
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int A, B;
    cin >> A >> B;
    int ans = 0;
    if (A < 6) {
    } else if (A <= 12) {
        ans = B / 2;
    } else {
        ans = B;
    }
    cout << ans << endl;
    return (0^_^0);
}



Measured memory_bytes: 256
while True:
    a,b,c = input().split()
    a = int(a)
    c = int(c)
    if b == '+':
        print(a + c)
    elif b == '-':
        print(a - c)
    elif b == '*':
        print(a * c)
    elif b == '/':
        print(a // c)
    if b == '?':
        break
    
    


Measured memory_bytes: 5596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n, m;
ll sum;
int a[10004];
int main()
{
	cin>>n>>m;
	for(int i=1;i<=m;i++)
    {
        scanf("%d",&a[i]);
        sum+=a[i];
    }
    if(sum>n) cout<<-1;
    else      cout<<n-sum;
    return 0;
}


Measured memory_bytes: 3776
import java.util.Scanner;
import java.util.Arrays;
public class Main {
    static int[][] grid;
    static int MAX_HEIGHT = 9;
    static int MAX_WIDTH = 9;
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	grid = new int[MAX_HEIGHT][MAX_WIDTH];
	String line;
	int width, n, pos;
	for (int i = 0; i < 9; i++) {
	    line = scan.nextLine();
	    width = 0;
	    for (int j = 0; j < line.length(); j++) {
		n = Integer.parseInt(line.substring(j, j+1));
		if (n == 0) {
		    continue;
		}
		if (i % 2 == 0) {
		    pos = j * 2;
		    grid[i][pos] = 1;
		    grid[i][pos+1] = 1;
		    grid[i][pos+2] = 1;
		} else {
		    pos = j*2;
		    grid[i-1][pos] = 1;
		    grid[i][pos] = 1;
		    grid[i+1][pos] = 1;
		}
	    }
	}
	solve();
    }
    
    static void solve () {
	StringBuilder sb = new StringBuilder();
	int width = 0, height = 0, direction = 0;
	int[] dwidth = {1, 0, -1, 0};
	int[] dheight = {0, 1, 0, -1};
	String[] textdirection = {"R", "D", "L", "U"};
	
	while (true) {
	    for (int i = 3; i < 7; i++) {
		int nextwidth = width + dwidth[(i + direction) % 4];
		int nextheight = height + dheight[(i + direction) % 4];
		int nextnextwidth = nextwidth + dwidth[(i + direction) % 4];
		int nextnextheight = nextheight + dheight[(i + direction) % 4];
		if (!(0 <= nextwidth && nextwidth < MAX_WIDTH && 0 <= nextheight && nextheight < MAX_HEIGHT)) {
		    continue;
		}
		if (!(0 <= nextnextwidth && nextnextwidth < MAX_WIDTH && 0 <= nextnextheight && nextnextheight < MAX_HEIGHT)) {
		    continue;
		}
		if (grid[nextheight][nextwidth] == 0 || grid[nextnextheight][nextnextwidth] == 0) {
		    continue;
		}
		width = nextnextwidth;
		height = nextnextheight;
		direction = (i + direction) % 4;
		sb.append(textdirection[direction]);
		break;
	    }
	    if (width == 0 && height == 0) {
		break;
	    }
	}
	System.out.println(sb.toString());
    }
}

Measured memory_bytes: 25988
from collections import Counter

h, w = map(int, input().split())
a = Counter(''.join(input() for _ in range(h)))

center = h * w % 2
side = (h // 2) * (w % 2) + (w // 2) * (h % 2)
corner = (h // 2) * (w // 2)

for i in range(center):
    for i in a:
        if a[i] % 2 == 1:
            a[i] -= 1
            break
for i in range(side):
    for i in a:
        if a[i] % 4 == 2:
            a[i] -= 2
            break

print('Yes' if sum(a[i] % 4 for i in a) == 0 else 'No')



Measured memory_bytes: 9432
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string sS = System.Console.ReadLine().Trim();
            int iN = int.Parse(sS);                                                     // 総数
            sS = System.Console.ReadLine().Trim();

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            List<int> lstOut = new List<int>();
            int iWAt = iN - sS.Replace("W", "").Length;                                 // 白の数
            int iRAt = iN - iWAt;                                                       // 赤の数
            int iWLc = 0;                                                               // 仕切より左の白の数
            int iRRc = iRAt;                                                            // 仕切より右の赤の数
            lstOut.Add(Math.Max(0, iRAt));                                              // 仕切最左端の位置の仕切の右側のWの数と左側のRの数の大きい方
            for (int i = 0; i < iN; i++)                                                // 仕切の位置を石の間に置く
            {
                string sOne = sS.Substring(i, 1);                                       // 前回の仕切の位置から右へ移動する石
                switch (sOne)
                {
                    case "W": iWLc += 1; break;                                         // WだったらiWLc+1
                    case "R": iRRc -= 1; break;                                         // RだったらiRRc+1
                }
                lstOut.Add(Math.Max(iWLc, iRRc));                                       // 石の間の仕切位置の右側のWの数と左側のRの数の大きい方
            }
            lstOut.Add(Math.Max(iWAt, 0));                                              // 仕切最右端の位置の仕切の右側のWの数と左側のRの数の大きい方
            lstOut.Sort();

            // 出力
            System.Console.WriteLine("{0}", lstOut[0].ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


Measured memory_bytes: 36196
#include<algorithm>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstdio>
#include<iomanip>
#include<cmath>
using namespace std;


int main() {
    int N;
    cin >> N;
    map<int, int> dp;
    int A;
    long long sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> A;
        if (dp[i-A] > 0) {
            sum += dp[i-A];
        }
        dp[i+A]++;
    }
    cout << sum;
    return 0;
}

Measured memory_bytes: 20652
from itertools import accumulate
import bisect


n = int(input())
t = list(map(int, input().split()))
v = list(map(int, input().split()))

t = [0]+t
t = list(accumulate(t))

v.append(0)
for i in range(1,len(t)):
    v[-i-1] = min(v[-i]+t[-i]-t[-i-1],v[-i-1])


a = [0]

for i in range(1,(t[-1])*2+1):
    j = i/2
    b = bisect.bisect_left(t,j)
    a.append(min(a[-1]+1/2,v[b-1],v[b]+t[b]-j))
print(sum(a)/2)







Measured memory_bytes: 45788
#include <stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	if (n == 1) {
		printf("Yes\n");
		printf("2\n");
		printf("1 1\n");
		printf("1 1\n");
		return 0;
	}
	int e = 0;
	for (int i = 2; i < 1000; i++) {
		if (i*(i + 1) / 2 == n)e = i;
	}
	if (e == 0) {
		printf("No\n");
		return 0;
	}
	e++;
	int a[1000][1000];
	int f = 1;
	for (int i = 0; i < e; i++) {
		for (int j = 0; j < e; j++) {
			if (i > j) {
				a[i][j] = f;
				f++;
			}
		}
	}
	for (int i = 0; i < e; i++) {
		for (int j = 0; j < e; j++) {
			if (j > i)a[i][j] = a[j][i];
		}
	}
	printf("Yes\n");
	printf("%d\n", e);
	for (int i = 0; i < e; i++) {
		printf("%d", e - 1);
		for (int j = 0; j < e; j++) {
			if (i != j) {
				printf(" %d", a[i][j]);
			}
		}
		printf("\n");
	}
}

Measured memory_bytes: 4736
import sys
from itertools import accumulate 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

n, wei = map(int,readline().split())

w,v = [],[]
for i in range(n):
    wi, vi = map(int,readline().split())
    w.append(wi)
    v.append(vi)

w1,w2,w3,w4 = [],[],[],[]
for i in range(n):
    if w[i] == w[0]: w1.append(v[i])
    if w[i] == w[0] + 1: w2.append(v[i])
    if w[i] == w[0] + 2: w3.append(v[i])
    if w[i] == w[0] + 3: w4.append(v[i])

w1 = [0] + list(accumulate(sorted(w1, reverse=True)))
w2 = [0] + list(accumulate(sorted(w2, reverse=True)))
w3 = [0] + list(accumulate(sorted(w3, reverse=True)))
w4 = [0] + list(accumulate(sorted(w4, reverse=True)))

ans = 0
for i in range(len(w1)):
    for j in range(len(w2)):
        for k in range(len(w3)):
            for l in range(len(w4)):
                vsum = w1[i] + w2[j] + w3[k] + w4[l];
                wsum = w[0]*i + (w[0]+1)*j + (w[0]+2)*k + (w[0]+3)*l;
                if wsum <= wei: ans = max(ans,vsum)

print(ans)


Measured memory_bytes: 73672
package main

import "fmt"

var K, N int
var dp []int

func main() {
	fmt.Scan(&N, &K)
	dp = make([]int, K+1)
	for x := K; x > 0; x-- {
		dp[x] = Mpow(K / x, N)
		for i := 2; i*x <=K; i++ {
			dp[x] -= dp[i*x]
		}
	}
	ans := 0
	for x, y := range dp {
		ans = Madd(ans, Mmul(x, y))
	}
	fmt.Println(ans)
}

// lib/modint.go
const MOD = 1000000007

func Madd(a, b int) int { return madd(a, b, MOD) }
func madd(a, b, mod int) int {
	if a+b > mod {
		return a + b - mod
	}
	return a + b
}

func Msub(a, b int) int { return msub(a, b, MOD) }
func msub(a, b, mod int) int {
	if a-b < 0 {
		return a - b + mod
	}
	return a - b
}

func Mmul(a, b int) int { return mmul(a, b, MOD) }
func mmul(a, b, mod int) int {
	return ((a % mod) * (b % mod)) % mod
}

func Mpow(a, b int) int { return mpow(a, b, MOD) }
func mpow(k, p, mod int) int {
	r := 1
	for ; p > 0; p >>= 1 {
		if p&1 == 1 {
			r = mmul(r, k, mod)
		}
		k = mmul(k, k, mod)
	}
	return r
}

func Minv(a int) int { return minv(a, MOD) }
func minv(a, mod int) int {
	b := mod
	u, v := 1, 0
	for b > 0 {
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	u %= mod
	if u < 0 {
		u += mod
	}
	return u
}

func Mdiv(a, b int) int { return mdiv(a, b, MOD) }
func mdiv(a, b, mod int) int {
	return mmul(a, minv(b, mod), mod)
}


Measured memory_bytes: 2660
//#define TEST

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using static System.Math;

class Program
{
    static int n;
    static long[] a;
    static void Main()
    {
        n = int.Parse(Console.ReadLine());
        a = Console.ReadLine().Split().Select(long.Parse).ToArray();
        int l = 0;
        int r = 0;
        long xor = a[0];
        long ans = 0;
        while (l < n - 1)
        {
            if (r < n - 1 && (xor & a[r + 1]) == 0)
            {
                xor ^= a[r + 1];
                r++;
                continue;
            }
#if TEST
            Console.WriteLine("l:{0} r:{1}",l,r);
#endif
            ans += r - l + 1;
            xor ^= a[l];
            l++;
            if (r < l)
            {
                r = l;
                xor = a[l];
            }
        }
#if TEST
        Console.WriteLine("l:{0} r:{1}", l, r);
#endif
        ans += r - l + 1;
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 34652
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int a = in.nextInt();
            int b = in.nextInt();
            int c = in.nextInt();

            System.out.println(b - a == c - b ? "YES" : "NO");
        }
    }
}


Measured memory_bytes: 27112
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String s = scan.nextLine();
        String t = scan.nextLine();

        String z = t.substring(0, t.length()-1);

        if(s.equals(z)){
        	System.out.println("Yes");
        } else {
        	System.out.println("No");
        }

        scan.close();
    }
}

Measured memory_bytes: 35548
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;

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 main() {
  int x;
  cin >> x;
  bool prime = false;
  while (!prime) {
    if (isprime(x)) {
      cout << x << endl;
      return 0;
    }
    else x++;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    if(n<10) cout<<n;
    else if(n>=10 && n<100) cout<<"9";
    else if(n>=100 && n<1000) cout<<n-90;
    else if(n>=1000 && n<10000) cout<<"909";
    else if(n>=10000 && n<100000) cout<<n-9090;
    else cout<<"90909";
//    char a[10];
//    for(int i=0;i<10;i++) cin>>a[i];
//    sort(a,a+10);
//    for(int i=0;i<10;i++) cout<<a[i]<<" ";
//    int a,b,c;
//    cin>>a>>b>>c;
//    cout<<c-(a-b);
}


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

bool judge(vector<int> A,int N){
  bool ans = true;
  for(int i=0;i<N;i++){
    if(A[i]%2!=0){
      ans=false;
    }
  }
  return ans;
}

int main()
{
  int N;
  cin>>N;
  vector<int> A;
  for(int i=0;i<N;i++){
    int j;
    cin>>j;
    A.push_back(j);
  }
  int cnt=0;
  while(judge(A,N)){
    for(int i=0;i<N;i++){
      A[i]/=2;
    }
    cnt++;
  }
  cout<< cnt;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
constexpr auto INF = 1000000000;
constexpr auto LLINF = 1LL << 60;
constexpr auto mod = 1000000007;
constexpr auto MOD = 998244353;
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; }

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector<vector<pair<int, ll>>>edge(n);
    int a, b;
    ll c;
    FOR(i, 0, n - 1) {
        cin >> a >> b >> c;
        edge[--a].push_back({ --b,c });
        edge[b].push_back({ a,c });
    }

    int q, k;
    cin >> q >> k;

    vector<ll> ans(n, LLINF);
    ans[--k] = 0;
    multiset<tuple<ll, int, int>> set;
    for (auto i : edge[k])set.insert(make_tuple(i.second, k, i.first));
    while (!set.empty()) {
        tie(c, a, b) = *set.begin();
        set.erase(set.begin());
        if (chmin(ans[b], ans[a] + c)) {
            for (auto i : edge[b])set.insert(make_tuple(i.second, b, i.first));
        }
    }

    int x, y;
    FOR(i, 0, q) {
        cin >> x >> y;
        cout << ans[--x] + ans[--y] << "\n";
    }
}

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

using namespace std;

int main()
{

    int a, b, c, d, e, aa, bb, cc, dd, ee, x[6];

    cin >> a >> b >> c >> d >> e;

    int sum = a + b + c + d + e;

    x[0] = a % 10;
    if(x[0] == 0)
      x[0] = 0;
    else
      x[0] = 10 - x[0];

    x[1] = b % 10;
    if(x[1] == 0)
      x[1] = 0;
    else
    x[1] = 10 - x[1];

    x[2] = c % 10;
    if(x[2] == 0)
      x[2] = 0;
    else
    x[2] = 10 - x[2];

    x[3] = d % 10;
    if(x[3] == 0)
      x[3] = 0;
    else
    x[3] = 10 - x[3];

    x[4] = e % 10;
    if(x[4] == 0)
      x[4] = 0;
    else
    x[4] = 10 - x[4];

    int mx = 0;
    for(int i = 0; i < 5; i++)
    {
       mx = max(mx, x[i]);
    }

    int sum2 = 0, ch = 0;
    for(int i = 0; i < 5; i++)
    {
       if(mx == x[i])
         ch++;
      if(mx != x[i] )
      {
        sum2 += x[i];

      }
      else if(mx == x[i] && ch > 1)
      {
         sum2 += x[i];
         ch++;
      }
    }

    //cout << sum2 << endl;

    int ans = sum + sum2;

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N, Q =map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N-1)]

g = {}
for a, b in ab:
    if a in g: g[a].append(b)
    else: g[a] = [b]
    if b in g: g[b].append(a)
    else: g[b] = [a]

cnt = [0]*(N+1)

for _ in range(Q):
    p, x = map(int, input().split())
    cnt[p] += x

temp = [1]
visited = [0]*(N+1)
visited[1] = 1

while temp:
    q = temp.pop()   
    for i in g[q]:
        if visited[i] == 0:
            temp.append(i)
            visited[i] = 1
            cnt[i] += cnt[q]
print(*cnt[1:])


Measured memory_bytes: 94812
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = k; i < n; ++i) {
    if (a[i - k] < a[i]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 4048
#include <iostream>

using namespace std;

int main() {
  string S, T;
  cin >> S >> T;
  int s = S.size(), t = T.size(), ans{1000};
  for (int i = 0; i <= s - t; ++i) {
    int c{t};
    for (int j = 0; j != t; ++j) {
      if (S[i+j] == T[j]) --c;
    }
    ans = min(ans, c);
  }
  cout << ans << endl;
}


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

public class Main{
    Main(){
	Scanner sc = new Scanner(System.in);
	boolean f = true;

	while(sc.hasNext()){
	    St[] a = new St[5];
	    for(int i = 0; i < 5 && f; i++){
		a[i] = new St((char)('A'+i), (sc.nextInt()+sc.nextInt()));
		if(a[i].t == 0) f = false;
	    }
	    if(!f) break;

	    Arrays.sort(a);
	    a[0].print();
	}
    }

    public static void main(String[] args){
	new Main();
    }
}

class St implements Comparable{
    public int t;
    public char s;

    St() {}
    St(char s, int t) {
	this.s = s;
	this.t = t;
    }

    public int compareTo(Object obj){
	St st = (St)obj;

	if(this.t > st.t) return -1;
	if(this.t < st.t) return 1;
	return 0;
    }

    public void print(){
	System.out.println(String.valueOf(s)+" "+String.valueOf(t));
	return ;
    }
}

Measured memory_bytes: 12000
// floyd2.cpp : アプリケーションのエントリ ポイントを定義します。
//

// floyd.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include <iostream>
#include <string>
using namespace std;



int main()
{
    string ABCD;
    int sum,s[10],k;
    
    cin >> ABCD;
    k = 0;
    sum = 0;

    while (k < 4) {
        s[k] = ABCD[k] - '0';
        k++;
    }

        if (s[0] + s[1] + s[2] + s[3] == 7) {
            cout << s[0] <<"+"<< s[1] <<"+"<< s[2]<< "+"<< s[3] <<"=7";
        }
        else if (s[0] - s[1] + s[2] + s[3] == 7) {
            cout << s[0] << "-" << s[1] << "+" << s[2] << "+" << s[3] << "=7";
        }
        else if (s[0] + s[1] - s[2] + s[3] == 7) {
            cout << s[0] << "+" << s[1] << "-" << s[2] << "+" << s[3] << "=7";
        }
        else if (s[0] + s[1] + s[2] - s[3] == 7) {
            cout << s[0] << "+" << s[1] << "+" << s[2] << "-" << s[3] << "=7";
        }
        else if (s[0] - s[1] - s[2] + s[3] == 7) {
            cout << s[0] << "-" << s[1] << "-" << s[2] << "+" << s[3] << "=7";
        }
        else if (s[0] - s[1] + s[2] - s[3] == 7) {
            cout << s[0] << "-" << s[1] << "+" << s[2] << "-" << s[3] << "=7";
        }
        else if (s[0] + s[1] - s[2] - s[3] == 7) {
            cout << s[0] << "+" << s[1] << "-" << s[2] << "-" << s[3] << "=7";
        }
        else {
            cout << s[0] << "-" << s[1] << "-" << s[2] << "-" << s[3] << "=7";
        }
        
    cout << endl;
}

Measured memory_bytes: 256
#n=int(input())
#N,M=map(int,input().split())
s=input()
l,r=0,len(s)-1
ans=0

while r-l>0:
    a,b=s[l],s[r]
    if a==b:
        l+=1
        r-=1
    elif a=='x' and b!='x':
        ans+=1
        l+=1
    elif b=='x' and a!='x':
        ans+=1
        r-=1
    else:
        ans=-1
        break

print(ans)

Measured memory_bytes: 39664
#include <bits/stdc++.h>
#define ld long double
#define int long long
using namespace std;
const int N = 1e5 + 50;
const int mod = 1e9 + 7;
const int inf = 1e17;
int dx[] = {0, 1, -1, 0, -1, 1, 1, -1};
int dy[] = {1, 0, 0, -1, -1, 1, -1, 1};
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);	
	int s, count = 1;
	cin >> s;
	map<int,int> mp;
	while(1){
		if(mp.find(s) != mp.end()){
			cout << count;
			exit(0);
		}
		mp[s]++;
		if(s % 2){
			s = 3 * s + 1;
		}else{
			s = s / 2;
		}
		count++;
	}
}

Measured memory_bytes: 256
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
s = ns().strip()
for c in s:
    x = ord(c)-ord('A')
    x = (x + n) % 26
    sys.stdout.write(chr(x+ord('A')))


Measured memory_bytes: 3700
/*
 * Talk is cheap, show me the code.
 * Author:  JiangDingyuan
 * Created Time:  2017/9/9 21:09:22
 * File Name: 123456.cpp
 */
#include <time.h>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#define PI acos(-1.0)
#define LL long long
#define bug printf("bug!\n");
#define RD freopen("in.txt", "r", stdin);
#define LD freopen("out.txt", "w", stdout);

using namespace std;

int main() {
    string a;
    cin >> a;
    if (a[0]=='9'||a[1]=='9') puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>

using namespace std;

int main(){
    int N;
    int A[2][100];

    scanf("%d", &N);
    for(int i = 0; i < N; i++){
        scanf("%d", &A[0][i]);
    }
    for(int i = 0; i < N; i++){
        scanf("%d", &A[1][i]);
    }    

    int ans = 0;
    for(int i = 0; i < N; i++){
        int num = 0;
        for(int j = 0; j < N; j++){
            if (j < i){
                num += A[0][j];
            }else if (j == i){
                num += A[0][j] + A[1][j];
            }else{
                num += A[1][j]; 
            }
        }
        if (ans <= num) ans = num;
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 128
// Abhishek Chaturvedi- abhishekchaturvedi10oct //

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define endl            "\n"
#define inf             2e18+1
#define ninf            -2e18+1
#define mod             1000000007
#define eps             1e-9
#define ff              first
#define ss              second
#define int             long long
#define ld              long double
#define str             string 
#define pb              emplace_back
#define mp              make_pair
#define vi              vector<int>
#define si              set<int>
#define pii             pair<int,int>
#define psi             pair<str,int>
#define mii             map<int,int>
#define msi             map<str,int>
#define maxheap         priority_queue<int>
#define minheap         priority_queue<int,vi,greater<int>>
#define sz(x)           (int)x.size()
#define all(x)          x.begin(),x.end()
#define allr(x)         x.rbegin(),x.rend()
#define gcd(x,y)        __gcd(x, y)
#define arrsz(x)        sizeof(x)/sizeof(x[0])
#define sp(x,y)         fixed<<setprecision(y)<<x
#define tc(x)           int x; cin>>x; while(x--)
#define loopf(i,x,y)    for(int i=x;i<=y;i++)
#define loopb(i,x,y)    for(int i=x;i>=y;i--)
#define in(x,n)         int x[n];loopf(i,0,n-1) cin>>x[i];
#define out(x)          for(auto i:x) cout<<i<<" "; cout<<endl;
#define init(x,n,y)     int x[n];loopf(i,0,n-1) x[i]=y;

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

void solve(){  
    int n; cin>>n; in(a,n); init(dp,n,inf); dp[0]=0; dp[1]=abs(a[1]-a[0]);
    loopf(i,2,n-1){
        dp[i]=min(abs(a[i]-a[i-1])+dp[i-1],abs(a[i]-a[i-2])+dp[i-2]);
    }
    cout<<dp[n-1];
}

int32_t main(){
    
    fastIO();

    //tc(t){
        solve();
    //}

    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() {
    int n; cin >> n;
    string s; cin >> s;
    map<char,int> l, r;
    rep(i, n) r[s[i]]++;
    int ans = 0;
    rep(i, n) {
        int res = 0;
        l[s[i]]++; r[s[i]]--;
        for(auto it=l.begin();it!=l.end();it++) {
            if(it->second * r[it->first]) res++;
        }
        ans = max(ans, res);
    }
    cout << ans;
}


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

template<int64_t MOD> struct Mint {
    int64_t v;
    Mint() { v = 0; }
    Mint(int64_t x) { v = x % MOD; if(v < 0)  v += MOD; }

    Mint operator-() { return Mint{-v}; };
    Mint operator+(Mint x) { return Mint(v + x.v); };
    Mint operator-(Mint x) { return Mint(v - x.v); };
    Mint operator*(Mint x) { return Mint(v * x.v); };
    Mint operator/(Mint x) { return Mint(v * pow(x.v, MOD-2).v); };

    Mint& operator+=(Mint x) { return *this = (*this + x); };
    Mint& operator-=(Mint x) { return *this = (*this - x); };
    Mint& operator*=(Mint x) { return *this = (*this * x); };
    Mint& operator/=(Mint x) { return *this = (*this / x); };

    static Mint pow(Mint base, int64_t exp) {
        if(exp == 0)  return Mint(1);
        return pow(base*base, exp/2) * (exp&1 ? base : Mint(1));
    }

    friend ostream& operator<<(ostream& os, Mint x) { return os << x.v; }
};
using mint = Mint<1000000007>;

template<class T> struct Counting {
    Counting(int64_t n) {
        _fact.assign(n+1, 1);
        for(int64_t i = 1; i <= n; i++)  _fact[i] = T(i) * _fact[i-1];
    }

    T fact(int64_t n) {
        assert(0 <= n && n < (int)_fact.size());
        return _fact[n];
    }

    T perm(int64_t n, int64_t k) {
        if(n < k)  return 0;
        return fact(n) / fact(n-k);
    }

    T comb(int64_t n, int64_t k) {
        if(n < k)  return 0;
        return fact(n) / (fact(k) * fact(n-k));
    }

    private:
        vector<T> _fact;
};

int main() {
    lint n, k;
    cin >> n >> k;
    
    Counting<mint> cnt(1e6);

    mint ans = 1;
    for(lint i=1; i<min(k+1, n); i++) {
        ans += cnt.comb(n, i) * cnt.comb(n-1, i);
    }

    cout << ans << endl;
}

Measured memory_bytes: 8064
#include <iostream>

#include <map>
#include <string>

#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cinttypes>


using namespace std;

int main()
{
	int array[] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
	int k;
	cin >> k;

	cout << array[k-1] << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        String s = sc.next();
        String t = sc.next();
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        String u = sc.next();
        if(u.equals(s)) {
            --a;
        } else {
            --b;
        }
        System.out.printf("%d %d", a, b);
    }
}

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

typedef int_fast32_t int32;
typedef int_fast64_t int64;

const int32 inf = 1e9+7;
const int32 MOD = 1000000007;
const int64 llinf = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define all(obj) (obj).begin(),(obj).end()
#define rall(obj) (obj).rbegin(),(obj).rend()
#define fi first
#define se second
#define pb(a) push_back(a)
typedef pair<int32,int32> pii;
typedef pair<int64,int64> pll;

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) { a = b; return true; } return false;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) { a = b; return true; } return false;
}

typedef pair<string,string> P;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n;
  string s;
  cin >> n >> s;
  map<P,int64> cnt;
  for(int32 mask = 0; mask < (1<<n); ++mask){
    string a,b;
    REP(i,n){
      if(mask>>i&1){
        a.pb(s[i]);
      }else{
        b.pb(s[i]);
      }
    }
    cnt[P(a,b)]++;
  }
  int64 ans= 0;
  for(int32 mask = 0; mask < (1<<n); ++mask){
    string a,b;
    REP(i,n){
      if(mask>>i&1){
        a.pb(s[2*n-1-i]);
      }else{
        b.pb(s[2*n-1-i]);
      }
    }
    ans += cnt[P(a,b)];
  }
  ANS(ans);
  return 0;
}

Measured memory_bytes: 91904
#include <bits/stdc++.h>
using namespace std;
string t,s;
vector<int> v;
long long ans;
int main(){
	cin>>t;
	int cnt=count(t.begin(),t.end(),'1');
	for(int i=0;i<=cnt;++i){
		ans+=(i+1)/2;
	}
	for(int i=0;i<t.size();++i){
		s+=t[i];
		int sz=s.size();
		if(sz>=2&&s[sz-1]=='1'&&s[sz-2]=='1'){
			s.pop_back();
			s.pop_back();
			ans+=t.size()-cnt;
		}
	}
	t=s;
	cnt=count(t.begin(),t.end(),'1');
	int cnter=0;
	for(int i=0;i<t.size();++i){
		if(t[i]=='1'){
			ans+=t.size()-cnt-((i+1)/2-(cnter+1)/2);
			cnter++;
		}
	}
	cout<<ans<<'\n';
	return 0;
} 

Measured memory_bytes: 3880
from math import gcd
a,b,c,d=list(map(int,input().split()))
a-=1
def calculation(x,c,d):
	x=x-(x//c)-(x//d)+(x//((c*d)//gcd(c,d)))
	return x
	
print(calculation(b,c,d)-calculation(a,c,d))

Measured memory_bytes: 9160
N = int(input())

SP = {}

for n in range(N):
    s, p = input().split()
    p = int(p)
    if s not in SP:
        SP[s] = [(p, n+1)]
    else:
        SP[s].append((p, n+1))


K = sorted(SP)

for k in K:
    SP[k].sort(reverse=True)
    for t in SP[k]:
        print(t[1])


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
 int main(){
   
 long a, b, c;  
   
 cin >> a;
 cin >> b;
 cin >> c;
 
   if(c>a){
      if(b>(c-a))
      {cout<< 0 <<" "<< b-(c-a);
      }
     else{
   cout<< 0 <<" "<< 0;
   }
   }else{
   cout<< a-c <<" "<< b;
   }
 return 0;
 }


Measured memory_bytes: 256
arr = list(map(int,input().split()))
count_5 = 0
count_7 = 0 
for i in arr:
    if i == 5:
        count_5 += 1
    elif i == 7:
        count_7 += 1

if count_5 == 2 and count_7 == 1:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 2940
S = str(input())
if S[0] == S[1] and S[2] == S[3] and S[0] != S[2]:
    print("Yes")
elif S[0] == S[2] and S[1] == S[3] and S[0] != S[1]:
    print("Yes")
elif S[0] == S[3] and S[1] == S[2] and S[0] != S[1]:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = 99999999;
const ll linf = 999999999999999999;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
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; }

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////



int main(){
	int n;
	ull a[100005] = {};

	cin >> n;
	rep(i,0,n)cin >> a[i];
	rsort(a,a+n,ull);

    ull h = 0,w = 0;
	rep(i,0,n-1){
	    if(h == 0){
            if(a[i] == a[i+1]){
                h = a[i];
                i++;
            }
        }else if(w == 0){
            if(a[i] == a[i+1]){
                w = a[i];
                i++;

                P(w*h);
                return 0;
            }
        }
	}

	P(0);

	return  0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	int n;
	cin >> n;
	
	vector<int> a(n);
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	
	if( n == 2 ) {
		sort(a.begin(), a.end());
		cout << a[1] << " " << a[0] << endl;
		return 0;
	}
	
	int maxA = *max_element(a.begin(), a.end());
	int diff = 1 << 29;
	int ans = 0;
	
	for(int i = 0; i < n; ++i) {
		if( maxA == a[i] ) continue;
		
		if( abs(maxA / 2 - a[i]) < diff ) {
			diff = abs(maxA / 2 - a[i]);
			ans = a[i];
		}
	}
	
	cout << maxA << " " << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3712