akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()




//#define int long long
using namespace std;

signed main(){
  ll N; cin>>N;
  vector <ll> A(N);
  REP(i,N) cin>>A[i];
  vector <ll> B(N),C(N);
  ll yobun = 0;
  map <ll,ll> Mb,Mc;
  REP(i,N){
    B[i] = i - A[i];
    C[i] = i + A[i];
    if(B[i] == C[i]) yobun++;
    Mb[B[i]]++;
    Mc[C[i]]++;
  }
  //sort(all(B));
  //sort(all(C));

  ll ans=0;

  /*

  REP(i,N){
    cout<<B[i]<<" ";
  }
  cout<<endl;
  REP(i,N){
    cout<<C[i]<<" ";
  }
  cout<<endl;
  */
 

  //int bi=0,ci=0;
  auto itr1 = Mb.begin();
  auto itr2 = Mc.begin();
  //set <int> com;
  for(;;){
    auto BB = (*itr1);
    auto CC = (*itr2);

    if(itr1==Mb.end() or itr2 == Mc.end()) break;

    if(BB.first > CC.first){
      itr2++;
      continue;
    }
    if(BB.first < CC.first){
      itr1++;
      continue;
    }

    
     ans += BB.second * CC.second;
     // com.insert(B[bi]);
      
      itr1++;
      
    
    


    //if(bi==N-1 and ci == N-1) break;
  }

  /*

  for(auto itr = com.begin();itr != com.end();itr++){
    int now = (*itr) ;
    int cnt1 = 0,cnt2 = 0;
    REP(i,N){
      if(B[i] == now) cnt1++;
      if(C[i] == now) cnt2++;
    }
    ans += cnt1 * cnt2;
  }
  */

 assert(ans - yobun >= 0);

  cout<<ans-yobun<<endl;
  //cout<<yobun<<endl;
  return 0;

}



Measured memory_bytes: 30880
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int a, n;
	cin >> n >> a;
	int f = min(a, 499);
	int g = n % 500;
	if(f >= g){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

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

int main(void){
    char a, b, c;
    int n;
    cin >> a >> b >> c;
    string s="";
    s += a;
    s += b;
    s += c;
    n = stoi(s);
    if(n%4 == 0){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
const int MAXN = 50 + 10;

int n, k;
int a[MAXN];
std::vector<int> res;
void insert(int x) {
  if (a[x] == 0) {
    puts("-1");
    exit(0);
  }
  a[x]--;
  res.push_back(x);
}

int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
  }

  static int seq[MAXN];
  for (int i = 1; i <= n; i++) seq[i] = i;
  
  auto cmp = [=](int x, int y) {
    return a[x] > a[y];
  };
  
  std::sort(seq + 1, seq + n + 1, cmp);
  for (int i = 1; i <= n; i++) {
    insert(seq[i]);
  }

  int last = seq[n];
  for (int ttt = 1; ttt <= k; ttt++) {
    std::vector<int> v;
    for (int i = 1; i <= n; i++) {
      if (i != last) v.push_back(i);
    }

    std::sort(v.begin(), v.end(), cmp);

    for (int i: v) {
      insert(i);
    }

    last = v.back();
  }

  printf("%lu\n", res.size());
  for (int i: res) {
    printf("%d ", i);
  }
  printf("\n");
  
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <map>
#include <numeric>
#include <functional>
#include <math.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)


int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    
    ll X;
    cin >> X;
    
    int i = 0;
    ll tmp = 100;
    while (tmp < X) {
        tmp += tmp/100;
        ++i;
    }
    cout << i << endl;

    return 0;
}


Measured memory_bytes: 3652
#include "bits/stdc++.h"
#define PRECISION(x) cout << fixed << setprecision(x)
#define FAST_IO ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define ALLR(X) (X).rbegin(), (X).rend()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second

using namespace std;
 
template<class T> void max_self(T & a, const T & b) { if(a < b) a = b; }
template<class T> void min_self(T & a, const T & b) { if(a > b) a = b; }
typedef long long LL;
const int INF = 1e9 + 7;
const double PI = acos(-1.0);
const double EPS = (1e-9);

int N, M;
bool visited[10];
vector<int> graph[10];

int cnt(int node, int howMany){
  if(howMany + 1 == N) return 1;

  int count = 0;
  visited[node] = true;
  for(int ele : graph[node]){
    if(visited[ele]) continue;
    count += cnt(ele, howMany + 1);
  }

  visited[node] = false;
  return count;
}

int main(){
  FAST_IO
  memset(visited, false, sizeof false);

  cin >> N >> M;
  for(int rep = 0, x, y; rep < M; ++rep){
    cin >> x >> y;
    graph[x].PB(y);
    graph[y].PB(x);
  }

  cout << cnt(1, 0);
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    n, m = MI()

    isACed = [0] * n
    submmited = [0] * n

    for i in range(m):
        p, res = input().split()
        p = int(p)
        if isACed[p - 1] == 0 and res == "WA":
            submmited[p - 1] += 1

        if res == "AC":
            isACed[p - 1] = 1
    acs = 0
    was = 0
    for i in range(n):
        if isACed[i] == 1:
            acs += 1
            was += submmited[i]

    print(acs, was, sep=" ")


main()


Measured memory_bytes: 76128
a = list(input())
b = list(input())

if len(a) == 0 or len(b) == 0:
	print(max(len(a),len(b)))

else:
	dp = [[None for i in range(len(b)+1)] for j in range(len(a)+1)]
	for i in range(len(a)+1):
		dp[i][0] = i
	for i in range(len(b)+1):
		dp[0][i] = i

	for i in range(1,len(a)+1):
		for j in range(1,len(b)+1):
			aaa = dp[i-1][j-1] if a[i-1] == b[j-1] else dp[i-1][j-1]+1
			dp[i][j] = min(aaa,dp[i-1][j] + 1,dp[i][j-1]+1)

print(dp[-1][-1])


Measured memory_bytes: 42892
#include<iostream>
#include<algorithm>
using namespace std;
int COU(int a,int b){
	if(a==b||a==0)return 1;
	while(true){
		if(a<b){int t=a;a=b,b=t;}
		if(b==0)return a;
		a%=b;
	}
}
int main(){
	int p,q;
	cin>>p>>q;
	q/=COU(p,q);
	for(int i=2;i*i<=q;i++){
		while(!(q%(i*i)))q/=i;
	}
	cout<<q<<endl;
	return 0;
}

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

#define int long long
#define ll unsigned long long
#define pb push_back
#define mp make_pair
#define veci vector<int>
#define pii pair<int,int>
#define reset(a, b) memset(a, b, sizeof(a))
#define rep(i,b) for(int i=0; i<b; i++)
#define repi(i,a,b) for(int i=a; i<=b; i++)
#define repd(i,a,b) for(int i=a; i>=b; i--)
#define fi first 
#define se second
#define all(v) v.begin(),v.end()

int mod=1e9+7;

int powerm(int x,int y, int M){ int res=1; while(y){ if(y&1) res=(res*x)%M; y=y>>1; x=(x*x)%M;} return res%M; }
int  power(int x,int y){ int res=1; while(y){ if(y&1) res=(res*x); y=y>>1; x=(x*x);} return res; }

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    int T;
    T=1;
//    cin>>T;
while(T--){
    int a;
    string b;
    cin>>a>>b;
    int b_temp = b[0] - '0';
    int deci = ((b[2] -'0')* 10 + (b[3] - '0'));
    int ans = (a * b_temp) + (deci * a) / 100;
    cout<<ans<<"\n";
}
    
    return 0;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;


/* macro */
#define int long long
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define sec second
#define fir first
#define pb push_back



/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;


/* constant */
const int inf = pow(2, 62);
const int mod = 1e9 + 7;
int dx[8]={1,0,-1,0,-1,1,-1,1};
int dy[8]={0,1,0,-1,-1,-1,1,1};



/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
string readline(){string s;getline(cin, s);return s;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}


/* general_method */
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }




/* main */



signed main(){

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

    string s = raw_input();

    int ans = inf;

    rep(i,0,s.size() - 2){
        string t = "";
        t.push_back(s[i]);
        t.push_back(s[i + 1]);
        t.push_back(s[i + 2]);

        int tmp = stoi(t);

        chmin(ans, abs(753 - tmp));


    }

    print(ans);



    




    
    
    
    
    








    

    
    




    
    



    
    

    







   




    

    

    




    



    



    

 
    
    


    

    
   
    













}






    










    




    










Measured memory_bytes: 256
n, m, l= map(int,input().split())
A = [list(map(int,input().split()))for i in range(n)]
b = [list(map(int,input().split()))for i in range(m)]
C = []

for i in range(n):
    C_c = []
    for j in range(l):
        c = 0
        for k in range(m):
            c += A[i][k]*b[k][j]
        C_c.append(c)
    C.append(C_c)

for C_c in C:
    print(*C_c)
        


Measured memory_bytes: 7064
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

struct Item
{
    int t,x,y;
    void read()
    {
        scanf(" %d %d %d",&t,&x,&y);
    }
    bool operator < (const Item &r) const
    {
        return t<r.t;
    }
}items[100050];

void work(int n)
{
    for(int i=0;i<n;i++)
    {
        int tmp=abs(items[i+1].x-items[i].x)+abs(items[i+1].y-items[i].y);
        if(tmp>items[i+1].t-items[i].t)
        {
            puts("No");
            return ;
        }
        if(((tmp%2)!=((items[i+1].t-items[i].t)%2)))
        {
            puts("No");
            return ;
        }
    }
    puts("Yes");
}
int main()
{
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        for(int i=1;i<=n;i++)
            items[i].read();
        sort(items+1,items+1+n);
        items[0].x=items[0].y=items[0].t=0;
        work(n);
    }
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
using namespace std;

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

	int n;
	cin >> n;

	int ans = 0;
	for (; n > 0; n--) {
		int x;
		cin >> x;
		while (x % 2 == 0) {
			x /= 2;
			ans++;
		}
	}
	cout << ans << endl;
}


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

using i64=int64_t;

#define rep(i,x,y) for(i64 i=i64(x),i##_max_for_repmacro=i64(y); i<i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
 
const int inf=1.01e9;
const i64 inf64=4.01e18;
const double eps=1e-9;
 
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    i64 N,A,B;
    cin >> N >> A >> B;
    vector<i64> P(N);
    vector<i64> cnt(3);
    rep(i,0,N){
        cin >> P[i];
        if(P[i]<=A) ++cnt[0];
        else if(P[i]<=B) ++cnt[1];
        else ++cnt[2];
    }
    
    cout << min({cnt[0],cnt[1],cnt[2]}) << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<int, int> P;
int main(){
   int n;
   cin>>n;
   vector<int> a(n);
   for(int i=0;i<n;i++)cin>>a.at(i);
   int ans=0;
   for(int left=0;left<n-2;left++){
       vector<int> b={a.at(left),a.at(left+1),a.at(left+2)};
       sort(b.begin(),b.end());
        if(a.at(left+1)==b.at(1))ans++;
   }
   cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long n,i,j,c,x,a,b;
bool res=true;
int main(){
  for(cin>>n,x=n;n!=0;i++)n/=10;
  for(;j<i-1;j++){
    if(x%10!=9)res=false;
    c+=9,x/=10;
  }
  if(i==1)cout<<x;
  else cout<<(res?c+x:c+x-1);
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <math.h>

using namespace std;
int dir[5] = {0,1,0,-1,0};
int main() {
  int H, W;
  cin >> H >> W;
  int Ch, Cw, Dh, Dw;
  cin >> Ch >> Cw >> Dh >> Dw;
  int board[H][W];
  int dist[H][W];
  
  for (int i=0; i<H; i++) {
    for (int j=0; j<W; j++) {
	  char x;
      cin >> x;
      if (x == '#') {
        board[i][j] = 0;
      } else {
        board[i][j] = 1;
      }
        dist[i][j] = 10000000;
    }
  }
     
  queue<int> whole_q;
  whole_q.push(Cw-1 + W * (Ch-1));
  int goal_dist = -1;
  int cur = 2;
  //board[Ch][Cw] = 2;
  dist[Ch-1][Cw-1]  = 0;
  while (!whole_q.empty()) {
    const int pos = whole_q.front();
    whole_q.pop();
    const int x = pos % W;
    const int y = pos / W;
    if (board[y][x] != 1) continue;
    queue<int> board_q;
    board_q.push(x + W*y);
    const int cur_dist = dist[y][x];
    while (!board_q.empty()) {
      const int bp = board_q.front();
      board_q.pop();
      const int bx = bp % W;
      const int by = bp / W;
      if (board[by][bx] != 1) continue;
      if (by == Dh-1 && bx == Dw-1) {
        while (!whole_q.empty()) whole_q.pop();
        while (!board_q.empty()) board_q.pop();
        goal_dist = cur_dist;
        break;
      }
      board[by][bx] = cur;
      dist[by][bx]  = cur_dist;
      for (int i=0; i<4; i++) {
        if (bx+dir[i] < 0 || bx+dir[i] >= W || by+dir[i+1] < 0 || by+dir[i+1] >= H) continue;
        if (board[by + dir[i+1]][bx + dir[i]] != 1) continue;
        board_q.push(bx+dir[i] + W*(by+dir[i+1]));
      }
      for (int i=-2; i<=2; i++) {
        for (int j=-2; j<=2; j++) {
          if (bx+j < 0 || bx+j >= W || by+i < 0 || by+i >= H) continue;
          if (abs(i) + abs(j) < 2) continue;
          if (board[by + i][bx + j] != 1) continue;
          whole_q.push(bx+j + W*(by+i));
          dist[by+i][bx+j] = min(dist[by+i][bx+j], cur_dist + 1);
        }
      }
    } //while_board
    cur++;
  }//while_whole
  cout << goal_dist;
  return 0;
}

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

typedef int ll;
#define int long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef pair<int,int>pii;

const int maxn=1e5+55;
int a[maxn];
bool vis[maxn];
vector<int>prime;
map<int,int>mpp,mppp;

void seave() {
	for (int i=2 ; i<maxn ; i+=2)
		vis[i]=1;
	prime.pb(2);
	for (int i=3 ; i<maxn ; i+=2) {
		if(vis[i])	continue;
		prime.pb(i);
		for (int j=i ; j<maxn ; j+=(2*i)) 
			vis[j]=1;
	}
}

void factor(int n) {
	// cout<<n<<" ";
	int num1=1,num2=1;
	for (int i=0 ; prime[i]<=3000 ; i++) {
		int cnt=0;
		while (n%prime[i]==0) {
			cnt++;
			n/=prime[i];
		}
		cnt%=3;
		if(cnt!=0) {
			for (int j=0 ; j<cnt ; j++)
				num1=num1*prime[i];
			cnt=3-cnt;
			for (int j=0 ; j<cnt ; j++)
				num2=num2*prime[i];
		}
		
	}
	if(n!=1) {
		int a=sqrt(n);
		if(a*a==n) {
			num1=num1*a*a;
			num2=num2*a;
		}
		else {
			num1=num1*n;
			num2=num2*n*n;		
		}
	}
	// cout<<num1<<" "<<num2<<endl;
	mpp[num1]++;
	mppp[num1]=num2;
}

ll main() {
	// freopen("Task.in","r",stdin);freopen("Task.out","w",stdout);

	std:ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	seave();
	int n,ans=0;
	cin>>n;

	for (int i=0 ; i<n ; i++) {
		int a;
		cin>>a;

		factor(a);
	}

	for (map<int,int>::iterator it=mpp.begin() ; it!=mpp.end() ; it++) {
		int val=it->ss;
		if(mpp.find(mppp[it->ff])!=mpp.end()) {
			if(val<mpp[mppp[it->ff]])
				val=mpp[mppp[it->ff]];
			mpp[mppp[it->ff]]=0;
			it->ss=0;
		
		}
		if(it->ff==mppp[it->ff])
			val=1;
		ans+=val;
	}
	cout<<ans<<endl;
}

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

using namespace std;

#define ll long long

const int mod = 1e9 + 7;

const int N = 1e3 + 10;

vector<pair<pair<ll,ll>,ll>> v;

bool cmp(const pair<pair<ll,ll>,ll> &a,const pair<pair<ll,ll>,ll> &b) {
    return a.first.first + a.first.second < b.first.first + b.first.second;
}

ll dp[N][10001];int n;

ll giveres(int indx,int w) {
    if(indx == n) return 0;
    if(w > 1e4) return 0;
    ll &ret = dp[indx][w];
    if(ret != -1) return ret;
    if(w <= v[indx].first.second) {
        ret = giveres(indx + 1,w + v[indx].first.first) + v[indx].second;
    }
    ret = max(ret,giveres(indx + 1,w));
    return ret;
}

int main() {

    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    cin >> n;
    for(int i = 0; i < n; i++) {
        ll a,b,c;
        cin >> a >> b >> c;
        v.push_back({{a,b},c});
    }
    sort(v.begin(),v.end(),cmp);
    
    memset(dp,-1,sizeof(dp));
    cout << giveres(0,0) << "\n";
    return 0;
}


Measured memory_bytes: 82620
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
double x[10], y[10];

double dist(int i, int j) {
  double dx = x[i] - x[j];
  double dy = y[i] - y[j];
  return sqrt(dx*dx+dy*dy);
}

int main() {
  int N; cin >> N;
  int fact = 1;
  for(int i = 1; i <= N; i++) fact*=i;
  for(int i = 1; i <= N; i++) {
    cin >> x[i] >> y[i];
  }

  double ans = 0.;
  vector<int> v(N);
  for(int i = 0; i < N; i++) v[i] = i+1;
  do {
    for(int i = 0; i < N-1; i++) ans += dist(v[i], v[i+1]);
  } while(next_permutation(v.begin(), v.end()));
  cout << fixed << setprecision(10);
  cout << ans / fact << endl;
  return 0;
}


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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

int N, K;

signed main()
{
  cin >> N >> K;
  if(K == 1) {
    cout << 0 << endl;
    return 0;
  }
  cout << N-K << endl;
  return 0;
}


Measured memory_bytes: 256
a,b,c,x,y = map(int,input().split())
cou = 0
lis = []
lis.append(a * x + b * y)
lis.append(max(x,y) * 2 * c)
nu = min(x,y)
cou += min(x,y) * 2 * c
x -= nu
y -= nu
cou += x * a + y * b
lis.append(cou)

print(min(lis))


Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		String[] arrInt = (new BufferedReader(new InputStreamReader(System.in))).readLine().split(" ");

		int a = Integer.parseInt(arrInt[0]);
		int b = Integer.parseInt(arrInt[1]);

		if(a < b) System.out.println("a < b");
		else if(a > b) System.out.println("a > b");
		else System.out.println("a == b");
	}
}

Measured memory_bytes: 24124
# util functions
# union find
$uf_par  = []
$uf_rank = []
$uf_vs   = []
def uf_init( num )
  $uf_par  = []
  $uf_rank = []
  $uf_vs   = []  
  num.times do |i|
    $uf_par[i] = i
    $uf_rank[i] = 0
    $uf_vs[i] = 1
  end
end

def uf_find(x)
  raise "x = #{x} is out of range 0..#{$uf_par.size - 1}" unless $uf_par[x]
  if $uf_par[x] == x
    return x
  else
    return uf_find( $uf_par[x] )
  end
end

def uf_unite( x, y )
  xrt = uf_find(x)
  yrt = uf_find(y)
  return if xrt == yrt
  
  if $uf_rank[xrt] > $uf_rank[yrt]
    $uf_par[yrt] = xrt
    $uf_vs[xrt] += $uf_vs[yrt]
  else
    $uf_par[xrt] = yrt
    $uf_vs[yrt] += $uf_vs[xrt]
    $uf_rank[yrt] += 1 if $uf_rank[xrt] == $uf_rank[yrt]
  end
end

def uf_same( x, y ) # rets true/false
  return uf_find( x ) == uf_find( y )
end

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

# input
inputs = []
lc = 0
while l = $stdin.gets do
  if false
    inputs << l.chomp.split(" ").map(&:to_s)
  else
    inputs << l.chomp.split(" ").map(&:to_i)
  end
  lc += 1
end

# input check
if $debugFlag
  p "--- INPUT (begin) ---"
  inputs.each do |l_i|
    p l_i
  end
  p "--- INPUT (end) ---"
  print "\n"
end

# body
$nn = inputs[0][0]
$mm = inputs[0][1]
$setE = inputs[1..-1]

if $debugFlag
  print "nn: "
  p $nn
  print "mm: "
  p $mm
  print 
  p $setE
end

result = []
cur = $nn * ($nn - 1) / 2
result << cur

uf_init( $nn )
$setE.reverse!
($setE.size-1).times do |i|
  if uf_same($setE[i][0]-1, $setE[i][1]-1 )
    result << cur
    next
  end

  cur -= $uf_vs[ uf_find( $setE[i][0]-1 ) ] * $uf_vs[ uf_find( $setE[i][1]-1 ) ]
  result << cur
  uf_unite( $setE[i][0]-1, $setE[i][1]-1 )
end

result.reverse.each do |e_i|
  puts e_i
end


Measured memory_bytes: 15712
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    int n;
    cin >> n;
    vector<ll> a(n + 1), b(n);
    for(int i = 0; i < n + 1; i++){
        cin >> a[i];
    }
    a.push_back(0);
    for(int i = 0; i < n; i++){
        cin >> b[i];
    }
    b.push_back(0);
    ll ans = 0;
    for(int i = 0; i < n; i++){
        ans += min(a[i], b[i]);
        b[i] = max(0LL, b[i] - a[i]);
        ans += min(a[i + 1], b[i]);
        a[i + 1] = max(0LL, a[i + 1] - b[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
import itertools
import math
N=int(input())
B=[]
C=[1,2,3]
for i in range(N):
    A,C=map(int,input().split())
    B.append([A,C])


D=(list(itertools.permutations(range(N))))
#print(B)
#print(D)
#print(len(D))
total=0
for i in range(len(D)):
    for j in range(N-1):
        total+=math.sqrt((B[D[i][j]][0]-B[D[i][j+1]][0])*(B[D[i][j]][0]-B[D[i][j+1]][0])+(B[D[i][j]][1]-B[D[i][j+1]][1])*(B[D[i][j]][1]-B[D[i][j+1]][1]))
        #print(B[j][0],B[j][1])
        #print(B[j+1][0],B[j+1][1])
        #print('')

print(total/len(D))

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

int main() {
    int N, a[109];
	cin >> N;
	for (int i = 0; i < N; i++) cin >> a[i];
	sort(a, a + N, greater<int>());
	int ret = 0;
	for (int i = 0; i < N; i++) ret += a[i] * (i & 1 ? -1 : 1);
	cout << ret << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int A,B;
    cin>> A >> B;
    if ((A>=0 && A<=100) && (B>=2 && B<=1000) && (B%2==0))
        if (A>=13)
            cout<< B;
        else if (A>=6 && A<=12)
            cout << B*0.5 ;
        else if (A<=5)
            cout<< "0";
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
typedef long long ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int INF = 1e9 + 5;
/////////////////////////////////////////////////////////////////////

int main() {
    string a, b;
    cin >> a >> b;
    vector<vector<pair<int, pair<int, int>>>> dp(a.length() + 1, 
        vector<pair<int, pair<int, int>>>(b.length() + 1, make_pair(-INF, make_pair(0, 0))));
    dp[0][0] = {0, {0, 0}};
    for (int i = 0; i < (int) a.length(); ++i) {
        for (int j = 0; j < (int) b.length(); ++j) {
            if (a[i] == b[j]) chmax(dp[i + 1][j + 1], make_pair(dp[i][j].first + 1, make_pair(i, j)));
            chmax(dp[i + 1][j], make_pair(dp[i][j].first, make_pair(i, j)));
            chmax(dp[i][j + 1], make_pair(dp[i][j].first, make_pair(i, j)));
        }
    }

    auto res = make_pair(0, make_pair(0, 0));
    for (int i = 0; i <= (int) a.length(); ++i) {
        for (int j = 0; j <= (int) b.length(); ++j) {
            chmax(res, make_pair(dp[i][j].first, make_pair(i, j)));
        }
    }

    string s;
    pair<int, int> curr = res.second;
    while (!(curr.first == 0|| curr.second == 0)) {
        int i = curr.first;
        int j = curr.second;
        auto perivous = dp[i][j].second;
        if (perivous == make_pair(i - 1, j - 1)) {
            s += a[i - 1];
        }
        curr = perivous;
    }
    reverse(s.begin(), s.end());
    cout << s << endl;

    return 0;
}

Measured memory_bytes: 105984
import sys


def resolve():
    readline = sys.stdin.readline

    N = int(readline())
    a = [int(x) for x in readline().split()]
    ans = 0
    for i in range(N):
        if (i + 1) % 2 == 1 and a[i] % 2 == 1:
            ans += 1
    print(ans)
    

resolve()


Measured memory_bytes: 9164
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define all(x) x.begin(), x.end()

int main() {
  ll n, m;
  cin >> n >> m;
  if (n >= 10 || m >= 10) {
    cout << -1 << endl;
  } else {
    cout << n * m << endl;
  }
}

Measured memory_bytes: 256
from collections import deque
sa=deque(list(input()))
sb=deque(list(input()))
sc=deque(list(input()))
sa.append("a")
sb.append("b")
sc.append("c")
tmp=sa.popleft()

while(len(sa)*len(sb)*len(sc)!=0):
    if tmp=="a":
        tmp=sa.popleft()
    elif tmp=="b":
        tmp=sb.popleft()
    elif tmp=="c":
        tmp=sc.popleft()
print("A" if len(sa)==0 else "B" if len(sb)==0 else "C")

Measured memory_bytes: 3316
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) throws IOException {
		InputReader in = new InputReader(System.in);
		String s = in.readString(); 
		System.out.println(s.charAt(0) + "" + (s.length()-2)  + ""+ s.charAt(s.length()-1)); 
	}
}
class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}


Measured memory_bytes: 22612
import numpy as np
 
c = np.array([list(map(int,input().split())) for _ in range(3)])

c -= np.min(c,axis=0)
c -= np.reshape(np.min(c,axis=1),(3, 1))

if(np.all(c==0)):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 12516
#include<bits/stdc++.h>
#define MAX 1000000007
#define ll long long int
#define fo(i,n) for(int i=0;i<n;i++)
#define ull unsigned long long int
#define pb push_back
#define eb emplace_back
using namespace std;

ll power(ll x, ll y)
{
    ll res = 1;
    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1) {
            res = ((res) * (x));
        }
        y = y>>1;  // y = y/2
        x = ((x)*(x));
    }
    return res;
}

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    // int t;
    // cin>>t;

    // while(t--) {
        
        

    // }
    int n,x,t;
    cin>>n>>x>>t;
    if(x>n){
        cout<<t<<endl;
    }
    else if(n >= x && n%x==0){
        int z = n/x;
        cout<<z*t<<endl;

    }
    else{
        int z = n/x;
        cout<<t*(z+1)<<endl;
    }

    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <unordered_map> 

using namespace std;
#define MAXN 100000
#define pb push_back
#define ll long long
#define I(x,y) (1ll*(x)*n+~-(y))
#define U(x) ((x)/n)
#define V(x) ((x)%n+1)
#define rint register int
#define gc() getchar()
inline int read(rint ans = 0, rint sgn = ' ', rint ch = gc())
{
	for(; ch < '0' || ch > '9'; sgn = ch, ch = gc());
	for(; ch >='0' && ch <='9';(ans*=10)+=ch-'0', ch = gc());
	return sgn-'-'?ans:-ans;
}
int fa[MAXN+5], n, c; vector<ll> q; vector<int> e[MAXN+5]; unordered_map<ll,int> g; inline int getf(int x){return x^fa[x] ? fa[x]=getf(fa[x]) : x;}
int main()
{
	n = read(), c = 1; for(rint i = 1; i <= n; fa[i] = i, i++); for(rint i = 1, u, v; i <= (n<<1)-2; u = read(), v = read(), e[u].pb(v), e[v].pb(u), ++g[I(v,u)], ++g[I(u,v)]==2 ? q.pb(I(u,v)),0 : 0, i++);
	for(rint i = 0, u, v, j, t; i < (int)q.size() && c < n; i++)
		if(u = getf(U(q[i])), v = getf(V(q[i])), e[v].size()<e[u].size()?u^=v^=u^=v:0, g[q[i]]==2&&u^v)
			for(++c, fa[u] = v, j = 0; j < (int)e[u].size(); t = e[u][j], e[v].pb(t), e[t].pb(v), g[I(t,v)] += g[I(t,u)], (g[I(v,t)]+=g[I(u,t)])==2 ? q.pb(I(v,t)),0 : 0, j++); puts(c^n?"NO":"YES"); return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD 1000000000 + 7
#define PI 3.14159265359

const long long INF = 100000;
typedef pair<int,int> P;
typedef long long ll;

using Graph = vector<vector<int>>;

vector<int> d(100000 + 5, -1);// d[i]は頂点1から頂点iまでの距離
vector<int> sign(100000 + 5, -1);// sign[i]は頂点iのしるべ

//頂点1から近い頂点から順にしるべを置いていく
void bfs(const Graph &G) {
	queue<int> que;
	que.push(1);

	while (que.size()) {
		int iTop = que.front();
		que.pop();

		for (auto next_iTop : G[iTop]) {
          	if (next_iTop == 1) continue;
			if (sign[next_iTop] == -1) {        	
				sign[next_iTop] = iTop;
				que.push(next_iTop);
			}
		}
	}
}

int main() {
	int N, M;
	cin >> N >> M;
	Graph maze(N + 1);

	for (int i = 0; i < M; i++) {
		int A, B;
		cin >> A >> B;
		maze[A].push_back(B);
		maze[B].push_back(A);
	}
	bfs(maze);
  	cout << "Yes" << endl;
  
	for (int i = 2; i <= N; i++) {
		cout << sign[i] << endl;
	}
}


Measured memory_bytes: 10672
extern crate core;

use std::io::{self, Read};

#[macro_export]
macro_rules! input {
  ($s:expr=>$($t:tt)*) => {
    let mut lines=$s.split("\n");
    $(
        line_parse!(lines,$t);
    )*
  };
}

macro_rules! line_parse {
  ($lines:expr,($($name:ident:$t:tt)*)) => {
    let mut line=$lines.next().unwrap().split_whitespace();
    $(value_def!(line,$name,$t);)*
  };

  //複数行
  ($lines:expr,{$n:expr;$name:ident:$t:tt}) => {
    values_def!($lines,$n,$name,$t);
  };
}

macro_rules! value_def {
    ($line:expr, $name:ident, $t:tt) => {
        let $name = value!($line, $t);
    };
}

macro_rules! values_def {
    ($lines:expr, $n:expr, $name:ident, $t:tt) => {
        let $name = {
            let mut vec = Vec::new();
            for i in 0..$n {
                let mut next = $lines.next().unwrap().split_whitespace();
                vec.push(value!(next, $t));
            }
            vec
        };
    };
}

macro_rules! value {
  //配列
  ($line:expr,[$t:tt]) => {
    $line.map(|x|{
      let mut iter=::std::iter::once(x);
      value!(iter,$t)
    }).collect::<Vec<_>>()
  };
  //タプル
  ($line:expr,($($t:tt),*)) => {
    ($(value!($line,$t),)*)
  };
  //文字列
  ($line:expr,#) => {
    $line.next().unwrap()
  };
  //インデックス(-1)
  ($line:expr,@) => {
    $line.next().unwrap().parse::<usize>().unwrap()-1
  };
  //単一値
  ($line:expr,$t:ty) => {
    $line.next().unwrap().parse::<$t>().unwrap()
  };
}

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = solve(input.trim().to_string());
    println!("{}", output);
}

fn solve(input: String) -> String {
    input!(input=>(a:f64 b:f64 h:f64 m:f64));

    // 時の角度。上を0とする
    let hr = -(((h) / 12f64 + (m / 60f64) * (1f64 / 12f64)) * 2.0 * std::f64::consts::PI);
    let mr = -(m / 60f64 * 2.0 * std::f64::consts::PI);

    let hx = hr.cos() * a;
    let hy = hr.sin() * a;

    let mx = mr.cos() * b;
    let my = mr.sin() * b;

    let vx = hx - mx;
    let vy = hy - my;

    (vx * vx + vy * vy).sqrt().to_string()
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!($output.trim().to_string(),super::solve($input.trim().to_string()));
                }
            )*
        }
    }
}

tests! {
    test1: "3 4 9 0\n" => "5.00000000000000000000\n",
    test2: "3 4 10 40\n" => "4.56425719433005567605\n",
}


Measured memory_bytes: 2904
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(){

    double a, b, c, d, e, f;
    for(;cin >> a >> b >> c >> d >> e >> f;){
        double x = (e * c - b * f) / (a * e - b * d);
        double y = (-d * c + a * f) / (a * e - b * d);
        
        printf("%.3f %.3f\n", x+0.00000001, y+0.00000001);
    }

    return 0;
}


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

int main(void) {

	// TODO: submit前にprintf-debugの削除確認！
	string S;
	cin >> S;

	int num[S.length()];
	for(int i=0; i<S.length(); i++) {
		num[i] = 1;
	}

	int revPos = -1;
	int ans[S.length()] = {0};
	for(int i=0; i<S.length(); i++) {
		if(S[i] == 'R') {
			if(revPos < i) {
				revPos = i+1;
				while(S[revPos] == 'R') revPos++;
			}

			if((revPos-i)%2) {
				ans[revPos-1]++;
			} else {
				ans[revPos]++;
			}
		}
	}
	revPos=S.length();
	for(int i=S.length()-1; i>=0; i--) {
		if(S[i] == 'L') {
			if(revPos > i) {
				revPos = i-1;
				while(S[revPos] == 'L') revPos--;
			}

			if((i-revPos)%2) {
				ans[revPos+1]++;
			} else {
				ans[revPos]++;
			}
		}
	}

	for(int i=0; i<S.length(); i++) {
		if(i != 0) cout << ' ';
		cout << ans[i];
	}
	return 0;
}

Measured memory_bytes: 1408
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        char[] c = new char[n];
        c = in.next().toCharArray();

        int ans = 0;
        int i = 0, j = n - 1; 
        while (i < j) {
            while (i < n && c[i] == 'R') {
                i++;
            }
            while (j >= 0 && c[j] == 'W') {
                j--;
            }

            if (i >= j) {
                break;
            }

            ans++;
            i++;
            j--;
        }

        System.out.println(ans);

    }
}

Measured memory_bytes: 41236
#include <bits/stdc++.h>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

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

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;

void solve()
{
	int n;
	cin>>n;
	vector<ll>ans(n+5);
	for(int i=1;i*i<=n;++i){
		for(int j=1;j*j<=n;++j){
			for(int k=1;k*k<=n;++k){
				if(i*i+j*j+k*k+i*j+j*k+k*i<=n){
					ans[i*i+j*j+k*k+i*j+j*k+k*i]++;
				}
			}
		}
	}
	for(int i=1;i<=n;++i){
		cout<<ans[i]<<"\n";
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 3692
#include <vector>
#include <sstream>
#include <algorithm>
#include <fstream>
#include <list>
#include <map>
#include <istream>
#include <bitset>
#include <sstream>
#include <unordered_map>
#include <stack>
#include <set>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <queue>
#include <string>

#define int long long
#define endl "\n"
#define all(x) x.begin(),x.end()
#define rr return 0
#define xx first
#define yy second
#define pii pair<int,int>

using namespace std;

typedef long long ll;
typedef long double ld;

bool cmp(pii a, pii b){
    return a.yy < b.yy;
}
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<pii> a(n);
    for(int i = 0;i < n;i++){
        cin >> a[i].xx >> a[i].yy;
    }
    sort(all(a), cmp);
    int t = 0;
    for(int i = 0;i < n;i++){
        if((t + a[i].xx) <= a[i].yy){
            t += a[i].xx;
        }else{
            cout << "No";
            rr;
        }
    }
    cout << "Yes";
    rr;
}


Measured memory_bytes: 3328
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int timeLimit = sc.nextInt();
        Integer cMin = null;
        for (int i = 0; i < n; i++) {
            int c = sc.nextInt();
            int t = sc.nextInt();
            if (t <= timeLimit) {
                if (cMin == null || c < cMin) {
                    cMin = c;
                }
            }
        }
        System.out.println(cMin == null ? "TLE" : cMin);
    }
}


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


int main(){


    int n, i, t;

    int k = 0;

    vector<int> p;


    cin >> n;


    for( i = 0 ; i < n ; i = i + 1 ){

         cin >> t;

         p.push_back(t);

         }


    for( i = 0 ; i < n ; i = i + 1 ){

         if( p.at(i) != i + 1 ) k += 1;

         }


    if( k == 0 || k == 2 ) cout << "YES" << endl;

    else cout << "NO" << endl;

    
    return 0;


    }

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed up
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed up
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed down
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed down
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
//    cout << fixed << setprecision(15);

    string s,t; cin >> s >> t;
    i32 a = 0;
    rep(i, s.size()) {
        if(s[i] != t[i]) a++;
    }

    cout << a << '\n';

    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 3776
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//またはかかつか
//例外処理は最初にする
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
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;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll MOD = (pow(10, 9) + 7);

int main() {
	ll N; cin >> N;
	vector<string> S(N); rep(i, N)cin >> S[i];

	vector<ll> a(5);
	rep(i, N) {
		if (S[i][0] == 'M') a[0]++;
		if (S[i][0] == 'A') a[1]++;
		if (S[i][0] == 'R') a[2]++;
		if (S[i][0] == 'C') a[3]++;
		if (S[i][0] == 'H') a[4]++;
	}

	ll ans = 0;
	for (int i = 0; i < 5; i++) {
		for (int j = i + 1; j < 5; j++) {
			for (int k = j + 1; k < 5; k++) {
				if (a[i] > 0 && a[j] > 0 && a[k] > 0) {
					ans += (a[i] * a[j] * a[k]);
				}
			}
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 6144
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

def main():
    N = int(input())
    H = list(map(int, input().split()))

    n = 1
    max_num = H[0]
    for i in range(1, N):
        if H[i] >= max_num:
            n += 1
            max_num = H[i]
    print(n)

main()


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

//ifstream cin("/home/mihai/Documents/c++/A/A.in");
//ofstream cout("/home/mihai/Documents/c++/A/A.out");

//ifstream f("perle.in");
//ofstream g("perle.out");

int main()
{
	int n;
	cin >> n;
	if(n == 1)
	{
		cout << 2;
		return 0;
	}
	if(n == 2)
	{
		cout << 2;
		return 0;
	}
	if(n % 2 == 0)
		cout << n;
	else
		cout << 2 * n;
}

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

int n;
int a[200001];
bool f;

int main(){
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> a[i];
    sort(a, a+n);
    f = true;
    for (int i = 0; i < n-1; ++i) f &= (a[i] != a[i+1]);
    cout << (f ? "YES" : "NO");
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
ll x,y,th[65];
ll dp[65][2][2][2];
//b<=x<=y<=a
ll rec(ll b,ll a){
	ll ans=0;
	{
		{
			vector<int>vec;
			ll A = a;
			while(A){ vec.pb(A&1); A/=2; }
			reverse(vec.begin(),vec.end());
			vector<int>vec2;
			A = b;
			while(A){ vec2.pb(A&1); A/=2; }
			while(vec2.size() < vec.size()) vec2.pb(0);
			reverse(vec2.begin(),vec2.end());
			dp[0][0][0][0] = 1;
			rep(i,vec.size()){
				//0,0
				rep(k,2){
    				if(vec2[i]==0)dp[i+1][0][(vec[i]==1?1:0)][k]+=dp[i][0][0][k];
    				if(vec2[i]==0)dp[i+1][0][1][k]+=dp[i][0][1][k];
    				dp[i+1][1][(vec[i]==1?1:0)][k]+=dp[i][1][0][k];
    				dp[i+1][1][1][k]+=dp[i][1][1][k];
				}
				//0,1
				for(int k=1;k<=1;k++){
    				if(vec2[i]==0&&vec[i]==1)dp[i+1][0][0][k]+=dp[i][0][0][k];
    				if(vec2[i]==0)dp[i+1][0][1][k]+=dp[i][0][1][k];
    				if(vec[i]==1)dp[i+1][1][0][k]+=dp[i][1][0][k];
    				dp[i+1][1][1][k]+=dp[i][1][1][k];
				}
				//1,1
				rep(k,2){
    				if(vec[i]==1)dp[i+1][(vec2[i]==1?0:1)][0][1]+=dp[i][0][0][k];
    				dp[i+1][(vec2[i]==1?0:1)][1][1]+=dp[i][0][1][k];
    				if(vec[i]==1)dp[i+1][1][0][1]+=dp[i][1][0][k];
    				dp[i+1][1][1][1]+=dp[i][1][1][k];
				}
				rep(x,2)rep(y,2)rep(k,2)dp[i+1][x][y][k]%=mod;
			}
			rep(x,2)rep(y,2)ans += dp[vec.size()][x][y][1];
			return (ans%mod);
		}
	}
}
int main(){
	cin>>x>>y;
	ll ans = rec(x,y);
	cout <<(ans%mod+mod)%mod <<endl;
}

Measured memory_bytes: 256