akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <regex>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;

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

int main()
{
    ll A, B;
    cin >> A >> B;

    if (A % 2 == 1 && B % 2 == 1){ 
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

int c, N, K, m, tmp;
array<int, 5000> a;
bitset<5000> bits;

int main()
{
    auto start = std::chrono::system_clock::now();

    cin >> c >> K;
    N = 0;
    lint sum = 0;
    REP(i, c) {
        cin >> tmp;
        sum += tmp;
        if (tmp < K) a[N++] = tmp;
    }

    if (sum < K)
    {
        cout << N << endl;
        return 0;
    }

    int ans = 0;
    REP(n, N)
    {
        bits.reset();
        bits.set(0);
        REP(i, N) if (i != n) bits |= (bits << a[i]);
        m = min(a[n], K);
        IREP(i, m) if (bits[K - i - 1]) {
            ans++;
            break;
        }
        auto now = std::chrono::system_clock::now();
        if (chrono::duration_cast<std::chrono::milliseconds>(now - start).count() > 1950)
        {
            cout << 0 << endl;
            return 0;
        }
    }
    cout << N - ans << endl;
}


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

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> a(N+1,true);
  for(int i=0; i<M; i++){
    int x; cin >> x;
    a[x] = false;
  }
  
  vector<long long int> dp(N+1,0);
  dp[0]=1; dp[1]=1;
  if(a[1]==false) dp[1]=0;
  for(int j=2; j<N+1; j++){
    if(a[j]){
      dp[j] = dp[j-1] + dp[j-2];
      dp[j] = dp[j]%1000000007;
    }
  } 
  cout << dp[N];  
  return 0;
}

Measured memory_bytes: 1408
#include<iostream>
#include<vector>
#define p 1000000007
using namespace std;

 long long int dp[2002][2002];
long long int h(vector<int> &v,int i,int m,int target)
{
  if(target==0)
	return 1;
  if(i>=m || target<3)
    return 0;
  if(dp[i][target]!=-1)
    return dp[i][target];
  long long int inc=h(v,0,m,target-v[i]);
  long long int exc=h(v,i+1,m,target);
  return dp[i][target]=((inc%p)+(exc%p))%p;
}
int main()
{
  int n;
  cin>>n;
  vector<int> v;
  for(int i=3;i<=n;i++)
    v.push_back(i);
  for(int i=0;i<=2001;i++)
  {
    for(int j=0;j<=2001;j++)
      dp[i][j]=-1;
  }
  int m=v.size();
  cout<<h(v,0,m,n)<<endl;
  return 0;
}

Measured memory_bytes: 34580
/*  ****************************

        Author: Devanshu Chaudhari  

        Institution: Indian Institute of Technology Roorkee
    
    ********************************/  
           #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int x,y;
    	int Min,Max;
    	cin>>x>>y;
    	Min=min(x,y);
    	Max=max(x,y);
    	for(int i =0;i<Max;i++)
    		cout<<Min;
    	cout<<'\n';
    }

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int dp[32];
void DPCalc()
{
	dp[0] = 1;
	dp[1] = 1;
	dp[2] = 2;
	for(int i = 0; i < 28; ++i)
	{
		dp[i + 3] = dp[i] + dp[i + 1] + dp[i + 2];
	}
}

void solve()
{
	DPCalc();
	int n;
	while(cin >> n)
	{
		if(n == 0)
		{
			break;
		}
		int ans = dp[n] / 365 / 10 + 1;
		cout << ans << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false); cin.tie(NULL);

#define endl '\n'
#define D(x) cout << #x << " = " << (x) << endl;

const int mod = 1000 * 1000 * 1000 + 7;
map<pair<int, string>, int> dp;

bool is_valid(string &s) {
  bool valid = s.find("AGC") == string::npos;
  for (int i = 1; i < s.size(); ++i) {
    swap(s[i - 1], s[i]);
    if (s.find("AGC") != string::npos) {
      valid = false;
    }
    swap(s[i - 1], s[i]);
  }

  return valid;
}

long long f(int n, string s) {
  if (!n) {
    return 1;
  }

  pair<int, string> key = {n, s};
  if (dp.count(key) == 0) {
    long long ret = 0;
    for (char c : string("ACGT")) {
      s.push_back(c);
      int len = s.size() - 3;
      // D(n); D(s); D(len);
      if (is_valid(s)) {
        string next_s = s.substr(max(0, len));
        ret += f(n - 1, next_s);
      }
      s.pop_back();
    }

    dp[key] = ret % mod;
  }

  return dp[key];
}

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

  long long ans = f(n, "");
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
int N, W;
long long dp[110][100010];
int main () {
    cin >> N >> W;
    for (int i = 1; i <= N; i++) {
        int w, v;
        cin >> w >> v;
        for (int j = 0; j <= W; j++) {
            dp[i][j] = dp[i-1][j];
            if (j-w >= 0) {
                dp[i][j] = max(dp[i][j], dp[i-1][j-w]+v);
            }
        }
    }
    cout << dp[N][W] << endl;
}

Measured memory_bytes: 79360
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>

using namespace std;
const long long MOD=1000000007;
long long Pwr(long long a,long long b,long long m){
    a%=m;
    long long res=1;
    while(b>0){
        if(b%2){res=res*a%m;}
        a=a*a%m;
        b>>=1;
    }
    return res;
}
int main()
{
    long long n;
    cin>>n;
    cout<<(Pwr(10,n,MOD)-Pwr(9,n,MOD)-Pwr(9,n,MOD)+Pwr(8,n,MOD)+10*MOD)%MOD;  
    
    return 0;
}


Measured memory_bytes: 3644
#include <stdio.h>
#include <stdlib.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[LEN+1];
int head, tail,n;

void enqueue(P x){
int next=(tail+1)%LEN;
if(next==head) {exit(2);}
Q[tail]=x;
tail=next;
}

P dequeue(){
P val;
if(head==tail){exit(3);}
val=Q[head];
head=(head+1)%LEN;
return val;
}

int min(int x,int y){
  if(x>y) return y;
  else return x;
}
int main(){
  int sum = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 1; i <= n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head =1 ;
  tail =n+1;
while (head!=tail) {
  u=dequeue();
  c=min(q,u.t);
  u.t=u.t-c;
  sum=sum+c;
  if (u.t>0) {
    enqueue(u);
  }
  else{
    printf("%s %d\n",u.name,sum);
  }

}

  return 0;
}


Measured memory_bytes: 11860
#include <iostream>
#include <math.h>
#include <string>

bool is_prime(const unsigned n){
    switch(n){
        case 0: // fall-through
        case 1: return false;
        case 2: return true;
    }
    if(n%2 == 0) return false;

    
    for(unsigned i=3;i*i<=n;i+=2){
        if(n%i == 0) return false;
    }

    return true;
}

int main() 
{
    int n, m;
    int result = 0;
    std::cin >> n;

    for (int i = 0; i < n; i++) 
    {
    std::cin >> m;
    result += is_prime(m);
    }

     std::cout << result << std::endl;

    
}


Measured memory_bytes: 3100
<?php
error_reporting(0);
$stdin = file_get_contents('php://stdin');
$line = explode("\n",$stdin);
$fi = 0;
$cnt = 0;
$list = array();
$key = new stdclass();
foreach($line as $l) {
  if (strlen($l)==0) continue;
  if ($fi == 0) {
    $a = explode(" ",$l);
    $key->A = $a;
    $fi++;
    continue;
  }
  if ($fi > 0) {
    $a = explode(" ",$l);
    $key->X[] = $a;
  }
}
$a = $key->A[0];
$b = $key->A[1];
$c = $key->A[2];

$ab = $a + $b;
$ac = $a + $c;
$bc = $b + $c;
printf("%d\n",min($ab,$ac,$bc));


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

int main(){
    int H, W;
    string S[2004];
    int lightupmap[2004][2004][4] = {};

    cin >> H >> W;
    for(int h=1;h<=H;h++) cin >> S[h];

    for(int h=1;h<=H;h++){
        S[h] = '#' + S[h] + '#';
    }
    S[0] = "##";
    S[H+1] = "##";
    for(int w=0;w<W;w++){
        S[0] = S[0] + '#';
        S[H+1] = S[H+1] + '#';
    }

    for(int h=1;h<=H;h++){
        for(int w=1;w<=W;w++){
            if(S[h][w] == '.'){
                lightupmap[h][w][0] = lightupmap[h][w-1][0] + 1;
            }
        }
    }
    for(int h=1;h<=H;h++){
        for(int w=W;w>=1;w--){
            if(S[h][w] == '.'){
                lightupmap[h][w][1] = lightupmap[h][w+1][1] + 1;
            }
        }
    }
    for(int w=1;w<=W;w++){
        for(int h=1;h<=H;h++){
            if(S[h][w] == '.'){
                lightupmap[h][w][2] = lightupmap[h-1][w][2] + 1;
            }
        }
    }
    for(int w=1;w<=W;w++){
        for(int h=H;h>=1;h--){
            if(S[h][w] == '.'){
                lightupmap[h][w][3] = lightupmap[h+1][w][3] + 1;
            }
        }
    }

    int ans = 0;
    for(int h=1;h<=H;h++){
        for(int w=1;w<=W;w++){
            if(S[h][w] == '.'){
                int lightup = lightupmap[h][w][0] \
                            + lightupmap[h][w][1] \
                            + lightupmap[h][w][2] \
                            + lightupmap[h][w][3] \
                            - 3;
                ans = max(ans, lightup);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 70912
#include <stdio.h>

int main(void){

  int h,w,i,j;
  
  while(1){

    scanf("%d %d",&h,&w);
    if(w==0&&h==0){
      break;
    }
  
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
	printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }

  return 0;
}

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

#define ll long long

signed main()
{
  string x;
  cin >> x;
  int sum = 0;
  for(int i = 0; i < x.size(); i++)
  {
    int c = (int)(x[i]) -48;
    sum += c;
  }
  cout << (sum %9 ==0 ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3732
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <sstream>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <numeric>
#include <bitset>
#include <ext/algorithm>
#include <ext/numeric>
#define ffor(_a,_f,_t) for(int _a=(_f),__t=(_t);_a<__t;_a++)
#define all(_v) (_v).begin() , (_v).end()
#define sz size()
#define pb push_back
#define SET(__set, val) memset(__set, val, sizeof(__set))
#define FOR(__i, __n) ffor (__i, 0, __n)
typedef long long LL; using namespace std;

LL findRoot(LL x) {
	LL s = 0LL, e = 1100000000LL, mid;
	LL ret = -1;
	while (s <= e) {
		mid = (s + e) >> 1;
		if (1LL * mid * mid <= x) {
			ret = mid;
			s = mid + 1LL;
		}
		else
			e = mid - 1LL;
	}
	return ret;
}

int main() {
	int t;
	cin >> t;
	LL A, B;
	FOR (test, t) {
		cin >> A >> B;
		if (A > B)
			swap(A, B);
		LL ret;
		if (A == B || A + 1LL == B)
			ret = 2LL * A - 2LL;
		else {
			LL C = findRoot(A * B - 1LL);
			//LL C = sqrt(A * B);
			//if (C * C == A * B)
				//C--;
			if (C * (C + 1LL) >= A * B)
				ret = 2LL * C - 2LL;
			else
				ret = 2LL * C - 1LL;
		}
		cout << ret << endl;
	}
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define rrep()
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

int main(){
    int n;
    while(cin>>n){
        int ans=0;
        rep(i,0,n+1)ans+=i;
        cout<<ans+1<<endl;
    }
    
    return 0;
}



Measured memory_bytes: 3020
import java.util.*;

public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        int[] c = new int[n];
        for(int i = 0; i < n; i++){
            a[i] = scan.nextInt();
            b[i] = scan.nextInt();
            c[i] = scan.nextInt();
        }
        int[][] dp = new int[n + 1][3];
        for(int i = 0; i < n; i++){
            dp[i + 1][0] = Math.max(dp[i][1] + b[i], dp[i][2] + c[i]);
            dp[i + 1][1] = Math.max(dp[i][0] + a[i], dp[i][2] + c[i]);
            dp[i + 1][2] = Math.max(dp[i][0] + a[i], dp[i][1] + b[i]);
        }
        System.out.println(Math.max(dp[n][0], Math.max(dp[n][1], dp[n][2])));
    }
    
    public static void main(String[] args){
        new Main().solve();
    }
}


Measured memory_bytes: 61128
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REP1(i, n) for (ll i = 1; i <= n; i++)
#define RREP(i, n) for (ll i = n - 1; i >= 0; i--)
#define RREP1(i, n) for (ll i = n; i >= 1; i--)
#define FOR(i, a, b, c) for (ll i = a; i <= b; i += c)
#define RFOR(i, a, b, c) for (ll i = a; i >= b; i -= c)
#define MAX(a, b) (a > b ? a : b)
#define MIN(a, b) (a < b ? a : b)
#define INF 1073709056
#define LLINF 4611686016279904256LL
typedef long long ll;

int main() {
    int a, b;
    scanf("%d %d", &a, &b);
    if (a + b >= 10) puts("error");
    else printf("%d\n", a + b);
    return 0;
}

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

#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define inter ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)

// policy-based
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;	


using namespace std;


typedef long long ll; // int or long long
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;

/*
typedef tree<
ll,
null_type,
less<ll>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
*/
 
const ll MAX = 3e5+100;
const ll inf = 1e12;
const ll mod = 1e9+7;




int main(){
	fastio;
	ll tc,n,x,y,k;
	cin >> k;	

	ll ans = 0,pot = 7,sum = 0;
	if(k%2 == 0 || k%5 == 0){
		cout << "-1\n";
		return 0;
	}
	while(1){
		ans++;
		(sum += (pot)%k)%=k;
		(pot *=10)%=k;
		if(sum % k == 0) break;
	}
	cout << ans << endl;
	
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
#define pb          push_back
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define endl        "\n"
#define fast        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int         long long int
#define mod         1000000007
#define test        int t;cin>>t;while(t--)
#define REP(i,a,b)  for(int i=a,i<=b;i++)
#define MAXN        200001


int m,n;
int mat[21][21];bool vis[21][21];
int res[21][21];

int x_mov[]={0,0,1,-1};
int y_mov[]={1,-1,0,0};

bool is_valid(int x,int y)
{
    if(x < 0 || x>= m || y<0 || y>=n || vis[x][y] || !mat[x][y])
        return false;
    return true;
}

int bfs(pair<int,int>src){

    memset(vis,false,sizeof(vis));
    memset(res,0,sizeof(res));

    vis[src.F][src.S]=true;
    res[src.F][src.S]=0;
    queue<pair<int,int>> q;
    q.push(src);
    while(!q.empty()){

        pair<int,int> pp=q.front();
        // cout<<pp.F <<"  "<<pp.S<<endl;
        q.pop();
        for(int i=0;i<4;i++){
            int new_x= pp.F + x_mov[i];
            int new_y= pp.S + y_mov[i];

            // cout<<new_x<<" -->"<<new_y<<endl;
            if(is_valid(new_x,new_y)){
                // cout<<"Im here"<<endl;
                res[new_x][new_y] = 1+ res[pp.F][pp.S];
                vis[new_x][new_y]=true;
                q.push({new_x,new_y});
            }
        }
    }

    int mx=INT_MIN;
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
            // cout<<res[i][j]<<" ";
            mx=max(mx,res[i][j]);
        }
        // cout<<endl;
    }
    return mx;
}
int32_t main()
{
    cin>>m>>n;
    string str;
    for(int i=0;i<m;i++){
        cin>>str;
        for(int j=0;str[j];j++){
            if(str[j]=='.')
                mat[i][j]=1;
            else
                mat[i][j]=0;
        }
    }

    pair<int,int> src;
    int ans=INT_MIN;
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
            if(mat[i][j]){
                ans=max(ans,bfs({i,j}));
            }
        }
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 3640
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>

using namespace std;
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-13)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1e9 + 7;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H& b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H& b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H& b) const { return x == b.x && y == b.y; }
	bool operator!=(const H& b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P& b) const { return cost < b.cost; }
	bool operator>(const P& b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E& b) const { return cost < b.cost; }
	bool operator>(const E& b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T& a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T& a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
ll bitcount(ll x) {
	int sum = 0;
	for (int i = 0; i < 20; i++)
		if ((1ll << i) & x) sum++;
	return sum;
}
void spsp(vector<ll>&v) {
	for (int i = 0; i < v.size(); i++) {
		printf("%lld%s", v[i], (i == v.size() - 1 ? "\n" : " "));
	}
}
ll fact_[200000];
ll comb(ll x, ll y, ll mod = Mod) {
	if (!fact_[0]) {
		fact_[0] = 1;
		for (int i = 1; i < 200000; i++) {
			fact_[i] = fact_[i - 1] * i % mod;
		}
	}
	if (x < y) return 0;
	return mod_pow(fact_[x], mod, mod) *
		mod_pow(fact_[x - y], mod - 2, mod) % mod *
		mod_pow(fact_[y], mod - 2, mod) % mod;
}//xCy
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
int n, k;
signed main() {
	cin >> n >> k;
	for (int i = 1; i <= k; i++) {
		cout << comb(n - k + 1, i) * comb(k - 1, i - 1) % Mod << endl;
	}
}

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

int main() {

  int n;
  cin >> n;

  long long int money = 100000;

  for ( int i = 0; i < n; i++ ) {
    money += money/20;
    if ( money%1000 != 0 ) {
      money = ( money/1000 + 1 ) * 1000;
    }
  }

  cout << money << endl;
  return 0;

}

Measured memory_bytes: 1156
N, T = map(int, input().split())
c_min = 1000
count = 0
for i in range(N):

    c, t = map(int, input().split())
    if t <= T and c <= c_min:
        count += 1
        c_min = c
if count == 0:
    print('TLE')
else:
    print(c_min)

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

using namespace std;

int main(){
  
  int N; cin >> N;
  
  int cnt = 0;
  
  for(int i = 1; i <= N; i+=2){
    
    int res = i;
    
    map<int,int> mp;
    
    for(int j = 2; j <= N; j++){
      while( res % j == 0 ){ res /= j; mp[j]++;}
    }
    
    int check = 1;
    
    for(auto ne : mp ){ 
      
      check *= (ne.second+1);
      
    }
    
    if(check == 8 ){ cnt++;}
    
  }

  cout << cnt << endl;
  
  return 0;
}

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

int main(void)
{
    char buff[256];   /* 入力文字列用 */
    int i;            /* for文用 */
    char a;
    int b = 0;
    scanf("%s",buff);            /* 文字列入力 */

    for(i = 0; i < strlen(buff); ++i){  /* 文字数分の回数繰り返す */
     a =  buff[i];
     switch(buff[i]){
         case '+':b++;break;
         case '-':b--;break;
         default :printf("+と-の文字列を入力してください");
     }
    }
    printf("%d\n", b);
    return(0); 
}


Measured memory_bytes: 128
// 4/3/2020 8:00:11 PM
#include <bits/stdc++.h>  
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/assoc_container.hpp>
#define forn(i,a,b)        for( i = a ; i < b  ; i++ )
#define debug(x)           cout << #x << " " << x << " -- \n"
#define I__O               ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll                 long long    
#define MOD                998244353
#define pi                 pair<int,int>
#define vi                 vector <int>
#define pb                 push_back
#define vp                 vector <pair<ll,ll>>
#define endl               cout << "\n"  
#define f1                 first 
#define s1                 second    
#define in                 insert
#define all(x)             (x).begin(),(x).end() 
using namespace std ; 
// 2020-04-01
// using namespace __gnu_pbds;
// typedef tree<int,null_type,less<int>,
// rb_tree_tag,tree_order_statistics_node_update> indexed_set ; 
const int N = 2e5+20;
const int mod = 1e9+7;  
int tests() {  
  ll n,k ;
  cin >> n >> k ; 
  cout << min(k-n%k,n%k) << '\n' ; 
  return 0;  
} 
int main(){
    I__O ;            
    int cases = 1 ; 
    // cin >> cases ;  
    for(int  _ = 1 ; _ <= cases ; _++ ){   
    // cout << "Case #" << _ << ": ";
      tests(); 
    }
    return 0 ; 
}

// -Wall -Weptra -O2
// -pedantic -std=c++11
// -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC

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

F = []
for _ in range(N):
    F += [list(map(int, input().split()))]
P = []
for _ in range(N):
    P += [list(map(int, input().split()))]


#bit全探索
ans = -10 ** 9
for i in range(1, 2**10):
    tmp = 0
    c = [0] * N
    for j in range(10):
        if (i >> j) & 1:
            for k in range(N):
                if F[k][j] == 1:
                    c[k] += 1
    for l in range(N):
        tmp += P[l][c[l]]
    ans = max(tmp, ans)

print (ans)

Measured memory_bytes: 3192
//  Created by conan1024hao in 2020.
//  Copyright © 2020 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao Twitter/QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e17
#define MOD 1000000007
#define mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
using Int=int_fast64_t;
typedef long long int ll;
typedef long long int LL;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ! llか? 统一类型 memset()! ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
	ll n,k;cin>>n>>k;
    k--;
    vector<ll>a(n);
    for(ll i=0;i<n;i++)cin>>a[i];
    ll ans=INF;
    n--;
    if(k==0){
        cout<<0<<endl;
        return 0;
    }
    for(int bit=0;bit < (1<<n); bit++)
    {
        int cnt=0;
        for(int i=0;i<n;i++){
            if(bit & (1<<i))
                cnt++;
        }
        if(cnt<k)continue;
        ll minm=a[0];
        ll tmp=0;
        for(int i=0;i<n;i++){
            if(bit&(1<<i)){
                if(minm<a[i+1]){
                    minm=a[i+1];
                }
                else{
                    tmp+=minm-a[i+1]+1;
                    minm++;
                    //cout<<tmp<<endl;
                }
            }
            else{
                chmax(minm,a[i+1]);
            }
        }
        chmin(ans,tmp);
    }
    cout<<ans<<Endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------

Measured memory_bytes: 256
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>
#include <unordered_map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
#define p(s) std::cout << s ;
#define pl(s)  std::cout << s << endl;
using namespace std;

// 素数判定 O(√n)
bool is_prime(int n){
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0) return false;
    }
    return true;
}

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 main() {
    int N;
    cin >> N;
    vector<string> a(N);
    rep(i, 0, N) {
        cin >> a[i];
    }
    ll res = 0;
    unordered_map<string, int> mp(N);
    rep(i, 0, N) {
        sort(a[i].begin(), a[i].end());
        if(mp[a[i]] != 0) {
            res += mp[a[i]];
        }
        mp[a[i]]++;
    }
    cout << res << endl;
    return 0;
}

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

template<class T> void vin(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
}

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll ans = 0;
    rep(i, n) rep(j, n) {
        ans = max(ans, abs(a[i]-a[j]));
    }
    cout << ans << endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>

using namespace std;

pair<int,int> count_bra(string str){
    vector<int> d(str.length()+1);
    d[0] = 0;
    for(int j=0;j<str.length();j++){
        if(str[j] == '(') d[j+1] = d[j] + 1;
        if(str[j] == ')') d[j+1] = d[j] - 1;
    }
    return make_pair(*min_element(d.begin(), d.end()), d[str.length()]);
}

int main(){
    int N;
    string S;
    cin >> N >> S;
    int x,d;
    tie(x,d) = count_bra(S);

    for(int i=0;i<abs(x);i++){
        S = '(' + S;
    }
    for(int i=0;i<d+abs(x);i++){
        S.push_back(')');
    }
    cout << S << endl;

    return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>
#include <set>
#include <map>
#include <type_traits>
#include <cstdint>
#include <queue>
#define _USE_MATH_DEFINES
#include <math.h>

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

//素因数分解
void factoring(ll n, map<ll, ll>& mp) {
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			mp[i]++;
			n /= i;
		}
	}
	if (n != 1) mp[n]++;
}

//絶対値
template<class T, class U = std::make_unsigned_t<T>>
U SafeAbs( T x ) {
    return x < 0 ? -static_cast<uintmax_t>(x) : x;
}

//最大・最小
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;
}

//xのn乗
ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}
//xの逆元
ll mod_inv(ll x, ll mod) {//O(log(mod))
    return mod_pow(x, mod - 2, mod);
}

//nCr
ll ncr(ll n, ll r, ll mod){
	ll res=1;
	ll num=1,den=1;
	for(ll i=n;i>=n-r+1;i--){
		(den*=i)%=mod;
	}
	for(ll i=1;i<=r;i++){
		(num*=i)%=mod;
	}
	
	res=den*mod_inv(num,mod);

	return res%mod;
}


//二分探索
bool isOk(ll index, ll key,vector<ll> &a){
	
	if(a[index]>key){
		return true;
	}
	
	return false;
}

ll bin_search(ll key, vector<ll> &a){
	
	ll l=-1;
	ll r=a.size();

	while(abs(r-l)>1){
		ll mid = (l+r)/2;
		if(isOk(mid, key, a)){
			r=mid;
		}
		else{
			l=mid;
		}
	}
	return r;
}

/*
//深さ優先探索
void dfs(vector<vector<ll>> &gra,vector<bool> &seen, ll v){

	seen[v]=true;

	for(auto next : gra[v]){
		if(seen[next]){
			continue;
		}

		dfs(gra,seen,next);
	}
	
}
*/
const ll MOD=1000000007;

ll min(ll a, ll b){
	if(a>=b){
		return b;
	}
	else{
		return a;
	}
}

void solve(){

	ll ans=0;
	ll a;
	cin>>a;

	ans=a+a*a+a*a*a;

	cout<<ans<<endl;
}


int main(){
	
	solve();
	
    return 0;
}


Measured memory_bytes: 3644
n = int(input())
s = [input() for _ in range(n)]
ac = s.count("AC")
wa = s.count("WA")
tle = s.count("TLE")
re = s.count("RE")
print(f"AC x {ac}")
print(f"WA x {wa}")
print(f"TLE x {tle}")
print(f"RE x {re}")

Measured memory_bytes: 82772
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>

using namespace std;

int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    priority_queue<double, vector<double>, greater<double>> v;

    int hoge;
    for (int i = 0; i < n; i++)
    {
        cin >> hoge;
        v.push(hoge);
    }
    
    for (int i = 0; i < n - 1; i++)
    {
        double f = v.top();
        v.pop();
        double s = v.top();
        v.pop();
        v.push((f + s) / 2.0);
    }

    cout << v.top() << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        // 主処理
        int len = s.length() - 2;
        int halfIndex = len / 2;

        int result = 0;
        for (int i = 0; i < halfIndex; i++) {
            String head = s.substring(0, halfIndex - i);
            String foot = s.substring(halfIndex - i, len - i * 2);
            if (head.equals(foot)) {
                result = head.length() * 2;
                break;
            }
        }

        // 出力
        System.out.println(result);
        sc.close();
    }
}


Measured memory_bytes: 21844
n, x = [int(i) for i in input().split()]

b = [1]
for _ in range(n + 1):
    b.append(b[-1] * 2 + 3)
c = [1]
for _ in range(n + 1):
    c.append(c[-1] * 2 + 1)

def a(x, n):
    if x == 0:
        return 0
    if n == 0:
        return c[0]
    x-=1
    ans = 0
    if x >= b[n - 1]:
        ans += c[n - 1]
        x -= b[n - 1]
    else:
        return a(x, n - 1)
    if x == 0:
        return ans
    elif x == 1:
        return ans + 1
    else:
        ans += 1
        x -= 1
        ans += a(x, n - 1)
        return ans
    
print(a(x,n))


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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void solve() {
    ll A, B, C, K;
    cin >> A >> B >> C >> K;

    ll ans = 0;
    ll t = min(A, K);
    ans += t;
    K -= t;
    t = min(B, K);
    K -= t;
    t = min(C, K);
    ans -= t;

    cout << ans << "\n";
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
using namespace std;

const int maxn = 2e5 + 100;
const int mod = 1e9 + 7;

int A[maxn] = {};
int revA[maxn] = {};

int power(int x, int y) {
	if (!y) return 1;
	int ret = power(x, y >> 1);
	ret = 1ll * ret * ret % mod;
	if (y & 1) ret = 1ll * ret * x % mod;
	return ret;
}

void init() {
	A[0] = 1;
	revA[0] = 1;
	for (int i = 1; i < maxn; ++i) {
		A[i] = 1ll * A[i - 1] * i % mod;
	}
	revA[maxn - 1] = power(A[maxn - 1], mod - 2);
	for (int i = maxn - 2; i >= 1; --i) {
		revA[i] = 1ll * revA[i + 1] * (i + 1) % mod;
	}
}

int C(int n, int m) {
	return (1ll * A[n] * revA[m] % mod * 1ll * revA[n - m] % mod);
}

int n, m, a, b;

int calc() {
	int ret = 0;
	int curi = n - a;
	for (int j = b + 1; j <= m; ++j) {
		int remj = m - j + 1;
		int remi = n - curi;
		(ret += 1ll * C((j - 1) + (curi - 1), (curi - 1)) * C((remj - 1) + (remi -1), (remi - 1)) % mod) %= mod;
	}
	return ret;
}

int main()
{
	ios::sync_with_stdio(0);
	cin >> n >> m >> a >> b;
	init();
	cout << calc() << endl;
	return 0;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()
#define chmin(a,b) a=min(a,b);
#define chmax(a,b) a=max(a,b);

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int nums[109];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;
    cin>>N;
    
    rep(i,N) cin>>nums[i];
    sort(nums,nums+N);
    reverse(nums,nums+N);
    
    int sum=0,a=0,b=0;
    rep(i,N){
        if(i%2==0) a+=nums[i];
        else b+=nums[i];
    }
    cout1(a-b)
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <utility>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;
using pii = pair<int,int>;

bool comp(pii &a, pii &b){
    if(a.second < b.second) return true;
    else if(a.second == b.second ){
        if(a.first > b.first)return true;
    }
    return false;
}

int main(){
    int n;
    int a,b;
    cin >> n;
    vector<pii> vp(n);
    rep(i,n){
        cin >> a >> b;
        vp[i] = make_pair(a,b);
    }

    sort(vp.begin(),vp.end(), comp);
int tot = 0;
    for(auto e: vp){
        //cout << e.first << " " << e.second << endl;
        tot += e.first;
        if(tot > e.second){
            cout << "No" <<endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  int M1 = h1 * 60 + m1;
  int M2 = h2 * 60 + m2;
  int ans = M2 - M1 - k;
  cout << ans << "\n";
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
//ll a[100001]={0};
int main()
{//ios_base::sync_with_stdio(false);
ll a,b,n;
cin>>a>>b>>n;

if(n<b)
{
    ll ans=a*(n)/b;
    ll t=(n)/b;
    t*=a;
    ans-=t;
    cout<<ans;
}
else
{
    ll ans=a*(b-1)/b;
    ll t=(b-1)/b;
    t*=a;
    ans-=t;
    cout<<ans;
}
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define ts cout<<"ok"<<endl
#define int long long
#define hh puts("")
#define ls(x) ((x)<<1)
#define rs(x) ((x)<<1|1)
using namespace std;
int n,m,rt,cnt,w[1000005],c[1000005],head[1000005],num,mo;
int f[1000005],d[1000005],top[1000005],son[1000005],sz[1000005],id[1000005],rk[1000005];
int sum[4000005],tag[4000005];
struct Edge{
	int v,nx;
}e[1000005];
inline int read(){
    int ret=0,ff=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-') ff=-ff;ch=getchar();}
    while(isdigit(ch)){ret=(ret<<3)+(ret<<1)+(ch^48);ch=getchar();}
    return ret*ff;
}
inline void add(int x,int y){
	e[++cnt].v=y;
	e[cnt].nx=head[x];
	head[x]=cnt;
}
void dfs1(int now,int fa){
	sz[now]=1;
	d[now]=d[fa]+1;
	for(int i=head[now];i;i=e[i].nx){
		int v=e[i].v;
		if(v==fa) continue;
		f[v]=now;
		dfs1(v,now);
		sz[now]+=sz[v];
		if(!son[now]||sz[son[now]]<sz[v]) son[now]=v;
	}
}
void dfs2(int now,int fa){
	id[now]=++num;
	rk[num]=now;
	top[now]=fa;
	if(son[now]) dfs2(son[now],fa);
	for(int i=head[now];i;i=e[i].nx){
		int v=e[i].v;
		if(f[now]==v||v==son[now]) continue;
		dfs2(v,v);
	}
}
inline void push_down(int l,int r,int k){
	int mid=(l+r)>>1;
	tag[ls(k)]=tag[ls(k)]+tag[k];
	tag[rs(k)]=tag[rs(k)]+tag[k];
	sum[ls(k)]=sum[ls(k)]+(mid-l+1)*tag[k];
	sum[rs(k)]=sum[rs(k)]+(r-mid)*tag[k];
	tag[k]=0;
}
void update(int l,int r,int x,int y,int v,int k){
	if(x<=l&&r<=y){
		tag[k]=tag[k]+v;
		sum[k]=sum[k]+(r-l+1)*v;
		return;
	}
	push_down(l,r,k);
	int mid=(l+r)>>1;
	if(x<=mid) update(l,mid,x,y,v,ls(k));
	if(mid+1<=y) update(mid+1,r,x,y,v,rs(k));
	sum[k]=sum[ls(k)]+sum[rs(k)];
}
int query(int l,int r,int x,int y,int k){
	if(x<=l&&r<=y) return sum[k];
	push_down(l,r,k);
	int mid=(l+r)>>1,res=0;
	if(x<=mid) res=res+query(l,mid,x,y,ls(k));
	if(mid+1<=y) res=res+query(mid+1,r,x,y,rs(k));
	return res;
}
inline void modify(int x,int y,int z){
	while(top[x]!=top[y]){
		if(d[top[x]]<d[top[y]]) swap(x,y);
		update(1,n,id[top[x]],id[x],z,1);
		x=f[top[x]];
	}
	if(id[x]>id[y]) swap(x,y);
	update(1,n,id[x],id[y],z,1);
}
inline int query_sum(int x,int y){
	int res=0;
	while(top[x]!=top[y]){
		if(d[top[x]]<d[top[y]]) swap(x,y);
		res=res+query(1,n,id[top[x]],id[x],1);
		x=f[top[x]];
	}
	if(id[x]>id[y]) swap(x,y);
	res=res+query(1,n,id[x],id[y],1);
	return res;
}
signed main(){
	n=read(),m=read(),rt=1;
	for(int i=1;i<n;i++){
		int x=read(),y=read();
		add(x,y);
		add(y,x);
	}
	dfs1(rt,0);
	dfs2(rt,0);
	for(int i=1;i<=m;i++){
		int x=read(),y=read();
		update(1,n,id[x],id[x]+sz[x]-1,y,1);
	}
	for(int i=1;i<=n;i++) printf("%lld ",query_sum(i,i));
    return 0;
}

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

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

    for (int i = 0; i < b; i++)
    {
        if((a-1)*i+1>=b){
            cout<<i<<endl;
            break;
        }
    }
    
    
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(ll i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define d_5 100000
#define d9_7 1000000007
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define pf push_front
#define ld long double
#define ll long long
//木構造グラフ
struct edge{
  struct treev* to;
  ll length;
  int num;
  int color;
  int pair;
};
struct treev{
  int num;
  vector<int> nexts;
};
vector<treev*> vs;
vector<edge> es;

vi colors;
int cmax=0;
treev* createtreenode(int num){
  treev* newt;
  try{
      treev* newt=new treev;
  }
  catch (std::bad_alloc&) {
      // メモリ確保に失敗
      // エラー処理
  }
  newt->num=num;
  newt->nexts={};
  return newt;
}
void insertree(ll len,int Va,int Vb,int num){//結ぶ頂点を
  es.pb({vs[Va],len,num,-1});
  es.pb({vs[Vb],len,num,-1});
  int size=es.size();
  es[size-1].pair=size-2;
  es[size-2].pair=size-1;
  vs[Va]->nexts.push_back(size-1);
  vs[Vb]->nexts.push_back(size-2);
  
  return;
}
void DFS(treev* root,ll depth,treev* pre, int precol){
  //ここにやりたい処理を書く
  int ncnt=0;
  for(auto i:root->nexts){
    if(pre==es[i].to){
      continue;
    }
    
    DFS(es[i].to,depth+es[i].length,root,ncnt);
  }
  return;
}
int main(void){
  int n,m;
  ll l;
  cin>>n>>m>>l;
  vll wsha(n,vl(n,llMAX));
  rep(i,m){
    int a,b;
    ll c;
    cin>> a>>b>>c;
    wsha[a-1][b-1]=c;
    wsha[b-1][a-1]=c;

    //insertree(c,a,b,i);

  }
  rep(i,n){
    wsha[i][i]=0;
  }
  //最小コスト
  rep(k,n){
    rep(i,n){
      rep(j,n){
        if(wsha[i][k]==llMAX || wsha[k][j]==llMAX)continue;
        wsha[i][j]=min(wsha[i][j],wsha[i][k]+wsha[k][j]);
      }
    }
  }
  vii wsha2(n,vi(n,intMAX));
  rep(i,n){
    rep(j,n){
      if(i==j){
        wsha2[i][i]=0;
        continue;
      }
      if(wsha[i][j]<=l){
        wsha2[i][j]=1;
      }
    }
  }
  rep(k,n){
    rep(i,n){
      rep(j,n){
        if(wsha2[i][k]==intMAX || wsha2[k][j]==intMAX)continue;
        wsha2[i][j]=min(wsha2[i][j],wsha2[i][k]+wsha2[k][j]);
      }
    }
  }
  int q;
  cin>>q;
  vi s(q);
  vi t(q);

  rep(i,q){
    cin>>s[i]>>t[i];
    s[i]--;t[i]--;
  }
  rep(i,q){
    if(wsha2[s[i]][t[i]]==intMAX){
      cout<<-1<<endl;
    }else{
    cout<<wsha2[s[i]][t[i]]-1<<endl;

    }
  }
  return 0;
}

Measured memory_bytes: 2304
#include<iostream>
#include<cmath>
using namespace std;
int n;

int main(){
  cin >> n;
  double ans = pow(n,3) / 27;
  printf("%.12f\n", (double)ans);
  return 0;
}
// #include <stdio.h>
// int main(){
// int L;
// scanf("%d",&L);
// printf("%.12f\n",(double)L*L*L/27);
// }


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=300000;
int a[maxn];
int b[maxn];
int cnt;
int num;
int n;
set<int>q;
int up;
int down;
int main()
{
    scanf("%d",&n);
    for(int i=1; i<=n; i++)
    {
        scanf("%d",&a[i]);
    }
    for(int i=1;i<=n;i++)
    {
        if(a[i-1]!=a[i])
        {
            b[cnt++]=a[i];
        }
    }
    for(int i=0;i<cnt;i++)
    {
        //cout<<b[i];
    }
    for(int i=0; i<cnt; i++)
    {
        if(i==n-1)
        {
            num++;
            break;
        }
        up=0;
        down=0;
        while(b[i]>=b[i+1]&&i+1<cnt)
        {
           // cout<<a[i]<<" "<<a[i+1]<<endl;
           // cout<<b[i]<<" "<<b[i+1]<<endl;
           // b[i]=0;
          //  b[i+1]=0;
            up=1;
            i++;
        }
        if(up)
        {
            num++;
            i++;
        }
        while(b[i]<=b[i+1]&&i+1<cnt)
        {
            down=1;
            i++;
        }
        if(down)
        {
            num++;
        }
        else if(up)
        {
            i--;
        }
    }
    printf("%d\n",num);
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stdio.h>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)

using namespace std;



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


	pair<int, int>a[1000002];
	rep(i, n) {
		cin >> temp;
		a[i] = make_pair(temp, i);
	}
	sort(a, a + n);

	rep(i, n) {
		if (i != n - 1)cout << a[i].second + 1 << ' ';
		else cout << a[i].second + 1 << endl;
	}

	return 0;
}

Measured memory_bytes: 8576
#include<stdio.h>

int main (void){ 
	
	int n,x,count=0,i,s,t;
	for(;;){
	count = 0;
	scanf("%d %d",&n,&x);
	if(n == 0 && x == 0) break;
	for(i=1;i<=n;i++){
		for(s=1;s<=n;s++){
			for(t=1;t<=n;t++){
				
				if(i+s+t==x && i != t && t != s && s != i){
						count += 1;
				}
				}
			}
		}
	
	
	printf("%d\n",count/6);
	}
return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,k,i,j,mod=1000000007;
    cin>>n>>k;
    long long int ar[n+1],dp[103][100003],pre[103][100003];
    for(i=0;i<=101;i++)
    {
        for(j=0;j<=100002;j++)
        {
            pre[i][j]=0;
            dp[i][j]=0;
        }
    }
    for(i=1;i<=n;i++)
    {
        cin>>ar[i];
    }
    for(i=1;i<=n;i++)
    {
        for(j=0;j<=k;j++)
        {
            if(i==1)
            {
               if(j<=ar[i])
               dp[i][j]=1;
            }
            else
            {
                if(j<=ar[i])
                dp[i][j]=(dp[i][j]%mod+pre[i-1][j]%mod)%mod;
                else
                dp[i][j]=(dp[i][j]%mod+(pre[i-1][j]-pre[i-1][j-ar[i]-1]+mod)%mod)%mod;
            }
            if(j>=1)
            pre[i][j]=(pre[i][j]+(pre[i][j-1]+dp[i][j]+mod)%mod)%mod;
            else
            pre[i][j]=(pre[i][j]%mod+dp[i][j]%mod)%mod;
        }
    }
    cout<<dp[n][k]%mod;
}

Measured memory_bytes: 161152
#!/usr/bin/env python3
import sys
import math
import numpy as np
# from functools import lru_cache

args = sys.argv
if len(args) == 2:
  from IPython import embed
  em = True
else:
  em = False

#### input
N = int(input())
# a, b, c, d = map(int, input().split())
# a = list(map(int, input().split()))
# a = list(map(lambda x: int(x)*(-1), a))  # 各要素を-1倍


# n = int(input())
# t = [int(input()) for i in range(n)]
if em: sys.stdin = open('/dev/tty')

#### functions
# @lru_cache(maxsize=10000)

#### process
# if em: embed()

## heapsort, O(logN)
# import heapq
# heapq.heapify(A)
# min = heapq.heappop(A)
# heapq.heappush(A, new_element)
print(N**3)


Measured memory_bytes: 21644