akhauriyash/Code-Regression huggingface dataset:
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
#define ar array
#define inf 1000000000000000
#define mod 998244353
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n,q;
const int MAXN = 202020, K = 12;
int t[4*MAXN],lazy[4*MAXN],p10[K][2*MAXN];

void push(int v, int tl, int tm, int tr){
  if(lazy[v]!=inf){
    t[v*2] = p10[lazy[v]][tm - tl + 1] * p10[0][n - tm] % mod;
    t[v*2+1] = p10[lazy[v]][tr - (tm + 1) + 1] * p10[0][n - tr] % mod;
    lazy[v*2+1] = lazy[v];
    lazy[v*2] = lazy[v];    
    lazy[v] = inf;    
  }
}

void build(int v, int tl, int tr){
  if(tl==tr){
    t[v] = p10[0][n-tl];
  }
  else {
    int tm = (tl+tr)/2;
    build(v*2, tl, tm);
    build(v*2+1, tm+1, tr);
    t[v] = (t[v*2] + t[v*2+1]) % mod;   
  }
}

void update(int v, int tl, int tr, int l, int r, int x) {
  if (l > r) 
    return;
  if (l == tl && tr == r) {
    t[v] = p10[x][r - l + 1] * p10[0][n - r] % mod;
    lazy[v] = x;
  } else {
    int tm = (tl + tr) / 2;
    push(v, tl, tm, tr);
    update(v*2, tl, tm, l, min(r, tm), x);
    update(v*2+1, tm+1, tr, max(l, tm+1), r, x);
    t[v] = (t[v*2] + t[v*2+1]) % mod;
  }
}

int query(int v, int tl, int tr, int l, int r) {
  if (l > r)
    return 0;   
  if (l <= tl && tr <= r)
    return t[v];
  int tm = (tl + tr) / 2;
  push(v, tl, tm, tr);
  return ((query(v*2, tl, tm, l, min(r, tm)) + query(v*2+1, tm+1, tr, max(l, tm+1), r)) % mod);
}

void pre(){
  for(int i=0;i<4*MAXN;i++){
    t[i]=0;
    lazy[i]=inf;
  }
  p10[0][0]=1;
  for(int i=1;i<=n;i++){
    p10[0][i] = (p10[0][i-1]*10LL)%mod;
  }
  for(int i=1;i<=9;i++){
    p10[i][0]=0;
    for(int j=1;j<=n;j++){
      p10[i][j] = ( p10[i][j-1]*10LL + i);
      p10[i][j]%=mod;
    }
  }
}

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  cin >> n >> q;
  pre();
  build(1,1,n);
  // cout << t[1] << endl;
  for(int i=1;i<=q;i++){
    int l,r,v;
    cin >> l >> r >> v;
    update(1,1,n,l,r,v);
    cout << t[1] << endl;
  }


return 0;
}
///....


Measured memory_bytes: 31900
import numpy as np
X1,Y1,X2,Y2 = (int(T) for T in input().split())
MoveV  = np.array([X2-X1,Y2-Y1]).T
Rotate = np.array([[0,-1],[1,0]])

MoveV = np.dot(Rotate,MoveV)
X3,Y3 = X2+MoveV[0],Y2+MoveV[1]

MoveV = np.dot(Rotate,MoveV)
X4,Y4 = X3+MoveV[0],Y3+MoveV[1]

print('{} {} {} {}'.format(X3,Y3,X4,Y4))

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

int main() {

	int ires = 10000;
	string sres = "TLE";

	int N, T;
	int c[10000], t[10000];
	cin >> N >> T;

	for (int i = 1; i <= N; i++) cin >> c[i] >> t[i]; //代入はok
	for (int j = 1; j <= N; j++) { if (t[j] <= T && c[j] < ires) ires = c[j]; }

	if (ires == 10000) cout << sres << endl; else cout << ires << endl;

}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
#define int long long
#define all(arr) arr.begin(),arr.end()
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define vi vector<int>
#define vstr vector<string>
#define vbool vector<bool>
#define vvi vector<vector<int> >
#define mii map<int,int>
#define pb push_back
#define pii pair<int,int>
#define vpair vector<pii > 
#define mkp make_pair
#define scan(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) {cout<<a[i]<<' ';}cout<<'\n'
#define mem(a,v) memset(a,v,sizeof(a))
#define loop(i,a,b) for (int i = a; i < b; i++)
#define loope(i,a,b) for (int i = a; i <= b; i++)
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PRECISION std::cout.unsetf ( std::ios::fixed );std::cout.precision(9)
#define PI 3.14159265
#define S second
#define F first
#define CHECK cout<<"CHEDEDWB"<<endl
#define br '\n'
/*int mod = 1e9+7;
int inf = 1e18;
int m_inf = INT_MIN;
int MOD = 100001;*/

void solve()
{
	string s,t;
	cin>>s>>t;
	int ans = 0;
	loop(i,0,3)
	{
		if(s[i]==t[i])
			ans++;
	}
	cout<<ans<<endl;
}

int32_t main()
{
	FastIO; PRECISION;
	int t = 1;
	//cin>>t;
	while(t--)
		solve();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FASTIO cin.tie(NULL); ios_base::sync_with_stdio(false);
#define ll long long int
#define ii pair<int,int>
#define endl '\n'
using namespace std;
ll MAX = 1e15+1;
ll a[100] = {0,};
void solve()
{
    int cnt;
    for(int i=1; ; i++)
    {
        a[i] = a[i-1]*26 + 26;
        if(a[i]>MAX)
            break;
        cnt = i;
    }
    int cur;
    ll n;
    cin >> n;
    for(int i=0; i<=cnt; i++)
        if(a[i] < n && n <= a[i+1])
        {
            n -= a[i];
            cur = i+1;
            break;
        }
    n--;
    string s;
    while(cur--)
    {
        s.push_back('a'+(n)%26);
        n/=26;
    }
    reverse(s.begin(), s.end());
    cout << s << endl;
}
int main()
{
   FASTIO
/* 	int t;
	cin >> t;
	while (t--) */
        solve();
}

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

int main(){
    // N円の商品を買う。 K個の数が嫌い。
    int N, K;
    int temp;
    cin >> N >> K;
    int hateNumbers[10];
    int hateNumber;
    for(int i = 0; i < K; i++){
        cin >> hateNumber;
        // 嫌いな数の番号を１にする。
        hateNumbers[hateNumber] = 1;
    }
    bool can = false;

    while(!can){
        temp = N;
        while(temp != 0){
            if(hateNumbers[temp%10] == 1) {
                N++;
                break;
            } 
            temp /= 10;
        }
        if(!temp){
            break;
        }
    }
    cout << N << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a) for(int i = a; i >= 0; i--)
#define fori(i,m) for(auto i = m.begin(); i != m.end(); i++) 
#define sz(s) int(s.size())
#define cls(a,car) memset(a,car,sizeof (a))
using namespace std;
typedef long long ll;
const int N = 1 * 1e5 + 5;
const ll mod = 1e9 + 7;
const int INF = INT_MAX;
const ll INFCAD  = ll(INT_MAX) * 2 + 1;
int toInt(const string &s){
    if(s[0] == '-')
        return -(s[1] - '0');
    return (s[0] - '0');
}
int main(){/*
    freopen("in","r",stdin);
    freopen("out","w",stdout);*/
    ll x;
    cin >> x;
    ll ans = 1;
    fore(i,1,x + 1)
        ans = (ans % mod * i % mod) % mod;
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 256
#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}
}

use input::*;
use std::collections::VecDeque;

fn bfs(g: &Vec<Vec<usize>>, f: usize, t: usize) -> bool {
    let mut dq = VecDeque::new();
    let mut visit = vec![false; g.len()];

    for z in &g[f] {
        if *z == t {
            continue;
        }
        dq.push_back(z);
    }

    while dq.len() != 0 {
        let buf = *dq.pop_front().unwrap();
        visit[buf] = true;
        if buf == t {
            return true;
        }
        for z in &g[buf] {
            if !(visit[*z] || buf == f && *z == t || buf == t && *z == f) {
                dq.push_back(z);
            }
        }
    }
    return false;
}

fn main() {
    let (n, m): (usize, usize);
    input!(n, m);
    let mut g = vec![Vec::new(); n];
    let mut v = Vec::new();
    for _ in 0..m {
        let (a, b): (usize, usize);
        input!(a, b);
        v.push((a - 1, b - 1));
        g[a - 1].push(b - 1);
        g[b - 1].push(a - 1);
    }

    let mut ans = 0;
    for (a, b) in v {
        if !bfs(&g, a, b) {
            ans += 1;
        }
    }

    p(ans);
}

Measured memory_bytes: 4352
unittest
{
	assert( [ "KIHBR" ].parse.expand.solve == "YES" );
	assert( [ "AKIBAHARA" ].parse.expand.solve == "NO" );
	assert( [ "AAKIAHBAARA" ].parse.expand.solve == "NO" );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto s = input.front.to!( dchar[] );
	return tuple( s );
}

auto solve( dchar[] s )
{
	auto t = "AKIHABARA"d;
	while( !s.empty || !t.empty )
	{
		if( t.empty ) return "NO";
		if( s.empty )
		{
			if( t.front != 'A' ) return "NO";
			t.popFront;
		}
		else
		{
			if( s.front != t.front && t.front != 'A' ) return "NO";
			if( s.front == t.front ) s.popFront;
			t.popFront;
		}
	}
	return "YES";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#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++)
int main() {
  ll N;
  cin >> N;
  vector<ll> vec(2 * N);
  rep(i, N * 2) {
    cin >> vec.at(i);
  }
  sort(vec.begin(), vec.end());
  ll sum = 0;
  rep(i, N * 2) {
    sum += vec.at(i);
    i++;
  }
  cout << sum;
}


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

#define _GLIBCXX_DEBUG
#define all(v) (v).begin(),(v).end()

using ll=long long;
using ld=long double;
using pii=pair<int, int>;
using vi=vector<int>;
using vii=vector<vector<int>>;

const ll LINF=1LL<<60;
const int INF=1<<29;
const int MOD=1e9+7;
struct edge{int to, cost;};

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


int main(){
    int N; cin >> N;
    vi a(3*N);
    for(auto &x : a)cin >> x;

    vector<ll> dpl(N+1, 0), dpr(N+1, 0);
    priority_queue<int, vi, greater<int>> pquel;
    priority_queue<int, vi, less<int>> pquer;
    for(int i=0; i<N; i++){
        pquel.push(a[i]);
        pquer.push(a[3*N-i-1]);
        dpl[0]+=a[i];
        dpr[0]+=a[3*N-i-1];
    }
    for(int i=N; i<2*N; i++){
        if(pquel.top() < a[i]){
            dpl[i-N+1]=dpl[i-N]-pquel.top()+a[i];
            pquel.pop();
            pquel.push(a[i]);
        }
        else dpl[i-N+1]=dpl[i-N];
    }
    for(int i=2*N-1; i>N-1; i--){
        if(pquer.top() > a[i]){
            dpr[2*N-i]=dpr[2*N-i-1]-pquer.top()+a[i];
            pquer.pop();
            pquer.push(a[i]);
        }
        else dpr[2*N-i]=dpr[2*N-i-1];
    }
    ll ans=-LINF;
    for(int i=0; i<=N; i++){
        ll score=dpl[i]-dpr[N-i];
        chmax(ans, score);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 7060
// Charan Sriramula

#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long int ll;

const ll logx=30;
const ll N=1e6+1;
const ll M=2e5+5;
const ll mod=1e9+7;
const ll INF=1e18+5;

#define ints(n) scanf("%d",&n)
#define intp(n) printf("%d\n",n)
#define longs(n) scanf("%intd",&n)
#define longp(n) printf("%intd\n",n)

inline ll mul(ll a, ll b){ return (a * 1ll * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }

#define f first
#define s second
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define mp(x,y) make_pair(x,y)
#define GCD(a,b) __gcd((a),(b))
#define all(v) v.begin(),v.end()
#define bits(x) __builtin_popcount(x)
#define LCM(a,b) ((a)*(b))/GCD((a),(b))
#define ms(dp,val) memset(dp,val,sizeof(dp))
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
template<typename T> T power(T x,T y,ll m){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1ll;x=(x*x)%m;}return ans%m;}

#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

string s,t;
ll dp[3005][3005];

int main()
{
    cin>>s>>t;
    ll n=s.length();
    ll m=t.length();
    string ans="\0";
    cout<<endl;
    for(ll i=0;i<=n;i++)
    {
        for(ll j=0;j<=m;j++)
        {
            if(i==0||j==0)
            {
                dp[i][j]=0;
                continue;
            }
            if(s[i-1]==t[j-1]){dp[i][j]=1+dp[i-1][j-1];}
            else{dp[i][j]=max(dp[i][j-1],dp[i-1][j]);}
        }
    }
    /*cout<<dp[n][m]<<endl;
    cout<<endl;
    for(ll i=0;i<=n;i++)
    {
        for(ll j=0;j<=m;j++){cout<<dp[i][j]<<" ";}
        cout<<endl;
    }
    cout<<endl;*/
    ll i=n,j=m;
    while(1)
    {
        if(i<=0||j<=0){break;}
        if(s[i-1]==t[j-1]){ans+=s[i-1];i--;j--;continue;}
        if(dp[i-1][j]>dp[i][j-1]){i--;}
        else{j--;}
    }
    reverse(all(ans));
    cout<<ans<<endl;
}

Measured memory_bytes: 70784
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int M = scanner.nextInt();

    List<Card> list = new ArrayList<>();
    for (int i = 0; i < N; i++) {
      int a = scanner.nextInt();
      list.add(new Card(a, 1));
    }
    for (int i = 0; i < M; i++) {
      int a = scanner.nextInt();
      int b = scanner.nextInt();
      list.add(new Card(b, a));
    }
    list.sort((c1, c2) -> c2.number - c1.number);

    int remain = N;
    long sum = 0;
    for (Card c : list) {
      int r = Math.min(remain, c.count);
      sum += (long) c.number * r;
      remain -= r;
    }
    System.out.println(sum);
  }

  private static class Card {
    private final int number;
    private final int count;

    private Card(int number, int count) {
      this.number = number;
      this.count = count;
    }
  }
}


Measured memory_bytes: 100260
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(N: int, K: int, A: "List[int]"):
    #while True:
    for _ in range(K):
        inc = [0] * N
        dec = [0] * N
        for i in range(N):
            s = max(0, i - A[i])
            e = min(N - 1, i + A[i])
            inc[s] += 1
            dec[e] += 1
        nexts = []
        cur = 0
        found = False
        for i in range(N):
            cur += inc[i]
            if cur < N:
                found = True
            nexts.append(cur)
            cur -= dec[i]
        A = nexts
        if not found:
            break
    print(*A, sep=' ')
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, K, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 220152
#include <iostream>
using namespace std;
int main() {
  int snukes, snacks;
  cin>>snukes>>snacks;
  int candies[snukes];
  for(int i = 0; i < snukes; i++)
    candies[i] = 0;
  
  int di, adi;
  for(int i = 0; i < snacks; i++) {
    cin>>di;
    for(int j = 0; j < di; j++) {
      cin>>adi;
      candies[adi -1]++;
    }
  }
  
  int poor_snukes = 0;
  for(int i = 0; i < snukes; i++)
    if(candies[i] == 0)
      poor_snukes++;
  cout<<poor_snukes<<"\n";
  return 0;
}

Measured memory_bytes: 3568
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
#include <iomanip>

using namespace std;
#define int long long

signed main(){
    string S;
    cin >> S;
    
    int size = S.length();
    sort(S.begin(),S.end());
    S.erase(unique(S.begin(),S.end()),S.end());
    
    if(size==S.length()){
        cout << "yes" << endl;
    }else{
        cout << "no" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
#define inf 0x3f3f3f3f
const ll N = 200030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    1e9+7;
ll n;
vector<pair<ll,ll> > arr;
int main()
{ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin>>n;
rep(i,1,n+1)
{
	ll x,y;
	cin>>x>>y;
	arr.push_back({x,y});
}
sort(arr.begin(),arr.end());
ll ans=0;
ll mn=-1e15;
for(int i=0;i<n;i++)
{
	if(mn<=arr[i].fi-arr[i].se)
	{
		ans++;
		mn=arr[i].fi+arr[i].se;
	}
	else
	{
		if(arr[i].fi+arr[i].se<mn)
		mn=arr[i].fi+arr[i].se;
	}
}
cout<<ans;

}


Measured memory_bytes: 2420
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>

using namespace std;

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

    int diffct = 0;
    for(int i = 1; i <= n; i++){
        int tmp;
        cin >>tmp;
        if(tmp != i){
            diffct++;
        }
    }
    if(diffct <= 2){
        printf("YES\n");
    }else{
        printf("NO\n");
    }

    return 0;
}

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

int main() {
 int A, B;
 cin >> A >> B;
 if (A < 10 && B < 10)
 {
   cout << A*B << endl;
 }
   else
   {
     cout << -1 << endl;
   }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
#define F first
#define S second
#define mod 1000000007
#define pb push_back
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int NUM = 2e5 + 5;

int main(){
    ios
    int num_tests=1; 
    //cin>>num_tests;
    while(num_tests-->0){
        int n; cin>>n;
        map<string,int> ma;
        ll ans=0;
        while(n--){
            string x; cin>>x;
            sort(x.begin(),x.end());
            ans+=ma[x];
            ma[x]++;
        }
        cout<<ans;
    }
}


Measured memory_bytes: 11264
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
const double pie = 3.14159265358979;

int main(){
    int n, p, cnt = 0;
    cin >> n;
    vector<int> P(n), M(n);  
    for(int i = 0; i < n; i++){
        cin >> p;
        P[i] = p;
        if(!i) M[i] = p;
        else M[i] = min(M[i-1], p); 
    }
    for(int i = 0; i < n; i++){
        if(M[i] == P[i]) cnt++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 1792
import bisect
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort()
B.sort()
C.sort()

count=0
for i in range (N):
    count_A=bisect.bisect_left(A,B[i])
    count_B=len(C)-bisect.bisect_right(C,B[i])
    count+=count_A*count_B
print(count)

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

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

int main() {
	int T;
	cin >> T;
	int64_t A, B, C, D;
	for (int i = 0;i < T;i ++) {
		cin >> A >> B >> C >> D;
		
		int64_t G = gcd(B, D); // これでA+Gxの形の数式であることが分かる
		int64_t H = (A % B + G - (C % G)) % G;
		if (H == 0) H += G;
		if (A < B || D < B || H + C < B) cout << "No" << endl;
		else cout << "Yes" << endl;
	}
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり

まず、B>Dなら答えはfalse、以下B≦Dとする
また、初期の本数はAの代わりにE=A%Bを、在庫の追加数はDの代わりにF=D%Bを用いるものとする
そうすると、mod B上で考えることができるな

さて、この時において永遠に買えない時とは？
これは、現在の本数+F=現在の本数+F mod Bの時
一度でも現在の本数がB-F未満になるとアウトと言える

*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
    string s;
    cin >> s;
    vector<string> e={"", "A"};
    for (auto a:e){
        for (auto b:e){ 
            for (auto c:e){ 
                for (auto d:e)  {
                    if (s == a + "KIH" + b + "B" + c + "R" + d) {
                    cout << "YES" <<endl;
                    return 0;
                    } 
                }
            }
        }
    }
    cout << "NO" <<endl;
    return 0;
}

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

void fnInput(int& rnWide, int& rnHigh, int& rnx, int& rny)
{
  cin >> rnWide >> rnHigh >> rnx >> rny;
}

void fnRectCutArea(int nWide, int nHigh, int nx, int ny)
{
  llong nRectArea = (llong)nWide * nHigh;
  ldouble nRectCutArea = nRectArea / 2.0;
  cout << nRectCutArea << " ";

  double nCenterx = nWide / 2.0;
  double nCentery = nHigh / 2.0;
  if (nCenterx == nx && nCentery == ny)
    cout << "1" << endl;
  else
    cout << "0" << endl;
}
  
int main()
{
  int nWide, nHigh, nx, ny;

  fnInput(nWide, nHigh, nx, ny);
  fnRectCutArea(nWide, nHigh, nx, ny);

  return 0;
}

Measured memory_bytes: 3756
/*
 *       ~ AtCoder  Botay ~
 *        code by kazalika
 */

#include <bits/stdc++.h>

using namespace std;



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

  int a, b, c, k;
  cin >> a >> b >> c >> k;
  if (k <= a + b)
    cout << min(a, k);
  else
    cout << a - (k - (a + b));

}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=210;
ll dist[N][N];
int order[N];
int n,m,r;ll ans=1e18;
int cost[N][N];
int main()
{
	for(int i=0;i<N;i++)for(int j=0;j<N;j++)dist[i][j]=1e12;
	cin>>n>>m>>r;
	for(int i=0;i<r;i++)cin>>order[i];
	for(int i=0;i<m;i++)
	{
		int a,b,c;
		cin>>a>>b>>c;
		dist[b][a]=dist[a][b]=min(dist[a][b],(ll)c);
	}
	for(int k=1;k<=n;k++)
		for(int i=1;i<=n;i++)
			for(int j=1;j<=n;j++)
				dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
	sort(order,order+r);
	do
	{
		ll sum=0;
		for(int i=1;i<r;i++)sum+=dist[order[i-1]][order[i]];
//		cout<<sum<<endl;
		ans=min(sum,ans);
	}while(next_permutation(order,order+r));
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <tuple>
#include <math.h>
#include <stdlib.h>
#include <algorithm>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

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; }

//INT_MAX	2,147,483,647 = 2*1.0e9

int main(){

  int N;
  cin >> N;

  vector<tuple<string, int, int>> book(N);
  for(int i = 0; i < N; i++){
    string s;
    int r;
    cin >> s >> r;
    book[i] = make_tuple(s, 100-r, i+1);  
  }

  sort(book.begin(), book.end());

  for(int i = 0; i < N; i++){
    cout << get<2>( book[i] ) << endl;
  }
  
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int to_int(char c) {
  return c - 48;
}
int main() {
  int n,a,b;
  cin >> n >> a >> b;
  int Sum = 0;
  for(int i = 1;i <= n;i++) {
    int sum = 0;
    string s = to_string(i);
    for(int j = 0;j < s.size();j++) {
      sum += to_int(s.at(j));
    }
    if(a <= sum && sum <= b) {
      Sum += i;
    }
  }
  cout << Sum << endl;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]

mod = 10**9 + 7
dp = [0 for i in range(N+1)]
dp[0] = 1

isbroken = [1 for _ in range(N+1)]

for i in range(M):
    isbroken[A[i]] = 0

for i in range(N):
    if i-1 >= 0:
        dp[i+1] = dp[i] * isbroken[i] + dp[i-1] * isbroken[i-1]
    else:
        dp[i+1] = dp[i] * isbroken[i]
    
    dp[i+1] %= mod
    
print(dp[N])

Measured memory_bytes: 9592
N = int(input())
 
from itertools import combinations
 
def get_sieve_of_eratosthenes(n):
    prime = [2]
    limit = int(n**0.5)
    data = [i + 1 for i in range(2, n, 2)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]

primes = get_sieve_of_eratosthenes(55555)

lst = []
for p in primes:
    if p%5==1:
        lst.append(p)

for i in range(N):
    print(lst[i], end=' ')

Measured memory_bytes: 4340
A,B,m=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
l=[]
for i in range(m):
  x,y,c=map(int,input().split())
  l.append(a[x-1]+b[y-1]-c)
l.append(min(a)+min(b))
print(min(l))

Measured memory_bytes: 18736
package main

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

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

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

func solve(hs []int, N int) int {
	dp := make([]int, N+1)
	for i:=2; i<=N; i++ {
		dp[i] = math.MaxInt32
		for l:=1; l<=2; l++ {
			if i-l <= 0 {
				// 无效石头
				continue
			}
			dp[i] = min(dp[i], dp[i-l]+abs(hs[i-1]-hs[i-l-1]))
		}
	}
	return dp[N]
}

func readLineNum(bf *bufio.Reader) int {
	line, _ := bf.ReadString('\n')
	line = strings.Trim(line, "\n")
	N, _ := strconv.Atoi(line)
	return N
}

func readLineNums(bf *bufio.Reader) []int {
	line, _ := bf.ReadString('\n')
	line = strings.Trim(line, "\n")
	fields := strings.Split(line, " ")
	nums := []int{}
	for _, field := range fields {
		num, _ := strconv.Atoi(field)
		nums = append(nums, num)
	}
	return nums
}

func main() {
	bf := bufio.NewReader(os.Stdin)
	N := readLineNum(bf)
	hs := readLineNums(bf)
	fmt.Println(solve(hs, N))
}


Measured memory_bytes: 8192
#include<stdio.h>
int main(void)
{
	int n[1000],z,w;
	w=0;
	while(scanf("%d",&z)!=EOF){
		w++;
		if(z!=0){
			n[w]=z;
		}
		else if(z==0){
			printf("%d\n",n[w-1]);
			w-=2;
		}
	}
	return 0;
}

Measured memory_bytes: 1032
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=1000000007;
const LL LINF=1LL<<62;
const LL INF=1<<17;


int main(){
    int n,t;cin >> n >> t;
    vector<LL> h(n);
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }
    vector<vector<LL>> dp(2,vector<LL> (n,0));
    dp[0][0]=h[0];
    dp[1][0]=2*h[0];
    for (int i = 1; i < n; i++) {
        dp[0][i]=dp[0][i-1]+h[i];
    }
    for (int i = 1; i < n; i++) {
        dp[1][i]=max(dp[1][i-1],dp[0][i])+h[i];
    }
    for (int i = 0; i < n; i++) {
        LL ans=(t-dp[0][i])/(dp[1][i]-dp[0][i])+2;
        if(dp[0][i]>t) ans=1;
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 6072
X = int(input())

def twari(x):
    if x == 2 or x == 3:
        is_p = 1
    else:
        rootx = x**(1/2)
        marootx = int(x // rootx)
    #     print(rootx,marootx)

        prime_list = [x for x in range(3,marootx+1,2) if x % 3 != 0]
        prime_list = [2,3] + prime_list

        is_p = 1

        for p in prime_list:
    #         print(p)
            if x % p == 0:
                is_p = 0
                break
    return(is_p)
    
count = 0
isp = 0
while isp == 0:
    isp = twari(X)
    if isp == 1:
        break
    else:
        X += 1

print(X) 

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#ifdef DEBUG
  #include "debug.hpp"
#else
  #define DUMP(var)
#endif

using namespace std;
template< class T1, class T2 > inline istream &
operator>>( istream & fin, pair< T1, T2 > & pr )
{ fin >> pr.first >> pr.second; return fin; }
template< class T0, class T1, class T2 > inline istream &
operator>>( istream & fin, tuple< T0, T1, T2 > & t )
{ fin >> get<0>(t) >> get<1>(t) >> get<2>(t); return fin; }
template< class T > inline istream &
operator>>( istream & fin, vector< T > & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class T, size_t n> inline istream &
operator>>( istream & fin, array<T, n> & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class FwdIter> inline auto
dump(FwdIter first, FwdIter last, const char * dlm = " ") -> void {
using value_type = typename iterator_traits<FwdIter>::value_type;
copy(first, last, ostream_iterator<value_type>(cout, dlm)); }
template<typename T> vector<T> & operator--(vector<T> & a)
{ for(auto & i: a) --i; return a; }
/* @@@ ----------------------------------- */



int main(const int /*argc*/, char ** /*argv*/) {
  ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

  string str;
  cin >> str;
  vector<map<string, size_t>> out(str.size());
  for (size_t i = 0; i < str.size(); ++i) {
    {
      const string tok = string(1, str[i]);
      size_t val = 1;
      if (i > 0) {
        for (const auto & pr: out[i - 1]) {
          if (pr.first != tok) {
            val = max(val, 1 + pr.second);
          }
        }
      }
      out[i].emplace(tok, val);
    }
    if (i > 0) {
      const string tok = str.substr(i - 1, 2);
      size_t val = 1;
      if (i > 1) {
        for (const auto & pr: out[i - 2]) {
          if (pr.first != tok) {
            val = max(val, 1 + pr.second);
          }
        }
      }
      out[i].emplace(tok, val);
    }
  }

  size_t val = 0;
  for (const auto & pr: out.back()) {
    val = max(val, pr.second);
  }
  cout << val;

  return EXIT_SUCCESS;
}


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

int main() {
  char c;
  cin >> c;

  // ここにプログラムを追記
  if ( c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o' ) cout << "vowel" << endl;
  else cout << "consonant" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<unordered_map>
#include<unordered_set>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592
#define PI acos(-1.0);

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    int k; cin >> k;
    vector<int> v = {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};
    cout << v[k-1] << endl;
}



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

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> v(n), u(n);
  vector<int> k(n);
  for (int i = 0; i < n - 1 + m; i++) {
    int a, b;
    cin >> a >> b;
    v[a - 1].push_back(b - 1);
    u[b - 1].push_back(a - 1);
    k[b - 1]++;
  }

  vector<int> r(n), d(n), l, s;
  for (int i = 0; i < n; i++) {
    if (k[i] == 0) s.push_back(i);
  }
  while (!s.empty()) {
    int i = s.back();
    s.pop_back();
    l.push_back(i);
    for (auto e : v[i]) {
      k[e]--;
      if (k[e] == 0) {
        s.push_back(e);
      }
    }
  }

  for (int i = 1; i < l.size(); i++) {
    int x = l[i];
    int y = u[x].front();
    for (auto e : u[x]) {
      if (d[e] > d[y]) {
        y = e;
      }
    }
    d[x] = d[y] + 1;
    r[x] = y + 1;
  }
  for (auto e : r) {
    cout << e << endl;
  }
}


Measured memory_bytes: 13436
#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <iomanip>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;


#define rep(i,n) for (int i=0; i<(n); i++)
const int INF =2*1e5+5;
const ll BIG = 1e9+7;
const double PI = 3.141592653589793;


int main(){
    int n;
    cin >> n;
    map<int,int> A;
    vector<int> av(n);
    rep(i,n) cin >> av[i];
    rep(i,n) A[av[i]]++;
    int q; 
    cin >> q;
    ll ans = 0;
    for(auto a: A){
        ans += a.first*a.second;
    }
    rep(i,q) {
        int b,c;
        cin >> b >> c;
        if(A.count(b)) {
            ans = ans + ((c-b)*A[b]);
            A[c] += A[b];
            A[b] = 0;
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 7352
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var NKC = Console.ReadLine().Split(' ').Select(s=>int.Parse(s)).ToArray();
            var N = NKC[0];
            var K = NKC[1];
            var C = NKC[2];
            var S = Console.ReadLine().Select(c=>c== 'o').ToArray();
            var ansT = new List<int[]>();
            for (var i = 0; i < N; i++)
            {
                ansT.Add(new int[] { int.MinValue, int.MaxValue });
            }
            var cnt = 1;
            for (var i = 0; i < N; i++)
            {
                if (S[i])
                {
                    ansT[i][0] = cnt;
                    cnt++;
                    i += C;
                }
            }
            cnt = K;
            for (var i = N-1; 0<=i ; i--)
            {
                if (S[i])
                {
                    ansT[i][1] = cnt;
                    cnt--;
                    i -= C;
                }
            }
            for(var i=0;i<N;i++)
            {
                if (ansT[i][0] == ansT[i][1]) Console.WriteLine(i + 1);
            }

        }

    }
}

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

using namespace std;
using ll = long long;

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    int nax = 1000;
    for(int i = 2; i < n; i++){
        string tmp = s.substr(i - 2, 3);
        int cur = stoi(tmp);
        nax = min(nax, abs(753 - cur));
    }
    cout << nax << endl;

}

Measured memory_bytes: 256
from collections import defaultdict

n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]

d = defaultdict(int)
for k in s:
    d[k] += 1
for k in t:
    d[k] -= 1

maxv = sorted(d.values(), reverse=True)[0]
if maxv > 0:
    print(maxv)
else:
    print(0)


Measured memory_bytes: 3316
#include <iostream>
using namespace std;
int main() {
    // cout<<"Hello World!";
    string s;
    string t;
    cin>>s>>t;
    int m=s.size();
    int n=t.size();
    
    int dp[m+1][n+1];
    for(int i=0;i<=m;i++){
        for(int j=0;j<=n;j++){
            dp[i][j]=0;
        }
    }
    for(int i=0;i<=m;i++){
        for(int j=0;j<=n;j++){
            if(i==0||j==0){
                dp[i][j]=0;
            }
            else if(s[i-1]==t[j-1]){
                dp[i][j]=dp[i-1][j-1]+1;
            }
            else{
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    int idx=dp[m][n];
    char lcs[idx+1];
    lcs[idx]='\0';
    int i=m;
    int j=n;
    while(i>0&&j>0){
        if(s[i-1]==t[j-1]){
            lcs[idx-1]=s[i-1];
            i--;
            j--;
            idx--;
        }
        else if(dp[i-1][j]>dp[i][j-1]){
            i--;

        }
        else{
            j--;
        }
    }
    
    cout<<lcs;
}


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

 
int main() {
   int a,b,c;
   cin>>a>>b>>c;
   cout<<max(0,c-a+b)<<endl;
}

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

int main(int argc, const char * argv[]) {
    // insert code here...
    int A, B, C;
    cin >> A >> B >> C;
    int five = 0, seven = 0;
    
    if (A == 5) five++;
    if (A == 7) seven++;
    if (B == 5) five++;
    if (B == 7) seven++;
    if (C == 5) five++;
    if (C == 7) seven++;
    
    if (five == 2 && seven == 1) cout << "YES" << endl;
    else cout << "NO" << endl;
    
    return 0;
}


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

int main(int argc, char const *argv[]) {
  int val[3];
  for (int i = 0; i < 3; i++) {
    scanf(" %d", &val[i]);
  }
  std::sort(val, val+3);
  int min = val[0] + val[1];
  printf("%d\n",min );
  return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace Tasks
{
    public class D
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var N = int.Parse(Console.ReadLine());
            var C = Console.ReadLine().ToCharArray();
            var R = C.Count(x => x == 'R');

            var answer = C.Take(R).Count(x => x == 'W');
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 29412
from scipy.misc import comb

n, k = map(int, input().split())
mod = 10**9+7

for i in range(1, k + 1):
    a = comb(k-1, i-1, exact=True) % mod
    b = comb(n - k + 1, i, exact=True) % mod
    print((a*b)%mod)

Measured memory_bytes: 15268
// “Incredible change happens in your life when you decide to take control of what
// you do have power over instead of craving control over what you don't.

// Dear online judge:
//  I've read the problem, and tried to solve it.
//  Even if you don't accept my solution, you should respect my effort.
//  I hope my code compiles and gets accepted.

#include <bits/stdc++.h>
typedef long long ll;
#define forn(i, start, end) for (ll i = start; i < ll(end); i++)
#define input(arr, n) forn(i, 0, n) cin >> arr[i];
#define input2d(arr, n, m) forn(i, 0, n) forn(j, 0, m) cin >> arr[i][j];
#define MOD 1000000007
#define pb push_back
#define ppb pop_back
#define mk make_pair
#define f first
#define s second
#define all(x) (x).begin(),(x).end()
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
#define tc    \
    ll T;     \
    cin >> T; \
    while (T--)
using namespace std;

char utl(char ch){
    ch |= ' ';
    return ch;
}

char ltu(char ch){
    ch &= '_';
    return ch;
}

bool isPrime(ll n) 
{ 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
    for (ll i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
    return true; 
} 

bool isPal(string str){
     string s=str;
     reverse(str.begin(),str.end());
     if(s==str)return true;
     return false;	
}

void printDivisors(ll n) 
{ 
    for (ll i=1; i*i<=n; i++) 
    { 
        if (n%i == 0) 
        { 
            if (n/i == i) 
                cout<<i; 
  
            else 
                cout<< i<<" "<<n/i<<" "; 
        } 
    } 
}

ll gcd(ll a, ll b){
    return __gcd(a,b);
}

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

ll power(ll base,ll exponent){
    ll ans=1;
    while(exponent){
        ans *= base;
        exponent--;
    }
    return ans;
}

void solve(){
    ll n,m;
    cin>>n>>m;
    cout<<n*m<<'\n';
    
}

int32_t main()
{
    FAST;
    //tc
    {
        solve();        
    }
    return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <iomanip>
#include<vector>
#include <algorithm>
#include <queue>
#include<string>
#include <map>
#include <cmath>
typedef long long ll;
typedef long double ld;

#define REP(i,s,n)for(ll i=s;i<(n);++i)
#define rep(i,n) REP(i,0,n)
using namespace std;


int main() {
	int N;
	cin >> N;
	vector<ll>S(N);
	rep(i, N) {
		cin >> S[i];
	}
	int Q;
	cin >> Q;
	ll ans = 0;
	rep(i, Q) {
		ll t;
		cin >> t;
		rep(j,N) {
			if (t==S[j]) {
				ans++;
				break;
			}
		}
	}
	cout << ans << endl;
	return 0;
}





Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n, ans=0;
	cin>>n;
	char ch;
	vector<int> r, w;
	for(int i=0;i<n;i++){
		cin>>ch;
		if(ch=='W')
			w.push_back(i);
		else r.push_back(i);
	}
	reverse(w.begin(),w.end());
	while(w.size() && r.size()){
		if(w.back()<r.back())
			ans++;
		w.pop_back();
		r.pop_back();
	}
	cout<<ans;
}


Measured memory_bytes: 4536
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <assert.h>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,a) for(ll i=ll(a-1);i>=0;--i)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}

const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll EPS = 1e-10;
int sgn(const double a){
    return (a < -EPS ? -1 : (a > EPS ? +1 : 0));
}
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> tri;
typedef pair<double,double> point;
typedef complex<double> Point;
const ll MAX = 201;
constexpr ll nx[4] = {-1,0,1,0};
constexpr ll ny[4] = {0,1,0,-1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll d,t,s;
    cin >> d >> t >> s;
    Yes(d <= t*s);
}



Measured memory_bytes: 3688
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> Pi;
typedef long long ll;
#define pii Pi
#define pll PL
#define Fi first
#define Se second
#define pb(x) push_back(x)
//#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> pll;
typedef long double ldouble;
typedef pair<double, double> pdd;

const double PI = acos(-1);
const double EPS = 1e-9;

const int MX = 1<<20;
const int MM = 1000000007;

int gcd(int x, int y){
	return x ? gcd(y%x, x) : y;
}

int N, K;

int main()
{
	scanf("%d%d", &N, &K);
	int g = 0, a, mx = 0;
	for(int i = 1; i <= N; i++){
		scanf("%d", &a);
		g = gcd(g, a);
		mx = max(mx, a);
	}
	if( K%g == 0 && K <= mx) printf("POSSIBLE\n");
	else printf("IMPOSSIBLE\n");
}


Measured memory_bytes: 256
// class point	の練習（クラスの高度な実装）
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>


typedef long long llong;
using namespace std;
#define MAX 100010

int fb(int n) {
	if (n < 0)return 0;
	if (n == 0 || n == 1)return 1;
	if (n > 1)return fb(n - 1) + fb(n - 2);
}
int main() {
	int H, W, K;

	cin >> H >> W >> K;

	llong ans[10] = { 0 };
	llong cpy[10] = { 0 };

	ans[1] = 1; 


	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			if (j == 1) {
					cpy[j] = ans[1] * fb(W - 1) + ans[2] * fb(W - 2);
			}
			else {
				cpy[j] = ans[j] * fb(j - 1)*fb(W - j) + ans[j - 1] * fb(j - 2)*fb(W - j) + ans[j + 1] * fb(j - 1)*fb(W - j - 1);
			}
		}
		for (int j = 1; j <= W; j++) {
			ans[j] = cpy[j] % 1000000007;
		}
		
	}

	cout << ans[K] << endl;

	

	return 0;
}
 

Measured memory_bytes: 256