akhauriyash/Code-Regression huggingface dataset:
import math
ini = lambda : int(input())
inm = lambda : map(int,input().split())
inl = lambda : list(map(int,input().split()))
gcd = lambda x,y : gcd(y,x%y) if x%y else y
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
mod = 10**9 + 7

#maincode-------------------------------------------------

n = int(input())
x = [0 for i in range(n)]
y = [0 for i in range(n)]
ans = 'No'

for i in range(n):
    x[i],y[i] = map(int,input().split())

for i in range(n-2):
    if (x[i] == y[i])and(x[i+1] == y[i+1])and(x[i+2] == y[i+2]):
        ans = 'Yes'

print(ans)

Measured memory_bytes: 9204
/**
 *    author:  otera    
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve() {
	string s; cin >> s;
    int n = (int)s.size();
    bool dp[100100];
    rep(i, 100100) dp[i] = 0;
    dp[0] = 1;
    rep(i, n) {
        if(s.substr(i, 5) == "dream") {
            dp[i + 5] |= dp[i];
        }
        if(s.substr(i, 7) == "dreamer") {
            dp[i + 7] |= dp[i];
        }
        if(s.substr(i, 5) == "erase") {
            dp[i + 5] |= dp[i];
        }
        if(s.substr(i, 6) == "eraser") {
            dp[i + 6] |= dp[i];
        }
    }
    if(dp[n]) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

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

//dijkstra
//d,edge,g,P,q
#define MAX_N 100010
lint d[MAX_N];
struct edge{
	int to;
	lint cost;
};
vector<edge>g[MAX_N];
typedef pair<lint,int> P;
priority_queue<P,vector<P>,greater<P>> q;

void pfs(int st){
	d[st]=0;q.push({0,st});
	lint cd,v;
	while(q.size()){
		cd=q.top().first;v=q.top().second;q.pop();
		if(cd>d[v])continue;
		for(edge& e:g[v])if(cd+e.cost<d[e.to]){
			d[e.to]=cd+e.cost;
			q.push({d[e.to],e.to});
		}
	}
}



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

	lint v,e,r;cin>>v>>e>>r;
	for(int i=0;i<v;++i)d[i]=INT_MAX;
	int s,t;
	lint c;
	for(int i=0;i<e;++i){
		cin>>s>>t>>c;
		g[s].push_back({t,c});
	}pfs(r);
	for(int i=0;i<v;++i){
		if(d[i]==INT_MAX)cout<<"INF\n";
		else cout<<d[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 19540
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;

class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st;
    st = new StringTokenizer(br.readLine(), " ");
    int N = Integer.parseInt(st.nextToken());
    int M = Integer.parseInt(st.nextToken());
    long students[][] = new long[N][];
    for (int i = 0; i < N; i++) {
      st = new StringTokenizer(br.readLine(), " ");
      students[i] = new long[]{Long.parseLong(st.nextToken()), Long.parseLong(st.nextToken())};
    }

    long checkpts[][] = new long[M][];
    for (int i = 0; i < M; i++) {
      st = new StringTokenizer(br.readLine(), " ");
      checkpts[i] = new long[]{Long.parseLong(st.nextToken()), Long.parseLong(st.nextToken())};
    }

    for (long[] student : students) {
      long a = student[0];
      long b = student[1];
      long min = 1000000000;
      int ans = 1;
      int i = 1;
      for (long[] checkpt : checkpts) {
        long x = checkpt[0];
        long y = checkpt[1];
        long t = Math.abs(a-x) + Math.abs(b-y);
        if (min > t) {
          min = t;
          ans = i;
        }
        i++;
      }
      System.out.println(ans);
    }
  }
}


Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
int n,m,x;
int c [10010];
int a[10010][10010];
const int MAX=9999999;
int money=MAX;
vector<int>v;

void DFS(int deep){
    int he=0;
    int hang[13]={0};
    for(auto weizi:v){
        he+=c[weizi];
        for(int j=1;j<=m;j++){
            hang[j]+=a[weizi][j];
        }
    }
    //cout<<he<<endl;
    if(he>money){
        return ;
    }
    bool is=true;
    for(int j=1;j<=m;j++){
        if(hang[j]<x){is=false;break;}
    }
    if(is){
        if(he<money){
            money=he;
        }
    }
    for(int i=deep;i<=n;i++){
        v.push_back(i);
        DFS(i+1);
        v.pop_back();
    }
}

int main() {
   cin>>n>>m>>x;
   for(int i=1;i<=n;i++){
       cin>>c[i];
       for(int j=1;j<=m;j++){
           cin>>a[i][j];
       }
   }
   for(int i=1;i<=m;i++) {
       DFS(i);
   }
   if(money==MAX){
       cout<<"-1"<<endl;
       return 0;
   }
   cout<<money<<endl;
    return 0;
}
/*
3 3 10
60 2 2 4
70 8 7 9
50 2 3 9
 */


Measured memory_bytes: 3680
package main

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

func main() {

	stdin := bufio.NewScanner(os.Stdin)
	stdin.Scan()
	text := stdin.Text()

	slice := strings.Split(text, " ")

	var divided, dividor int
	divided, _ = strconv.Atoi(slice[0])
	dividor, _ = strconv.Atoi(slice[1])
	d := divided / dividor
	r := divided % dividor
	f := float64(divided) / float64(dividor)

	fmt.Printf("%d %d %f", d, r, f)
}



Measured memory_bytes: 1108
// C - Forbidden List
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int)(n);++i)

bool exist(int x, vi &P){
		for(auto p:P) if(x == p) return true;
		return false;
}

int main(){
	int x, n; cin>>x>>n;
	vi P(n); rep(i, n) cin>>P[i];
	int ans = x, d = 1e9;
	rep(c, 101+1){ // candidate:[0,101]
		if(!exist(c, P) && d > abs(x-c)){
			d = abs(x-c);
			ans = c;
		}
	}
	cout<< ans <<endl;
}


Measured memory_bytes: 3544
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            String s = in.nextString();

            int[] wSum = new int[n + 1];
            int[] sSum = new int[n + 1];
            for (int i = 0; i < n; i++) {
                if (s.charAt(i) == 'W') {
                    wSum[i + 1] = 1;
                } else {
                    sSum[i + 1] = 1;
                }
            }
            for (int i = 0; i < n; i++) {
                wSum[i + 1] += wSum[i];
                sSum[i + 1] += sSum[i];
            }

            int min = n;
            for (int i = 0; i < n; i++) {
                int cnt = 0;
                cnt += wSum[i] - wSum[0];
                cnt += sSum[n] - sSum[i + 1];

                min = Math.min(min, cnt);
            }

            out.println(min);
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 29268
N,M = [int(v) for v in input().split()]
H = [int(v) for v in input().split()]
ad = [[] for _ in range(N)]

for _ in range(M):
    f,t = [int(v) for v in input().split()]
    ad[f-1].append(t-1)
    ad[t-1].append(f-1)


ans = 0
for i in range(N):
    flag = True
    h = H[i]

    for t in ad[i]:
        if h <= H[t]: flag = False
    if flag: ans += 1
print(ans)


Measured memory_bytes: 29512
///usr/bin/g++ -O2 $0 -o ${0%.cpp} && echo "----------" && ./${0%.cpp}; exit;
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> ii; 

const int N = 1005; 
const int mod = 1e9 + 7;

int f[N][N], n, a, b, c, d, fact[N], inv[N][N];

inline int mul() { return 1; }
template<class Head, class... Tail> inline int mul(Head a, Tail... b) {
    return (ll) a * mul(b...) % mod; 
}

inline int Pow(int a, int p) {
    int ret = 1; while(p) {
        if(p & 1) ret = mul(ret, a); 
        a = mul(a, a); 
        p >>= 1;
    } return ret;
}

void precalc() {
    fact[0] = 1; 
    for(int i = 1; i < N; ++i) 
        fact[i] = mul(fact[i - 1], i); 
    inv[N - 1][1] = Pow(fact[N - 1], mod - 2); 
    for(int i = N - 2; i >= 0; --i) 
        inv[i][1] = mul(inv[i + 1][1], i + 1); 
    for(int i = 0; i < N; ++i) {
        inv[i][0] = 1; 
        for(int j = 2; j < N; ++j) {
            inv[i][j] = mul(inv[i][j - 1], inv[i][1]); 
        }
    }
}

int main(int argc, char const *argv[]) {
    precalc();
    scanf("%d %d %d %d %d", &n, &a, &b, &c, &d); 

    for(int i = 0; i <= n; ++i) f[0][i] = 1;  
    for(int i = 1; i <= n; ++i) {
        for(int j = a; j <= b; ++j) {
            f[i][j] = f[i][j - 1]; 
            for(int k = c; k <= d && j * k <= i; ++k) {
                f[i][j] += mul(fact[i], f[i-j*k][j-1], inv[i-j*k][1], inv[j][k], inv[k][1]); 
                if(f[i][j] >= mod) f[i][j] -= mod; 
            } 
        }
    }
    printf("%d\n", f[n][b]);
}

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

int main(int argc, char *argv[]) {
        std::string first_name;
        std::string middle_name;

        std::cin >> first_name;  // AtCoder 固定
        std::cin >> middle_name;

        std::string result("A");
        result += middle_name[0];
        result += "C";

        std::cout << result << std::endl;
        return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    int N =sc.nextInt();
    int M =sc.nextInt();
    int R[] =new int[M];
    int S[] =new int[2*M];
    int T[] =new int[M];
    int U[] =new int[M];
    int V[] =new int[M];
    int W[] =new int[M];
    int X[] =new int[M];
    int Y[] =new int[M];
    int Z[] =new int[M];
    for(int i =0;i<2*M;i++){
      S[i]=sc.nextInt();}
    for(int j=0;j<M;j++){
      T[j]=S[2*j];
      U[j]=S[2*j+1];}
      int x=0;
    for(int k=0;k<M;k++){
      for(int l=0;l<k;l++){
        if(T[l]==T[k]){
          if(!(U[l]==U[k])){System.out.println(-1);
                          System.exit(0);}}}
             if(T[k]==1){ x= x+100;X[k]=T[k];V[k]=U[k];}
             else if(T[k]==2){x=x+10;Y[k]=T[k];W[k]=U[k];}
             else{x=x+1;Z[k]=T[k];R[k]=U[k];}
    }int b=0;int c=0;int d =0;int e=0; int f=0;int g =0;
    for(int a=0;a<M;a++){b=b+X[a];c=c+Y[a];d=d+Z[a];e=e+V[a];f=f+W[a];g=g+R[a];}
    if(b>1){x=x-100*b+100;e=e/b;}
    if(c>3){x=x-10*c/2+10;f=2*f/c;}
    if(d>5){x=x-d/3+1;g=3*g/d;}
    if(N==3){if((((x==111)||(x==100))||((x==110)||(x==101)))&&
      (e==0)){System.out.println(-1);}
             else{
               if(x==111){System.out.println(100*e+10*f+g);}
               else if(x==11){System.out.println(100+10*f+g);}
               else if(x==101){System.out.println(100*e+g);}
               else if(x==100){System.out.println(100*e);}
               else if(x==110){System.out.println(100*e+10*f);}
               else if(x==10){System.out.println(100+10*f);}
               else if(x==1){System.out.println(100+g);}
               else{System.out.println(100);}}}
    else if(N==2){if(((x==110)||(x==100))&&
      (e==0)){System.out.println(-1);}
                  else{
                    if(x==110){System.out.println(10*e+f);}
                    else if(x==100){System.out.println(10*e);}
                    else if(x==10){System.out.println(10+f);}
                    else{System.out.println(10);}}}
    else{if(x==100){System.out.println(e);}
         else{System.out.println(0);}
        }    
  }
}

Measured memory_bytes: 23252
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.next());
        int[] a = new int[n-1];
        for (int i = 0; i < n-1; i++) {
            a[i] = Integer.parseInt(scanner.next());
        }
        int[] count = new int[n];
        for (int i = 0; i < n; i++) {
            count[i] = 0;
        }
        for (int ai: a) {
            count[ai-1] ++;
        }
        for (int ci: count) {
            System.out.println(ci);
        }
    }
}


Measured memory_bytes: 61068
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A, B;
  cin >>A >>B;
  if(A<6){
    cout << "0" << endl;}
  else if(A<13){
    cout << B/2 << endl;}
  else{
    cout << B << endl;}
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>

typedef long long ll;
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> l(n);
    for (auto &i: l)
        cin >> i;

    if (n < 3) {
        cout << 0 << endl;
        return 0;
    }

    int count = 0;
    for (int i=0; i<n; i++) {
        for (int j=i+1; j<n; j++) {
            for (int k=j+1; k<n; k++) {
                if (l[i] + l[j] > l[k] && l[i] + l[k] > l[j] && l[k] + l[j] > l[i]) {
                    if (l[i] != l[j] && l[j] != l[k] && l[k] != l[i]) {
                        count++;
                    }
                }

            }
        }
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(x) x.begin(), x.end()
#define mod 1000000007
typedef long long ll;

int main(){
  string str;
  cin >> str;
  int k;
  cin >> k;
  rep(i, str.length()){
    if(str[i] != 'a' && 'z'+1-str[i] <= k){
      k -= 'z'+1-str[i];
      str[i] = 'a';
    }
  }
  k %= 26;
  str[str.length()-1] += k;
  cout << str << endl;
  return 0;
}

Measured memory_bytes: 512
S[100001];main(n,k,s,t,z){for(;scanf("%d%d",&n,&k),n;printf("%d\n",k)){
for(t=1;t<=n;t++)S[t]=1;
for(z=0;k;k--)if(scanf("%d",&t),t)S[t]=0;else z++;
for(t=1;t<=n;t++)S[t]+=S[t-1];
for(s=t=0;t<=n;t++){if(S[t]-S[s]>z)s++;if(t-s>k)k=t-s;}
}exit(0);}

Measured memory_bytes: 988
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll INF=1e9+7;

int main()
{
    
    ll n,k;
    cin >> n >> k;
    vector<bool> d(10,false);
    rep(i,k){
        ll x;
        cin >> x;
        d[x]=true;
    }
    ll ans=INF;
    for(ll i1=0;i1<=9;i1++){
        for(ll i2=0;i2<=9;i2++){
            for(ll i3=0;i3<=9;i3++){
                for(ll i4=0;i4<=9;i4++){
                    for(ll i5=0;i5<=9;i5++){
                        if(d[i1] || d[i2] || d[i3] || d[i4] || d[i5]) continue;
                        ll y=i1*10000+i2*1000+i3*100+i4*10+i5;
                        if(y>=n){
                            ans=min(ans,y);
                        }
                    }
                }
            }
        }
    }
    for(ll i1=0;i1<=9;i1++){
        for(ll i2=0;i2<=9;i2++){
            for(ll i3=0;i3<=9;i3++){
                for(ll i4=0;i4<=9;i4++){
                    ll y=i1*1000+i2*100+i3*10+i4;
                    if(d[i1] || d[i2] || d[i3] || d[i4]) continue;
                    if(y>=n){
                        ans=min(ans,y);
                    }
                }
            }
        }
    }
    for(ll i1=0;i1<=9;i1++){
        for(ll i2=0;i2<=9;i2++){
            for(ll i3=0;i3<=9;i3++){
                ll y=i1*100+i2*10+i3;
                if(d[i1] || d[i2] || d[i3]) continue;
                if(y>=n){
                    ans=min(ans,y);
                }
            }
        }
    }
    for(ll i1=0;i1<=9;i1++){
        for(ll i2=0;i2<=9;i2++){
            if(d[i1] || d[i2]) continue;
            ll y=i1*10+i2;
            if(y>=n){
                ans=min(ans,y);
            }
        }
    }
    for(ll i1=0;i1<=9;i1++){
        if(d[i1]) continue;
        ll y=i1;
        if(y>=n){
            ans=min(ans,y);
        }
    }
    cout << ans << endl;
    return 0;
} 


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

using namespace std;

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

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

    int dp[n+1][3];
    dp[0][0] = dp[0][1] = dp[0][2] = 0;

    for(int i = 1; i <= n; i++) {
        dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a[i-1];
        dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b[i-1];
        dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c[i-1];
    }

    int result = max(dp[n][0], dp[n][1]);
    result = max(result, dp[n][2]);

    cout << result << endl;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define N 100005
#define Y second
#define X first
using namespace std;
typedef pair<int,int> P;

int n,q,a,b,c,d[N];
string s;
P par[N];

P Find(int x){
  if(par[x].X==x)return P(x,0);
  P r=Find(par[x].X);
  return par[x]=P(r.X,r.Y+par[x].Y);
}

void Union(int x,int y,int v){
  P rx=Find(x),ry=Find(y);
  if(rx.X==ry.X)return;
  par[rx.X]=P(ry.X,v-rx.Y+ry.Y);
}

void IN(){
  scanf("%d%d%d",&a,&b,&c);
  Union(a,b,-c-d[a]+d[b]);
  d[a]+=c;
  d[b]+=c;
}

void COMPARE(){
  scanf("%d%d",&a,&b);
  P r1=Find(b),r2=Find(a);
  if(r1.X!=r2.X)printf("WARNING\n");
  else printf("%d\n",r1.Y-r2.Y+d[b]-d[a]);
}

int main(){
  cin>>n>>q;
  for(int i=1;i<=n;i++)par[i]=P(i,0);
  while(q--){
    cin>>s;
    if(s[0]=='I')IN();
    else COMPARE();
  }
  return 0;
}

Measured memory_bytes: 2424
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args)throws IOException {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> ai = new ArrayList<Integer>();
		int min  = 0,max = 0;
		long sum = 0;

		for(int i = 0;i < n;i++){
			ai.add(sc.nextInt());
			sum += ai.get(i);
		}
		
		max =  ai.get(0);
		min =  ai.get(0);
		
		for(int i = 1;i < ai.size();i++){
			if( ai.get(i) > max){
				max =  ai.get(i);
			}
			if( ai.get(i) < min){
				min = ai.get(i);
			}
		}
			System.out.println(min + " " + max + " " + sum);
		    sc.close();
	}
}

Measured memory_bytes: 42384
/*
  Vivek Rathi
  CSE 2nd Year
  MNNIT
*/
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
#define ll long long int
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define present(c,x) ((c).find(x) != (c).end())
#define null NULL
#define mp make_pair
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define inf 1e18
#define flush fflush(stdout);
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
ll modpower(ll a,ll b,ll c)
{
	ll res=1;
	while(b)
	{
		if(b&1LL)
			res=(res*a)%c;
		a=(a*a)%c;
		b>>=1;
	}
	return res;
}
//-------------------------------Template--Above------------------------------------------------


int main()
{
	boost
	ll a;
	string s;
	cin>>a>>s;
	if(a>=3200)
		cout<<s<<endl;
	else
		cout<<"red"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main()
{
	char str[255];
	int i;
	int l;

	while(fgets(str,sizeof(str),stdin) != NULL)
	{
		l = strlen(str);
		while(1){
			if(strstr(str,"the") != '\0' || strstr(str,"this") !=  '\0' || strstr(str, "that") != '\0')
				break;
			else
			{
				for(i = 0; i < l; i++)
				{
					if(str[i] >= 'a' && str[i] <= 'y')
						str[i]++;
					else if(str[i] == 'z')
						str[i] = 'a';
				}
			}
		}
		printf("%s", str);
	}

	return 0;
}

Measured memory_bytes: 524
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
//#include <math.h>
#include <string>
#include <numeric>
#include <queue>
#include <cstdio>
#include <cstring>
#include <cmath>
#define ll long long
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=1;i<n;++i)
#define mrep(i,n) for(ll i=n;i>=0;--i)
#define all(a) (a).begin(),(a).end()
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define pl pair<ll,ll>
#define inf 1001001001001001000
//#define mod 1000000007
#define mod 998244353
#define pi 3.14159265358979323846
using namespace std;
struct __INIT{
    __INIT(){
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout<<fixed<<setprecision(15);
    }
}__init;



int main(void){
    double a,b,h,m;
    cin>>a>>b>>h>>m;
    h = h*5+(m/60.0)*5;
    double maxi = max(a,b);
    double mini = min(a,b);
    a = mini;
    b = maxi;
    double theta = abs(h-m)*(double)2*pi/(double)60;
    double t1 = b*sin(theta);
    double t2 = b*cos(theta)-a;
    //cout<<sqrt(t1*t1+abs(b*cos(theta))*abs(b*cos(theta)))<<endl;
    double ans = sqrt(t1*t1+t2*t2);
    cout<<ans<<endl;
}

Measured memory_bytes: 4116
#include <bits/stdc++.h>
#include <iomanip>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
 
const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;

ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}
ll lcm(ll x,ll y){
  ll g=gcd(x,y);
  return x/g*y;
}

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  int m,n,k;
  cin >> n >> m >> k;
  
    rep(i,m+1)rep(j,n+1){
          if(n*i+m*j-2*i*j==k){
            cout << "Yes" <<endl;
     		return 0;
          }
        }
      
    cout << "No" <<endl;
  
  
}


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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (auto& x : a) { cin >> x; }
    sort(a.begin(), a.end());

    auto dsum = [&](auto it1, auto it2) {
        vector<int> b(n);
        for (int i = 1; i < n - 1; i++) {
            b[i] = (i % 2 == 0) ? *it1++ : *it2++;
        }
        b[0] = *it1;
        b[n - 1] = *it2;
        int64_t s = 0;
        for (int i = 1; i < n; i++) {
            s += abs(b[i] - b[i - 1]);
        }
        return s;
    };

    cout << max(dsum(a.begin(), a.rbegin()), dsum(a.rbegin(), a.begin())) << '\n';
}


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

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  for(ll i=0;i<n;i++){
    cin >> a[i];
  }
  vector<ll> b(n);
  for(ll i=0;i<n;i++){
    b[i] = a[i] - i+1;
  }
  
  sort(b.begin(),b.end());
  ll x;
  if(n%2 == 1){
    x = b[n/2];
  }else{
    x = (b[n/2-1]+b[n/2])/2;
  }
  
  ll ans = 0;
  for(ll i=0;i<n;i++){
    ans += abs(b[i]-x);
  }
  
  cout << ans << endl;
  
  return(0);
}

Measured memory_bytes: 6276
// Created by arvybhatt

#include <bits/stdc++.h>
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define p_b push_back
#define m_p make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define repA(i,a,n) for(int i=a;i<=(n);++i)
#define repD(i,a,n) for(int i=a;i>=(n);--i)

using namespace std;
using ll = long long;



int main()
{
    fast;
	int n,m;cin>>n>>m;
	int h[n+1];
	
	for(int i=1; i<=n; i++)
	cin>>h[i];
	int hash[n+1];
	memset(hash,-1,sizeof(hash));

	for(int i=0;i<m; i++)
	{
		int a,b;cin>>a>>b;
		hash[a]=max(hash[a],h[b]);
		hash[b]=max(hash[b],h[a]);
	}
	

	ll count=0;
	for(int i=1; i<=n ;i++)
	{
		if(hash[i]==-1)
			count++;
		else if(h[i]>hash[i])
			{//cout<<i<<"\n";
			count++;
			}
	}
	cout<<count<<"\n";

    return 0;
}


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

int main(){
    int n;
    cin>>n;
    int sum=0;
    int x=n;
    while(n>0){
        sum+=n%10;
        n/=10;
    }
    if(x%sum==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <map>

using namespace std;

vector<int> road[200000];
vector<int> rail[200000];

int ar[200000];
int br[200000];
int res[200000];

//道路の連結探索を再帰的に行う関数
void link_road(int n)
{
	for(int i=0;i<road[n].size();i++)
	{
		if(ar[road[n][i]]==ar[n])
		{
			continue;
		}else{
			ar[road[n][i]]=ar[n];
			link_road(road[n][i]);
		}
	}
	return;
}
//鉄道の連結探索を再帰的に行う関数
void link_rail(int n)
{
	for(int i=0;i<rail[n].size();i++)
	{
		if(br[rail[n][i]]==br[n])
		{
			continue;
		}else{
			br[rail[n][i]]=br[n];
			link_rail(rail[n][i]);
		}
	}
	return;
}

int main()
{
	int n,k,l;
	cin>>n>>k>>l;
	int p,q;
	map<int,pair<int,int>> link; //それぞれの街がどのような連結成分に属するか
	map<pair<int,int>,int> cnt; //同じ連結成分を持つ要素のカウント
	for(int i=0;i<n;i++)
	{
		ar[i]=-1;
		br[i]=-1;
		res[i]=0;
	}
	for(int i=0;i<k;i++)
	{
		cin>>p>>q;
		road[p-1].push_back(q-1);
		road[q-1].push_back(p-1);
	}
	for(int i=0;i<l;i++)
	{
		cin>>p>>q;
		rail[p-1].push_back(q-1);
		rail[q-1].push_back(p-1);
	}

	//道路の連結探索
	for(int i=0;i<n;i++)
	{
		if(ar[i]!=-1)
		{
			continue;
		}
		ar[i]=i;
		link_road(i);
	}
	//鉄道の連結探索
	for(int i=0;i<n;i++)
	{
		if(br[i]!=-1)
		{
			continue;
		}
		br[i]=i;
		link_rail(i);
	}

	//ペアの作成とグループごとの数え上げ
	for(int i=0;i<n;i++)
	{
		link[i]=pair<int,int>(ar[i],br[i]);
		cnt[pair<int,int>(ar[i],br[i])]+=1;
		//cerr<<link[i].first<<" "<<link[i].second<<endl;
	}
	//数え上げ
	for(int i=0;i<n;i++)
	{
		res[i]=cnt[link[i]];
	}
	//結果の出力
	for(int i=0;i<n;i++)
	{
		cout<<res[i]<<" ";
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 41088
# -*- coding: utf-8 -*-
# ITP1_11_C

class Dice:
    def __init__(self, num):
        self.num = num
        
    def roll(self, direction):
        """ 転がす処理 """
        data = []
        new_num = []
        if direction == "N":
            data = [1, 5, 2, 3, 0, 4]
        elif direction == "S":
            data = [4, 0, 2, 3, 5, 1]
        elif direction == "E":
            data = [3, 1, 0, 5, 4, 2]
        elif direction == "W":
            data = [2, 1, 5, 0, 4, 3]
        elif direction == "L":
            data = [0, 2, 4, 1, 3, 5]
        elif direction == "R":
            data = [0, 3, 1, 4, 2, 5]

        for i in data:
            new_num.append(self.num[i])
        self.num = new_num
        
def dice_roll1(dice, dice_tf):
    dice_roll = ""
    top = dice_tf[0]
    
    if dice.num.index(top) == 1:
        dice_roll = "N"
    elif dice.num.index(top) == 2:
        dice_roll = "W"
    elif dice.num.index(top) == 3:
        dice_roll = "E"
    elif dice.num.index(top) == 4:
        dice_roll = "S"
    elif dice.num.index(top) == 5:
        dice_roll = "NN"
        
    return dice_roll

def dice_roll2(dice, dice_tf):
    dice_roll = ""
    front = dice_tf[1]

    if dice.num.index(front) == 2:
        dice_roll = "L"
    elif dice.num.index(front) == 3:
        dice_roll = "R"
    elif dice.num.index(front) == 4:
        dice_roll = "LL"
        
    return dice_roll

dice1 = Dice(list(map(int, input().split())))
dice2 = Dice(list(map(int, input().split())))

dice_tf = dice1.num[:2]

direction = dice_roll1(dice2, dice_tf)
for i in direction:
    dice2.roll(i)
direction = dice_roll2(dice2, dice_tf)
for i in direction:
    dice2.roll(i)

if dice1.num[2] == dice2.num[2]:
    print("Yes")
else:
    print("No")



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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  vector<ll>A(3);
  for(int i=0;i<3;i++)cin>>A[i];
  sort(rng(A));
  ll ans=LONG_MAX;
  do{
    ll l=A[0]*A[1]*(A[2]/2);
    ll u=A[0]*A[1]*((A[2]/2)+A[2]%2);
    ans=min(ans,abs(l-u));
  }while(next_permutation(rng(A)));
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[500][500];
void calc(int i,int j){
  if(a[i][j]==1){
    a[i][j]=2;
    calc(i+1,j);
    calc(i,j+1);
    calc(i+1,j+1);
    calc(i+1,j-1);
    calc(i-1,j);
    calc(i,j-1);
    calc(i-1,j-1);
    calc(i-1,j+1);
  }
  else return;
}

int main(){
  while(1){
    int w,h;
    cin>>w>>h;
    if(w==0&&h==0) break;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	cin>>a[i][j];
      }
    }
    int count=0;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	if(a[i][j]==1){
	  count++;
	  calc(i,j);
	}
      }
    }
    cout<<count<<endl;
  }
  return 0;
}



Measured memory_bytes: 3200
n,m=io.read("*n","*n","*l")
h={}
t={}
for i=1,n do
    h[i]=io.read("*n")
    t[i]=1
end

for i=1,m do
    a,b=io.read("*n","*n")
    if h[a]<h[b] then
        t[a]=0
    elseif h[b]<h[a] then
        t[b]=0    
    else
        t[a]=0
        t[b]=0
    end
end

counter=0
for i=1,n do
    counter=counter+t[i]
end
print(counter)

Measured memory_bytes: 6420
#include <iostream>

using namespace std;

const int MAX_N = 51;

char A[MAX_N][MAX_N];
char B[MAX_N][MAX_N];

int main() {
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			cin >> A[i][j];
		}
	}
	for (int i = 0; i < M; i++) {
		for (int j = 0; j < M; j++) {
			cin >> B[i][j];
		}
	}
	bool flag = false;
	for (int i = 0; i + M - 1 < N; i++) {
		for (int j = 0; j + M - 1 < N; j++) {
			bool temp = true;
			for (int x = 0; x < M; x++) {
				for (int y = 0 ; y < M; y++) {
					if (A[i + x][j + y] != B[x][y]) temp = false;
				}
			}
			if (temp) flag = true;
		}
	}
	if (flag) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}



Measured memory_bytes: 256
import re
import numpy as np

N, M = [int(item) for item in re.split(r"\s", input())]
X = [int(item) for item in re.split(r"\s", input())]

if N >= M:
    print(0)
elif N == 1:
    s_X = np.array(sorted(X))
    print(s_X[-1] - s_X[0])
else:
    splitter = N - 1
    s_X = np.array(sorted(X))

    diffs = np.sort(np.diff(s_X))[::-1] - 1
    diff_sum = diffs[:splitter].sum()
    print(s_X[-1] - s_X[0] + 1 - N - diff_sum)


Measured memory_bytes: 22924
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;

const int INF = 1e9 + 7;

int a[128];

int main()
{
	IO_OP;
	
	int n;
	cin >> n;
	for(int i=0;i<n;i++)
		cin >> a[i];
	sort(a, a+n);
	int sm = 0;
	for(int i=0;i<n-1;i++)
		sm += a[i];
	if(sm > a[n-1]) cout << "Yes" << endl;
	else cout << "No" << endl;
}



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


void cc_env() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	//
#endif
}

int recursive(int k, vector<int> &inputArr, vector<int> &dp) {
	// base case

	if (dp[k] != -1)
		return dp[k];

	// recursive case
	int ans = 0;
	for (int i = 0; i < (int)inputArr.size(); i++) {
		if (k - inputArr[i] < 0)
			break;
		bool temp = recursive(k - inputArr[i], inputArr, dp);
		ans = 1 - temp;
		if (ans == 1)
			break;
	}
	dp[k] = ans;
	return dp[k];
}


void iterative(int K, vector<int> &inputArr, vector<int> &dp) {
	for (int i = 1; i <= K; i++) {
		for (int j = 0; j < (int)inputArr.size(); j++) {
			if (i - inputArr[j] < 0) break;

			else if (dp[i - inputArr[j]] == false) {
				dp[i] = true;
				break;
			}
		}
	}
}



int main() {
	// cc_env();
	// input part
	int N, K;
	cin >> N >> K;

	vector<int> inputArr(N);
	for (int i = 0; i < N; i++)
		cin >> inputArr[i];

	// procssing part;
	sort(inputArr.begin(), inputArr.end());
	vector<int> dp(K + 1, -1);
	dp[0] = 0;
	recursive(K, inputArr, dp);
	string ans = dp[K] == 1 ? "First" : "Second";
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5376
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <algorithm>
#include <cmath>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// to container
template <class C>
void input(C &c)
{
    for_each(c.begin(), c.end(), [](auto &i) { cin >> i; });
}

// to number, string
template <class T>
T input()
{
    T data;
    cin >> data;
    return data;
}

int main()
{
    int N = input<int>();

    cout << (N % 2 == 0 ? floor(N / 2.0) : ceil(N / 2.0)) / (double)N << endl;
    return 0;
}

Measured memory_bytes: 256
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <bits/stdc++.h>
using namespace std;

int main(){
    string o, e; cin >> o >> e;
    int e_size = e.size();
    int o_size = o.size();
    
    for(int i = 0; i < o_size; i++){
        if(i > e_size - 1){
            cout << o.at(i) << endl;
        }else{
            cout << o.at(i) << e.at(i);
        }
    }
}



Measured memory_bytes: 256
import java.util.*;
 
public class Main{
	public static void main(String[] args){
	    Scanner sc = new Scanner(System.in);
    	int friends = sc.nextInt();
        int height = sc.nextInt();
        int fh[] = new int[friends];
        int count = 0;
        for(int i = 0; i < friends; i++){
        	fh[i] = sc.nextInt();
            if(fh[i] >= height){
            	count++;
            }
        }
        System.out.println(count);
	}
}

Measured memory_bytes: 57496
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath> // sqrt
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#define ps(arr) \
    debug("size %ld: ", arr.size()); \
    for(auto e: arr) cout << e << " "; \
    cout << endl;
#else
#define debug(fmt, ...)
#define ps(arr)
#endif


#define TARGET 7
int main(void) {
    string str;
    cin >> str;
    int len = str.length();
    vector<int> arr(len);
    for(int i = 0; i < len; i++) {
        arr[i] = str[i] - '0';
    }

    for(int pat = 0; pat < (1<<(len-1)); pat++) {
        // arr[i] * arr[i+1]
        int num = arr[0];
        string str;
        str.push_back(arr[0] + '0');
        for(int bit = 0; bit < len-1; bit++) {
            // plus
            if(pat & (1<<bit)) {
                num += arr[bit+1];
                str.push_back('+');
            } else {
                num -= arr[bit+1];
                str.push_back('-');
            }
            str.push_back(arr[bit+1]+'0');
        }
        if(num == TARGET) {
            cout << str << "=7" << endl;
            return 0;
        }
    }
    __builtin_unreachable();
    return 0;
}

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

int main() {
    int h, w;
    cin >> h >> w;
    int cost[10][10];
    for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) cin >> cost[i][j];
    }
    vector<int> nums(10, 0);
    for (int i = 0; i < h * w; i++) {
        int x;
        cin >> x;
        if (x == -1) continue;
        nums[x]++;
    }
    for (int k = 0; k < 10; k++) {
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
            }
        }
    }
    int ans = 0;
    for (int i = 0; i < 10; i++) ans += nums[i] * cost[i][1];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3640
#include<iostream>
using namespace std;
int main()
{
    int N,M;
    long a[1000];
    // int p[1000],x[1000];
    cin >> N;

    // int sumT=0;
    long max=-1;
    long min =10000000000;

    for (int i=0;i<N;i++){
      cin >> a[i];
      if (min > a[i])min = a[i];
      if (max < a[i])max = a[i];
    }

    // cin >> M;



    cout << ( max-min )<< endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<algorithm>
using namespace std;
int main() {
	vector <int> time;
	int array[5];
	int temp = 0;;
	for (int i = 0; i < 5; i++)
		cin >> array[i];
	do {
		temp = 0;
		for(int i=0;i<4;i++){
			temp += array[i] % 10 == 0 ? (array[i]) : (array[i] / 10 + 1) * 10;
		}
		temp += array[4];
		time.push_back(temp);
	} while (next_permutation(array, array + 5));
	int min = *min_element(time.begin(), time.end());
	cout << min << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

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

    int H,W; cin >> H >> W;

    map<int,int> mp;
    multiset<int> st;
    rep(i,W) mp[i] = i;
    rep(i,W) st.insert(0);

    rep(i,H) {
        int l,r; cin >> l >> r;
        --l;
        auto itr = mp.lower_bound(l);
        int rr = -1;
        while (itr != mp.end() && itr->first <= r){
            rr = max(rr,itr->second);
            int v = (*itr).first - (*itr).second;
            st.erase(st.find(v));
            mp.erase(itr++);
        }
        if (rr != -1 && r < W) {
            mp[r] = rr;
            st.insert(r - rr);
        }
        int ans = -1;
        if ((int)st.size() > 0) {
            ans = *st.begin() + i + 1;
        }
        cout << ans << '\n';
    }
    return 0;
}

Measured memory_bytes: 22356
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1e9+7
#define PI acos(-1.0)
#define ll long long

int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
//---------------------------

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  int N;cin>>N;
  ll a[201];
  int ans=0;
  int flag=1;
  for(int i=1;i<=N;i++){
    cin>>a[i];
  }
  while(flag){
    for(int i=1;i<=N;i++){
      if(a[i]%2==1){
        flag=0;
        break;
      }
      a[i]/=2;
    }
    ans++;
  }
  P(ans-1);
  // a[i]/=2;
  // if(a[i]%2==1){ans;break;}
  return 0;
}


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

#define N 100000

char aa[] = "abcdefghijklmnopqrstuvwxyz";

int main() {
	static char s[N + 1], used[26];
	int n, i, c;

	scanf("%s", s);
	n = strlen(s);
	for (i = 0; i < n; i++)
		used[s[i] - 'a'] = 1;
	for (c = 0; c < 26; c++)
		if (!used[aa[c] - 'a']) {
			printf("%c\n", aa[c]);
			return 0;
		}
	printf("None\n");
	return 0;
}


Measured memory_bytes: 256
// Starting with the name of Allah

#include <bits/stdc++.h>
#define ll long long
#define nl endl
#define flash_all ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define gcd(a,b)         __gcd(a,b)
#define lcm(a,b)         (a/gcd(a,b))*b


using namespace std;


int main()
{
	flash_all;
	int n,k,i,sum=0,sum1=0;
	cin>>n>>k;
	int p[n+1];
	for(i=0;i<n;i++){
		cin>>p[i];
	}
	sort(p,p+n);
	for(i=0;i<k;i++){
		sum=sum+p[i];
	}
	cout<<sum<<nl;
}
//Happy Coding.....

Measured memory_bytes: 3668
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {

            int i = 0;
            while (true)
            {
                string[] s = Console.ReadLine().Split();
                int x = int.Parse(s[0]);
                int y = int.Parse(s[1]);
                int z = 0;
                if (x == 0 && y == 0)
                {
                    break;
                }
                if (x > y)
                {
                    z = x;
                    x = y;
                    y = z;
                }
                Console.WriteLine(x + " " + y);
                i++;
            }
        }
    }
}

Measured memory_bytes: 9268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    ll x, y, z = 0;
    cin >> x >> y;
    while (x <= y) x *= 2, z++;
    cout << z;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <bitset>

using namespace std;

int stack[1000];
int sp = 0;

void dump(int stack[1000],int num){
    for(int i = 0; i < num ; i++){
        cout << stack[i] << " ";
    }
    cout << endl;
}

void push(int num) {
    stack[++sp] = num;
}

int pop() {
    if(sp == 0000){
        cout << "pop error" << endl;
        exit(1);
    }
    return stack[sp--];

}

void add() {
    push(pop() + pop());
}

void sub() {
    int a = pop();
    int b = pop();
    push(b - a);
}

void mul() {
    push(pop() * pop());
}

int main() {
    char token[200];
    while (scanf("%s",token) != EOF) {
        switch (token[0]) {
            case '+':
                add();
                break;
            case '*':
                mul();
                break;
            case '-':
                sub();
                break;
            default:
                push(atoi(token));
        }
    }
    cout <<  pop() << endl;
    return 0;
}


Measured memory_bytes: 3176
import sys

n=int(raw_input())
l=[]
cnt=0
for i in xrange(n):
 l.append(int(raw_input()))
if l[0]==2:
 print 1
 sys.exit()
i=0
cnt=1
next=0
while i<n:
 next=l[next]-1
 if l[next]==2:
  print cnt+1
  sys.exit()
 cnt+=1
 i+=1
print -1


Measured memory_bytes: 5892
x = int(input())
if x >= 2000:
    print(1)
else:
    c = x//100 + 1
    am = x%100
    for i in range(c):
        for j in range(c-i):
            for k in range(c-i-j):
                for l in range(c-i-j-k):
                    for m in range(c-i-j-l):
                        if am == i*5 + j*4 + k*3 + l*2 + m*1:
                            print(1)
                            exit()
    print(0)


Measured memory_bytes: 3064
cost = {15:2244,12:1870,10:1520,5:850,3:550,2:380}

mincost =  [10000]*51

for j in cost:
    mincost[j] = cost[j]
for i in range(4,51):
    for j in cost:
        if mincost[i-j] < 10000 and mincost[i] > mincost[i-j] + cost[j]:
            mincost[i] = mincost[i-j] + cost[j]

while True:
    n = int(raw_input())
    if n == 0:
        break 
    print mincost[n/100]

Measured memory_bytes: 4224
#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;

int main(){
    string s;
    int count;
    int capitals;
    while(cin >> s && s.size() >= 4 && s.size() <= 10){
        count = 0;
        capitals = 0;
        if(s[0]=='A'){
            for(int i = 2; i < s.size() - 1; i++){
                if(s[i]=='C'){
                    count++;
                }
            }
            if(count != 1){
                cout << "WA" << endl;
            }
            else{
                for(int j = 0; j < s.size(); j++){
                    if(isupper(s[j])){
                        capitals++;
                    }
                }
                if(capitals==2){
                    cout << "AC" << endl;
                }
                else{
                    cout << "WA" << endl;
                }
            }
        }
        else{
            cout << "WA" << endl;
        }
    }

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define rep(i,l,r) for(int (i)=(l);(i)<(r);i++)
#define erep(i,l,r) for(int (i)=(l);(i)<=(r);i++)
#define MOD 1000000007
using namespace std;
int main(){
    int n,r,ans;
    cin>>n>>r;
    if(n>=10) ans=r;
    else ans=r+100*(10-n);
    cout<<ans<<endl;
}

Measured memory_bytes: 256