akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#include<time.h>
#include<stdlib.h>
#define pb push_back
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define ull unsigned long long
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/__gcd((a),(b))
#define clr(x) x.clear()
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vi>
#define mp make_pair
#define hell 1000000007

using namespace std;

int main()
{
    IOS
    int r,c;
    cin>>r>>c;
    cin.ignore();
    char a[r][c];
    ll dp[r][c];
    for(int i=0;i<r;i++)
    {
        for(int j=0;j<c;j++){
            cin>>a[i][j];
            if(a[i][j]=='#')
                dp[i][j]=0;
        }
        cin.ignore();
    }
    if(a[r-1][c-2]=='.')
        dp[r-1][c-2]=1;
    if(a[r-2][c-1]=='.')
        dp[r-2][c-1]=1;
    for(int j=c-3;j>=0;j--)
    {
        if(a[r-1][j]=='.')
            dp[r-1][j]=dp[r-1][j+1];
    }
    for(int j=r-3;j>=0;j--)
    {
        if(a[j][c-1]=='.')
            dp[j][c-1]=dp[j+1][c-1];
    }
    for(int i=r-2;i>=0;i--)
        for(int j=c-2;j>=0;j--)
            if(a[i][j]=='.')
                dp[i][j]=(dp[i+1][j]+dp[i][j+1])%hell;
    cout<<dp[0][0]<<"\n";
    return 0;
}


Measured memory_bytes: 9088
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define ll long long
//#define double long double
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

const int INF = 1e9;
const int MB = 30;
const int MOD = 1e9 + 7;
const int maxN = 2e5 + 1;

vector<vector<int>> g, a;
vector<int> c, s, tin, tout;

int timer = 0;

void dfs(int v, int p = -1) {
    s[v] = 1;
    tin[v] = timer++;
    for (int u : g[v]) {
        if (u != p) {
            dfs(u, v);
            s[v] += s[u];
        }
    }
    tout[v] = timer++;
    a[c[v]].push_back(v);
}

bool isParent(int a, int b) {
    return tin[b] <= tin[a] && tout[a] <= tout[b];
}

void solve() {
    int n;
    cin >> n;
    c.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> c[i];
        c[i]--;
    }

    g.resize(n);
    for (int i = 0; i < n - 1; i++) {
        int from, to;
        cin >> from >> to;
        from--; to--;
        g[from].push_back(to);
        g[to].push_back(from);
    }

    s.resize(n);
    a.resize(n);
    tin.resize(n);
    tout.resize(n);
    dfs(0);

    vector<int> ans(n);
    for (int i = 0; i < n; i++) {
        stack<int> st;
        int minusUp = 0;
        for (int v : a[i]) {
            reverse(all(g[v]));
            int sum = 0;
            for (int u : g[v]) {
                if (isParent(v, u)) continue;
                int my = s[u];
                while (!st.empty() && isParent(st.top(), u)) {
                    int w = st.top();
                    my -= s[w];
                    minusUp -= s[w];
                    st.pop();
                }
                ans[i] += my * sum;
                sum += my;
            }
            ans[i] += sum * (n - s[v] - minusUp);
            ans[i] += sum + n - s[v] - minusUp + 1;
            minusUp += s[v];
            st.push(v);
        }
    }
    for (int i : ans) cout << i << '\n';
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //int t;
    //cin >> t;
    int t = 1;
    //srand(time(0));
    cout.precision(12);
    cout << fixed;
    while (t--) solve();
}

Measured memory_bytes: 43172
#include <bits/stdc++.h>
        using namespace std;
   #define int long long
const int MAX = 510000;
const int MOD =  998244353;
//
int x[1000];bool dp[1000][5001];
vector<int> ko[1000];
int  dfs(int a){
     dp[a][0]=true;
     int al=0;
     for(int i=0;i<ko[a].size();i++){
          al+=x[ko[a][i]];
         
          int p=dfs(ko[a][i]);
          bool q;
          if(p==-1)return -1;
          al+=p;
          for(int j=x[a];j>=0;j--){
               q=false;
               if(j-x[ko[a][i]]>=0)q|=dp[a][j-x[ko[a][i]]];
               if(j-p>=0)q|=dp[a][j-p];
               dp[a][j]=q;
          }
  
     }
     for(int j=x[a];j>=0;j--){
          if(dp[a][j]){
           //    cerr<<a<<' '<<al-j<<endl;
               return al-j;
          }
     }
     return -1;

}
     signed main(){
         int n,p;cin>>n;
          for(int i=1;i<n;i++){
               cin>>p;p--;
               ko[p].push_back(i);
          }
          for(int i=0;i<n;i++)cin>>x[i];
     if(dfs(0)==-1)cout<<"IMPOSSIBLE"<<endl;
     else cout<<"POSSIBLE"<<endl;
   }
         


        


Measured memory_bytes: 4864
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
int a[100002];
int main(void)
{
	int n, t, imax = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &t);
		a[t]++;
		a[t + 1]++;
		a[t + 2]++;
	}
	for (int i = 0; i < 100002; i++)
	{
		imax = max(imax, a[i]);
	}
	printf("%d", imax);
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <map>
#include <set>
using namespace std;
int main(void){
    int n;
    long long k, ans = 0;
    vector<long long> a, sum;
    map<long long, int> p;
    map<long long, set<int> > ps;
    cin >> n >> k;
    a.assign(n+1, 0);
    sum.assign(n+1, 0);

    p[0]++;
    for(int i=1;i<=n;i++){
        cin >> a[i];
        sum[i] = sum[i-1] + a[i];
        if(i >= k){
            p[(sum[i-k]-i+k*i)%k]--;
        }
        ans += p[(sum[i]-i+k*i)%k]++;
        //cout << ans << endl;
    }



    cout << ans << endl;
}


Measured memory_bytes: 15872
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include<stack>
#include<string>
#include<algorithm> 
#include <set>
#include<list>
#include <bit>
#include <bitset>
#include <cstdint>
#include <initializer_list>
using namespace std;
int main() {
    int N; cin >> N;
    vector<int> pos(N);
    int ans = 10000000;
    for (int i = 0; i < N; i++)cin >> pos[i];
    sort(pos.begin(), pos.end());
    int min_val = pos[0], max_val = pos[N - 1];
    int sum;
    for (int i = 0; i < max_val - min_val + 1; i++) {
        sum = 0;
        for (int j = 0; j < N; j++) {
            sum += (pos.at(j) - (min_val + i)) * (pos.at(j) - (min_val + i));
        }
        if (sum < ans)ans = sum;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
    int x;
    cin >> x;
    if(x >= 400 && x <= 599) cout << 8 << endl;
    if(x >= 600 && x <= 799) cout << 7 << endl;
    if(x >= 800 && x <= 999) cout << 6 << endl;
    if(x >= 1000 && x <= 1199) cout << 5 << endl;
    if(x >= 1200 && x <= 1399) cout << 4 << endl;
    if(x >= 1400 && x <= 1599) cout << 3 << endl;
    if(x >= 1600 && x <= 1799) cout << 2 << endl;
    if(x >= 1800 && x <= 1999) cout << 1 << endl;
}

Measured memory_bytes: 3620
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
from math import ceil, floor, log2, sin, cos, radians, sqrt
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np
# from numpy import cumsum  # accumulate

def solve():
    A, B, H, M = MI()

    hour = 0
    for i in range(12):
        min = 0
        for j in range(60):
            if i == H and j == M:
                # theta = abs(hour - min)
                # print(hour, min, i, j, theta)

                x1, y1 = A * cos(radians(hour)), A * sin(radians(hour))
                x2, y2 = B * cos(radians(min)), B * sin(radians(min))

                x = abs(x1 - x2)
                y = abs(y1 - y2)
                print(sqrt(x**2 + y**2))

            hour += 0.5
            min += 6


if __name__ == '__main__':
    solve()


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

#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
struct Grid{int x,y,t;};
struct Edge{int to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  Graph(int n):E(n){E.resize(n);V=n;}
  void add_edge(int from,int to,int cost){E[from-1].pb({to-1,cost});}
};
int main(){
  int n,a,b;cin>>n>>a>>b;
  string s;cin>>s;
  int A=0,B=0;
  for(int i=0;i<n;i++){
    if(s[i]=='a'){
      Yes((A+B)<(a+b));
      A++;
    }else if(s[i]=='b'){
      Yes(((A+B)<(a+b))&&(B<b));
      if(B<b)
	B++;
    }else{
      Yes(false);
    }
  }
  return 0;
}


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

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
  }
 
  int x=(a.size()-k)%(k-1);
  if(x!=0){
    int ans=2+(a.size()-k-x)/(k-1);
    cout << ans << endl;
    }else{
      int ans=1+(a.size()-k)/(k-1);
      cout << ans << endl;
  }
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MAXN = 100005;

struct ii {
	ll a, b, c;
	bool operator > (ii o) const {
		return a > o.a;
	}
};

ll N;
ii arr[MAXN];

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	
	cin >> N;
	for (ll i = 0; i < N; i++) {
		ll x, y;
		cin >> x >> y;
		arr[i] = {x+y, x, y};
	}
	sort(arr, arr+N, greater<ii>());
	ll ans = 0;
	for (ll i = 0; i < N; i++) {
		if (i%2 == 0) ans += arr[i].b;
		else ans -= arr[i].c;
	}
	cout << ans << "\n";
}


Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long ll;

#define INF 1e9
#define MAX_K 100000

struct edge{
  int to;
  ll cost; 
};
typedef pair<int, int> P;

int k;
vector<edge> e[MAX_K];
ll d[MAX_K]; 

void dijkstra(int s)
{
  priority_queue<P, vector<P>, greater<P> > q;
  fill(d, d + k, INF);
  d[s] = 0;
  q.push(P(0, s));

  while(!q.empty()){
    P p = q.top();
    q.pop();
    int v = p.second;
    if(d[v] < p.first) continue;
    for(int i = 0; i < e[v].size(); i++){
      edge ee = e[v][i];
      if(d[ee.to] > d[v] + ee.cost){
        d[ee.to] = d[v] + ee.cost;
        q.push(P(d[ee.to], ee.to));
      }
    }
  }
}

int main()
{
  cin >> k;

  edge ee;

  ee.cost = 1LL;
  for(int i = 0; i < k; i++){
    ee.to = (i+1) % k; 
    e[i].push_back(ee);
  }

  ee.cost = 0LL;
  for(int i = 1; i < k; i++){
    ee.to = (i*10) % k;
    e[i].push_back(ee);
  }

  dijkstra(1);

  cout << d[0] + 1LL << endl;

  return 0;
}


Measured memory_bytes: 8700
#include <iostream>
#include <queue>

using namespace std;

int main(void) {
  int n, q, command, t, x;
  cin >> n >> q;

  queue<int> que[n];

  for(int i = 0; i < q; i++) {
    cin >> command >> t;
    switch(command) {
      case 0:
        cin >> x;
        que[t].push(x);
        break;
      case 1:
        if(!que[t].empty())
          cout << que[t].front() << endl;
        break;
      case 2:
        if(!que[t].empty())
          que[t].pop();
        break;
    }
  }
}


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

using namespace std;

int main() {
   int d;

   cin >> d;

   if(d == 25){
      cout << "Christmas" << endl;
   }else if(d == 24){
      cout << "Christmas Eve" << endl;
   }else if(d == 23){
      cout << "Christmas Eve Eve" << endl;
   }else if(d == 22){
      cout << "Christmas Eve Eve Eve" << endl;
   }
   return 0;
}


Measured memory_bytes: 256
import numpy as np
N,M,Q = (int(x) for x in input().split())
route = np.zeros((N,N))
for i in range(M):
    L,R = (int(x) for x in input().split())
    route[L-1][R-1] += 1
cs1 = np.cumsum(route,axis=1)
cs2 = np.cumsum(cs1,axis=0)
for i in range(Q):
    p,q = (int(x) for x in input().split())
    if p == 1:
        print(int(cs2[q-1][q-1]))
    else:
        print(int(cs2[q-1][q-1]-cs2[p-2][q-1]))

Measured memory_bytes: 20428
n = int(input())
Sn = []

for i in range(n):
    Sn.append(input())

ac = Sn.count('AC')
wa = Sn.count('WA')
tle = Sn.count('TLE')
re = Sn.count('RE')

print('AC x {}'.format(ac))
print('WA x {}'.format(wa))
print('TLE x {}'.format(tle))
print('RE x {}'.format(re))

Measured memory_bytes: 16176
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define REP(i,n) for(int i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
#define LINF LLONG_MAX/3
#define MP make_pair
#define PB push_back
#define pb push_back
#define EB emplace_back
#define ALL(v) (v).begin(),(v).end()
#define all(v) ALL(v)
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
constexpr double eps = 1e-14; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

#define MAX_A 10000

int N;

int main(){
    cin >> N;
    vector<int> A(N);
    rep(i,N){ cin >> A[i]; A[i]--; }
    int ma = *max_element(all(A));
    vector<int> cnt(ma+1,0);
    rep(i,N) cnt[A[i]]++;
    for(int i=0;i<=ma;i++) if(cnt[i]>2){
        if(cnt[i]%2==1) cnt[i]=1;
        else cnt[i]=2;
    }


    vector<int> v;
    for(int i=0;i<=ma;i++) if(cnt[i]==2) v.push_back(i);
    if(v.size()==0){
        ll sum = accumulate(cnt.begin(),cnt.end(),0ll);
        cout << sum << endl;
        return 0;
    }

    for(int i=0;i<sz(v)-1;i++){
        if(cnt[v[i]]<2) continue;
        cnt[v[i]]--;
        cnt[v[i+1]]--;
    }

    ll sum = 0;
    for(int i=0;i<=ma;i++) sum += cnt[i];
    if(cnt[v[sz(v)-1]]==2) sum -= 2;
    cout << sum << endl;
}


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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int64_t a, b;
  std::cin >> a >> b;
  int64_t i = 1;
  int64_t ans = 0;

  while (i < b) {
    i += a - 1;
    ans++;
  }
  std::cout << ans << std::endl;
  return 0;
}


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

int main()
{
    int N, T, X;
    int ans = 0;


    cin >> N >> X >> T;

    if (N % X == 0)
        cout << (N / X) * T << endl;
    else
        cout << (N / X) * T + T << endl;

    return 0;
}

Measured memory_bytes: 3568
class UnionFindTree():
    def __init__(self, values=[]):
        self.parent_of = {}
        self.rank_of = {}
        for value in values:
            self.add(value)

    def add(self, value):
        if value in self.parent_of:
            raise RuntimeError("Dupulicated Value Added")
        self.parent_of[value] = None
        self.rank_of[value] = 0

    def __root(self, value):
        if self.parent_of[value] is None:
            return value
        else:
            self.parent_of[value] = self.__root(self.parent_of[value])
            return self.parent_of[value]

    def unite(self, a, b):
        r1 = self.__root(a)
        r2 = self.__root(b)
        if r1 != r2:
            if self.rank_of[r1] < self.rank_of[r2]:
                self.parent_of[r1] = r2
            else:
                self.parent_of[r2] = r1
                if self.rank_of[r1] == self.rank_of[r2]:
                    self.rank_of[r1] += 1

    def is_same(self, a, b):
        return self.__root(a) == self.__root(b)

    def groups(self):
        groups = {}
        for k in self.parent_of.keys():
            r = self.__root(k)
            if r not in groups:
                groups[r] = []
            groups[r].append(k)
        return [groups[x] for x in groups]


def main():
    H, W = map(int, input().split())
    S = [input() for _ in range(H)]
    uft = UnionFindTree()
    for i in range(H):
        for j in range(W):
            if S[i][j] == '#':
                uft.add((i, j))
                if i >= 1 and S[i-1][j] == '#':
                    uft.unite((i, j), (i-1, j))
                if j >= 1 and S[i][j-1] == '#':
                    uft.unite((i, j), (i, j-1))
    for g in uft.groups():
        if len(g) == 1:
            print("No")
            return
    print("Yes")


if __name__ == "__main__":
    main()


Measured memory_bytes: 45932
#include <bits/stdc++.h>
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
#define _all(arg) begin(arg),end(arg)

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

using namespace std;

int main(void){
	int n; cin >> n;
	string d = "";
	rep(i,n) {
		string c; cin >> c;
		d += c;
	}

	set<int> tmp;
	rep(i,0,n) {
		rep(j,1,8) {
			string _d = d.substr(i,j);
		//	cerr << i << " " << j << " " << _d << endl;
			tmp.insert(stoi(_d));
		}
	}
	rep(i,1000) {
		if(tmp.find(i) == tmp.end()) {
			cout << i << endl;
			break;
		}
	}
        
	return 0;
}

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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1e9;
const LL MOD = 1e9+7;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()

int main() {
  int N, x=0,y=0;
  cin >> N;
  REP(i,N) {
    int a;
    cin >> a;
    if(a%4 == 0)x++;
    if(a%2 == 1)y++;
  }
  int z = N-x-y;
  if(z == 0) x++;
  
  if(x >= y) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
 
using namespace std;
typedef long long ll;
const ll INF = 1e18;

# define rep(i, n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(ll i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(ll i=((int)(n)); i>0; --i)
# define all(x) (x).begin(), (x).end()
# define pb push_back
 
ll N, K;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> N >> K;
    vector<ll> l(N);
    
    rep(i,N) {
        cin >> l[i];
    }

    sort(all(l), greater<ll>());
    
    ll sum = 0;
    rep(i,K) {
        sum += l[i];
    }
    
    cout << sum << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define ld long double
#define hell 1000000007
#define dd double
#define rep(i,a,n) for(ll i = a; i < n; i++)
#define sep(i,n,b) for(ll i=n-1;i>=b;i--)
#define pb push_back
#define mp make_pair
#define Mll map<ll,ll>
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin >> n;
	ll x=n%10;
	if(x==3){
		cout << "bon";
	}	
	else if(x==0 or x==1 or x==6 or x==8){
		cout << "pon";
	}
	else{
		cout << "hon";
	}
	return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,x;
  cin>>n>>x;
  vector<int> m(n);
  for(int i=0;i<n;i++){
    cin>>m[i];
  }
  x-=accumulate(m.begin(),m.end(),0);
  int ans=n;
  ans+=x/(*min_element(m.begin(),m.end()));
  cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int llint
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a+MOD)%MOD)+((b+MOD)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define EPS (1e-20)
#define INF INT_MAX
#define INFLL LLONG_MAX
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using MCI = std::map<char, int>;
using VPII = std::vector<PII>;
using namespace std;


int N, M;
TIII e[2010];
int d[1010];


bool bellmanFord(){
	fill(RNG(d, 0, N), INFLL);
	d[0] = 0;
	rep(i, 0, N){
		rep(j, 0, M){
			int f = get<0>(e[j]);
			int t = get<1>(e[j]);
			int c = get<2>(e[j]);
			if(d[f] != INFLL && d[t] > d[f]+c){
				d[t] = d[f]+c;
				if(i == N-1 && t == N-1) return true;
			}
		}
	}
	return false;
}


signed main(){
	cin >> N >> M;
	rep(i, 0, M){
		int a, b, c;
		cin >> a >> b >> c, a--, b--;
		e[i] = mt(a, b, -c);
	}

	if(!bellmanFord()) cout << -d[N-1] << endl;
	else cout << "inf" << endl;

	return 0;
}

Measured memory_bytes: 384
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#define ll long long
#define pb  push_back
#define f first
#define s second
#define mp make_pair
#define EPS 1e-6
#define all(x) x.begin(),x.end()
using namespace std;
const int mod = 1000 * 1000 * 1000 + 7;
int n , m , s;
vector<vector<int> > g(200000);
vector<int> path;
int cnt1;
int visited[200000];
void dfs(int u)
{
	//cout << u << endl;
	visited[u] = 1;

	for(int i = 0; i < g[u].size(); i++)
	{
		int v = g[u][i];
		if(!visited[v])
			dfs(v);
	}
}

int main()
{
	scanf("%d %d" , &n , &m);
	for(int i = 0; i < m; i++)
	{
		int u , v;
		scanf("%d %d" , &u , &v);
		u--;v--;
		g[u * 2].pb(v * 2 + 1);
		g[u * 2 + 1].pb(v * 2);
		g[v * 2].pb(u * 2 + 1);
		g[v * 2 + 1].pb(u * 2);
	}
	dfs(0);
	ll ans = 0;
	bool bipatride = false;
	for(int i = 0; i < 2 * n; i++)
	{
		if(!visited[i])
		{
			bipatride = true;
		}
	}
	if(!bipatride)
	{
		ans = (ll)n * (n - 1)/ 2;
		cout << ans - m;
		return 0;
	}
	else
	{
		ll ans = 0;
		ll cnt1 = 0;
		for(int i = 0; i < n; i++)
		{
			if(visited[2 * i])
			{
				cnt1++;
			}
		}
		ans = cnt1 * (n - cnt1);
		//cout << cnt1 << endl;
		for(int i = 0; i < n; i++)
		{
			if(visited[2 * i])
			{
				ans -= g[2 * i].size();
			}

		}
		cout << ans;
	}


	return 0;
}



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

typedef long long ll;
typedef unsigned long long ull;

typedef struct Node{
    int key;
    Node *parent;
    Node *lhs, *rhs;
} Node;

typedef struct{
    Node *root;
} BinaryTree;

void init_node(Node *node, int val){
    node->key = val;
    node->parent = nullptr;
    node->lhs = nullptr;
    node->rhs = nullptr;
}

void init_bintree(BinaryTree *T){
    T->root = nullptr;
}

void insert(BinaryTree *T, Node *node){
    Node *parent = nullptr;
    Node *x = T->root;
    while(x != nullptr){
        parent = x;
        if(node->key < x->key) x = x->lhs;
        else x = x->rhs;
    }
    node->parent = parent;
    if(parent == nullptr) T->root = node;
    else if(node->key < parent->key) parent->lhs = node;
    else parent->rhs = node;
}

void print_preorder(Node *n){
    if(n == nullptr) return;
    cout << ' ' << n->key;
    print_preorder(n->lhs);
    print_preorder(n->rhs);
}

void print_inorder(Node *n){
    if(n == nullptr) return;
    print_inorder(n->lhs);
    cout << ' ' << n->key;
    print_inorder(n->rhs);
}

void print(BinaryTree *T){
    print_inorder(T->root);
    cout << endl;
    print_preorder(T->root);
    cout << endl;
}

BinaryTree T;
Node n[500000];

int main(){
    int idx = 0;
    int m;

    init_bintree(&T);
    cin >> m;
    for(int i=0;i<m;i++){
        string comm;
        cin >> comm;
        if(comm=="print") print(&T);
        else if(comm=="insert"){
            int v;
            cin >> v;
            init_node(n+idx, v);
            insert(&T, n+idx);
            idx++;
        }
    }
    
    
    return 0;
}


Measured memory_bytes: 18632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int N; cin >> N;
    vector<int> a(N);
    int cnt = 0;
    for(int i = 0; i < N; i++)
    {
        cin >> a.at(i);
    }
    sort(a.begin(),a.end());
    int Alice = 0,Bob = 0;
    for(int i = 0; i < N; i++)
    {
        if(i % 2 == 0)
        {
            Alice += a.at(N - i - 1);
        }
        else
        {
            Bob += a.at(N - i - 1);
        }
    }
    cout << Alice - Bob << endl;
}

Measured memory_bytes: 256
let split_on_char sep s =
  let open String in
  let r = ref [] in
  let j = ref (length s) in
  for i = length s - 1 downto 0 do
    if get s i = sep then begin
      r := sub s (i + 1) (!j - i - 1) :: !r;
      j := i
    end
  done;
  sub s 0 !j :: !r

let read_ints () = read_line () |> split_on_char ' ' |>  List.map int_of_string

let dfs vs n =
  let d = Array.make n (-1) in
  let rec doit i j =
    d.(i) <- j;
    List.iter (fun v -> if d.(v) = (-1) then doit v j) vs.(i) in
  Array.iteri (fun i e -> if e = (-1) then doit i i) d;
  d

let solve n m =
  let g = Array.make n [] in
  for _ = 0 to m - 1 do
    match read_ints () with
    | [s; t] ->
      g.(s) <- t :: g.(s);
      g.(t) <- s :: g.(t);
    | _ -> assert false
  done;
  let v = dfs g n in
  let q = read_int () in
  for _ = 0 to q - 1 do
    match read_ints () with
    | [s; t] -> Printf.printf (if v.(s) = v.(t) then "yes\n" else "no\n")
    | _ -> assert false
  done

let () =
  match read_ints () with
  | [n;m] -> solve n m
  | _ -> assert false

Measured memory_bytes: 19140
#include <algorithm>
#include <cstring>
#include <cstdio>
const int p[] = {2, 3, 5, 7, 11, 13, 17}, lim[] = {8, 5, 3, 2, 2, 2, 2}, len = 7; 
int pos[305], val[305], arr[15], sum[305], n, ans = -1e9; 
void dfs(int cur, int g = 1)
{
	if (cur >= len)
	{
		memset(sum, 0, sizeof(sum)); 
		for (int i = 0; i < n; i++)
		{
			int x = pos[i]; 
			bool f = true; 
			for (int j = 0; j < len; j++)
			{
				for (int k = 0; k < arr[j]; k++)
				{
					if (!(x % p[j]))
						x /= p[j]; 
				}
				if (!(x % p[j]))
					f = false; 
			}
			if (f)
				sum[x] += val[i];
		}
		int res = sum[1]; 
		for (int i = 2; i <= 300; i++)
			res += std::max(sum[i], 0); 
		ans = std::max(ans, res); 
		return;
	}
	for (arr[cur] = 0; arr[cur] <= lim[cur]; arr[cur]++)
	{
		dfs(cur + 1, g); 
		g *= arr[cur]; 
	}
}
int main()
{
	// freopen("CF17-TR-H.in", "r", stdin); 
	scanf("%d", &n); 
	for (int i = 0; i < n; i++)
		scanf("%d%d", pos + i, val + i); 
	dfs(0); 
	printf("%d\n", ans);
	return 0; 
}


Measured memory_bytes: 128
# include <iostream>
# include <sstream>
# include <cstdio>
# include <cstdlib>
# include <algorithm>
# include <string>
# include <cstring>
# include <cmath>
# include <stack>
# include <queue>
# include <vector>
# include <list>
# include <map>
# include <set>
# include <deque>
# include <iterator>
# include <functional>
# include <bitset>
# include <climits>
# include <ctime>
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define odd(x) ((x)%2)
typedef long long ll;
typedef long double ld;
const ll oo=2*1000*1000*1000;
const int _cnt=1000*1000;
const int _p=1000*1000*1000+7;
int o(int x) { return x%_p; }
int gcd(int a,int b) { return (b)?gcd(b,a%b):a; }
int lcm(int a,int b) { return a/gcd(a,b)*b; }
using namespace std;

void file_put(){
	freopen("filename.in","r",stdin);
	freopen("filename.out","w",stdout);
}

int n,k,x=0,y=0;
string s[10005],t;

int _compare(string s,string t){
	int k=max(s.length(),t.length()),p=0;
	for (int i=1; i<=k-s.length(); i++) s+=' ';
	for (int i=1; i<=k-t.length(); i++) t+=' ';
	for (int i=0; i<k; i++){
		if (s[i]!='?' && s[i]<t[i]) {
			if (p>0) return 0; else
			return 1;
		}
		if (s[i]!='?' && s[i]>t[i]) {
			if (p<0) return 0; else
			return -1;
		}
		if (s[i]=='?' && 'a'<t[i] && t[i]<'z') return 0;
		if (s[i]=='?' && t[i]=='a') p=1;
		if (s[i]=='?' && t[i]=='z') p=-1;
	}
	return 0;
}

int main(){
	//file_put();
	
	scanf("%d",&n);
	cin.ignore();
	for (int i=1; i<=n; i++){
		cin>>s[i];
		cin.ignore();
	}
	cin>>t;
	for (int i=1; i<=n; i++){
		k=_compare(s[i],t);
		if (k==1) x++;
		if (k==-1) y++;
	}
	for (int i=x+1; i<=n-y; i++) printf("%d ",i);
	printf("%d\n",n+1-y);
	
	return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <algorithm>
using namespace std;

#define uint unsigned int
#define ull unsigned long long
#define ll long long
#define vint vector<int>
#define vuint vector<unsigned int>
#define vull vector<ull>
#define vll vector<ll>
#define init(type,var) type var;cin>>var;
#define vinit(vtype,var,n) vtype var(n);loop(i,0,n)cin>>var[i];
#define range(container) container.begin(),container.end()
#define loop(i,first,end) for(ull i=(first);i<(end);i++)
#define outl(out) cout<<out<<endl;

const ull MOD = 1000000007ULL;
const ull INF = (ull)(-1LL);

const ull AMAX = 2001;

ull pow_mod(ull a, ull b)
{
	if (b == 0)return 1;
	else if (b == 1)return a % MOD;
	else{
		ull c = pow_mod(a, b >> 1);
		c = (c * c) % MOD;
		if (b & 1)c = (c * a) % MOD;
		return c;
	}
}

ull div_mod(ull a, ull b)
{
	return (a * pow_mod(b, MOD - 2)) % MOD;
}

int main(void){
	init(ull, n);
	init(ull, k);
	vinit(vull, a, n);

	vull d(AMAX, 0);
	ull c = 0;
	ull m = 0;
	loop(i, 0, n){
		loop(j, a[i] + 1, AMAX){
			c = (c + d[j]) % MOD;
		}
		d[a[i]]++;
		if (a[i] > m)m = a[i];
	}
	c = (c * k) % MOD;

	ull ke = div_mod((k * (k - 1)) % MOD, 2);

	loop(i, 1, m)loop(j, i + 1, m + 1)c = (c + d[j] * d[i] * ke) % MOD;

	outl(c);

	return 0;
}

Measured memory_bytes: 256
/*
START BY THE NAME OF ALMIGHTY ALLAH
THIS WONT BE ACCEPTED
STOP_GIVING_UP

██╗███████╗████████╗██╗ █████╗ ██╗  ██╗
██║██╔════╝╚══██╔══╝██║██╔══██╗██║ ██╔╝
██║███████╗   ██║   ██║███████║█████╔╝
██║╚════██║   ██║   ██║██╔══██║██╔═██╗
██║███████║   ██║   ██║██║  ██║██║  ██╗
╚═╝╚══════╝   ╚═╝   ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝

*/
#include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define pb push_back
#define in insert
#define mp make_pair
#define lw(v) sort(v.begin(),v.end());
#define hi(v) sort(v.begin(),v.end(),greater<long long>());
#define all(v) v.begin(),v.end()
#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)
using namespace std;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long  t,r=1,r1=0,r2=0,k=0,a,b,c=0,m,d=0,n,e,f,x=0,g,p=0,q=0,y=0,z=0;
    vector<long long>v;
    vector<long long>u;
    vector<tuple<string,int,
           int>>mp;
    set<long long>s;
    std::vector<int>::iterator it;
    string  s1,s2,s3,s4;
    cin>>n;
    l(i,0,n)
    {
        cin>>a;
        v.pb(a);
    }
l(i,1,n)
{
    if(v[i]<v[i-1])
    {
        d=d+abs(v[i]-v[i-1]);
        v[i]=v[i]+abs(v[i]-v[i-1]);
    }
}
cout<<d<<endl;


    }


Measured memory_bytes: 5292
n = int(input())
a = list(map(int, input().split()))

ans = 0
t=0

while True:
    for i in range(n):  # 0 1 2 ... n-1
        if a[i] %2 ==0:
            a[i] = a[i] / 2
        else:
            t = 1
    if t != 1:
        ans += 1
    else:
        break

print(ans)

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

#define ll long long
#define mx  100005
#define mod 1000000009
#define lim 10000000

using namespace std;

struct prob{
	int p,c;
}a[15];

int need,d,dp[15][1000000];

int rec(int i,int scor)
{
	if(scor>=need)return 0;
	if(i==d)return lim;

	if(dp[i][scor]!=-1)return dp[i][scor];
	int ans=lim;
	for(int k=0;k<=a[i].p;k++)
	{
		int bo=0;
		if(k==a[i].p)bo=a[i].c;
		
		ans=min(ans,rec(i+1,scor+k*(i+1)+bo)+k);
	}
	dp[i][scor]=ans;
	return ans;
}


int main(){
	ios_base::sync_with_stdio(false);

	cin>>d>>need; need/=100;

	for(int i=0;i<d;i++)
		{
			cin>>a[i].p>>a[i].c;
			a[i].c/=100;
		}
	memset(dp,-1,sizeof(dp));
	cout<<rec(0,0)<<"\n";
	return 0;
}


Measured memory_bytes: 58880
N = int(input())
a1, a2, a3 = map(int, input().split())
b1, b2, b3 = map(int, input().split())
A = [a1, a2, a3]
B = [b1, b2, b3]
if (a1<=b1 and a2<=b2 and a3<=b3) or (a1>=b1 and a2>=b2 and a3>=b3):
    if a1>b1 or a2>b2 or a3>b3:
        A, B = B, A
    dp = [[-float("inf")]*(N+1) for _ in range(4)]
    dp[0][0] = 0
    for i in range(3):
        ai = A[i]
        bi = B[i]
        for j in range(N+1):
            if j-ai>=0:
                dp[i+1][j] = max(dp[i][j], dp[i+1][j-ai]+bi)
            else:
                dp[i+1][j] = dp[i][j]
    ans = 0
    for i, v in enumerate(dp[3]):
        ans = max(ans, v+(N-i))
    print(ans)

    #print(dp[3][:30])
else:
    C, D = [], []
    for a, b in zip(A, B):
        if a <= b:
            C.append([a, b])
        else:
            D.append([b, a])

    if len(C)==1:
        a, b = C[0]
        q, n = divmod(N, a)
        N_ = q*b + n
    else:
        N_ = N
        (a1, b1), (a2, b2) = C
        for i in range(N + 1):
            j = N - i
            q1, n1 = divmod(i, a1)
            q2, n2 = divmod(j, a2)
            N_ = max(N_, q1 * b1 + q2 * b2 + n1 + n2)

    if len(D)==1:
        a, b = D[0]
        q, n = divmod(N_, a)
        print(q*b + n)
        #print("a")
    else:
        ans = N_
        (a1, b1), (a2, b2) = D
        for i in range(N_+1):
            j = N_ - i
            q1, n1 = divmod(i, a1)
            q2, n2 = divmod(j, a2)
            ans = max(ans, q1*b1+q2*b2+n1+n2)
        print(ans)





Measured memory_bytes: 42620
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <cmath>

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

	std::cin >> a >> b >> c;

	if (a + b >= c) {
		std::cout << "Yes" << std::endl;
	}
	else {
		std::cout << "No" << std::endl;
	}


	return 0;
}

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

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        int n = sc.nextInt();
        long [] a = new long[n];
        for (int i = 0; i <n; i++) a[i] = sc.nextLong();
        mod = (long) 1e9 + 7;
        long sq = 0;
        for (int i = 0; i < n; i++) sq = (sq + (a[i] * a[i]) % mod) % mod;
        long sum = 0;
        for (int i = 0; i < n; i++) sum = (sum + a[i]) % mod;
        sum = (sum * sum) % mod;
        long ret = sum - sq;
        ret = (ret * inv(2)) % mod;
        if (ret < 0) ret += mod;
        out.println(ret);
        out.close();
    }

    static long[] fac;
    static long mod = (long) 1e9 + 7;

    static void initFac(long n) {
        fac[0] = 1;
        for (int i = 1; i <= n; i++) {
            fac[i] = (fac[i - 1]  * i) % mod;
        }
    }

    static long exponentiation(long base, long exp)
    {
        long t = 1L;
        while (exp > 0) {

            // for cases where exponent
            // is not an even value
            if (exp % 2 != 0)
                t = (t * base) % mod;

            base = (base * base) % mod;
            exp /= 2;
        }
        return t % mod;
    }

    static long nck(int n, int k) {
        if (n < k)
            return 0;
        long den = inv((int) (fac[k] * fac[n - k] % mod));
        return fac[n] * den % mod;
    }

    static long pow(long b, long e) {
        long ans = 1;
        while (e > 0) {
            if (e % 2 == 1)
                ans = ans * b % mod;
            e >>= 1;
            b = b * b % mod;
        }
        return ans;
    }

    static long inv(long x) {
        return pow(x, mod - 2);
    }


    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }


    }

}

Measured memory_bytes: 55920
N = int(input())
A = list(map(int, input().split()))
xa, a = max(enumerate(A), key=lambda x: abs(x[1]))
print(2*N)
for i in range(2):
    print(xa+1, 1 if a > 0 else N)
if a > 0:
    for i in range(1, N):
        for j in range(2):
            print(i, i+1)
else:
    for i in range(N, 1, -1):
        for j in range(2):
            print(i, i-1)

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

#define ll long long
#define pb push_back
#define debug1(x) cerr << #x << " = " << x << '\n';
#define debug2(x, y) cerr << #x << " = " << x << "   " << #y << " = " << y << "\n";
#define _ ios_base::sync_with_stdio(0);cin.tie(NULL);

void solve() {
    long double a, b;
    cin >> a >> b;
    long double x = a*b;
    //debug1(x)
    cout << (ll)(x);
}

int main() {_
    int t = 1;
    //cin >> t;
    // Please remember to uncomment for taking test cases
    for(int i = 1; i<=t; i++) {
        solve();
    }
    return 0;
}


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

int n,m,k,ans=1e9;
int a[11][1010], b[11][1010];

void dfs (int x,int fool) {
	for (int i=1;i<=m;i++) b[fool][i]+=a[x][i];
	
	if (x==n) {
		for (int i=1;i<=fool;i++)
		for (int j=1;j<=m;j++)
			if (b[i][j]-b[i][j-1]>k) return ;
			
		int up=0, now=fool-1;
		for (int i=1;i<=m;i++)
		{
			for (int j=1;j<=fool;j++)
			{
				if ((b[j][i]-b[j][up])<=k) {
					continue ;
				} else {
					now++;
					up=i-1;
					break ;
				}
			}
		}
		ans=min (ans,now);
	} else {
		dfs (x+1,fool+1);
		dfs (x+1,fool);
	}
	
	for (int i=1;i<=m;i++) b[fool][i]-=a[x][i];
}

int main ()
{
	cin >> n >> m >> k;
	for (int i=1;i<=n;i++)
	for (int j=1;j<=m;j++)
	{
		scanf ("%1d",&a[i][j]);
		a[i][j]+=a[i][j-1];
	}
	
	dfs (1,1);
	
	cout << ans << endl;
}

Measured memory_bytes: 384
from functools import reduce
from fractions import gcd

n = int(input())
A = [int(a) for a in input().split()]

l = [0 for _ in range(n+1)]
r = [0 for _ in range(n+1)]
ans = []

for i in range(n):
    l[i+1] = gcd(l[i],A[i])

for i in range(n-1,-1,-1):
    r[i-1] = gcd(r[i],A[i])
    
for i in range(n):
    ans.append(gcd(l[i],r[i]))
    
print(max(ans))

Measured memory_bytes: 16148
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next(), t = sc.next();
		sc.close();
		char c1[] = s.toCharArray(), c2[] = t.toCharArray();

		Arrays.sort(c1);
		Arrays.sort(c2);

		String ss = new String(c1), tt = new String(c2);
		String ttr = new StringBuilder(tt).reverse().toString();

		if (ss.compareTo(ttr) < 0) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


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

N, K = map(int, input().split())
A = list(map(int, input().split()))

for i in range(N):
    A[i] -= 1

b = bin(K)
D = {0:list(range(N))} # ダブリングマトリクス
D[1] = [A[D[0][i]] for i in range(N)]

for i in range(1, len(b)-2):
    D[2**i] = [D[2**(i-1)][D[2**(i-1)][j]] for j in range(N)]


n = 2**(len(b[2:])-1)
S = D[n][0] # 初期状態
keta = len(b[2:]) - 2
for j in range(len(b[3:])):
    k = 2**keta
    if b[j+3] == '1':
        S = D[k][S]
    keta -= 1

print(S+1)


Measured memory_bytes: 217576
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
 
const ll nmax = 1e9 + 7;
const ll Mod = 998244353;
const double PI = 2 * asin(1);

int main(){
  int N, cnt = 0; cin >> N;
  ll A[N], sum = 0, m = 1e9;
  for (int i = 0; i < N; i++){
    cin >> A[i];
    if (A[i] < 0) cnt++;
    sum += abs(A[i]);
    m = min(m, abs(A[i]));
  }
  
  if (cnt % 2 == 0){
    cout << sum << endl;
  }else{
    cout << sum - 2 * m << endl;
  }

  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int Q;cin>>Q;
  for(int i=0;i<Q;i++){
    ll A,B,ans=0;cin>>A>>B;
    if(A>B) swap(A,B);
    ans+=(A-1);
    ll C=floor(sqrt(A*B));
    ans+=(C-A);
    if(C*(C+1)<A*B) ans++;
    if(A==B) ans++;
    if(C*C==A*B) ans--;
    ans+=(C-1);
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 256
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import decimal
import heapq
import collections
import itertools
sys.setrecursionlimit(100001)

# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

def checker(n):
    n = str(n)
    n_list = list(n)
    for i in n_list:
        if i == "3":
            return True

n = int(input())
ans =[]
for i in range(1, n+1, 1):
    if i%3==0 or checker(i):
        ans.append(i)

print("", *ans, sep=" ")


Measured memory_bytes: 7540
N,M = map(int, input().split())

ans = []
for i in range(1, int(M**0.5)+1, 1):
    if M%i==0:
        ans.append([i,M//i])

a = 0
for x,y in ans:
    if x>=N:
        a = max(a, y)
    if y>=N:
        a = max(a, x)

print(a)

Measured memory_bytes: 3060
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;


int main() {
    int n;
    vi x, y, h;
    cin >> n;
    x.resize(n); y.resize(n); h.resize(n);
    rep(i, n) cin >> x[i] >> y[i] >> h[i];

    for(int xi = 0; xi <= 100; xi++) {
        for(int yi = 0; yi <= 100; yi++) {
            bool fl = true;
            int top;
            rep(i, n) {
                if (h[i] != 0) {
                    top = abs(xi - x[i]) + abs(yi - y[i]) + h[i];
                }
            }
            for(int i = 0; i < n; i++){
                int height = max(top - (abs(xi - x[i]) + abs(yi - y[i])), 0);
                if (height != h[i]) fl = false;
            }
            if (fl) {
                cout << xi << " " << yi << " " << top << endl;
                return 0;
            }
        }
    }
    return 1;
}


Measured memory_bytes: 256