akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

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

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

ll dp[3010][3010];
void solve(std::string s, std::string t)
{
    int n = s.size();
    int m = t.size();
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {
            if (s[i - 1] == t[j - 1])
            {
                dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + 1);
            }
            else
            {
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
            }
        }
    }

    string ans = "";

    while (n > 0 && m > 0)
    {
        if (dp[n][m] == dp[n - 1][m])
        {
            n--;
        }
        else if (dp[n][m] == dp[n][m - 1])
        {
            m--;
        }
        else
        {
            n--;
            m--;
            ans.push_back(s[n]);
        }
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
}

int main()
{
    std::string s;
    std::cin >> s;
    std::string t;
    std::cin >> t;
    solve(s, t);
    return 0;
}


Measured memory_bytes: 70784
import sys
sys.setrecursionlimit(1000000)

N=int(input())
a=list(map(int,input().split()))

b=[i for i in range(1,N+1)]

A=[]
for i in range(N):
    A.append([a[i],b[i]])
A.sort(reverse=True)
#print(A)
PL=[i for i in range(N+1)]+[N+1]
PR=[i for i in range(N+1)]+[N+1]

def findL(x):
    if x==PL[x]:
        return x
    else:
        return findL(PL[x])
        
def findR(x):
    if x==PR[x]:
        return x
    else:
        return findR(PR[x])
#print(PR)
ans=0
for i in range(N):
    ans+=A[i][0]*(A[i][1]-findL(A[i][1]-1))*(findR(A[i][1]+1)-A[i][1])
    #print(ans,A[i][1],(A[i][1]-findL(A[i][1])+1),findR(A[i][1])-A[i][1]+1)
    #print(PR)
    PL[A[i][1]]=findL(A[i][1]-1)
    PR[A[i][1]]=findR(A[i][1]+1)
print(ans)

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

#define cnd(c, a, b) (c ? a : b);
#define fl(x,y,z) for(int x=y;x<z;x++)
#define fe(x,y,z) for(int x=y;x<=z;x++)
#define fge(x,y,z) for(int x=y;x>=z;x--)

#define debug(x) std::cerr << #x << " --> " << x << "\n";
#define fastIO std::ios_base::sync_with_stdio(false);std::cin.tie(0);std::cout.tie(0);
#define pb push_back
#define pob pop_back
 
#define ln '\n'
typedef long long int ll;

ll mod=1e9+7;

ll a[2001];

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

ll mod_div(ll a, ll b) {
	ll ans = ((a%mod)*(mod_pow(b,mod-2)%mod))%mod;
	return (ans+mod)%mod;
}

ll ncr(ll n, ll r) {
	ll den = ((a[n-r]%mod)*(a[r]%mod))%mod;
	ll num = a[n]%mod;
	ll ans = mod_div(num, den);
	return (ans+mod)%mod;
}

void decrypt() {
	ll s, ans;
	cin>>s;
	ll mxlen = s/3;
	ans = 0;
	if(s<3) {
		cout<<"0\n";
		return;
	}
	ans = 1;
	fe(i,2,mxlen) {
		ll val = s-i*3;
		ans = (ans%mod + ncr((val+i-1), i-1)%mod);
	}
	cout<<ans<<ln;
	return;
}

int main() {
    fastIO
    a[0] = 1;
    a[1] = 1;
    fl(i,2,2001) {
    	a[i] = ((a[i-1]%mod)*(i%mod))%mod;
    }

    int t = 1;
    // cin >> t;
    fl(i,0,t) {
    	// cout << "Case #"<< i+1 <<": ";
    	decrypt();
    }
    return 0;
}

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

using namespace std;

#define ll long long
ll input(){
	ll x=0,f=0;char ch=getchar();
	while(ch<'0'||ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return f? -x:x;
}

const int N=1e5+7;

int h[N],dp[N];

int main(){
	int n=input();
	for(int i=1;i<=n;i++){
		h[i]=input();
	}
	dp[1]=0,dp[2]=abs(h[1]-h[2]);
	for(int i=3;i<=n;i++){
		dp[i]=min(dp[i-1]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i-2]-h[i]));
	}
	cout<<dp[n]<<endl;
} 

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
double n,sum;
int main(){
	cin>>n;
	double a;
	string b;
	for(int i=1;i<=n;i++){
		cin>>a>>b;
		if(b=="JPY")sum+=a;
		else if(b=="BTC") sum+=a*380000;
	}
	cout<<fixed<<sum;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
template <class T>
istream& operator>>(istream& input, vector<T>& v) {
    for (T& i : v) input >> i;
    return input;
}
int main() {
    int N, D;
    cin >> N >> D;
    vector<vector<int>> X(N, vector<int>(D));
    int cnt = 0;
    cin >> X;
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            double dis = 0.0;
            for (int k = 0; k < D; k++) dis += pow(X[i][k] - X[j][k], 2);
            if (sqrt(dis) == static_cast<int>(sqrt(dis))) cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

#define INFTY 1000000000
#define N 500000

void merge(int *,int,int,int);
void mergeSort(int *,int,int);

int count=0;

int main()
{
  int a,i,A[N];
  
  scanf("%d",&a);
  
  for(i=0;i<a;i++){
    scanf("%d",&A[i]);
  }
  
  mergeSort(A,0,a);
  
  for(i=0;i<a;i++){
    printf("%d",A[i]);
    if(i!=a-1) printf(" ");
  }
  
  printf("\n");
  
  printf("%d\n",count);

  return 0;
}


void merge(int A[],int left,int mid,int right)
{
  int i,j,k,s,t;
  int l[N/2+2],r[N/2+2];
  
  s = mid - left;
  t = right - mid;
  
  for(i=0;i<s;i++){
    l[i]=A[left+i];
  }
  
  for(i=0;i<t;i++){
    r[i]=A[mid+i];
  }
  
  l[s]=INFTY;
  r[t]=INFTY;
  i=0;
  j=0;
  
  for(k=left;k<right;k++){
    count++;
    if(l[i]<=r[j]){
      A[k] = l[i];
      i=i+1;
    }
    else {
      A[k] = r[j];
      j=j+1;
    }
  }
}


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



Measured memory_bytes: 5600
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		String ans = "No";
		for(int i=1;i<=9;i++) {
			for(int j=i;j<=9;j++) {
				if(i*j==N) {
					ans ="Yes";
				}
			}
		}

		System.out.println(ans);

		sc.close();
	}


}

Measured memory_bytes: 22868
import heapq

n, m = map(int, input().split())
work = [[] for _ in range(10**5 + 1)]
for i in range(n):
    a, b = map(int, input().split())
    work[a].append(b)

total = 0
candidates = []
for d in range(1, m+1):
    for w in work[d]:
        heapq.heappush(candidates, -w)
    if len(candidates) > 0:
        total += -heapq.heappop(candidates)
print(total)

Measured memory_bytes: 72608
#include<stdio.h>

int main(void)
{
	long long int a, b, c;
	int k = 0;
	

	scanf("%lld", &c);

	for (a = 0; a < 1000; a++) {
		for (b = -a; b < a; b++) {
			if ((a * a * a * a * a - b * b * b * b * b) == c) {
				k = 1;
				break;
			}
		}

		if (k == 1) {
			printf("%lld %lld", a, b);
			break;
		}
	}


	return 0;
}

Measured memory_bytes: 2144
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
#define vecout(a) rep(i,a.size())cout << a[i] << " ";cout << "\n"
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ld pi = 3.14159265358;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
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;}
template<class T> inline bool change(T a,T b){if(a > b){swap(a,b);return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
ll fac[cmax], finv[cmax], inv[cmax];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N,M;
    cin >> N >> M;
    cout << N + M / 2 << endl;
}

Measured memory_bytes: 3620
// dile a la jardinera que traigo flores

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

const int N=1005;

int main(){
 	int X,Y,Z,K;cin>>X>>Y>>Z>>K;
  	vector<ll>A(X);
   	vector<ll>B(Y);
   	vector<ll>C(Z);
   	for(int i=0;i<X;i++)cin>>A[i];
   	for(int i=0;i<Y;i++)cin>>B[i];
   	for(int i=0;i<Z;i++)cin>>C[i];
   	sort(A.rbegin(),A.rend());
	sort(B.rbegin(),B.rend());
	sort(C.rbegin(),C.rend());


	vector<ll>ABC;
	for(int a = 0;a < X ; a++){
		for(int b = 0; b < Y ; b++){
			if( (a+1) * (b+1) > K ) break;
			for(int c = 0 ;c < Z ; c++){
				if( (a+1) * (b+1) * (c+1) > K ) break;
				ABC.push_back( A[a] + B[b] + C[c]);
			}
		}
	}
	sort(ABC.rbegin(),ABC.rend());
	for(int i = 0 ; i < K ; i++){
		cout<<ABC[i]<<endl;
	}
   return 0 ;
}

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

using lnt = long long;
using Real = long double;

#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(lnt i=0;i<(n);++i)
#define RANGE(i, a, b) for(lnt i=(a);i<(b);++i)
#define RREP(i, n) for(lnt i=(n)-1;i>= 0;--i)

#define ln '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define dcout cout<<fixed<<setprecision(20)
#define summon_tourist cin.tie(0);ios::sync_with_stdio(false)

constexpr int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
constexpr Real eps = 1e-9; const Real pi = acosl(-1);
constexpr lnt BIG = INT_MAX/10, BBIG = LLONG_MAX/10;

template<class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<class T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<class T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
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;}

using pint = pair<int, int>; using plnt = pair<lnt, lnt>;
using vint = vector<int>; using vlnt = vector<lnt>;
constexpr lnt MOD = 1e9+7;

int main(){
	summon_tourist;

	int K; string S; cin >> K >> S;
	if(S.size() <= K) cout << S << ln;
	else {
		S = S.substr(0, K);
		cout << S << "..." << ln;
	}
}

Measured memory_bytes: 3652
#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 i, N, K, x, count=0, ans=0;
  ll a, b, c, d, max1, max2;
  
  cin >> a >> b >> c >> d;
  
  max1 = a*c;
  if(a*d>max1) max1=a*d;
  if(b*c>max1) max1=b*c;
  if(b*d>max1) max1=b*d;
  
  cout << max1 << endl;
}

  
  


Measured memory_bytes: 3612
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<queue>
#include<utility>

#define rep0(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rep1(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)

using namespace std;

int N;

int A[110];



int main(void) 
{
	int min = -1;

	cin >> N;

	rep0(i, 0, N)cin >> A[i];

	for(int i=0;i<N-1;i++) 
	{
		for(int j=i;j<N;j++) 
		{
			if (abs(A[i] - A[j])>min)
			{
				min = abs(A[i] - A[j]);
			}
		}
	}

	cout << min << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int main()
{
	ll a, b, x;
	cin >> a >> b >> x;
	if (a == 0) cout << b / x + 1 << endl;
	else cout << b / x - (a - 1) / x << endl;
}

Measured memory_bytes: 3620
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

use std::cmp::max;

fn main() {
    let n = read::<usize>();
    let mut x: Vec<Vec<usize>> = Vec::with_capacity(n);
    let mut y: Vec<Vec<usize>> = Vec::with_capacity(n);

    for i in 0..n {
        let ai = read::<usize>();
        x.push(Vec::with_capacity(ai));
        y.push(Vec::with_capacity(ai));
        for _ in 0..ai {
            let xyi = (read::<usize>(), read::<usize>());
            x[i].push(xyi.0);
            y[i].push(xyi.1);
        }
    }


    let mut ans = 0;
    'outer: for i in 0..2_i32.pow(n as u32) {
        let mut cnt = 0;
        for j in 0..n {
            if (i & (1 << j)) == 0 { continue } else { cnt+=1 }
            for k in 0..x[j].len() {
                if (i >> (x[j][k]-1) & 1) ^ y[j][k] as i32 != 0 { continue 'outer; }
            }
        }
        ans = max(ans, cnt);
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main(){
	let n: u8 = read();
    if n == 1 {
    	println!("Hello World");
    } else {
    	let a: u8 = read();
    	let b: u8 = read();
    	println!("{}", a+b);
    }
}

Measured memory_bytes: 4352
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
 
public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		String S  = keyboard.next();
		 String[] T = S.split("");
		
		int a = Integer.parseInt(T[0]);
		int b = Integer.parseInt(T[1]);
		int c = Integer.parseInt(T[2]);
		int d = Integer.parseInt(T[3]);
 
		int AA = 10 * a + b;
		int BB = 10 * c + d;
		
		String ans = "";
				
		if(AA == 0 && BB == 0) {
			ans = "NA";
			}else if(AA <13 && BB < 13) {
				if(AA == 0) {
					ans = "YYMM";
				}else if(BB == 0){
					ans = "MMYY";
				}else{
				ans = "AMBIGUOUS";
				}
			}else if(AA < 13 && BB > 12) {
				if(AA == 0) {
					ans = "NA";
				}else {
					ans = "MMYY";
				}
			}else if(AA > 12 && BB < 13) {
				if(BB == 0) {
					ans = "NA";
				}else {
				ans = "YYMM"; 
				}
			}else {
				ans = "NA";
			}
		
		System.out.print(ans);
		keyboard.close();	
	}
}


Measured memory_bytes: 22100
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int mod = 1e9+7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
 
int main()
{
    int n;
    cin >> n;
    vector<int> c(n),s(n),f(n);
    for(int i = 0; i < n-1; i++) cin >> c[i] >> s[i] >> f[i];
    for(int i = 0; i < n-1; i++){
        int res = s[i]+c[i];
        for(int j = i+1; j < n-1; j++){
            if(res <= s[j]) res = s[j];
            else{
                int tmp = s[j];
                while(tmp < res) tmp += f[j];
                res = tmp;
            }
            res += c[j];
        }
        cout << res << endl;
    }
    cout << 0 << endl;
    return 0;
}

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

#define FOR(i, a, b) for(i = a; i < b; ++i)
#define REP(i, n) FOR(i, 0, n)
#define comp(a, b) comp(const void *a, const void *b)
#define MOD 1000000007

typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned long long ull;

void yes_or_no(char boolean){
    if(boolean){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
}

void judge_prime(uint N, char isPrime[N + 1]){
    uint sq = sqrt(N) + 1;
    uint i;
    FOR(i, 5, sq){
        if(isPrime[i]){
            uint k = i * 2;
            while(k <= N){
                isPrime[k] = 0;
                k += i;
            }
        }
    }
}

uint count_times(uint p, uint N){
    uint p_n = p, ret = 0;
    while(p_n <= N){
        ret += N/p_n;
        p_n *= p;
    }
    return ret + 1;
}

int main(){
    uint N, i;
    scanf("%d", &N);
    char isPrime[N + 1];
    isPrime[0] = 0;
    isPrime[1] = 0;
    FOR(i, 2, N + 1){
        if(i == 2 || i == 3 || i % 6 == 1 || i % 6 == 5){
            isPrime[i] = 1;
        }else{
            isPrime[i] = 0;
        }
    }
    judge_prime(N, isPrime);
    ull ANS = 1;

    FOR(i, 2, N + 1){
        if(isPrime[i]){
            ANS *= count_times(i, N);
            ANS %= MOD;
        }
    }

    printf("%llu\n", ANS);
    return 0;
}

/*
まずN以下の素数pを全部求める.
次に1~Nのなかでp, p^2...p^m < Nで割れる数の個数を全部求め, 個数の和S_pを求める.
答えは, Π(S_p + 1)
*/

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 10000000000000000
#define MOD 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

signed main() {
	int n;
	cin >> n;
	P pa[100005];
	rep(i, n) {
		cin >> pa[i].first;
		pa[i].second = i + 1;
	}
	sort(pa, pa + n);
	rep(i, n) {
		cout << pa[i].second << " ";
	}
	cout << endl;

	return 0;
}


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

int main(){
    int n, m;
    cin >> n >> m;
    string a[52], b[52];
    for(int i=0;i<n;++i)
        cin >> a[i];
    for(int i=0;i<m;++i)
        cin >> b[i];
    bool ok = false;
    for(int i=0;i<=n-m;++i){
        for(int j=0;j<=n-m;++j){
            bool flag = true;
            for(int y=0;y<m;++y){
                for(int x=0;x<m;++x){
                    if(a[i+y][j+x] != b[y][x]){
                        flag = false;
                        break;
                    }
                }
            }
            if(flag){
                ok = true;
                break;
            }
        }
        if(ok)break;
    }
    cout << (ok ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int N,d,p[1000],count=0;
	cin >> N >> d;
	for(int i=0;i<N;i++){
		cin >> p[i];
		if(p[i] > d){
			count = count + (p[i]-d);
		}
	}
	if(count == 0){
		cout << "kusoge\n";
	}
	else{
		cout << count << "\n";
	}
	return 0;
}

Measured memory_bytes: 3092
#1indexed
class BIT():
    def __init__(self, n):
        self.size = n
        self.bit = [0] * (n+1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.bit[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.bit[i] += x
            i += i & -i

n = int(input())
s = input()
q = int(input())

bit = [BIT(n+1) for i in range(26)]
for i in range(n):
    bit[ord(s[i])-97].add(i+1, 1)


s = list(s)
for _ in range(q):
    query, a, b = input().split()
    if query == "1":
        i = int(a)
        c = ord(b)-97
        bit[ord(s[i-1])-97].add(i, -1)
        bit[c].add(i, 1)
        s[i-1] = b
    else:
        ans = 0
        for k in range(26):
            if bit[k].sum(int(b))-bit[k].sum(int(a)-1) >= 1:
                ans += 1
        print(ans)


Measured memory_bytes: 171620
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	return sc
}

func main() {
	sc = initScanner(os.Stdin)
	parseProblem()
}

func parseProblem() {
	a, b, k := scanInt(sc), scanInt(sc), scanInt(sc)
	for i := a; i <= b; {
		if i < a+k || b-k < i {
			fmt.Println(i)
			i++
		} else {
			i = b - k + 1
		}
	}
}

func resolve(n int) int {
	return n
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1784
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			int n = Integer.parseInt(br.readLine());
			int[] array = new int[n];
			String input = br.readLine();
			String[] s = input.split("\\s");
			for (int i = 0; i < array.length; i++) {
				array[i] = Integer.parseInt(s[i]);
			}
			System.out.println(bubbleSort(array));
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	// バブルソート
	public static int bubbleSort(int[] array) {
		int cnt = 0;// 交換回数
		boolean flg = true;
		for (int i = 0; flg; i++) { // iは未ソート部分列の先頭インデックス
			flg = false;
			for (int j = array.length - 1; j > i; j--) {
				if (array[j] < array[j - 1]) {
					int tmp = array[j - 1];
					array[j - 1] = array[j];
					array[j] = tmp;
					flg = true;
					cnt++;
				}
			}

		}
		// 表示
		String str = Arrays.toString(array);
		System.out.println(str.replace("[", "").replace("]", "").replace(",", ""));
		return cnt;
	}

}


Measured memory_bytes: 24520
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
#include <math.h>
#include <utility>
#include <map>
#include <queue>
#include <stack>

using namespace std;

#define INF 210000000
#define int long long

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

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

signed main() {
    int a,b,c;
    cin >> a >> b >> c;
    if(c >= a && c <= b){
        cout << "Yes";
    }else{
        cout << "No";
    }
}



Measured memory_bytes: 256
#!/usr/bin/node
(function() {
  var T=[];
  var S=[];
  var stdin = process.openStdin();
  stdin.setEncoding('utf8');

  var rec=function(x,y){
    if(0<=x&&x<T[0].length&&0<=y&&y<T.length&&T[y][x])
      T[y][x]=0,rec(x-1,y),rec(x+1,y),rec(x,y-1),rec(x,y+1),
      rec(x-1,y-1),rec(x+1,y-1),rec(x-1,y+1),rec(x+1,y+1);
  }

  var input_fragment="";
  stdin.on('data', function(input) {
	var ref=(input_fragment+input).split("\n");
	input_fragment=ref.pop();
	for(var i=0;i<ref.length;i++){
		if(ref[i]=='')continue;
		var y=ref[i].split(" ");
    	for(var j=0;j<y.length;j++)y[j]=parseInt(y[j])
		S.push(y);
	}
  });

  stdin.on('end', function(z) {
    var i,j,r;
    for(;;){
      r=0;
      var h=(S.shift())[1];
      if(!h)break;
      T=S.slice(0,h);
      for(i=0;i<T[0].length;i++)for(j=0;j<T.length;j++)if(T[j][i])r++,rec(i,j);
      console.log(r);
      S=S.slice(h);
    }
  });
}).call(this);

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

int main(){
  int X,Y,A,B,C;
  cin>>X>>Y>>A>>B>>C;
  vector<pair<int64_t,int>> p;
  for(int i=0;i<A;++i){
    int64_t a;
    cin>>a;
    p.push_back(make_pair(a,2));
  }
  for(int i=0;i<B;++i){
    int64_t a;
    cin>>a;
    p.push_back(make_pair(a,1));
  }
  for(int i=0;i<C;++i){
    int64_t a;
    cin>>a;
    p.push_back(make_pair(a,0));
  }

  sort(p.begin(),p.end(),greater<pair<int64_t,int>>());

  vector<int> v(3,0);
  int i=0;
  int64_t ans=0;
  while(v[0]+v[1]+v[2]<X+Y){
    int c=p[i].second;
    if(c==2 && v[c]<X){
      ans += p[i].first;
      ++v[2];
    }
    else if(c==1 && v[c]<Y){
      ans += p[i].first;
      ++v[1];
    }
    else if(c==0){
      ans += p[i].first;
      ++v[0];
    }
    ++i;
  }

  cout<<ans<<endl;
}

Measured memory_bytes: 10476
import java.util.*;

public class Main {
	static char[][] field;
	static int w;
	static int h;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			w = sc.nextInt();
			h = sc.nextInt();
			if (w == 0 && h == 0)
				break;
			field = new char[h][w];
			for (int i = 0; i < h; i++) {
				String str = sc.next();
				for (int j = 0; j < w; j++)
					field[i][j] = str.charAt(j);
			}
			for (int i = 0; i < h; i++)
				for (int j = 0; j < w; j++)
					if (field[i][j] != '.')
						check(j, i);
			int black = 0;
			int white = 0;
			for (int i = 0; i < h; i++)
				for (int j = 0; j < w; j++) {
					if (field[i][j] == 'b')
						black++;
					if (field[i][j] == 'w')
						white++;
				}
			System.out.println(black + " " + white);
		}
		sc.close();
	}

	static void check(int x, int y) {
		int[] dx = { 0, 1, 0, -1 };
		int[] dy = { -1, 0, 1, 0 };
		for (int i = 0; i < 4; i++) {
			switch (field[y][x]) {
			case 'W':
			case 'w':
				if (x + dx[i] >= 0 && x + dx[i] < w && y + dy[i] >= 0
						&& y + dy[i] < h)
					switch (field[y + dy[i]][x + dx[i]]) {
					case '.':
						field[y + dy[i]][x + dx[i]] = 'w';
						check(x + dx[i], y + dy[i]);
						break;
					case 'b':
						field[y + dy[i]][x + dx[i]] = 'n';
						check(x + dx[i], y + dy[i]);
						break;
					}
				break;
			case 'B':
			case 'b':
				if (x + dx[i] >= 0 && x + dx[i] < w && y + dy[i] >= 0
						&& y + dy[i] < h)
					switch (field[y + dy[i]][x + dx[i]]) {
					case '.':
						field[y + dy[i]][x + dx[i]] = 'b';
						check(x + dx[i], y + dy[i]);
						break;
					case 'w':
						field[y + dy[i]][x + dx[i]] = 'n';
						check(x + dx[i], y + dy[i]);
						break;
					}
				break;
			case 'n':
				if (x + dx[i] >= 0 && x + dx[i] < w && y + dy[i] >= 0
						&& y + dy[i] < h)
					switch (field[y + dy[i]][x + dx[i]]) {
					case '.':
					case 'b':
					case 'w':
						field[y + dy[i]][x + dx[i]] = 'n';
						check(x + dx[i], y + dy[i]);
						break;
					}
				break;
			}
		}
	}
}

Measured memory_bytes: 32816
def main():
	# n,m = map(int,input().split())
	# n,k = map(int,input().split())
	# n = int(input())
	# a = list(map(int,input().split()))
	# rsp = list(str(input()))
	# l = [list(map(int, input().split())) for _ in range(n)]
	# s = list(s)
	
	a = int(input())
	s = str(input())

	if a >= 3200:
		print(s)
	else:
		print("red")


 
if __name__ == '__main__':
	main()

Measured memory_bytes: 38256
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <sstream>
#include <fstream>
#include <tuple>
#include <set>
#include <functional> 
#include <string.h>
//#include <assert.h>
//#include <typeinfo.h>
#include <time.h>

#define X first
#define Y second
#define MP make_pair
#define MT make_tuple
#define FOR(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define REP(i, a, n) for(int (i) = (a); (i) < (n); ++(i))
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll > pll;
using namespace std;

const int INIT_SIZE_MAX = (1 << 29) + 10;
const int INIT_SIZE_MIN = -(1 << 29) - 10;
const int INIT_SIZE = 0;
const int MAX = 8;
const int DIR_SIZE = 12;
const double PI = 3.1415926535897932384;

template<class T, class U>
void convert(T &t, U &u){
	stringstream ss;
	ss << t;
	ss >> u;
}

int main(){
	int x, h;
	while (cin >> x >> h && x|h){
		double x2 = x, h2 = h;
		double hh = sqrt((h2 * h2) + ((x2 / 2)*(x2 / 2)));
		printf("%.6f\n", (x * hh / 2 * 4) + (x * x));
	}
}

Measured memory_bytes: 1176
s = input()
x = int(s[0:2])
y = int(s[2:4])
if 1 <= x <= 12:
    if 1 <= y <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif 1 <= y <= 12:
    print("YYMM")
else:
    print("NA")

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

#define rep(X,N) for(ll X = 0LL; X < (N); X++)
#define ALL(V) (V).begin(),(V).end()

using namespace std;
typedef long long ll;

const double PI = 3.1415926535897932384626;
const ll MODN = 1000000007;
const ll MODN2 = 998244353;
const double EPS = 1e-10;

class ModInt{
public:
    long long n;
    int p;

    ModInt(){
    }

    //値と割る値を受け取って、オブジェクトを返す
    ModInt(long long _n, int _p){
        p = _p;
        n = _n % _p;

        //負の値を受け取ったときには正の値に戻す
        if(n < 0){
            n += p;
        }
    }

    ModInt operator+(ModInt a){

        ModInt tmp = ModInt(*this);

        tmp.n += a.n;

        if(tmp.n > tmp.p){
            tmp.n -= tmp.p;
        }
        
        return tmp;
    }

    ModInt operator-(ModInt a){

        ModInt tmp = ModInt(*this);

        tmp.n -= a.n;

        if(tmp.n < 0){
            tmp.n += tmp.p;
        }

        return tmp;
    }

    ModInt operator*(ModInt a){

        ModInt tmp = ModInt(*this);

        tmp.n = (tmp.n * a.n) % tmp.p;

        return tmp;
    }

    int modpow(int b, int k){
        if(k == 0){
            return 1;
        }else if(k % 2 == 1){
            long long tmp = b;
            tmp = tmp * modpow(b, k - 1) % p;
            
            return tmp;
        }else{
            long long tmp = modpow(b, k / 2);
            return tmp * tmp % p;
        }
    }

    int modinv(int b){
        return modpow(b, p - 2);
    }

    ModInt operator/(ModInt a){

        ModInt tmp = ModInt(*this);

        tmp.n = tmp.n * modinv(a.n) % tmp.p;
        return tmp;
    }
};

int main(){

    int k;
    cin >> k;
    string s;
    cin >> s;

    int size = s.size();

    vector<ModInt> fact(k + size + 1);
    fact[0] = ModInt(1, MODN);

    for(int i = 1; i <= k + size; i++){
        fact[i] = fact[i - 1] * ModInt(i, MODN);
    }

    function<ModInt(int, int)> combi = [&](int n, int m) -> ModInt{
        return fact[n] / fact[n - m] / fact[m];
    };

    ModInt ans = ModInt(0, MODN);

    vector<ModInt> pow25(k + size + 1, ModInt(1, MODN));
    vector<ModInt> pow26(k + size + 1, ModInt(1, MODN));

    for(int i = 1; i <= k + size; i++){
        pow25[i] = pow25[i - 1] * ModInt(25, MODN);
    }

    for(int i = 1; i <= k + size; i++){
        pow26[i] = pow26[i - 1] * ModInt(26, MODN);
    }

    for(int i = size; i <= size + k; i++){

        int before = i - size;
        int after = size + k - i;

        ans = ans + combi(i - 1, size - 1) * pow25[before] * pow26[after];
    }

    cout << ans.n << endl;

    return 0;
}


Measured memory_bytes: 98152
main = do
    xs <- (map read . words) <$> getLine :: IO [Int]
    let a = xs !! 0
        b = xs !! 1
        c = xs !! 2
        d = xs !! 3
    let x = (c - 1) `div` b + 1
        y = (a - 1) `div` d + 1
    if x <= y then putStrLn "Yes"
              else putStrLn "No"

Measured memory_bytes: 3804
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))

from random import randrange
from itertools import accumulate
from bisect import bisect_left
import time
#%%code

def calc(LIST):
    ans=0
    last=[0]*26
    for i in range(len(LIST)):
        a=i+1 #day a0
        x=LIST[i]-1
        #increase
        ans+=S[i][x]
        #decrease
        last[x]=a#update
        temp=0
        for j in range(26):
            temp+=C[j]*(a-last[j])
        #print(ans,temp,"deb")
        ans-=temp
        #print(ans)

    return ans

def answerer(c):
    """
    #方針その2
    最初にですが乱択をします。ただし、CとDの積に応じてあたりやすさをでかくします
    """
    acc=list(accumulate(c))
    ret=[]
    for d in range(D):
        acc=list(accumulate(c))
        miru=[]
        for i in range(len(c)):
            miru.append(acc[i]*S[d][i])
        temp=randrange(miru[-1])
        s=bisect_left(miru,temp)
        if s<1:s+=1
        elif s>=len(miru):s=len(miru)
        ret.append(s+1)

        #print(s+1)
    return ret

def resolve():
    global D,C,S
    #input of prob.A
    D,=pin()
    C=[*pin()]#0-indexed
    S=[[*pin()]for i in range(D)]
    answerer(C)


    ##print(acc)
    start=time.time()
    king=[1]*365
    max_score=calc(king)
    #print(max_score)

    while(time.time()-start<1.8):
        temp=answerer(C)
        challenge=calc(temp)
        if challenge>max_score:
            max_score=challenge
            king=temp[:]
        ##print(king,max_score)

    #assert len(king)==D
    print(*king,sep="\n")
    #print(max_score)
#%%submit!
resolve()



Measured memory_bytes: 86428
import math
import numpy as np
a,b,c=map(int, input().split())
def nroot(a_, n, x=1.0, eps=1e-10):
    while abs(a_ - x**n) > eps:
        x = ( (n-1)*x + a_/(x**(n-1)) ) / n
    return x

#if round(math.sqrt(a) + math.sqrt(b),10) < round(math.sqrt(c),10):
if c-a-b <0:
    print('No')
elif 4*a*b < (c-a-b)**2:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 12484
from itertools import product

s = input()
a = int(s[0])
b = int(s[1])
c = int(s[2])
d = int(s[3])

ops = product([1,-1],repeat=3)

for op in ops:
  test = a + b * op[0] + c * op[1] + d * op[2]
  if test == 7:
    _op = [""]*3
    for i in range(3):
      _op[i] = "+" if op[i] == 1 else "-"
    print("{}{}{}{}{}{}{}=7".format(a,_op[0],b,_op[1],c,_op[2],d))
    exit()
print(-1)

Measured memory_bytes: 9172
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;


public class Main {
	
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			int[] arr = {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};
			
			final int K = sc.nextInt();
			
			System.out.println(arr[K - 1]);
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		

		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 21076
#include <iostream>
using namespace std;
int main() {
  int n, v[100005];
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> v[i];
  int cur = 0, best = 0;
  for (int i = 2; i <= n; i++) {
  	if (v[i] <= v[i - 1]) {
  		cur++;
  	}
  	else {
  		best = max(best, cur);
  		cur = 0;
  	}
  }
  best = max(best, cur);
  return cout << best, 0;
}
  

Measured memory_bytes: 640
#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>;

const int mod=1e9+7;

int main(){
    int n,k;
    cin>>n>>k;
    vector<int>a(n),s,t;
    rep(i,n){
        cin>>a[i];
        if(a[i]>=0)s.push_back(a[i]);
        else t.push_back(a[i]);
    }
    bool ok=false;
    if(s.empty()){
        if(k%2==0)ok=true;
    }
    else{
        if(n==k){
            if(t.size()%2==0)ok=true;
        }
        else ok=true;
    }
    ll ans=1;
    if(!ok){
        sort(a.begin(),a.end(),[](int i, int j){
            return abs(i)<abs(j);
        });
        rep(i,k){
            ans*=a[i];
            ans%=mod;
        }
    }
    else{
        sort(s.rbegin(),s.rend());
        sort(t.begin(),t.end());
        priority_queue<ll>q;
        if(t.size()>=2)for(int i=0; i<t.size()-1; i+=2){
            q.push((ll)t[i]*t[i+1]);
        }
        int i=0;
        if(k%2==1)ans*=s[i],i++;
        if(s.size()>=2)for(; i<s.size()-1; i+=2){
            q.push((ll)s[i]*s[i+1]);
        }
        rep(i,k/2){
            ans*=(q.top()%mod);
            ans%=mod;
            q.pop();
        }
    }
    if(ans<0)ans+=mod;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 6292
#include <cstdio>

using namespace std;

int main()
{
    int n, t, minimum_cost = 9999999, cost, time;

    scanf("%d %d\n", &n, &t);

    for(int i=1; i<=n; i++)
    {
        scanf("%d %d", &cost, &time);

        if(time <= t && cost < minimum_cost)
            minimum_cost = cost;
    }

    if(minimum_cost == 9999999)
        printf("TLE\n");
    else
        printf("%d\n", minimum_cost);
}


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

int main()
{

    int n;
    cin>>n;
    ll a[n+1],b[n],total = 0;
    for(int i=0;i<=n;i++)   cin>>a[i];
    for(int i=0;i<n;i++)    cin>>b[i];

    for(int i=0;i<n;i++)
    {
        if(a[i]>=b[i])  total += b[i];
        else
        {
            total += (a[i]+min(a[i+1],b[i]-a[i]));
            a[i+1] -= min(a[i+1],b[i]-a[i]);
        }
    }
    cout<<total<<endl;
    return 0;
}


Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<(n);i++)
#define Rep(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define eb emplace_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
// const int mod=998244353;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

class Combination {
    private:
    vector<int> x, y;
    int mod = (int)1e9 + 7;
    
    void make(int n) {
        x.resize(n+1);
        y.resize(n+1);        
        x[0] = y[0] = 1;
        for (int i = 1; i <= n; i++) {
            x[i] = (x[i-1]*i) % mod;
            y[i] = modpow(x[i],mod-2);
        }
    }
    
    int modpow(int x, int n) {
        int ret = 1;
        while (n > 0) {
            if ((n & 1)) {
                ret = ret * x % mod;
            }
            x = x * x % mod;
            n >>= 1;
        }
        return ret;
    }
    
    public:
    Combination(int n) {
        make(n);
    }
    
    Combination(int n, int mod) {
        this->mod = mod;
        make(n);
    }
    
    int get(int n, int r) {
        if (n < r) return 0;
        return x[n] * y[n - r] % mod * y[r] % mod;
    }
    
};

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

void run(){
    int k;
    string s;
    cin>>k>>s;
    int n=s.length();
    Combination c(k+n);
    int a=0;
    REP(i,0,k){
        a=(a+modpow(25,i)*c.get(i+n-1,i)%mod*modpow(26,k-i)%mod)%mod;
    }
    cout<<a<<endl;
}

Measured memory_bytes: 35688
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REP(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define REP1(i,x,n) for(int (i)=(x);(i)<=(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using Int = long long;

//INT_MAX = 2147483647;
//LLONG_MAX = 9223372036854775807;
//ULLONG_MAX = 18446744073709551615;
const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int,int> P;
typedef std::priority_queue<int> IntPrioQueue;
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue;

//少数点表示
//cout << std::fixed << std::setprecision(14) << 値

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    ll x;
    cin >> x;
    ll yo = 100;
    ll cnt = 0;
    while(yo<x){
        yo *= 1.01;
        cnt++;
    }
    cout << cnt <<endl;
    return 0;
}

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

template<typename T, typename E, typename F, typename G, typename H>
class LazySegmentTree {
  int n, height;
  F f; G g; H h; const T ti; const E ei;
  vector<T> dat; vector<E> laz; vector<int> highest;

  void propagate(int k) {
    if(laz[k] != ei) {
      laz[2*k] = h(laz[2*k],laz[k]); laz[2*k+1] = h(laz[2*k+1],laz[k]);
      dat[k] = g(dat[k],laz[k],n/highest[k]);
      laz[k] = ei;
    }
  }
  inline void recalc(int k) {
    while(k >>= 1) dat[k] = f(g(dat[2*k],laz[2*k],n/highest[2*k]),g(dat[2*k+1],laz[2*k+1],n/highest[2*k+1]));
  }
  inline void thrust(int k) {
    for(int i = height; i > 0; i--) propagate(k >> i);
  }
public:
  LazySegmentTree(int _n, F f, G g, H h, T ti, E ei): f(f), g(g), h(h), ti(ti), ei(ei) {
    n = 1; height = 0;
    while(n < _n) n <<= 1, height++;
    dat.assign(2*n,ti); laz.assign(2*n,ei); highest.assign(2*n,0);
    int c = 1;
    for(int i = 1; i < 2*n; i++) {
      if(c*2 <= i) c <<= 1;
      highest[i] = c;
    }
  }
  void set(int k, T x) {
    dat[k+n] = x;
  }
  void build() {
    for(int i = n-1; i >= 0; i--) {
      dat[i] = f(dat[2*i],dat[2*i+1]);
    }
  }
  void update(int a, int b, const E x) {
    thrust(a += n); thrust(b += n-1);
    for(int l = a, r = b + 1; l < r; l >>= 1, r >>= 1) {
      if(l & 1) laz[l] = h(laz[l],x), ++l;
      if(r & 1) --r, laz[r] = h(laz[r],x);
    }
    recalc(a); recalc(b);
  }
  T query(int a, int b) {
    thrust(a += n); thrust(b += n-1);
    T l = ti, r = ti; b++;
    while(a < b) {
      if(a & 1) l = f(l,g(dat[a],laz[a],n/highest[a])), a++;
      if(b & 1) b--, r = f(g(dat[b],laz[b],n/highest[b]),r);
      a >>= 1; b >>= 1;
    }
    return f(l,r);
  }
};

int main(){
  int n;
  cin >> n;
  ll x[n], s[n];
  rep(i,n) cin >> x[i] >> s[i];
  auto f = [](ll a, ll b){return max(a,b);};
  auto g = [](ll a, ll b, int l){return a+b;};
  auto h = [](ll a, ll b){return a+b;};
  LazySegmentTree<ll,ll,decltype(f),decltype(g),decltype(h)> lst(n+1,f,g,h,-INF,0);
  rep(i,n) lst.set(i,0);
  lst.build();
  ll ans = -INF;
  rep(i,n) {
    lst.update(i,i+1,x[i]);
    ans = max(ans,lst.query(0,i+1)+s[i]-x[i]);
    lst.update(0,i+1,s[i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 16696