akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

void Main()
{
  int x, n;
  cin >> x >> n;
  vector<int> p(n);
  
  int flg = 1;
  
  int judgeEqual = 0;
  int judgeEqualPlus = 0;
  int judgeEqualMinus = 0;
  
  int plus = x;
  int minus = x;
  
  int ans;
  
  if(n != 0){
  	REP(i, n)
  	cin >> p[i];
    
    for(int i = 0; i < n; i++){
      if(x == p[i])
        break;
      else
        judgeEqual++;
    }
    if(judgeEqual == n)
      ans = x;
    
    else{
    	while(flg){
      	  plus++;
          minus--;
          
          for(int i = 0; i < n; i++){
      		if(plus == p[i])
        		break;
      		else
        		judgeEqualPlus++;
          }
            
          for(int i = 0; i < n; i++){
      		if(minus == p[i])
        		break;
      		else{
        		judgeEqualMinus++;
            }
          }
            
            if(judgeEqualPlus == n){
              if(judgeEqualMinus == n)
                ans = minus;
              else
                ans = plus;
              
              flg = 0;
            }
              
            else{
              
              if(judgeEqualMinus == n){
                ans = minus;
                flg = 0;
              }
              else{
              	judgeEqualPlus = 0;
              	judgeEqualMinus = 0;
              }
            }
          
        }
    }
          
    printf("%d", ans);
  }
  
  else
    printf("%d", x);
}

int main()
{
  std::cout << std::fixed << std::setprecision(15);
  Main();
}


Measured memory_bytes: 3728
S=input()
T=input()
s=len(S)
t=len(T)
A=[]


for i in range(s-t+1):
  word=S[i:i+t]
  a=0
  for j in range(t):
    if word[j]==T[j]:
      a+=1
    else:
      a+=0
  A.append(t-a)

print(min(A))

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

using namespace std;
int p[100005];
string s[100005];
vector<int>v;
map<int,int>mp;
map<int,int>cnt;
int main(){
	int n,m;
	cin>>n>>m;
	int sum1=0,sum2=0;
    v.push_back(0);
	for(int i=1;i<=m;i++){
		cin>>p[i]>>s[i];
		if(s[i]=="AC"&&mp[p[i]]==0){
			v.push_back(i);
          	sum1++;
          	mp[p[i]]=1;
        	sum2+=cnt[p[i]];
        }
		if(s[i]=="WA"&&mp[p[i]]==0){
			cnt[p[i]]++;
		}
	} 
	cout<<sum1<<" "<<sum2<<endl;
	return 0;
}

Measured memory_bytes: 15864
// to Utils -> L47
// to Rlyeh -> L78
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <map>
#include <numeric>
#define class struct
#define bogo_sort std::sort
#define bozo_sort std::stable_sort
#define elif else if
#define echo std::cout <<
#define read std::cin >>
#define fin << '\n'
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define alles(obj) obj.begin(), obj.end()
#define bash push_back
#define makePair std::make_pair
// type-define
#define String std::string
#define Stack std::stack
#define Queue std::queue
#define pQueue std::priority_queue
#define Vector std::vector
#define Pair std::pair
#define Map std::map
typedef long long llong;
typedef bool boolean;
typedef Pair<int,int> Pii;
typedef Vector<int> Vi;
// utils
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

class hori {

    static llong power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) {
                ans = ( ans * x ) % mod;
            }
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }

    static llong power ( llong x, llong n ) {
        return power( x, n, 1000000007 );
    }

    static llong gcd ( llong x, llong y ) {
        return x % y ? gcd( y, x % y ) : y;
    }

    static llong lcm ( llong x, llong y ) {
        return ( x / gcd(x, y) * y );
    }

    static boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
};

namespace Rlyeh {

    signed call_of_Cthulhu( signed datum ) {

        int d;
        read d;
        int sum = 0;
        int max = 0;
        for ( int i = 0; i < d; i++ ) {
            int a;
            read a;
            sum += a;
            max = std::max ( a, max );
        }

        echo sum - max/2 fin;

        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); Rlyeh::call_of_Cthulhu(114514); return 0;}


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

int main(){
	int N; string S; cin>>N>>S;
	int ans = 0;
	for(int i=0; i<1000; i++){
		int j = -1;
		for(int d=100; d; d/=10){
			char c = i/d%10+'0';
			for(++j; j<N && S[j]!=c; j++);
			if(j==N) break;
			if(d==1) ans++;
		}
	}
	cout<< ans <<endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
 
using namespace std;
 
#define fast_cin() ios_base::sync_with_stdio(false);cin.tie(NULL)
#define rep(i, x, n) for(int i=x; i<n; i++)
#define all(x) x.begin(), x.end()
#define pb push_back
#define eb emplace_back
#define trav(a, x) for(auto& a: x)
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define MOD 1000000007
#define endl '\n'
#define MAX 100002
#define pii pair<int, int>
#define pll pair<long long, long long>


typedef long long int ll;
typedef unsigned long long ull;
typedef vector<int> vec;


int main(){
    int k;cin>>k;
    string s;cin>>s;
    int n=s.length();
    //cout<<n<<endl;
    if(n<=k)
        cout<<s<<endl;
    else{
        string x;
        for(int i=0;i<k;i++)
            x+=s[i];
        x+="...";
        cout<<x<<endl;
    }

}

Measured memory_bytes: 3628
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
#define For(i,x) for (int i=h[x],k; i; i=nxt[i])
typedef long long ll;
using namespace std;

const int N=100010;
int n,ans,cnt,h[N],d[N],vis[N],to[N],nxt[N];
struct P{ int x,y; }p[N];

void add(int u,int v){ to[++cnt]=v; nxt[cnt]=h[u]; h[u]=cnt; }
void dfs(int x){ vis[x]=1; For(i,x) if (!vis[k=to[i]]) dfs(k); }

int main(){
	scanf("%d",&n); ans=n;
	rep(i,1,n) scanf("%d%d",&p[i].x,&p[i].y);
	rep(i,1,n) rep(j,1,n) if (i!=j){
		int tx=p[i].x-p[j].x,ty=p[i].y-p[j].y,res=0; cnt=0;
		rep(u,1,n) h[u]=vis[u]=d[u]=0;
		rep(u,1,n) rep(v,1,n) if (p[u].x-p[v].x==tx && p[u].y-p[v].y==ty) add(u,v),d[v]++;
		rep(u,1,n) if (!d[u]) dfs(u),res++;
		ans=min(ans,res);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include<string.h>
 
 
int main()
{
 char s[101];
 scanf("%s", s);
 
 int len = strlen(s);
 for (int i = 0; i < len; i++) {
 printf("x");
 }
  printf("\n");
}


Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
    std::ios::sync_with_stdio(0); cin.tie(0);
    int n, m, c;
    int temp=0;
    int ans=0;
    cin >> n >> m >> c ;
    int array [m][n];
    int bb[m];
for(int i=0;i<m;i++){
cin >> bb[i];
}


    for(int i=0;i<n;i++){
       for(int j=0; j<m; j++){
           cin >> array[j][i];
       } 

    }
    for(int i=0; i<n;i++){
        temp=0;
        for (int j=0; j<m; j++){
           temp = temp + array[j][i]*bb[j];
       } 
       if(temp+c>0){
           ans++;
       }
    }

    // for(int i=0;i<A;i++){
    //     double z;
    //     string p;
    //     cin >> z;
    //     cin >> p;
    //     if(p=="BTC") {
    //         b += z*380000;
    //     }else if(p=="JPY"){
    //         b += z;
    //     }
    // }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    int k=sc.nextInt();
    int n=sc.nextInt();
    int a[]=new int[n+1];
    for (int i=0;i<n;i++) {
      a[i]=sc.nextInt();
    }
    a[n]=k+a[0]-a[n-1];

    for (int i=n-1;i>0;i--) {
      a[i]=a[i]-a[i-1];
      // System.out.println(a[i]);
    }

    Arrays.sort(a);


    System.out.println(k-a[n]);
  }
}


Measured memory_bytes: 76348
#!/usr/bin/env python3
import sys
import heapq
import copy
import itertools

inf = float('inf')

def path(u, v):
    return frozenset((u, v))


class Graph_dijkstra(object):
    def __init__(self, V: "List[int]", E: "Set[FrozenSet[int, int]]", L: "Dict[FrozenSet[int, int], int]"):
        self.V = V
        self.E = E
        self.L = L
        self.adjacent = self.init_adjacent() # type: Dict[int: List[int]]
        self.shortest_path = self.init_shortest_path() # type: Dict[FrozenSet[int, int], int]
    
    def init_adjacent(self):
        ret = {v: [] for v in self.V}
        for e in self.E:
            el = list(e)
            ret[el[0]].append(el[1])
            ret[el[1]].append(el[0])
        return ret
    
    def init_shortest_path(self):
        ret = {path(s, g): inf for s, g in itertools.permutations(self.V, 2)}
        for v in self.V:
            ret[path(v, v)] = 0
        return ret
    
    def dijkstra(self, s: int):
        D = {v: inf for v in self.V}
        D[s] = 0
        prev = {v: None for v in self.V}
        Q = [(0, s)]

        while len(Q) > 0:
            du, u = heapq.heappop(Q)
            for v in self.adjacent[u]:
                e = path(u, v)
                alt = du + self.L[e]
                if alt < D[v]:
                    D[v] = alt
                    prev[v] = u
                    heapq.heappush(Q, (D[v], v))

        for v in self.V:
            self.shortest_path[path(s, v)] = D[v]

    def find_shortest_path(self, pair: "FrozenSet[int, int]"):
        d = self.shortest_path[pair]
        if d < inf:
            return d
        s = list(pair)[0]
        self.dijkstra(s)
        return self.shortest_path[pair]

def solve(N: int, M: int, R: int, r: "List[int]", A: "List[int]", B: "List[int]", C: "List[int]"):
    V = list(range(N))
    E = set()
    L = dict()
    
    for i in range(M):
        e = path(A[i], B[i])
        E.add(e)
        L[e] = C[i]

    G = Graph_dijkstra(V, E, L)
    for ri in r:
        G.dijkstra(ri)
    shortest = inf
    for p in itertools.permutations(r):
        path_len = 0
        for i in range(len(p)-1):
            path_len += G.find_shortest_path(path(p[i], p[i+1]))
        if path_len < shortest:
            shortest = path_len
    
    print(shortest)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    R = int(next(tokens))  # type: int
    r = [ int(next(tokens))-1 for _ in range(R) ]  # type: "List[int]"
    A = [int()] * (M)  # type: "List[int]" 
    B = [int()] * (M)  # type: "List[int]" 
    C = [int()] * (M)  # type: "List[int]" 
    for i in range(M):
        A[i] = int(next(tokens))-1
        B[i] = int(next(tokens))-1
        C[i] = int(next(tokens))
    solve(N, M, R, r, A, B, C)

if __name__ == '__main__':
    main()


Measured memory_bytes: 16200
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

const int N=3e5+5;

ll d,n,a,x[N],h[N],s[N];

pll p[N];

int main()
{ios_base::sync_with_stdio(false);
cin>>n>>d>>a;
rep(i,0,n-1)cin>>x[i]>>h[i],p[i]=mp(x[i],h[i]);
sort(p,p+n);
rep(i,0,n-1)x[i]=p[i].ff,h[i]=p[i].ss;
ll ans=0;
rep(i,0,n-1)
{
	if(i)s[i]+=s[i-1];
	ll kk=h[i]+s[i];
	int id=upper_bound(x,x+n,x[i]+2*d)-x;
	ll cnt=max(0ll,(kk+a-1)/a);
	ans+=cnt;
	s[i]-=cnt*a;
	s[id]+=cnt*a;
}
ol(ans);
return 0;
}



Measured memory_bytes: 11264
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin>>s;
	Yn(s[0]=='7'||s[1]=='7'||s[2]=='7');
}


Measured memory_bytes: 3668
n,k=map(int,input().split())
loop_=[1]
l_set=set()
lst=list(map(int,input().split()))

tar=None
for i in range(k):
    num=lst[loop_[-1]-1]
    if num in l_set:
        tar=num
        break
    else:
        loop_.append(num)
        l_set.add(num)

if tar==None:
    print(loop_[k])
    exit()    
loop__=loop_[loop_.index(tar):]

num=k+1-len(loop_)
try:
  print(loop__[num%len(loop__)-1])
except:
  print(1)

Measured memory_bytes: 32384
//Tree.
//Refering to exp.
#include<iostream>
#include<vector>
#include<queue>
#include<map>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef pair<int,int> pii;
typedef vector<int>   vi;
typedef vector<vi >   vvi;

int main(){
	int n;
	cin>>n;
	
	vvi g(n);
	vector<pii> vp;
	REP(i,n-1){
		int a,b;
		cin>>a>>b;
		a--, b--;
		g[a].push_back(b);
		g[b].push_back(a);
		vp.emplace_back(a,b);
	}
	
	int num_color=0;
	map<pii,int> mp;
	queue<int> q;
	vi check(n,-1);
	
	q.push(0);
	check[0]=0;
	while(!q.empty()){
		int leaf=q.front();
		q.pop();
		
		num_color=max(num_color,(int)g[leaf].size());
		
		int tmp=1;
		REP(i,g[leaf].size()){
			if(check[g[leaf][i]]==-1){
				if(tmp==check[leaf]) tmp++;
				mp[pii(leaf,g[leaf][i])]=mp[pii(g[leaf][i],leaf)]=check[g[leaf][i]]=tmp++;
				q.push(g[leaf][i]);
			}
		}
	}
	
	cout<<num_color<<endl;
	for(auto &elem:vp) cout<<mp[elem]<<endl;
}

Measured memory_bytes: 19700
import heapq as hq

N = int(input())
AB = []

for i in range(N):
    a, b = [int(_) for _ in input().split()]
    hq.heappush(AB, (b, a))

t = 0
while AB:
    b, a = hq.heappop(AB)
    t += a
#    print(a, b, t)
    if t > b:
        print('No')
        exit()
print('Yes')


Measured memory_bytes: 28760
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _0002
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> height = new List<int>();
            for (int i = 0; i < 10; ++i)

            {
                height.Add(int.Parse(Console.ReadLine()));
            }
            height.Sort();
            Console.Write("{0}\n{1}\n{2}\n", height[9], height[8], height[7]);
        }
    }
}



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

// Shrotening
#define fst first
#define snd second
#define pb push_back

// Loop
#define FOR(i,a,b) for(auto i=(a);i<(b);++i)
#define RFOR(i,a,b) for(auto i=(a);i>=(b);--i)

#define REP(i,a) for(auto i=0;i<(a);++i)
#define RREP(i,a) for(auto i=(a);i>=0;--i)

#define EACH(i,a) for(auto (i)=(a).begin(),_END=(a).end();i!=_END;++i)
#define REACH(i,a) for(auto (i)=(a).rbegin(),_END=(a).rend();i!=_END;++i)

//Algorithm
#define ALL(a) (a).begin(), a.end()
#define RALL(a) (a).rbegin(), a.rend()
#define EXIST(a,x) ((a).find(x)!=(a).end())
#define SORT(a) std::sort((a).begin(), (a).end())
#define UNIQUE(a) std::sort((a).begin(), a.end()), a.erase(std::unique((a).begin(), a.end()), a.end());
#define SUM(a) std::accumulate((a).begin(), (a).end(), 0);

//Setting
#define OPT std::cin.tie(0);std::ios::sync_with_stdio(false);

//debug message
bool debug = true;
#define MSG(s)   if(debug){std::cout << s << std::endl;}
#define DEBUG(x) if(debug){std::cout << "debug(" << #x << "): " << x << std::endl;}

//alias
typedef long long LL;
typedef std::vector<char> VC;
typedef std::vector<int>  VI;
typedef std::vector<long> VL;
typedef std::vector<long long> VLL;

typedef std::vector< VC > VC2;
typedef std::vector< VI > VI2;
typedef std::vector< VL > VL2;
typedef std::vector< VLL > VLL2;

typedef std::pair<int,int> PII;

int inline digit(LL x) {
    return std::log10(x) + 1;
}

LL N;
int main() {
    std::cin >> N;

    int ans = std::numeric_limits<int>::max();
    for(LL i = 1; i*i <= N; ++i) {
        if(N % i != 0) continue;
        LL j = N / i;
        ans = std::min(ans, std::max(digit(i), digit(j)));
    }

    std::cout << ans << std::endl;
}

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

int main() {
  int N, K, x;
  cin >> N >> K;
  int total = 0;
  for (int i = 0; i < N; i++) {
    cin >> x;
    if (x * 2 <= K) {
      total = total + x;
    }
    else if (x * 2 > K) {
      total = total + K - x;
    }
  }
  cout << total * 2 << endl;
}
    

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

int N;
vector<int> h;
int func(int,int);

int main() {
  cin >> N;
  h = vector<int>(N);
  for (int i=0;i<N;i++){
    cin >> h.at(i);
  }

  cout << func(0, N) << endl;  

}

int func(int l, int r){
  bool allZero = true;
  for (int i=l;i<r;i++){
    if (h.at(i)!=0){
      allZero = false;
      break;
    }
  }
  if (allZero){
    return 0;
  }
  int existZero = -1;
  for (int i=l;i<r;i++){
    if (h.at(i)==0){
      existZero = i;
      break;
    }
  }
  if (existZero==-1){
    for (int i=l;i<r;i++){
      h.at(i)--;
    }
    return func(l, r) + 1;
  } else {
    return func(l, existZero) + func(existZero+1, r);
  }
}

Measured memory_bytes: 256
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func f(b, n int) int {
	if b > n {
		return n
	}
	return f(b, n/b) + n%b
}

func main() {
	sc.Split(bufio.ScanWords)

	N := getInt()
	S := getInt()

	ans := -1
	if N == S {
		ans = N + 1
		fmt.Println(ans)
		return
	}
	m := int(math.Sqrt(float64(N))) + 1
	for b := 2; b < m; b++ {
		if f(b, N) == S {
			ans = b
			break
		}
	}

	div := N - S
	if (ans == -1) && (div > 0) {
		for p := 1; p < m; p++ {
			if div%p != 0 {
				continue
			}
			b := div/p + 1
			if b < m {
				continue
			}
			q := N % b
			s := p + q
			if (s == S) && ((ans > b) || (ans == -1)) {
				ans = b
			}
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 640
import java.util.Scanner;

/**
 * Created by enpingkuang on 2020/9/11 11:31 下午
 */
public class Main {
    private static int[] prime = new int[1000001];
    private static int[] factor = new int[1000005];
    private static boolean[] vis = new boolean[1000001];

    private static int gcd(int a,int b){
        if(b == 0){
            return a;
        }
        return gcd(b,a%b);
    }

    private static void getPrime(){
        for(int i = 2;i<=1000000;i++){
            if(prime[i] == 1){
                continue;
            }
            factor[i] = i;
            for(int j = 2;j*i<=1000000;j++){
                factor[j * i] = i;
                prime[j*i] = 1;
            }
        }
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        getPrime();
        boolean first = true;
        boolean second = false;
        int tmp_gcd = 0;
        for(int i = 0;i<n;i++){
            int x = scanner.nextInt();
            first = resolve(first,x);
            tmp_gcd = gcd(x,tmp_gcd);
            if(tmp_gcd == 1){
                second = true;
            }
        }
        if(first){
            System.out.println("pairwise coprime");
        }else{
            if(second){
                System.out.println("setwise coprime");
            }else{
                System.out.println("not coprime");
            }
        }
    }

    private static boolean resolve(boolean flag,int x){
        if (!flag) {
            return false;
        }
        while (x != 1) {
            if(vis[factor[x]]){
                return false;
            }
            vis[factor[x]] = true;
            int tmp = factor[x];
            x /= factor[x];
            while(x!= 1 && tmp == factor[x]) {
                x /= factor[x];
            }
        }
        return true;
    }
}


Measured memory_bytes: 68704
n = input()

def solve(a, b):
	if len(a) < len(b):
		a, b = b, a
	x = [0 for i in range(len(b)+1)]
	empty = []
	for i in xrange(len(a)):
		e = a[i]
		f = x + empty
		for j in xrange(len(b)):
			if e == b[j]:
				x[j+1] = f[j] + 1
			elif x[j+1] < x[j]:
				x[j+1] = x[j]
	return x[-1]

for i in range(n):
	x = raw_input()
	y = raw_input()
	print solve(x, y)

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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int A,B;
int d[11][11];
const int C = 101;
int S = 1 , T = 2 * C;
int N = T , M = 2 * (C-1) + C * C;
int e[C][C];

int main(){
	cin >> A >> B;
	repp(i,1,A+1) repp(j,1,B+1) cin >> d[i][j];
	repp(i,0,C) repp(j,0,C){
		repp(x,1,A+1) repp(y,1,B+1) e[i][j] = max(e[i][j] , d[x][y]-i*x-j*y);
	}
	repp(x,1,A+1) repp(y,1,B+1){
		int z = C;
		repp(i,0,C) repp(j,0,C) z = min(z,e[i][j]+i*x+j*y);
		if(z != d[x][y]) return cout << "Impossible" << endl , 0;
	}
	cout << "Possible" << endl;
	cout << N << ' ' << M << endl;
	repp(i,1,C){
		cout << i << ' ' << i+1 << " X" << endl;
		cout << C+i << ' ' << C+i+1 << " Y" << endl;
	}
	repp(i,0,C) repp(j,0,C) cout << i+1 << ' ' << N-j << ' ' << e[i][j] << endl;
	cout << S << ' ' << T << endl;
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <queue>
#include <vector>
#include <list>
#include <algorithm>


using namespace std;


using ll = long long;


vector<vector<ll>> graph;
vector<ll> out;
// list<ll> out;
vector<bool> discovered;
vector<ll> indeg;
ll V, E;

/*
void bfs(ll start)
{
    queue<ll> q;
    q.push(start);
    discovered[start] = true;

    while (!q.empty()) {
        ll now = q.front();
        q.pop();

        out.push_back(now);

        for (auto e : graph[now]) {
            indeg[e]--;
            if (indeg[e] == 0 && !discovered[e]) {
                discovered[e] = true;
                q.push(e);
            }
        }
    }
}


void topological_sort_bfs()
{
    for (ll i = 0; i < V; i++) {
        if (indeg[i] == 0 && !discovered[i]) {
            bfs(i);
        }
    }
}
*/


void dfs(ll now)
{
    discovered[now] = true;
    for (auto e : graph[now]) {
        if (!discovered[e])
            dfs(e);
    }
    out.push_back(now);
}


void topological_sort_dfs()
{
    // for (ll i = 0; i < V; i++) {
    for (ll i = V - 1; i >= 0; i--) {
        if (!discovered[i])
            dfs(i);
    }
    reverse(out.begin(), out.end());
}


int main()
{

    cin >> V >> E;
    graph.resize(V);
    discovered.resize(V, false);
    indeg.resize(V, 0);

    for (ll i = 0; i < E; i++) {
        ll s, t;
        cin >> s >> t;
        graph[s].push_back(t);
        indeg[t]++;
    }

    topological_sort_dfs();

    for (auto e : out)
        cout << e << endl;
}



Measured memory_bytes: 3992
#include<iostream>
#include<vector>
#include<algorithm>
#include<cassert>
#include <time.h>
using namespace std;

int main(){
  srand((unsigned int)time(NULL));
  int n; cin >> n;
  if(n >= 24){cout << 0 << endl; return 0;}
  if(n>=22){cout << rand()%2 << endl; return 0;}
  int ans = 0;
  vector<int> d(n+1);
  for(int j=1;j<=n;j++) cin >> d[j]; 
  vector<int> t(n+1);
  t[0] = 0;
  for(int i=0;i<1<<n;i++){
    for(int j=1;j<=n;j++){
      if((1<<(j-1))&i) t[j] = d[j];
      else t[j] = -d[j];
    }
    int tm = 24;
    for(int j=0;j<n;j++) for(int k=j+1;k<=n;k++) tm = min(tm, min(24 - abs(t[j]-t[k]), abs(t[j]-t[k])));
    ans = max(ans, tm);
  }
  cout << ans << endl;
  return 0;
}


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

int dp[55][55][2600];

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,a;
    cin>>n>>a;
    vector<int> x(n);
    rep(i,0,n){cin>>x[i];}
    dp[0][0][0]=1;
    rep(i,0,n+1){
        rep(j,0,n+1){
            rep(k,0,2600){
                if(k+x[i]<=2500){dp[i+1][j+1][k+x[i]]+=dp[i][j][k];}
                dp[i+1][j][k] += dp[i][j][k];
            }
        }
    }
    int ans = 0;
    rep(i,1,n+1){
        ans += dp[n][i][i*a];
    }
    cout<<ans<<endl;
}

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

int main()
{
	int N, Q, tmp = 0;
	cin >> N >> Q;
	vector<int> sim(N), res(N);
	for (int i = 0; i < N; i++) {
		sim[i] = i;
	}
	res[0] = res[1] = 1;
	for (int i = 0, a, b; i < Q; i++) {
		cin >> a >> b;
		swap(sim[a - 1], sim[b - 1]);
		if (sim[a - 1] == 0) {
			tmp = a - 1;
		}
		else if (sim[b - 1] == 0) {
			tmp = b - 1;
		}
		res[sim[max(tmp - 1, 0)]] = res[sim[min(tmp + 1, N - 1)]] = 1;
	}
	int ans = 0;
	for (int i = 0; i < N; i++) {
		if (res[i]) ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,n,i;
	char b[3];
	float x;
	scanf("%d %s",&a,b);
	n=strlen(b);
	for(i=0;i<n;i++)
	{
		a*=10;
		a+=b[i]-'0';
	}
	x=sqrt(a);
	a=x;
	if(x==a)
	{
		printf("Yes");
	}
	else
	{
		printf("No");
	}
	return 0;
}

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

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

int main(){
    string s;
    int k;
    cin >> s >> k;
    ll dp0[101][101],dp1[101][101];
    rep(i,101){
        rep(j,101){
            dp0[i][j] = dp1[i][j] = 0;
        }
    }

    int n = s.length();

    int tmp = s[0] - '0';
    dp0[1][0] = 1;
    dp0[1][1] = tmp - 1;
    dp1[1][1] = 1;

    reps(i,1,n){
        rep(j,4){
            dp0[i+1][j]   +=     dp0[i][j];
            dp0[i+1][j+1] += 9 * dp0[i][j];
        }

        int num = s[i] - '0';
        if(num == 0){
            rep(j,4){
                dp1[i+1][j] += dp1[i][j]; 
            }
        }else{
            rep(j,4){
                dp0[i+1][j]     += dp1[i][j];
                dp0[i+1][j+1]   += (num-1)*dp1[i][j];
                dp1[i+1][j+1]   += dp1[i][j];
            }
        }
    }

    cout << dp0[n][k] + dp1[n][k] << endl;
    return 0;
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e5 + 5);

int n;
ll a[MAX_N];

multiset<ll> mst;

int main(void) {
  // Here your code !
  scanf("%d", &n);

  for (int i = 0; i < n; ++i) {
    scanf("%lld", &(a[i]));
  }

  for (int i = 0; i < n; ++i) {
    auto ptr = mst.lower_bound(a[i]);

    if (ptr == mst.begin()) {
      mst.insert(a[i]);
    } else {
      ptr = prev(ptr);
      mst.erase(ptr);
      mst.insert(a[i]);
    }
  }

  printf("%d\n", mst.size());

  return 0;
}


Measured memory_bytes: 5760
/**
 * C - Splitting Pile
 * https://atcoder.jp/contests/abc067/tasks/arc078_a
 **/
#include<iostream>
#include<numeric>
#include<algorithm>
#include<vector>

#define ll long long

using namespace std;

int main() {
    ll n; cin >> n;
    vector<ll> a(n);
    ll x=0, X=0, ans=1000000000000000000LL;
    for(int i=0; i<n; i++) {
        cin >> a[i];
        X += a[i];
    }
    for(int i=0; i<n; i++) {
        x += a[i];
        if(i+1<n)ans = min(ans, abs(X-2*x));
    }
    cout << ans << endl;
}



Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)



signed main(){
	int A,B,T;
	cin>>A>>B>>T;
	int ans=0;
	for(int i=A;(double)i<(double)T+0.5;i+=A){
		ans+=B;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
import math
import bisect
N=123456*2
prime=[True]*(N+1)
prime[0],prime[1]=False,False
for i in range(2,int(math.sqrt(N))):
    if prime[i]==True:
        j=i
        while i*j<=N:
            prime[i*j]=False
            j+=1
prime=[i for i in range(N+1) if prime[i]==True]

while True:
    n=input()
    if n==0:break
    if n==1:
        print 1
    else:
        l=bisect.bisect_left(prime,n+1)
        u=bisect.bisect_left(prime,2*n)
        print u-l

Measured memory_bytes: 14436
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    ll n, sum = 0; cin >> n;
    vi v(n), c(n);
    rep(i, n) cin >> v[i];
    rep(i, n) cin >> c[i];
    rep(i, n) if(v[i]-c[i]>0) sum += v[i]-c[i];
    cout << sum << endl;
}

Measured memory_bytes: 256
using System;

class Program
{
    static void Main(string[] args)
    {
        var abk = Console.ReadLine().Split(' ');
        var a = int.Parse(abk[0]);
        var b = int.Parse(abk[1]);
        var k = int.Parse(abk[2]);

        for (int i = a; i <= b; i++)
        {
            if (i - a < k || b - i < k)
                Console.WriteLine(i);
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define endl "\n"
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned int ui;

int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    FAST();
    ll x;
    long double y;
    cin >> x >> y;
    cout << (ll)(x*y);
    

}

Measured memory_bytes: 3744
#include<iostream>
#include<cmath>
using namespace std;
int main() {
	int n; 
	while (cin >> n) {
                if(!n)return 0;
		double sum = 0;
		int a[1010];
		for (int i = 0; i < n; i++) {
			cin >> a[i];
			sum += a[i];
		}
		sum /= n;
		double cnt = 0;
		for (int i = 0; i < n; i++) {
			cnt += pow(a[i] - sum, 2);
		}
		cnt /= n;
		printf("%.100f\n", sqrt(cnt));
	}
}

Measured memory_bytes: 3228
#include <bits/stdc++.h>
#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 srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
typedef vector<pii> vp;
typedef vector<tiii> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//cout << fixed << setprecision(10);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

  auto f = [&](int n) {
    int res;
    if (n%2 == 0) res = n/2;
    else res = 3*n + 1;
    return res;
  };

  set<int> st;
  int a = s;
  while (st.count(a) == 0) {
    st.insert(a);
    a = f(a);
  }
  cout << st.size()+1 << 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 = Integer.parseInt(sc.nextLine());
    int K = Integer.parseInt(sc.nextLine());
    int ans = 1;
    for(int i = 0; i < N; i++){
      if(ans < K){
        ans *= 2;
      }else{
        ans += K;
      }
    }
    
    System.out.println(ans);
  }
}

Measured memory_bytes: 21844
//#pragma GCC optimize("03", "unroll-loops")
//#pragma GCC target("avx2")

#include <bits/stdc++.h>

#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define FOR(i,n) for(i=0;i<n;i++)
#define FORn(i,j,n) for(i=j;i<n;i++)
#define pb push_back
#define unique_sort(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define vprint(v) for(auto t:v)cout<<t<<" "
#define endl "\n"

using namespace std;

typedef long long int lli;
typedef long int li;
typedef vector<lli> vli; 
typedef vector<int> vi; 
typedef vector<string> vs; 


const lli mod=1000000007;
const lli limit=1000000;


void fc(lli &x)
    {
        bool neg=false;
        register char c;
        x =0;
        c=getchar();
        if(c=='-')
        {
            neg = true;
            c=getchar();
        }
        for(;(c>47 && c<58);c=getchar())
            x = (x<<1) + (x<<3) +c -48;
        if(neg)
            x *=-1;
    }

int main() {

    fast()
    lli n,q,t;
    lli temp,temp1,temp2,temp3;
    lli i,j,k;
    cin>>n;
    double long ans = 2*22*n/7.0;
    cout<<setprecision(10)<<ans<<endl;
 
}

Measured memory_bytes: 3812
Public Class Main
    Public Shared Sub Main()
        Dim arr() As Integer = sc.intArray()
        Dim H As Integer = arr(0)
        Dim N As Integer = arr(1)
        Dim A() As Integer = sc.intArray()
        Dim accum As Integer = 0
        For i As Integer = N - 1 To 0 Step -1
            accum += A(i)
        Next
        Console.WriteLine(If(accum < H, "No", "Yes"))
    End Sub
End Class

' FastScanner start
Public Class sc
    Public Shared Function nextString() As String
        Return Console.ReadLine()
    End Function
    Public Shared Function nextInt() As Integer
        Return Integer.Parse(nextString())
    End Function
    Public Shared Function nextLong() As Long
        Return Long.Parse(nextString())
    End Function
    Public Shared Function nextDouble() As Double
        Return Double.Parse(nextString())
    End Function
    Public Shared Function stringArray(Optional separator As String = " ") As String()
        Return nextString().Split(separator)
    End Function
    Public Shared Function intArray(Optional separator As String = " ") As Integer()
        Return Array.ConvertAll(Of String, Integer)(stringArray(separator), AddressOf Integer.Parse)
    End Function
    Public Shared Function longArray(Optional separator As String = " ") As Long()
        Return Array.ConvertAll(Of String, Long)(stringArray(separator), AddressOf Long.Parse)
    End Function
    Public Shared Function doubleArray(Optional separator As String = " ") As Double()
        Return Array.ConvertAll(Of String, Double)(stringArray(separator), AddressOf Double.Parse)
    End Function
End Class
' FastScanner end

Measured memory_bytes: 16736
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,l=0,temp,t[20000],h,m,a[1];
	for(int i=0;i<2;i++){
		cin >> n;
		for(int j=0;j<n;j++){
			cin >> h >> m;
			t[l]=h*60+m;
            l++;
		}
	}
	for(int i=0;i<l-1;i++){
		for(int j=i+1;j<l;j++){
			if(t[i]>t[j]){
                swap(t[i],t[j]);
			}
		}
	}
    int count=0;
    for(int i=0;i<l;i++){
        if(t[i]==t[i-1]){
            a[i]=0;
        }else{a[i]=1;}
        if(a[i]==1){
		    count++;
            if(count==1){
                int hour=t[i]/60;
                cout << hour<< ":";
            }else{
                cout << " " << t[i]/60<< ":";
            }
		    if(t[i]%60<10){
			    cout << 0;
            }
            cout<<t[i]%60;
        }
    }
    cout<<endl;
}


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

#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define ALL(c) (c).begin(), (c).end()

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

    int N; cin >> N;
    vector<pair<int64_t, int64_t>> points(N);
    REP(i, N) cin >> points[i].first >> points[i].second;

    vector<vector<int64_t>> f(N);
    REP(i, N) {
        auto [x, y] = points[i];
        f[i] = {x-y, x+y};
    }

    int64_t ans = numeric_limits<int64_t>::min();
    REP(d, 2) {
        auto m1 = numeric_limits<int64_t>::max();
        auto m2 = numeric_limits<int64_t>::min();
        REP(i, N) m1 = min(m1, f[i][d]);
        REP(i, N) m2 = max(m2, f[i][d]);
        ans = max(ans, m2 - m1);
    }
    cout << ans << endl;
}


Measured memory_bytes: 16908
a, b, k = map(int, input().split())
ans = []
if 2 * k > b - a:
	for i in range(a, b + 1):
		print(i)
	exit()
for i in range(a, a + k):
	ans.append(i)
for i in range(b - k + 1, b + 1):
	ans.append(i)
ans.sort()
for i in range(len(ans)):
	print(ans[i])

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

typedef long long signed int ll;

constexpr ll NIL = -20000000000;

ll dp[50];

ll fib(int n) {
    if(n < 3) return n;
    if(dp[n] == 0) dp[n] = fib(n-1) + fib(n-2);
    return dp[n];
}

int main() {
    int n;
    cin >> n;
    cout << fib(n) << endl;
}


Measured memory_bytes: 3088
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <math.h>
#include <numeric>


int main() {
	int m, d;

	std::cin >> m >> d;

	int ans = 0;

	for (size_t i = 4; i <= m; i++)
	{
		for (size_t j = 22; j <= d; j++)
		{
			int d1 = j % 10;
			int d10 = j / 10;
			if (d1 < 2 || d10 < 2) {
				continue;
			}
			if (d1 * d10 == i) {
				ans++;
			}
		}
	}

	std::cout << ans << 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 A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		if(A + B >= C) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		sc.close();
	}

}


Measured memory_bytes: 21716
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <set>
#include <math.h>
#include <queue>
#include <deque>
#define rep(i,n) for (int i = 0; i < (n); ++i)
typedef long long ll;
using namespace std;

const int di[]={-1,0,1,0};
const int dj[]={0,-1,0,1};
const int INF = 1e9;

int main() {
    int h, w, ch, cw, dh, dw;
    cin >> h >> w >> ch >> cw >> dh >> dw;
    --ch; --cw; --dh; --dw;
    vector<string> s(h);
    rep(i,h) cin >> s[i];
    vector<vector<int> > dist(h,vector<int>(w,INF));
    deque<pair<int,int> > q;
    dist[ch][cw]=0;
    q.emplace_back(ch,cw);
    while(!q.empty()) {
        int i=q.front().first;
        int j=q.front().second;
        int d=dist[i][j];
        q.pop_front();
        if(dist[i][j]!=d) continue;
        rep(v,4) {
            int ni=i+di[v], nj=j+dj[v];
            if(ni<0||ni>=h||nj<0||nj>=w) continue;
            if(s[ni][nj]=='#') continue;
            if(dist[ni][nj]<=d) continue;
            dist[ni][nj]=d;
            q.emplace_front(ni,nj);
        }
        for(int ei=-2; ei<=2; ++ei) {
            for(int ej=-2; ej<=2; ++ej) {
                int ni=i+ei,nj=j+ej;
                if(ni<0||ni>=h||nj<0||nj>=w) continue;
                if(s[ni][nj]=='#') continue;
                if(dist[ni][nj]<=d+1) continue;
                dist[ni][nj]=d+1;
                q.emplace_back(ni,nj);
            }
        }
    }
    int ans=dist[dh][dw];
    if(ans==INF) ans=-1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8712
#include<bits/stdc++.h>
#define pb push_back

#define f(i,a,b) for(int i=a;i<b;i++)
#define f1(i,a,b) for(int i=a;i<=b;i++)
#define int long long
using namespace std;
#define mod 1000000007
signed main()
{

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

    int n, a, b;
    cin >> n;
    vector<pair<int, int>>arr;
    for(int i = 0; i < n; i++)
    {
        cin >> a >> b;
        arr.pb(make_pair(a, b));
    }
    bool flag = false;
    for(int i = 0; i < (int)arr.size(); i++)
    {
        if(arr[i].first == arr[i].second)
        {
            for(int j = i + 1; j < (int)arr.size(); j++)
            {
                if(arr[j].first == arr[j].second && j == i + 1)
                {
                    for(int k = j + 1; k < (int)arr.size(); k++)
                    {
                        if(arr[k].first == arr[k].second && k == j + 1)
                        {
                            flag = true;
                            break;
                        }
                    }
                }
            }
        }
    }
    if(flag)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }


    return 0;
}


Measured memory_bytes: 3672
package main
 
import (
	"fmt"
	"sort"
  "bufio"
  "os"
	"strings"
  "strconv"
)
 
var sc = bufio.NewScanner(os.Stdin)
func main() {
	var c int
	//scan
	fmt.Scanf("%d", &c)
  var ws []string
	var is, is2 []int
  if sc.Scan() {
    ws = strings.Split(sc.Text(), " ")
		for _, w := range ws {
			i,_:=strconv.Atoi(w)
			is = append(is,i)
			is2 = append(is2,i)
		}
  }

  //sort
	// fmt.Println(is)
  sort.Ints(is)

	count := 0
	for i:=0; i<c; i++ {
		// fmt.Println(i,is[i],isOrig[i])
		if is[i] == is2[i] {
		} else {
			count += 1
		}
	}
	if count <= 2 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}

}


Measured memory_bytes: 640
a, b, ab, x, y = [int(i) for i in input().split()]

if a + b < 2 * ab:
    print(a * x + b * y)

else:
    ans = min(x, y) * 2 * ab
    if x > y:
        ans += min((x - y) * 2 * ab, (x - y) * a)
    elif y > x:
        ans += min((y - x) * 2 * ab, (y - x) * b)

    print(ans)


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

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

	scanf("%lld %lld %lld %lld",&a,&b,&c,&k);
	if(a<k){
		ans=a;
		if(a+b<k){
			ans=a-(k-(a+b));
		}else{
			ans=a;
		}
	}else{
		ans=k;
	}
	printf("%lld",ans);

	return 0;
}


Measured memory_bytes: 1728
#include<iostream>
using namespace std;
int main(){
  int a[4],b[4];
  while(cin>>a[0]>>a[1]>>a[2]>>a[3]>>b[0]>>b[1]>>b[2]>>b[3]){
    int aa[10]={};
    int bb[10]={};
    for(int i=0;i<4;i++)
      aa[a[i]]=1;
    for(int i=0;i<4;i++)
      bb[b[i]]=1;
    int blow=0,hit=0;
    for(int i=0;i<10;i++)
      if(aa[i]==bb[i]&&aa[i]==1)
	blow++;
    for(int i=0;i<4;i++){
      if(a[i]==b[i]){
	hit++;
	blow--;
      }
    }
    cout<<hit<<" "<<blow<<endl;
  }
  return 0;
}

Measured memory_bytes: 3032
import heapq
N=int(input())
N_max=100000

d=set()
n=1
while n<=N_max:
    d.add(n)
    n*=6
n=1
while n<=N_max:
    d.add(n)
    n*=9

dp=[N_max+1 for _ in range(N_max+1)]
dp[0]=0
for i in range(1,N_max+1):
    for n in d:
        if i>=n:
            dp[i]=min(dp[i],dp[i-n]+1)

print(dp[N])

Measured memory_bytes: 45552