akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] sol = new int[N];

        for (int i = 1; i <= N; i++) sol[sc.nextInt() - 1] = i;
        for (int s : sol) System.out.print(s + " ");
    }
}

Measured memory_bytes: 57892
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define rep(i,n) for (int i=0; i<n; i++)
#include<math.h>
using namespace std;
int main() {
  int N,A,B;
  cin >> N >> A >> B;
  vector<int> P(N);
  for (int i=0; i<N; i++) cin >> P[i];
  
  int a = 0;
  int b = 0;
  int c = 0;
  for (int i=0; i<N; i++) {
    if (P[i] <= A) a++;
    else if (P[i] > A && P[i] <= B) b++;
    else if (P[i] > B) c++;
  }
  int ans = min({a,b,c});
  cout << ans << endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin >> a[i];
    int mi = 10000000;
    int sm = 0;
    for(int i=0;i<n;i++){
        sm += a[i];
        if(a[i]%10!=0){
            mi = min(mi,a[i]);
        }
    }
    if(sm%10!=0){
        cout << sm << endl;
    }else{
        if(mi!=10000000){
            cout << sm- mi << endl;
        }else{
            cout << 0 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
import itertools
h, w = [int(w) for w in input().split()]
field = [list(input()) for _ in range(h)]

dlist = []
nuse = [0]*w

for i in range(h):
    if not "#" in field[i]:
        dlist.append(i)
    for j in range(w):
        if field[i][j] == "#":
            nuse[j] += 1

nuse = [True if w > 0 else False for w in nuse]
for i in range(h):
    if i in dlist:
        continue
    s = list(itertools.compress(field[i], nuse))
    print("".join(s))


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

using db = double;
using ll = long long;
using vi = vector <int>;
#define op operator
#define pb push_back

int a[4];

int solve(int n) {
	int r = 0;
	for(int i : {500, 100, 50, 10}) {
		r += n / i;
		n %= i;
	}
	return r;
}

int main() {
	cout << fixed << setprecision(9);
	ios :: sync_with_stdio(0);

	bool f = 0;
	for(int n; cin >> n && n; ) {
		if(f) cout << '\n'; f = 1;
		cin >> a[0] >> a[1] >> a[2] >> a[3];
		pair <int, vi> ans = {100, {}};
		for(int i = 0; i <= a[0]; i ++)
			for(int j = 0; j <= a[1]; j ++)
				for(int k = 0; k <= a[2]; k ++)
					for(int s = 0; s <= a[3]; s ++) {
						int sum = i * 10 + j * 50 + k * 100 + s * 500;
						if(sum >= n)
							ans = min(ans,
								{solve(sum - n) + a[0] + a[1] + a[2] + a[3] - i - j - k - s, {i, j, k, s}});
					}
		if(ans.second[0]) cout << "10 " << ans.second[0] << '\n';
		if(ans.second[1]) cout << "50 " << ans.second[1] << '\n';
		if(ans.second[2]) cout << "100 " << ans.second[2] << '\n';
		if(ans.second[3]) cout << "500 " << ans.second[3] << '\n';
	}

	return 0;
}

Measured memory_bytes: 3104
#include <iostream>
#include <vector>

using namespace std;

int main()
{
  int n,m;
  int famous = 0;
  double judge = 0;
  cin >> n >> m;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    judge += a[i];
  }
  judge = judge / (4 * m);

  for (int j = 0; j < n; j++) {
    if (a[j] >= judge) {
      famous++;
    }
  }
  if (famous >= m) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }

  cin >> m;
  return 0;
}

Measured memory_bytes: 256
n=int(input())
ac=0
wa=0
tle=0
re=0
for i in range(n):
  s=input()
  if s=='AC':
    ac+=1
  elif s=='WA':
    wa+=1
  elif s=='TLE':
    tle+=1
  else:
    re+=1
print('AC','x',ac)
print('WA','x',wa)
print('TLE','x',tle)
print('RE','x',re)

Measured memory_bytes: 9232
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n, k;
  cin >> n >> k;
  vector<int> x(n);
  rep(i, 0, n) cin >> x[i];

  vector<ll> acc_p(1, 0), acc_m(1, 0);
  bool zero = false;
  rep(i, 0, n) {
    if (x[i] > 0)
      acc_p.push_back(x[i]);
    if (x[i] == 0)
      zero = true;
  }

  repr(i, 0, n) {
    if (x[i] < 0)
      acc_m.push_back(-x[i]);
  }

  if (zero)
    k--;
  if (k == 0) {
    cout << 0 << endl;
    return 0;
  }

  ll ans = 1e18;
  rep(p, 0, k + 1) {
    int m = k - p;
    if (p >= (int)acc_p.size() || m >= (int)acc_m.size())
      continue;
    chmin(ans, acc_p[p] * 2 + acc_m[m]);
    chmin(ans, acc_p[p] + acc_m[m] * 2);
  }

  cout << ans << endl;
}


Measured memory_bytes: 4884
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.D;
		Console.WriteLine("{0}",n*2*PI);
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 27640
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) throws Exception {
		while (true) {
			String t = sc.next();
			if (t.equals("-")) break;
			String l = sc.next();
			String b = sc.next();
			StringBuilder r = new StringBuilder();
			int pt = 0;
			int pl = 1;
			int pb = 0;
			char cur = l.charAt(0);
			while (pt < t.length() || pl < l.length()) {
				if (pb < b.length() && cur == b.charAt(pb)) {
					cur = t.charAt(pt);
					++pt;
					++pb;
				} else {
					r.append(cur);
					cur = l.charAt(pl);
					++pl;
				}
			}
			r.append(cur);
			System.out.println(r);
		}
	}

}

Measured memory_bytes: 11000
#include <bits/stdc++.h>
using namespace std;
const int maxn=1e5+7;
long long  a[maxn];
long long  b[maxn<<1];
int c[maxn<<1];
int main() {
//    freopen("in.txt","r",stdin);
    int n,m;
    long long sum=0;
    scanf("%d%d",&n,&m);
    for(int i=1; i<=n; ++i)
        scanf("%lld",&a[i]);
    for(int i=2; i<=n; ++i) {
        if(a[i]>a[i-1]) {
            sum+=a[i]-a[i-1];
            b[a[i-1]+1]+=a[i-1]+1;
            b[a[i]+1]-=a[i-1]+1;
            c[a[i-1]+1]++;
            c[a[i]+1]--;
        } else {
            sum += m-a[i-1]+a[i];
            b[a[i-1]+1] += a[i-1]+1;
            b[a[i]+1] += m-a[i-1]-1;
            b[1] -= m-a[i-1]-1;
            c[1]++;
            c[a[i-1]+1]++;
            c[a[i]+1]--;
        }
    }
    for(int i=1; i<=m; ++i) {
        c[i]+=c[i-1];
        b[i]+=b[i-1];
    }
    long long  ma=0;
    for(int x=1; x<=m; ++x) {
        if(c[x]) {
            ma=max(ma,1ll*x*c[x]-b[x]);
        }
    }
    printf("%lld\n",sum-ma);
    return 0;
}


Measured memory_bytes: 2176
// 2020-07-03 18:40:48
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
namespace prime {
  bool is_prime(ll n) {
    if(n < 2) return false;
    for(ll i = 2; i * i <= n; i++) {
      if(n % i == 0) return false;
    }
    return true;
  }
  vector<ll> divisors(ll n) {
    vector<ll> res;
    for(ll i = 1; i * i <= n; i++) {
      if(n % i == 0) {
        res.push_back(i);
        if(i != n / i) res.push_back(n / i);
      }
    }
    return res;
  }
  map<ll, int> prime_factors(ll n) {
    map<ll, int> res;
    if(n < 2) return res;
    for(ll i = 2; i * i <= n; i++) {
      while(n % i == 0) {
        res[i]++;
        n /= i;
      }
    }
    if(n > 1) res[n] = 1;
    return res;
  }
};

void answer() {
  ll n;
  cin >> n;
  auto mp = prime::prime_factors(n);
  ll ans = 0;
  for(auto a : mp) {
    int i = 1, b = a.second;
    ll m = a.first;
    while(i <= b) {
      n /= m;
      m *= a.first;
      b -= i;
      i++;
      ans++;
    }
  }
  cout << ans << '\n';
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 3628
#include <cstdio>
const int N=200005,mo=1000000007;
long long fac[N],inv[N];
int ksm(int x,int y){
	int i=1;
	for (;y;y>>=1,x=1ll*x*x%mo)
		if (y&1) i=1ll*i*x%mo;
	return i;
}
void Pre(int n){
	fac[0]=1;
	for (int i=1;i<=n;i++) fac[i]=fac[i-1]*i%mo;
	inv[n]=ksm(fac[n],mo-2);
	for (int i=n;i>=1;i--) inv[i-1]=inv[i]*i%mo;
}
long long C(int n,int m){
	return fac[n]*inv[m]%mo*inv[n-m]%mo;
}
int main(){
	int h,w,a,b,ans=0;
	scanf("%d%d%d%d",&h,&w,&a,&b);
	Pre(h+w);
	for (int i=1;i<=h-a;i++)
		ans=(ans+C(i+b-2,i-1)*C(h+w-i-b-1,h-i))%mo;
	printf("%d\n",ans);
}

Measured memory_bytes: 3328
import java.util.Scanner;
public class Main {
        public static void main(String[] args){
                final Scanner sc=new Scanner(System.in);
                int n=sc.nextInt();
                int[] matrix=new int[n+1];
                matrix[0]=matrix[1]=1;
                for(int i=2;i<=n;i++){
                        matrix[i]=matrix[i-1]+matrix[i-2];
                }
                System.out.println(matrix[n]);
        }
        
}

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

int main(){
  int N;
  cin >> N;
  int max_n = 1;
  int max_c = 0;
  for(int i = 1; i <= N; i++){
    int c = 0;
    int n = i;
    while(n > 0){
      if(n % 2 == 0){
        c++;
        n /= 2;
      }else{
        break;
      }
    }
    if(c > max_c){
      max_n = i;
      max_c = c;
    }
  }
  cout << max_n << endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  rep(i,n){
    cin >> p[i];
  }
  int ans=0;
  int m=1e9;
  rep(i,n){
    m=min(m,p[i]);
    if (m==p[i])ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int insertionSort(long* A, long n, long g){
  int i,cnt=0;
  for (i=g;i<n;i++) {
    int k=A[i];
    int j=i-g;
    while((j>=0)&&(A[j]>k)) {
      A[j+g]=A[j];
      j-=g;
      cnt++;
      A[j+g]=k;
    }
  }
  return cnt;
}

void shellSort(long *A, long n){
  long G[100];
  long m,i,cnt=0;

  for(G[0]=1,m=0; (G[m]<=n) && (m<100); G[m+1]=G[m]*3+1, m++);
  cnt=0;
  for(i=m-1;i>=0;i--)
    cnt +=insertionSort(A,n,G[i]);
  printf("%ld\n",m);
  for(i=m-1; i>0; i--)
    printf("%ld ", G[i]);
  printf("%ld\n",G[0]);
  printf("%ld\n",cnt);
}

int main(void){
  long N,n;
  long A[1000000];
  scanf("%ld\n",&N);
  for(n=0;n<N;n++)
    scanf("%ld\n",&A[n]);
  shellSort(A,n);
  for(n=0;n<N;n++)
    printf("%ld\n",A[n]);
  return 0;
}

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

using namespace std;
using LL = long long int;
const LL mod = 1000000007;

int main() {
    int A, B;
    cin >> A >> B;
    if(A <= 8 && B <= 8) {
        cout << "Yay!" << endl;
    } else {
        cout << ":(" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
// TOPSIC001_0

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef int _loop_int;
#define REP(i, n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i, a, b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i, a, b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a, b) a=min((a),(b))
#define CHMAX(a, b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a, b) (abs(a-b)<EPS)
typedef complex<Real> P;


int main() {
//    int N ,L; cin >> N >> L;
    string N; cin >> N;

//    vector<string> vs(N);
//    REP(i, N) cin >> vs.at(i);
//    string O, E; cin >> O >> E;

    if(N.at(0) == N.at(1) &&  N.at(1) == N.at(2) || N.at(1) == N.at(2) && N.at(2) == N.at(3)) {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }


    return 0;
}


Measured memory_bytes: 256
m[10100];main(W,p,i){for(;~scanf("%d%d\n",&p,&W);W-1&&printf("%d %d\n\0LOOP\n"+!i*7,p%W,p/W)){for(i=0,p*=++W;p&&--p;)m[i++]=getchar();for(;i=m[p],i>46;p+=i<63?i-61:i<99?-W:W)m[p]=0;}}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define exists(s,x) (s).find(x)!=(s).end()
#define REP(i,n) for(int i=0;i<(n);++i)
#define FOR(i,k,n) for(int i=(k);i<(n);++i)
#define fi first
#define se second
typedef long long ll;
const ll INF = 1LL<<60;
const ll MOD = 1000000007;

inline ll add(ll x, ll y) {return (x+y)%MOD;}
inline ll mul(ll x, ll y) {return (x*y)%MOD;}
inline ll sub(ll x, ll y) {
    ll res = x - y;
    if(res < 0) res += MOD;
    return res;
}
inline ll modpow(ll x, ll y) {
    ll res = 1;
    while(y) {
        if(y&1) res = mul(res,x);
        y >>= 1;
        x = mul(x,x);
    }
    return res;
}

int c[10005];
vector<int> G[10005];
int res[10005];

void bfs(){
    queue<int> que;
    res[0] = c[0];
    int now = 1;
    que.push(0);
    while(!que.empty()) {
        int idx = que.front(); que.pop();
        for(auto x:G[idx]) {
            if(res[x] != -1) continue;
            res[x] = c[now];
            now++;
            que.push(x);
        }
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    REP(i,N-1) {
        int a, b; cin >> a >> b; a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    REP(i,N) cin >> c[i];
    sort(c,c+N,greater<int>());
    int ans = 0;
    FOR(i,1,N) ans += c[i];
    cout << ans << endl;
    REP(i,N) res[i] = -1;
    bfs();
    REP(i,N) {
        cout << res[i];
        cout << (i!=N-1 ? ' ':'\n');
    }
    return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <string>
#include <cmath>
#include <string>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
using namespace std;

// C - Half and Half
int main(){
    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;
    
    int allAB = A*X + B*Y;
    int A_AB_B = C*2*X + B*(Y-X);
    int B_AB_A = C*2*Y + A*(X-Y);
    if(X>Y){
        A_AB_B = C*2*X;
        B_AB_A = C*2*Y + A*(X-Y);
    }else if(Y>X){
        B_AB_A = C*2*Y;
        A_AB_B = C*2*X + B*(Y-X);
    }
    int ans = min(allAB, min(A_AB_B, B_AB_A));

    cout << ans << endl;
    return 0;
}




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

#define itn int
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())

using namespace std;

inline int nxt() {
	int x;
	scanf("%d", &x);
	return x;
}

const int N = 100000;
long long small[N];

void solve() {
	long long n;
	scanf("%lld", &n);
	int a = nxt(), b = nxt(), c = nxt(), d = nxt();
	fill_n(small, N, (long long)1e18);
	small[0] = 0;
	set<pair<long long, int>> S;
	S.insert({0, 0});
	while (!S.empty()) {
		auto [val, pos] = *S.begin();
		S.erase(S.begin());
		if (pos > 0 && small[pos - 1] > val + d) {
			S.erase({small[pos - 1], pos - 1});
			small[pos - 1] = val + d;
			S.insert({small[pos - 1], pos - 1});
		}
		if (pos + 1 < N && small[pos + 1] > val + d) {
			S.erase({small[pos + 1], pos + 1});
			small[pos + 1] = val + d;
			S.insert({small[pos + 1], pos + 1});
		}
		if (pos * 2 < N && small[pos * 2] > val + a) {
			S.erase({small[pos * 2], pos * 2});
			small[pos * 2] = val + a;
			S.insert({small[pos * 2], pos * 2});
		}
		if (pos * 3 < N && small[pos * 3] > val + b) {
			S.erase({small[pos * 3], pos * 3});
			small[pos * 3] = val + b;
			S.insert({small[pos * 3], pos * 3});
		}
		if (pos * 5 < N && small[pos * 5] > val + c) {
			S.erase({small[pos * 5], pos * 5});
			small[pos * 5] = val + c;
			S.insert({small[pos * 5], pos * 5});
		}
	}
	map<long long, long long> cache;
	auto rec = [&](long long n, const auto& rec) {
		if (n < N) {
			return small[n];
		}
		if (cache.count(n)) {
			return cache[n];
		}
		long long res = 1e18;
		if (n < 2e18 / d) {
			res = n * d;
		}
		res = min(res, n % 2 * d + a + rec((n - n % 2) / 2, rec));
		res = min(res, (2 - n % 2) * d + a + rec((n + 2 - n % 2) / 2, rec));
		res = min(res, n % 3 * d + b + rec((n - n % 3) / 3, rec));
		res = min(res, (3 - n % 3) * d + b + rec((n + 3 - n % 3) / 3, rec));
		res = min(res, n % 5 * d + c + rec((n - n % 5) / 5, rec));
		res = min(res, (5 - n % 5) * d + c + rec((n + 5 - n % 5) / 5, rec));
		return cache[n] = res;
	};
	cout << rec(n, rec) << "\n";
}

int main() {
	int t = nxt();
	while (t--) {
		solve();
	}

	return 0;
}


Measured memory_bytes: 6944
# coding=utf-8

n, q = map(int, input().split())
queue = []
total_time = 0
finished_loop = 0

for i in range(n):
    name, time = input().split()
    queue.append([name, int(time)])

while queue:
    n -= finished_loop
    finished_loop = 0
    for i in range(n):
        poped = queue.pop(0)
        name = poped[0]
        time = poped[1]
        if time > q:
            queue.append([name, time - q])
            total_time += q
        else:
            total_time += time
            print(name, total_time)
            finished_loop += 1

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

int main(){
  long N, ans = 1, min = 0, P;
  cin >> N;
  cin >> min;
  for (int i = 1; i < N; i++){
    cin >> P;
    if (min >= P){
      min = P;
      ans ++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3612
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iterator>
#include<sstream>
#include<iomanip>
#include<map>
#include<queue>
#include<deque>
#include<fstream>
#include<random>

#define rep(i, n) for (ll i = 0; i < n; i++) 
#define rrep(i, n) for(ll i = n-1; i>=0; i--)
#define range(i, n, m) for (ll i = n; i < m; i++) 
#define rrange(i, n, m) for (ll i = n - 1; i => m; i--) 
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vp vector<pair<ll, ll> >
#define vvp vector<vector<pair<ll, ll> > >
#define First first
#define Second second.first
#define Third second.second
#define Sort(X) sort(X.begin(), X.end())
#define RSort(X, T) sort(X.begin(), X.end(), greater<T>())
//#define MOD 998244353
#define MAX 100000

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

using namespace std;

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() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll N;
	cin >> N;

	vl A(N);
	rep(i, N) {
		cin >> A[i];
	}

	ll m = 0;
	ll cnt = 0;

	rep(i, N - 1) {
		if (A[i] >= A[i + 1]) {
			cnt++;
			chmax(m, cnt);
		}
		else {
			cnt = 0;
		}

	}

	cout << m << endl;



	return 0;
}



Measured memory_bytes: 1024
#include <iostream>
//#include <iomanip>
//#include <string>
//#include <vector>
//#include <algorithm>
#include <utility>
#include <set>
//#include <map>
//#include <queue>
//#include <bitset>
//#include <math.h>
using namespace std ;
//using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//string yorn(bool a){if(a) return"Yes" ; return "No" ;}
//string YorN(bool a){if(a) return"YES" ; return "NO" ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	int n ; cin >> n ;
	set<pair<int,int>> s ;
	int ans = 0 ;
	for(int i=1;i<=n;i++){
		int a ; cin >> a ;
		int b ;
		if(a>i){
			b = a ;
			a = i ;
		}else{
			b = i ;
		}
		pair<int,int> sub = make_pair(a,b) ;
		if(s.count(sub)) ans++ ;
		else s.insert(sub) ;
	}
	cout << ans << endl ;
}


Measured memory_bytes: 4992
def solve():
  N, M, K = map(int, input().split())
  mod = 10**9+7
  com = 1
  for i in range(1,K-1):
    com *= N*M-1-i
    com *= pow(i,mod-2,mod)
    com %= mod
  ans = com*M*N*(M*N-1)*(M+N)//6
  return ans%mod
print(solve())

Measured memory_bytes: 73024
class UnionFind:
    __slots__ = ["_data_size", "_roots"]

    def __init__(self, data_size: int) -> None:
        self._data_size = data_size
        self._roots = [-1] * data_size

    def __getitem__(self, x: int) -> int:
        while self._roots[x] >= 0:
            x = self._roots[x]
        return x

    def is_connected(self, x: int, y: int) -> bool:
        return self[x] == self[y]

    def unite(self, x: int, y: int) -> None:
        x, y = self[x], self[y]
        if x == y:
            return
        if self._roots[x] > self._roots[y]:
            x, y = y, x
        self._roots[x] += self._roots[y]
        self._roots[y] = x


N, Q, *TUV = map(int, open(0).read().split())
tree = UnionFind(N)
res = []
for t, u, v in zip(*[iter(TUV)] * 3):
    if t:
        res.append(int(tree.is_connected(u, v)))
    else:
        tree.unite(u, v)
print("\n".join(map(str, res)))


Measured memory_bytes: 58008
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,a,n) for(ll i=a;i<n;i++)
int main(){
  ll n;
  string s;
  cin>>n;
  while(n){
    n--;
    s+='a'+n%26;
    n /= 26;
  }
  reverse(s.begin(),s.end());
  cout<<s<<endl;
  return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
#include <complex>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;++i)
#define repi(i,n) for(ll i=n-1;i>=0;--i)
#define sll(n) scanf("%lld", &n);
#define slf(n) scanf("%lf", &n);
typedef long long ll;
typedef double lf;

ll N, M;


void Main(){
    // bool is_ok = true;
    // printf("------------- V=%lld---------\n", V);
    ll N;
    ll x, a;
    sll(N);
    vector<ll> A(N);
    sll(x);
    rep(i,N){
        sll(a);
        A[i] = a;
    }

    ll num = 0;
    if(A[0]>x){
        num += A[0] - x;
        A[0] = x;
    }
    for(ll i=1;i<N;i++){
        if(A[i]+A[i-1] > x){
            ll new_n = A[i-1] + A[i] - x;
            A[i] -= new_n;
            num += new_n;
        }
    }

    printf("%lld\n", num);


    // cout<<fixed<<setprecision(10)<<num<<endl;
    // cout << num << endl;

}

int main(){
    Main();

    return 0;

}

Measured memory_bytes: 1024
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    int n, m, a, max, i, j;
    m = sc.nextInt(); n = sc.nextInt();
    max = -1;
    for(i = 0;i < m;i++){
      a = 0;
      for(j = 0;j < n;j++)a += sc.nextInt();
      if(max < a)max = a;
    }
    out.println(max);

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 27300
#include<stdio.h>

int main() {
	int a, b, c;
	int x, y, z = 0;

	scanf("%d %d %d", &a, &b, &c);

	x = a - b;
	y = a - c;
	z = b - c;

	if (x==0&&y==0&&z==0) {
		printf("1");
	}
	else if(a==b||b==c||a==c){
		printf("2");
	}
	else{
		printf("3");
	}

	return 0;
}

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

using namespace std;



long long int n,m,r;
long long int dist[210][210]; 
long long int ra[9];
long long int a[40010],b[40010],c[40010]; 
long long int res; 
bool used[9];


void dfs(int c,int las,int distan) { 
  if(c==r+1) { 
    if(res>distan)res=distan;
    return; 
  } 
  for(int i=0;i<r;i++)
    if(!used[i]) { 
      used[i]=true; 
      if(las==-1) dfs(c+1,i,0); 
      else dfs(c+1,i,distan+dist[ra[las]][ra[i]]); 
      used[i]=false; 
     
    }
}

int main(){

  cin >> n >> m >> r;
  
  for(int i=0;i<r;i++)
    cin >> ra[i];
  
  for(int i=0;i<r;i++){
    ra[i]--;
  }
    
for(int i=0;i<m;i++){
    cin >> a[i] >> b[i] >> c[i];
    a[i]--,b[i]--;
     
  }
  
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(i==j){
      dist[i][j] = 0;
      }
      else{
        dist[i][j] = 1e18;
      }
    }
  }
  
  
  for(int i=0;i<m;i++){
    
      dist[a[i]][b[i]] = min(dist[a[i]][b[i]],c[i]);
    dist[b[i]][a[i]] = min(dist[b[i]][a[i]],c[i]);
    
  }
  
 
  for (int k = 0; k < n; k++){       
    for (int i = 0; i < n; i++) {    
      for (int j = 0; j < n; j++) {  
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      }
    }
  }
 
  res = 1e18;
  
  dfs(1,-1,0);
  
  cout << res << endl;
}


Measured memory_bytes: 1024
import Data.Bits
import Debug.Trace

move :: Int -> (Int, Integer) -> (Int, Integer)
move amount (offset, places) =
  (offset - amount, places .|. (shiftL places (2 * amount)))

toNums :: String -> [Int]
toNums s = let (fs, rem) = span (== 'F') s
               n = length fs
           in case rem of
                []       -> [n]
                t : rem' -> n : toNums rem'

eoDiv :: [a] -> ([a], [a])
eoDiv = foldr (\a (xs, ys) -> (a : ys, xs)) ([], [])

toPlaces :: Int -> [Int] -> (Int, Integer)
toPlaces p0 = foldr move (p0, 1)

solve :: String -> Int -> Int -> String
solve commands x0 y0 =
  let fstX : numsYX = toNums commands
      (numsY, numsX) = eoDiv numsYX
      (xOffset, xPlaces) = toPlaces fstX numsX
      (yOffset, yPlaces) = toPlaces 0 numsY
  in if testBit xPlaces (x0 - xOffset) && testBit yPlaces (y0 - yOffset)
     then "Yes" else "No"

main :: IO ()
main = do
  cont <- getContents
  let [com, sx0, sy0] = words cont
  putStrLn $ solve com (read sx0) (read sy0)



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

typedef long long int ll;
typedef long double ld;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define MOD (ll)(1e9 + 7)
#define vi vector<int>
#define vii vector<vector<int> >
#define vl vector<ll>
#define vll vector<vector<ll> >
#define vc(T, nm) vector<T> nm
#define pb push_back
#define popb pop_back
#define si set<int>
#define sl set<ll>
#define F first
#define S second
#define pii pair<int, int>
#define mp make_pair
#define ins insert
#define ers erase
#define endl "\n"
#define mul(a, b) ((a % MOD) * (b % MOD)) % MOD
#define adr(a, b) ((a % MOD) + (b % MOD)) % MOD
#define FORA(x, s, e, inc) for(ll x = s; x != e; x += inc)
#define ROFA(x, s, e, inc) for(ll x = s; x != e; x -= inc)
#define FOR(x, s, e) FORA(x, s, e, 1)
#define ROF(x, s, e) ROFA(x, s, e, 1)
#define loop(x, n) FOR(x, 0, n)
#define rd1(t, a) 					t a; cin >> a;
#define rd2(t, a, b) 				rd1(t, a); rd1(t, b); 
#define rd3(t, a, b, c) 			rd2(t, a, b); rd1(t, c);
#define rd4(t, a, b, c, d) 			rd3(t, a, b, c); rd1(t, d);
#define rd5(t, a, b, c, d, e) 		rd4(t, a, b, c, d); rd1(t, e);
#define rd6(t, a, b, c, d, e, f) 	rd5(t, a, b, c, d, e); rd1(t, f);
#define rdA(t, nm, len)				t nm[len]; loop(i, len) {cin >> nm[i];}
#ifdef DEBUG
	#define deb(v) cout << endl << #v << ": " << v << endl
	#define db1(v) cout << endl << #v << ": " << "[ "; for(auto x: v) {cout << x << " ";}; cout << "]" << endl;
	#define db2(v) cout << endl << #v << ": " << endl; for(auto r: v) {cout << "[ "; for(auto x: r) {cout << x << " ";}; cout << "]" << endl;};
	#define dbl cout << "-------------------------------" << endl
#else
	#define deb(v)
	#define db1(v)
	#define db2(v)
	#define dbl
#endif

void solve() {
    rd2(ll, x, n);
    ll xc = x;
    vl A(n), vis(1000, 0);
    map<int, int> m;
    FOR(i, -400, 401) {
        m[i] = 0;
    }
    
    FOR(i, 0, n) {
        cin >> A[i];
        m[A[i]] = 1;
    }
    
    int mnd = INT_MAX;
    int mne = x;
    for(auto nm: m) {
        if(nm.S == 0) {
            int diff = abs(nm.first - xc);
            if(diff < mnd) {
                mnd = diff;
                mne = nm.first;
            }
        }
    }
    
    cout << mne;
    
    
	
}

int main() {
	
	fastio;

//  	rd1(ll, t);
	ll t = 1;

    while(t--) {
        solve();
    }
    
	return 0;
}

Measured memory_bytes: 3700
#include <iostream>
#include <vector>

#define llint long long int
#define NUM 1000000007

template<typename t>
inline t add(t x, t y){
  return (x+y) % NUM;
}
template<typename t>
inline t mult(t x, t y){
  return (x*y) % NUM;
}


int main(void){
  int n, m;
  std::cin >> n >> m;

  std::vector<std::vector<llint> >  dp(n+2, std::vector<llint>(m+2));
  std::vector<std::vector<llint> > sum(n+2, std::vector<llint>(m+2));

  std::vector<int> s(n+1);
  for(int i=1; i<=n; i++) std::cin >> s[i];
  std::vector<int> t(m+1);
  for(int i=1; i<=m; i++) std::cin >> t[i];

  for(int i=1; i<=n; i++){
    for(int j=1; j<=m; j++){
      dp[i][j] = (s[i]==t[j]) ? sum[i-1][j-1]+1 : 0;
      dp[i][j] = dp[i][j]%NUM;
      sum[i][j] = sum[i-1][j] + dp[i][j] + sum[i][j-1] - sum[i-1][j-1] + NUM;
      sum[i][j] = sum[i][j]%NUM;
    }
  }

  std::cout << sum[n][m]+1 << std::endl;

  return 0;
}


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

using namespace std;

#define DIM 1000009
#define INF ((long long)1e18+9ll)
#define pairll pair<long long,long long>
#define fi first
#define se second
#define ld long double
#define amen exit(0)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define endl '\n'
#define y1 trymax_lox
#define y2 sijgkvdfbo
#define eps 1000000

long long i,j,k,l,n,m;

int main(){

   // freopen("boards.in","r",stdin);
   // freopen("boards.out","w",stdout);
    fast;

    cin>>n;

    l=INF;

    for(i=1;i<=n;i++){
        cin>>k;
        if(k<=l)m++;
        l=min(l,k);
    }

    cout<<m<<endl;

    amen;
}

Measured memory_bytes: 256
/*siddharth goyal*/
#include<bits/stdc++.h>
using namespace std;
#define   pb              push_back
#define   REP(i,n)        for(int i=1;i<=n;i++)
#define   FOR(i,a,b)      for(int i=a;i<=b;i++)
#define   all(v)          v.begin(),v.end()
#define   F               first
#define   S               second
#define   vl              vector<LL>
#define   itr             ::iterator it
#define   lb              lower_bound
#define   ub              upper_bound
#define   LL              long long
#define   ULL             unsigned long long
#define   ret             return 
#define   sz(x)           (LL)x.size()
LL n,i,j ; 
long double ans = 0;
long double a[1000000] ; 
long double dp[3002][3002] ; 
int main()
{   // Read the constraints,highlights,Time Limit,Test Cases
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n ; 
    REP(i,n) cin>>a[i] ;
    for(int i=0;i<=n;i++) dp[0][i] = 1 ; 
    REP(i,n)
    {  long double x = 1.00 - a[i] ;  
       for(int j=0;j<=i-1;j++)
        dp[i][j] += dp[i-1][j] * x  ; 
       for(int j=1;j<=i;j++)
         dp[i][j] += dp[i-1][j-1] * a[i] ; 
    } 
    for(int i=(n+1)/2;i<=n;i++)
      ans += dp[n][i] ; 
    cout<<fixed<<setprecision(10)<<ans<<endl; 
}
//Check for 0,1 and other corner cases.

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

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    vector<int> a(n);
    map<int, int> cnt;
    for (int i = 0; i < n; i++){
        cin >> a[i];
        cnt[a[i]]++;
    }
    
    ll ans = 0;
    for (auto i : cnt) {
        ll curcnt = i.second;
        ans += curcnt * (curcnt-1);
    }
    
    for (int i = 0; i < n; i++){
        cout << (ans - cnt[a[i]] * (cnt[a[i]]-1) + (cnt[a[i]]-1) *(cnt[a[i]]-2))/2 << "\n";
    }
    
    
    
    return 0;
}


Measured memory_bytes: 8320
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{

    internal class Solution
    {
        public int N;
        public int[] A;

        public void Run()
        {
            N = Input.ReadInt();
            A = Input.ReadIntArray();

            int ret = int.MaxValue;

            for (int i = 0; i < N; i++)
            {
                int r = 0;
                int a = A[i];
                while (a % 2 == 0)
                {
                    r++;
                    a /= 2;
                }

                ret = Math.Min(ret, r);
            }
            Console.WriteLine(ret);
        }
       
    }
    
    internal static class Input
    {
        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
int main() {
  int N;
  cin >> N;
  vector<string> S(N);
  map<string, int> mp;
  rep(i, N) {
    cin >> S[i];
    if(!mp.count(S[i])) mp[S[i]] = 0;
    mp[S[i]]++;
  }
  int mx = 0;
  for(auto m: mp) mx = max(m.second, mx);
  for(auto m: mp) {
    if(m.second == mx) cout << m.first << endl;
  }
  return 0;
}


Measured memory_bytes: 26752
package main

import "fmt"

func main() {
  var a,b int
  fmt.Scan(&a, &b)
  
  var c int
  d := (b-b%10)/10
  
  if d == 10 {
    c = 1000
  } else if d > 0 {
    c = 100
  } else {
    c = 10
  }

  s := a*c + b
  t := s
  
  if b%2 == 0 {
    t = s/2
  } 
    
  for i := 3 ; i < t ; i++ {
     if i * i == s {
      fmt.Println("Yes")
      return
    }
  }
	
  fmt.Println("No")

}


Measured memory_bytes: 512
#-*-coding:utf-8-*-
from collections import Counter

def main():
    n = int(input())
    a_list = list(map(int, input().split()))

    a_set = set(a_list)
    cnt = Counter(a_list)

    min_cnt = 0
    for i in a_set:
        if cnt[i] - i >= 0:
            min_cnt += cnt[i] - i
        else:
            min_cnt += cnt[i]

    print(min_cnt)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 24308
#include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG_OUTPUT
#define DEBUG_LOG(s) cout << s << endl;
#else
#define DEBUG_LOG(s) void();
#endif

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

    vector<int> a(n), b(n), c(n);
    for (auto i = 0; i < n; i++) cin >> a[i];
    for (auto i = 0; i < n; i++) cin >> b[i];
    for (auto i = 0; i < n; i++) cin >> c[i];
    sort(a.begin(), a.end());
    sort(c.begin(), c.end());

    int64_t ans = 0;
    for (auto i = 0; i < (int)b.size(); i++) {
        auto a_itr = lower_bound(a.begin(), a.end(), b[i]);
        auto c_itr = lower_bound(c.begin(), c.end(), b[i] + 1);
        if(a_itr == a.begin()) continue;
        if(c_itr != c.end()) {
            ans += (distance(a.begin(), prev(a_itr)) + 1) * distance(c_itr, c.end());
//            cout << *prev(a_itr) << "," << distance(a.begin(), prev(a_itr)) << " "
//                << *c_itr << "," << distance(c_itr, c.end()) << endl;
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
int main()
{
    long H, result(1), x(1);
    std::cin >> H;
    while (H > 0)
    {
        if (H == 1)
        {
            break;
        }
        else
        {
            H /= 2;
            result += x * 2;
            x *= 2;
        }
    }
    std::cout << result << std::endl;
}

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

int const N = 3000;

int main(){
	int a, b, c, n;
	scanf("%d%d%d%d", &a, &b, &c, &n);
	int an = 0;
	f(i, 0, N + 1)f(j, 0, N + 1){
		int nn = i * a + j * b;
		if (nn > n)continue;
		nn = n - nn;
		if (nn % c)continue;
		++an;
	}
	printf("%d\n", an);
}

Measured memory_bytes: 256
//         Jai Saraswati Maa       Om Namah Shivaay        Jai Bhawani
// You have to work hard and keep coding till you get correct output never quit! :-)
// May the force be with you
// Ganpatai Bappa Morya! Mangal Murti Morya!
#include<bits/stdc++.h>
#define sc(x) scanf("%d",&x);
#define scc(x,y) scanf("%d %d",&x,&y);
#define sccc(x,y,z) scanf("%d %d %d",&x,&y,&z);
#define sl(x) scanf("%lld",&x);
#define sll(x,y) scanf("%lld %lld",&x,&y);
#define slll(x,y,z) scanf("%lld %lld %lld",&x,&y,&z);
#define pf(x) printf("%d",x);
#define pfn(x) printf("%d\n",x);
#define pl(x) printf("%lld",x);
#define pln(x) printf("%lld\n",x);
#define st(s) scanf("%s",s);
using namespace std;
bool isPerfectSquare(int n)
{
    // sum is sum of all odd numbers. i is
    // used one by one hold odd numbers
    for (int sum=0,i=1; sum<n; i+=2)
    {
        sum += i;
        if (sum == n)
            return true;
    }
    return false;
}
int main()
{
   int n,i;
   sc(n)
   for(i=n;i>=0;i--)
   {
       if(isPerfectSquare(i)){
         printf("%d",i);
         return 0;}
   }
 return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,n-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);

int main() {
	int W, H;

	while(cin >> H >> W, H) {
		vs tile(H);
		vvi field(H, vi(W));

		REP(i, H) {
			cin >> tile[i];
		}

		int x = 0, y = 0;
		
		while(field[x][y] != 1) {
			field[x][y] = 1;
			switch(tile[x][y]) {
			case '^':
				x--;
				break;
			case '>':
				y++;
				break;
			case 'v':
				x++;
				break;
			case '<':
				y--;
				break;
			case '.':
				cout << y << " " << x << endl;
				goto next;
			}
		}
		cout << "LOOP" << endl;

		next:;
	}

	return 0;
}

Measured memory_bytes: 1296
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;
  int b;
  int c = 0;
  for(int i=0;i<a;i++){
    cin >> b;
   if(b%2==0){
     if(b%3!=0&&b%5!=0){
       c++;
     }
   }
  }
    if(c==0){
     cout << "APPROVED" << endl;
    }
  else{
    cout << "DENIED" << endl;
  }
}


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

// マクロ //
#define rep(i,N) for(int i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define uniq(x) x.erase(unique(all(x)), x.end())
#define vsum(x) accumulate(all(x), 0)
#define cou(x) cout << x << endl
#define y() cout << "Yes" << endl
#define n() cout << "No" << endl
#define Y() cout << "YES" << endl
#define N() cout << "NO" << endl
#define x2(x) (x) * (x)

// 型エイリアス //
using lint = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vli = vector<lint>;
using vc = vector<char>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvc = vector<vc>;
using vpii = vector<pii>;
using msi = map<string, int>;

// 関数 //
template<class T> lint gcd(T a, T b) {
    int t;
    while (b != 0) {
        t = a % b;
        a = b;
        b = t;
    }
    return a;
}

template<class T> lint lcm(T a, T b) {
    return a * b / gcd(a, b);
}

double distance(pii a, pii b) {
    double dist;
    dist = sqrt(x2(a.first - b.first) + x2(a.second - b.second));
    return dist;
}

lint perm(int a) {
    lint perm = 1;
    for (int i = a; i >= 1; i--) {
        perm *= i;
    }
    return perm;
}

lint combination(int n, int m) {
    long double c = 1;
    for (int i = n, k = 1; i > m; i--, k++) {
        c *= i;
        c /= k;
    }
    return (lint)c;
}

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

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

// 定数 //
#define pi acos(-1)
#define mod 1000000007
#define MOD 998244353
#define inf ((1LL << 62) - 1 + (1LL << 62))

// キーワード //
#define elif else if

// End of Template //



int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);
        
    int X, Y, Z;
    cin >> X >> Y >> Z;
    
    cou(Z << " " << X << " " << Y);


}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<math.h>
#include<tuple>
#include<string.h>
#include <numeric> 
#include<unordered_map>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define pp1(...) "\033[1;47;35m" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define dg(x) debug() << pp1(x)
#define dg1(x) debug() << "[line : " << __LINE__ <<"]"<< pp(x)
#define dg2(x,y) debug() << "[line : " << __LINE__ <<"]"<< pp(x) pp(y)
#define dg3(x,y,z) debug() << "[line : " << __LINE__ <<"]"<< pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << "[line : " << __LINE__ <<"]"<< pp(w) pp(x) pp(y) pp(z)
template<typename T> void db(T x ){ debug() <<">>> " <<  x; }
template<typename T> void db(T x , T y){ debug() <<">>> " <<  x <<" , "<< y; }
template<typename T> void db(T x , T y , T z){ debug() <<">>> "<< x <<" , "<< y <<" , "<< z; }
template<typename T> void db(T x , T y , T z , T a){ debug() <<">>> "<< x <<" , " << y <<" , "<< z <<" , "<< a; }
#define int long long
#define all(x) x.begin() , x.end()
#define clr(x , y) memset(x , y , sizeof x);
#define sz(x) (int)x.size()

const int Mod = 1e9 + 7;
const int inf = 1e18;
vector<int>a;
int check(int m, int delta, int B) {
    int cnt = 0;
    for(int i = 0; i < sz(a); i++) {
        int rem = a[i] - (m * B);
        if(rem > 0) {
            int need = rem / delta + (rem % delta != 0);
            cnt += need;
        }
    }

    return cnt <= m;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n , A, B;
  cin >> n >> A >> B; 
  a = vector<int>(n);
  for(int i = 0;i < n; i++) {
      cin >> a[i];
  }
  int delta = A - B;
  int l = 1, h = 1e9;
  int ans = inf;
  while(l <= h) {
      int mid = (l + h) / 2;
      if(check(mid, delta, B)) {
          ans = min(ans , mid);
          h = mid - 1;
      }
      else l = mid + 1;
  }
  cout << ans << '\n';
}

Measured memory_bytes: 3936
#include<stdio.h>

int max(int x,int y){
  if(x > y){
    return x;
  }
  else{
    return y;
  }
}

int min(int x,int y){
  if(x < y){
    return x;
  }
  else{
    return y;
  }
}

int main(){
  int a,b;
  scanf("%d",&a);
  scanf("%d",&b);
  int i;
  int x = max(a,b);
  int y = min(a,b);

  for(i = 0;i < x;i++){
    printf("%d",y);
  }

  return 0;
}


Measured memory_bytes: 128
/**
 *    author:  tourist
 *    created: 20.05.2018 15:04:18       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    x--;
    p[x] = i;
  }
  int t = 1, ans = 1;
  for (int i = 1; i < n; i++) {
    if (p[i] > p[i - 1]) {
      t++;
    } else {
      t = 1;
    }
    ans = max(ans, t);
  }
  cout << n - ans << '\n';
  return 0;
}


Measured memory_bytes: 1024
def answer():
    l = []
    l_sub = []
    serving_time = 0
    for _ in range(5):
        l.append(int(input()))  # 5種類の料理の調理時間の10分わけ

    for v in l:
        l_sub.append((v-1) % 10 +1)
        serving_time += ((v -1)//10 + 1) *10

    serving_time = serving_time - 10 + min(l_sub)
    return serving_time


def main():
    print(answer())

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940