akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ls( s) (s&(-s))
#define ll long long
#define inf 0x3f3f3f3f
const ll N = 200030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    1e9+7;
ll ans=0;
ll n,m;
ll arr[N];
int main()
{ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

cin>>n>>m;
rep(i,1,n+1)
cin>>arr[i];


{
	ll x=1;
	rep(i,1,n+1)
	{
		x=x*(arr[i]/2)/((__gcd(x,arr[i]/2)));
		if(x>m)
		{
			cout<<0;
			return 0;
		}
	}
rep(i,1,n+1){
		if((2*x/arr[i])%2==0){
			puts("0");return 0;
		}
	}

	cout<<(m-x)/(2*x)+1<<endl;
}




}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static int linearSearch(int[] first, int[] second) {
		int output = 0;
		
		for (int i = 0; i < second.length; i++) {
			boolean match = false;
			for (int j = 0; j < first.length; j++) {
				if (second[i] == first[j] && !match) {
					match = true;
				}
			}
			if (match) {
				output++;
			}
		}
		return output;
	}

	public static int[] toArray(String s, int l) {
		Scanner in = new Scanner(s);
		int[] output = new int[l];
		for (int i = 0; i < l; i++) {
			output[i] = in.nextInt();
		}
		in.close();
		return output;
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int lengthOne, lengthTwo;
		String arrayOne, arrayTwo;

		lengthOne = in.nextInt();
		in.nextLine();
		arrayOne = in.nextLine();

		lengthTwo = in.nextInt();
		in.nextLine();
		arrayTwo = in.nextLine();

		int[] first = toArray(arrayOne, lengthOne);
		int[] second = toArray(arrayTwo, lengthTwo);
		System.out.println(linearSearch(first, second));

		in.close();
	}
}



Measured memory_bytes: 48380
n,*a=map(int,open(0).read().split())

rank=[0]*9

for aa in a:
    rank[aa//400 if aa<3200 else 8]+=1

cnt=8
for i in range(8):
    if rank[i]==0:
        cnt-=1

print('{} {}'.format(max(1,cnt),cnt+rank[8]))

Measured memory_bytes: 61860
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l;
  cin >> n >> l;
  vector<int> vec(n);
  for (int i = 1; i <= n; i++) {
    vec[i - 1] = i + l - 1;
  }
  sort(vec.begin(), vec.end(),
       [](int i, int j) -> bool { return abs(i) < abs(j); });
  cout << accumulate(vec.begin() + 1, vec.end(), 0) << endl;
  return 0;
}

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

int a,b,c;

int main(){
	cin>>a>>b>>c;

while(a==b && b==c){
	cout<<"1"<<endl;
	break;
}
while((a==b&&b!=c)||(b==c&&c!=a)||(c==a&&a!=b)){
	cout<<"2"<<endl;
	break;
}
while(a!=b && b!=c&&c!=a){
	 cout<<"3"<<endl;
	 break;

} 

return 0;
}

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

using namespace std;

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

const ll INF=1e9+7;

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n),dp(1000001);
    map<ll,ll> m;
    rep(i,n){
        cin >> a[i];
        m[a[i]]++;
    }
    sort(a.begin(),a.end());
    ll ans=0;
    rep(i,n){
        if(dp[a[i]]) continue;
        if(m[a[i]]==1) ans++;
        for(ll j=a[i];j<=1000000;j+=a[i]){
            dp[j]++;
        }
    }
    cout << ans << endl;
} 

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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

// const int INF = 1001001001;
// long long max => LLONG_MAX

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

    vector<vector<pair<int,int>>> xy(n);
    for(int i = 0; i < n; i++){
        int a; cin >> a;
        for(int j = 0; j < a; j++){
            int x, y; cin >> x >> y;
            x--;
            xy[i].push_back(make_pair(x, y));
        }
    }

    int ans = 0;
    for(int i = 0; i < (1<<n); i++){
        bool check = true;
        for(int j = 0; j < n; j++){
            if((i>>j)&1){
                for(P p : xy[j]){
                    int x = p.first;
                    int y = p.second;
                    if(((i>>x)&1) && y != 1){
                        check = false;
                        break;
                    }
                    if(!((i>>x)&1) && y == 1){
                        check = false;
                        break;
                    }

                }
            }
            if(!check) break;
        }
        if(check) {
            int now = 0;
            for(int j = 0; j < n; j++){
                if((i>>j)&1) now++;
            }
            ans = max(ans, now);
        }
    }
    cout << ans << endl;

    return 0;
}


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

int main(){
    int H, W;
    cin >> H >> W;
    string S[H];
    int A[H][W];
    int B[H][W];
    int C[H][W];
    int M[H];

    for(int i = 0; i < H; i++){
        cin >> S[i];
    }

    for(int i = 0; i < H; i++){
        for(int j = 0; j < W;){
            if(S[i][j] == '#'){
                A[i][j] = 0;
                j++;
            }
            else{
                int k = 0;
                while(S[i][j+k] == '.'){
                    k++;
                    if(j+k == W){
                        break;
                    }
                }
                for(int l = j; l < j + k; l++){
                    A[i][l] = k;
                }
                j += k;
            }   
        }
    }

    for(int i = 0; i < W; i++){
        for(int j = 0; j < H;){
            if(S[j][i] == '#'){
                B[j][i] = 0;
                j++;
            }
            else{
                int k = 0;
                while(S[j+k][i] == '.'){
                    k++;
                    if(j+k == H){
                        break;
                    }
                }
                for(int l = j; l < j + k; l++){
                    B[l][i] = k;
                }
                j += k;
            }   
        }
    }

    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            C[i][j] = A[i][j] + B[i][j] -1;
        }
        sort(C[i],C[i] + W, greater<int>());
        M[i] = C[i][0];
    }

    sort(M, M + H, greater<int>());

    cout << M[0] << endl;
}

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

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

#define fill(a,x) memset(a,x,sizeof(a)) 
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) x.begin(),x.end() 
#define F first
#define S second
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i = a; i>=b; --i)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
const ll INF = 1e18;
const int mod = 1e9+7;
const int N = 1e5+10; 
inline int add(int x,int y){
  x += y;
  if(x >= mod) x -= mod;
  return x;
}
inline int mul(int x,int y){
  x = (1LL * x * y) % mod;
  return x;
}
int main(){
  fast;
  ll x,y;
  cin >> x >> y;
  if(x < y)swap(x,y);
  if(y <= x - 2){
  	cout << "Alice\n";
  }
  else{
  	cout << "Brown\n";
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <deque>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
#include <string>
#include <iostream>
using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b;
    c = b * 2;
    if (c >= a) { cout << 0 << endl; }
    else { cout << a - c << endl; }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
template<typename T>
struct Edge {
    int from, to;
    T cost;
    Edge(int from, int to, T cost) {
        this->from = from;
        this->to = to;
        this->cost = cost;
    }
};
template<typename T>
using Edges = std::vector<Edge<T>>;
template<typename T>
using Graph = std::vector<Edges<T>>;
template<typename T>
std::vector<int> topological_sort(const Graph<T> &graph) {
    Graph<T> g = graph;
    int n = g.size();
    std::vector<int> res;
    std::queue<int> que;
    std::vector<std::set<int>> in(n);
    for(int i=0;i<n;++i) {
        for(int j=0;j<(int)(g[i].size());++j) {
            in[g[i][j].to].insert(i);
        }
    }
    for(int i=0;i<n;++i) {
        if((int)(in[i].size()) == 0) que.push(i);
    }
    while(!que.empty()) {
        int now = que.front(); que.pop();
        res.push_back(now);
        for(int i=0;i<(int)(g[now].size());++i) {
            int next = g[now][i].to;
            if((int)(in[next].size()) == 1) {
                que.push(next);
            }
            in[next].erase(now);
        }
        g[now].clear();
    }
    for(int i=0;i<n;++i) {
        if((int)(g[i].size()) > 0) {
            res.resize(1, -1);
            break;
        }
    }
    return res;
}
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  cout << fixed << setprecision(10);
  int n, m; cin >> n >> m;
  Graph<int> g(n);
  for(int i=0;i<m;++i) {
    int u, v; cin >> u >> v;
    u--; v--;
    g[u].push_back(Edge<int>(u, v, 1));
  }
  vector<int> d = topological_sort(g);
  map<int, int> mp;
  for(int i=0;i<n;++i) {
    mp[d[i]] = i;
  }
  vi dp(n, 0);
  for(int i=0;i<n;++i) {
    int now = d[i];
    for(int j=0;j<(int)(g[now].size());++j) {
      int next = g[now][j].to;
      dp[mp[next]] = max(dp[mp[next]], dp[i] + 1);
    }
  }
  int ma = 0;
  for(int i=0;i<n;++i) {
    ma = max(ma, dp[i]);
  }
  cout << ma << endl;
}


Measured memory_bytes: 21244
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#define N 100005
using namespace std;
typedef long long ll;
const ll mod = 1000000007LL;
int n;
int main() {
	cin>>n;
	vector<int> a(n);
	int cnt[N];
	memset(cnt, 0, sizeof(cnt));
	for (int i = 0; i < n; ++i) {
		cin>>a[i];
		cnt[a[i]]++;
	}
	if (n % 2) {
		bool ok = true;
		ll tot=1LL;
		for (int i = 2; i <= n / 2 * 2; i+=2) {
			if (cnt[i] != 2) {
				ok=false;
				break;
			}
			tot = 2LL*tot%mod;
		}
		if (cnt[0] != 1) ok=false;
		if (!ok) {
			cout<<0<<endl;
		} else {
			cout<<tot<<endl;
		}
	} else {
		bool ok = true;
		ll tot=1LL;
		for (int i =1; i <= n/2*2-1; i+=2) {
			if (cnt[i] != 2) {
				ok=false;
				break;
			}
			tot=tot*2LL%mod;
		}
		if (!ok) cout<<0<<endl;
		else cout<<tot<<endl;
	}
	return 0;
}

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

int main() {
  string s, t;
  cin >> s >> t;
  int ans = 0;
  rep(i, s.size()) {
    if (s[i] != t[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3836
#include<iostream>
#include<cstdio>
#define ll long long
#define mod 1000000007
using namespace std;
int n;
int a[1000010];
ll ans=1ll,fac=1ll;
char s[1000010];
int main(){
	scanf("%d%s",&n,s+1);
	for(register int i=1;i<=n;i++)fac=fac*i%mod;
	n<<=1;
	for(register int i=1,now=0;i<=n;i++){
		if(i==n&&now!=1){
			printf("0\n");
			return 0;
		}
		int t0=now,t1=now+1;
		if(t0&1)swap(t0,t1);
		if(s[i]=='W'){
			if(!t0){
				printf("0\n");
				return 0;
			}
			if(t0==now){
				ans=ans*1ll*now%mod;
				now--;
			}
			else{
				now++;
			}
		}
		else{
			if(t1==now){
				ans=ans*1ll*now%mod;
				now--;
			}
			else{
				now++;
			}
		}
	}
	printf("%lld\n",ans*fac%mod);
	return 0;
} 

Measured memory_bytes: 384
#include<cstdio>
#include<cstring>
char str[200005];
int cnt[30],sum[30];
int main()
{
  scanf("%s",str+1);
  int n=strlen(str+1);
  for(int i=1;i<=n;++i)sum[str[i]-'a'+1]++;
  long long ans=0;
  for(int i=1;i<=n;++i)
  {
    cnt[str[i]-'a'+1]++;
    ans=ans+n-i-(sum[str[i]-'a'+1]-cnt[str[i]-'a'+1]);
  }
  printf("%lld\n",ans+1);
}

Measured memory_bytes: 384
package main

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

func main() {
	In := readLineInt()
	Count := In[0]
	Results := make([]string, Count)
	Loop(0, Count, func(i int) {
		Results[i] = readLine()
	})
	sort.Strings(Results)
	for _, s := range Results {
		fmt.Print(s)
	}
	fmt.Println()
}

/////////////////////////////////////////
var scanner = bufio.NewScanner(os.Stdin)

func init() {
	//scanner.Split(bufio.ScanWords)
}
func readLine() string {
	scanner.Scan()
	return scanner.Text()
}
func readLineInt() []int {
	result := make([]int, 0)
	for _, v := range strings.Split(readLine(), " ") {
		r, _ := strconv.Atoi(v)
		result = append(result, r)
	}
	return result
}

func Loop(start, end int, f func(i int)) {
	for i := start; i < end; i++ {
		f(i)
	}
}

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

int main(){
    int i;
	char s[100] = {0};
	
	cin >>s;
	for(i = 0;i <100;i++){
	    if(s[i]=='\0')break;
	    s[i] = 'x';
	}
	cout << s;
	
	return 0;
}

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

#define F first 
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 100010, M = 35;

int n, m;
struct Pro
{
	int s, t, c;
	bool operator<(const Pro &e)const
	{
		if (s != e.s) return s < e.s;
		else return t < e.t;
	}
}a[N];
int cnt;
PII rec[M];

bool cmp(PII a, PII b)
{
	return a.F > b.F;
}

int main()
{
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i ++ )
	{
		int s, t, c;
		scanf("%d%d%d", &s, &t, &c);
		a[i] = {s, t, c};
	}
	sort(a, a + n);
	
	for (int i = 0; i < n; i ++ )
	{
		bool flag = false;
		int s = a[i].s, t = a[i].t, c = a[i].c;
		sort(rec, rec + cnt, cmp);
		
		for (int j = 0; j < cnt; j ++ )
			if (rec[j].F == s && rec[j].S == c)
			{
				rec[j].F = t;
				flag = true;
				break;
			}
			else if (rec[j].F + 1 <= s)
			{
				rec[j] = {t, c};
				flag = true;
				break;
			}
			
		if (!flag) rec[cnt ++ ] = {t, c};
	}
	
	printf("%d\n", cnt);
    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>

using namespace std;

int main(){
	string ch;
	int i;

	getline(cin, ch);

		for(i=0; i<ch.size(); i++){

		if(isalpha(ch[i])!=0){
			ch[i] = toupper(ch[i]);
		}
	}

	cout << ch << endl;
}

Measured memory_bytes: 1176
N = int(input())
M = []
for _ in range(N):
    h, p = map(int, input().split())
    M.append((h, p))
M = sorted(M, key=lambda x: x[0] + x[1])
dp = [10 ** 9 + 1] * (N+1)
dp[0] = 0
ans = 0
for h, p in M:
    for i in range(N-1, -1, -1):
        if dp[i] <= h:
            dp[i+1] = min(dp[i+1], dp[i] + p)
            ans = max(ans, i+1)

print(ans)

Measured memory_bytes: 45672
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
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;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    long double ans = 0.0;
    ll N, K;
    cin >> N >> K;
    for(ll i = 1; i <= N; i++) {
        long double tmp = 1 / (long double)N;
        ll now = i;
        while(now < K) {
            now *= 2;
            tmp *= 0.5;
        }
        ans += tmp;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

void solve() {
    int x, y, z;
    std::cin >> x >> y >> z;
    std::swap(x, y);
    std::swap(x, z);
    std::cout << x << " " << y << " " << z << std::endl;
}

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

    solve();

    return 0;
}


Measured memory_bytes: 892
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> PII;
typedef pair<PII,int> PIII;
template<typename T>
void read(T &x)
{
    char ch=getchar();
    int f=1;
    for (x=0;ch!='-'&&(ch<'0'||ch>'9');ch=getchar());
    if (ch=='-') f=-1,ch=getchar();
    for (;ch>='0'&&ch<='9';x=x*10+ch-'0',ch=getchar());
    x*=f;
}
void st(int &a,int &b,int &c)
{
	int f[3]={a,b,c};
	sort(f,f+3);
	a=f[0],b=f[1],c=f[2];
}
set<PIII> se;
int a,b,c,aa,bb,cc,ans;
int main()
{
	read(a),read(b),read(c);
	st(a,b,c);
	se.insert(make_pair(make_pair(a,b),c));
	ans=0;
	while (a%2==0 && b%2==0 && c%2==0)
	{
		ans++;
		aa=b/2+c/2;
		bb=a/2+c/2;
		cc=a/2+b/2;
		a=aa,b=bb,c=cc;
		st(a,b,c);
		if (se.count(make_pair(make_pair(a,b),c)))
		{
			puts("-1");
			return 0;
		}
		else se.insert(make_pair(make_pair(a,b),c));
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
 
  char s[200],p[100];
   
  scanf("%s", s);
  scanf("%s", p);
   
  int a,b;
  a = strlen(s);
  b = strlen(p);
 
  int i,j,k;
  k = 0;
   
  for ( i = 0 ; i < a ; i++ ){
    s[ i + a ] = s[i];
  }
   
  for ( i = 0 ; i <= a ; i++ ){
 
    if ( a == i ){
      printf("No\n");
      break;
    }
     
    for ( j = 0 ; j <= b ; j++ ){
      if ( j == b ){
    printf("Yes\n");
    k = 1;
    break;
      }
      if ( s[ i + j ] != p[j] ) break;
    }
    if ( k == 1 ) break;
  }
 
  return 0;
   
}

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

void disp(vector<int>& v) {
    for (int i=0; i<v.size()-1; i++) {
        cout << v[i] << " ";
    }
    cout << v[v.size()-1] << endl;
}

int main()
{
    int i, j;
    int inp, tmp, N;
    vector<int> v;

    cin >> N;
    for (i=0; i<N; i++) {
        cin >> inp;
        v.push_back(inp);
    }

    if (v.size() == 1) {
        cout << v[0] << endl;
        return 0;
    }

    disp(v);
    for (i=1; i<v.size(); i++) {
        tmp = v[i];
        j = i - 1;
        while (j>=0 && v[j]>tmp) {
            v[j+1] = v[j];
            j--;
        }
        v[j+1] = tmp;
        disp(v);
    }
    return 0;
}

Measured memory_bytes: 1224
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Y = sc.nextInt();
		boolean flag = false;

		A:for(int x = 0; x <= Math.min(Y/10000, N); x++) {
			for(int y = 0; y <= Math.min((Y-10000*x)/5000, N-x); y++){
				int k = Y - 10000*x - 5000*y;
				if(k%1000 == 0) {
					int z = k/1000;
					if(z == (N - x - y)) {
						System.out.printf("%d %d %d", x, y, z);
						flag = true;
						break A;
					}
				}
			}
		}
		if(!flag) System.out.printf("-1 -1 -1");
		sc.close();
	}
}

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


public class Main {
	
	static class Team implements Comparable<Team>{
		int number;
		int time;
		
		Team(int n, int t){
			number = n;
			time = t;
		}
		
		@Override
		public int compareTo(Team arg0) {
			return Integer.valueOf(this.time).compareTo(Integer.valueOf(arg0.time));
		}
		
		@Override
		public String toString(){
			return Integer.toString(number);
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			final int n = sc.nextInt();
			
			if(n == 0){
				break;
			}
			
			Team[] array = new Team[n];
			
			for(int i = 0; i < n; i++){
				int number = sc.nextInt();
				int time = sc.nextInt()*60 + sc.nextInt()
						 + sc.nextInt()*60 + sc.nextInt()
						 + sc.nextInt()*60 + sc.nextInt()
						 + sc.nextInt()*60 + sc.nextInt();
				array[i] = new Team(number, time);
			}
			
			Arrays.sort(array);
			
			System.out.println(array[0]);
			System.out.println(array[1]);
			System.out.println(array[n-2]);
		}
		
	}

}

Measured memory_bytes: 13000
import java.util.Scanner;

public class Main {
	private Scanner sc;
	
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);
		
		int[] days = {
				31, 29, 31, 30, 31, 30,
				31, 31, 30, 31, 30, 31
		};
		
		String str = "";
		while (sc.hasNextLine() == true) {
			str = sc.nextLine();
			if (str.equals("0 0")) break;
			
			String[] params = str.split(" ");
			int month = Integer.parseInt(params[0]);
			int day = Integer.parseInt(params[1]);
			
			int seven = day;
			for (int i = 1; i < month; i++) {
				seven = seven + days[i - 1];
			}
			
			seven = seven % 7;
			
			switch (seven) {
			case 0:
				System.out.println("Wednesday");
				break;
			case 1:
				System.out.println("Thursday");
				break;
			case 2:
				System.out.println("Friday");
				break;
			case 3:
				System.out.println("Saturday");
				break;
			case 4:
				System.out.println("Sunday");
				break;
			case 5:
				System.out.println("Monday");
				break;
			case 6:
				System.out.println("Tuesday");
				break;
			}
		}
	}
}

Measured memory_bytes: 26116
#include<stdio.h>
int main(void){
	int n,a,b,q1=0,q2=0,q3=0,ans;
	scanf("%d",&n);
	scanf("%d %d",&a,&b);

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

	for(int i=0;i<n;i++){
		if(p[i]<=a){
			q1++;
		}else if(p[i]<=b){
			q2++;
		}else{
			q3++;
		}
	}
	
	if(q1<=q2){
		if(q1<=q3){
			ans = q1;
		}else{
			ans = q3;
		}
	}else{
		if(q2<=q3){
			ans = q2;
		}else{
			ans = q3;
		}
	}

	printf("%d",ans);

	return 0;
}

Measured memory_bytes: 128
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int[] v = new int[n];
		Integer[] r = new Integer[n];
		int sum=0;
		for (int i = 0; i < n; i++) {
			v[i]=scn.nextInt();
		}
		for (int i = 0; i < n; i++) {
			r[i] = v[i] - scn.nextInt();
		}
		Arrays.sort(r,Comparator.reverseOrder());
		for(int i=0;i<n;i++) {
			if(r[i]>0) {
				sum+=r[i];
			}else {
				break;
			}
		}
		System.out.println(sum);
	}
}

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

//{{{
#if ((_WIN32 || __WIN32__) && __cplusplus < 201103L)
#define lld I64d
#else
#define lld lld
#endif
using namespace std;
typedef long long LL;
typedef vector<int> VI;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define clr(a, b) memset(a, b, sizeof(a))
// clang-format off
#define debug(args...) {vector<string> _v = split(#args, ','); err(_v.begin(), args); cerr<<endl;}
vector<string> split(const string& s, char c) {vector<string> v; stringstream ss(s); string x; while
(getline(ss, x, c)) v.push_back(x); return v;} void err(vector<string>::iterator) {}
template<typename T, typename... Args> void err(vector<string>::iterator it, T a, Args... args)
{cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; err(++it, args...);}
// clang-format on
//}}}

const int N = 1e5 + 10;

int head[N], e;
struct E
{
    int v, next;
} edge[N];

void addedge(int u, int v)
{
    edge[e].v = v;
    edge[e].next = head[u];
    head[u] = e++;
}

int dp[N];
int dfs(int u)
{
    if (dp[u] != -1) return dp[u];

    int ret = 0;
    for (int i = head[u]; ~i; i = edge[i].next)
    {
        int v = edge[i].v;

        int val = dfs(v);
        ret = max(ret, val + 1);
    }
    return dp[u] = ret;
}

int n, m;

int main()
{
#ifdef LOCAL
    freopen("in", "r", stdin);
    // freopen("out", "w", stdout);
#endif

    while (~scanf("%d%d", &n, &m))
    {
        clr(head, -1), e = 0;
        for (int i = 1; i <= m; i++)
        {
            int u, v;
            scanf("%d%d", &u, &v);
            addedge(u, v);
        }

        clr(dp, -1);

        int ans = 0;
        for (int i = 1; i <= n; i++)
        {
            int v = dfs(i);
            ans = max(ans, v);
        }
        printf("%d\n", ans);
    }

    return 0;
}


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

using namespace std;

int N, sol = 1, mod = 1000000007;

int main() {
    cin >> N;
    for (int i = 1; i <= N; ++i) {
        sol = (1LL * sol * i) % mod;
    }

    cout << sol << '\n';
    return 0;
}


Measured memory_bytes: 764
// Created By Jefferson Samuel on 23/08/20 at 2:47 PM

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;

class Main {


    static void solve() throws Exception {

        int N = scanInt();
        int L = scanInt();
        ArrayList<String> lis = new ArrayList<>();
        for(int i = 0; i <N;i++)
            lis.add(scanString());
        Collections.sort(lis);
        StringBuilder br = new StringBuilder();
        for( String k : lis)
            br.append(k);

        out.println(br.toString());

    }




    // dont touch this side
    static int scanInt() throws IOException {
        return parseInt(scanString());
    }

    static long scanLong() throws IOException {
        return parseLong(scanString());
    }

    static String scanString() throws IOException {
        while (tok == null || !tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            solve();
            in.close();
            out.close();
        } catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    }
}

Measured memory_bytes: 32992
import java.util.ArrayList;
import java.util.Scanner;

class Main{
	static int[][] dp;




	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		int[] p = new int[N];
		ArrayList<Integer> one = new ArrayList<Integer>();
		ArrayList<Integer> two = new ArrayList<Integer>();
		ArrayList<Integer> three = new ArrayList<Integer>();

		for(int i = 0;i < N;i++){
			p[i] = sc.nextInt();
			if(p[i] <= A){
				one.add(p[i]);
			}else if(p[i] <= B){
				two.add(p[i]);
			}else{
				three.add(p[i]);
			}
		}
		int min = Math.min(one.size(), Math.min(two.size(), three.size()));
		
		
		System.out.println(min);
		
	}


}







class Pair implements Comparable{
	int from;		//p
	int end;		//y
	int num;
	int bango;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}



Measured memory_bytes: 21588
using System;
    class Program
    {
      static void Main()
      {
      	string str=Console.ReadLine();
        if(str.Length%2!=0){
         Console.WriteLine("No");
          return;
        }
        for(int i=0;i<str.Length;i+=2){
        	if(!(str[i]=='h'&&str[i+1]=='i')){
            	Console.WriteLine("No");
              return;
            }
        }
        Console.WriteLine("Yes");
      }
    }

Measured memory_bytes: 13140
import java.text.DecimalFormat;
import java.util.stream.LongStream;
import java.util.stream.IntStream;
import java.io.*;
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        
        AtCoder problem = new AtCoder(sc);
        problem.solve(out);
        
        out.flush();
    }
    
}

class AtCoder {
    final String S;
    AtCoder(FastScanner sc) {
        S = sc.next();
    }

    void solve(PrintWriter out) {
        out.println("2018" + S.substring(4));
    }
    
}

// https://qiita.com/p_shiki37/items/a0f6aac33bf60f5f65e4
class FastScanner {
    
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    
    private int readByte() {
        if (hasNextByte()) {
            return buffer[ptr++];
        } else {
            return -1;
        }
    }
    
    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
    
    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
            ptr++;
        }
        return hasNextByte();
    }
    
    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    
    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
            throw new NumberFormatException();
        }
        return (int) nl;
    }
    
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 21332
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
//#define N 131072 //100000
#define MAXVAL ((long int) ((unsigned long) (1 << 31) - 1))  //*2
int min(int a, int b){return a>b?b:a;}
int data[2*131072+100];      //the size of array, for present the tree

void update(int index, int x){
	if(index<0) return;
	data[index] = x;
	//even : right, odd: left 
	if(index%2==1){
		update(index/2,(min(data[index],data[index+1])));
	}else if(index%2==0){
		update(index/2-1,(min(data[index],data[index-1])));
	}
	
}
//segment of thr last layer
int search(int search_left,int search_right, int current_node, int node_left, int node_right){
	if(search_right < node_left || search_left > node_right){
        return MAXVAL;//not in the range
	}
	else if(search_left <= node_left && search_right >= node_right){
		return data[current_node];
	}else {
		int left = search(search_left, search_right,current_node*2+1, node_left,(node_left+node_right)/2);
		int right = search(search_left, search_right,current_node*2+2, (node_left+node_right)/2+1, node_right);
		return min(left,right);
	}
	
}
int main(){
	int n, q;
	//FILE *fp = fopen("in.txt","r");
	scanf("%d %d",&n,&q);
	int N = 1;
	while(N<n) N = N<<1;
	for(int i = 0; i<=2*N-2; i++){
		data[i] = MAXVAL;
	}
	for(int i = 0; i<q; i++){
		int temp = 0;
		scanf("%d", &temp);
		int a,b,c;
		scanf("%d %d",&a,&b);
		if(temp == 0) {  //update
			update(N-1+a,b);
		} else if(temp == 1){ //search
			printf("%d\n",search(a,b,0,0,N-1));
		}
	}
	
	return 0;
}

Measured memory_bytes: 3780
fun main(args : Array<String>) {
    val n = Integer.parseInt(readLine())
    val a = readLine()!!.split(" ").map(String::toInt)

    var count = 0
    for (i in a) {
        var x = i
        while(x % 2 == 0) {
            x = x / 2
            count++
        }
    }

    println(count)
}


Measured memory_bytes: 39868
N=input()
C=len(N)

if C % 2 == 0:
  a ="09"
  a=a*(int(C/2))
  print(int(a))
elif C==1:
  print(int(N))
else:
  e = int(N)-10**(C-1)+1
  a = "09"
  a = a * (int((C-1)/2))
  print(int(a)+e)


Measured memory_bytes: 3060
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <vector>
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define eps 1e-8
#define mp make_pair
#define np next_permutation
#define pb push_back
#define all(x) (x.begin(),x.end())
#define rep(i,a,n) for(int i=a;i<n;++i)
#define per(i,a,n) for(int i=n-1;i>=a;--i)
using namespace std; 
const int maxn=500+5;
 
vector <int> v[maxn]; 
bool vis[maxn];
 
void init(){
	rep(i,0,maxn) v[i].clear();
	memset(vis,0,sizeof(vis));
}
 
 
void addedge(int l,int r){
	int len=r-l;
	v[l].pb(len);
}
 
int  checkedge(int l,int len){
//	if(v[l].begin()!=v[l].end()) 
//		 cout<<*v[l].begin()<<endl; 
	int ans=upper_bound(v[l].begin(),v[l].end(),len)-v[l].begin();
//	cout<<"ans="<<ans<<endl;
	return ans;
}
int n,m,q,li,ri,pi,qi;
 
int main(){
	ios::sync_with_stdio(false);
	while(cin>>n>>m>>q){
		init(); 
		rep(i,0,m){
			cin>>li>>ri;
			addedge(li,ri);
			vis[li]=1;
		}
		rep(i,0,maxn){
			if(vis[i])	sort(v[i].begin(),v[i].end()); 
		} 
		rep(i,0,q){
			cin>>pi>>qi;
			int cnt=0;
			for(int i=pi;i<=qi;i++){
				int plen=qi-i;
//				cout<<"plen="<<plen<<endl;
				cnt+=checkedge(i,plen);
			}
			cout<<cnt<<endl;
		}
	} 
} 

Measured memory_bytes: 2176
N = int(input())

A = list(map(int, input().split()))
check = {}
ans = 0


for i, v in enumerate(A):
    if (i-v) in check:
        ans += check[i-v]
    if v+i in check:
        check[v+i] += 1
    else:
        check[v+i] = 1

print(ans)


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

using namespace std;

int main()
{
  int N; cin >> N;
  int D, X; cin >> D >> X;
  vector<int> A(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }

  int sum = X;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j * A[i] + 1 <= D; ++j) {
      sum++;
    }
  }

  cout << sum;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d", $N, $K);
fscanf(STDIN, "%[^\n]", $str);

$arr = explode(" ", $str);
for ($i = 0; $i < count($arr); $i++) {
	$arr[$i] = intval($arr[$i]);
}

$maxLength = 0;
for ($i = 0; $i < $K; $i++) {
	$target = max($arr);
	$maxLength+=$target;
	$point = array_search($target, $arr);
	unset($arr[$point]);
}

echo $maxLength;

Measured memory_bytes: 4604
// 26/01/20 // 12:19 PM //

#include <bits/stdc++.h>

using namespace std;

#define endl "\n"
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long

const int MAXN = (int)(3e3) + 10;

int n, a[MAXN];
int memo[MAXN][MAXN];

int solve(int l, int r){
    if(memo[l][r]!=-1) return memo[l][r];

    if(l>r) return memo[l][r] = 0;
    if(((r-l+1)&1)==(n&1))
        return memo[l][r] = max(a[l] + solve(l+1, r), a[r] + solve(l, r-1));
    else
        return memo[l][r] = min(solve(l+1, r) -a[l], solve(l, r-1) -a[r]);
}


void solve2(){
    for(int l=n; l>=1; l--){
        for(int r=l; r<=n; r++){
            if(((r-l+1)&1)==(n&1)) // taro
                memo[l][r] = max(a[l] + memo[l+1][r], a[r] + memo[l][r-1]);
            else
                memo[l][r] = min(memo[l+1][r] - a[l], memo[l][r-1] - a[r]);
        }
    }
}

int32_t main(){
    fastio;

    cin >> n;
    for(int i=1; i<=n; i++) cin >> a[i];

    solve2();

    cout << memo[1][n] << endl;

    return 0;
}


Measured memory_bytes: 70016
#include<bits/stdc++.h>
#define ll long long
#define dl double
#define mp make_pair
#define pb push_back
using namespace std;

//***********************************************************************

// hash struct for unordered_map
struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
};

int MAXNUM = 5e3+5;
vector <int>vis(MAXNUM);
vector<int> pr;
void sieve() {
	pr.push_back(2);
	for(ll i=3;i<MAXNUM;i+=2) if(!vis[i]) {
		pr.push_back(i);
		for(ll j=i*i;j<MAXNUM;j+=2*i) vis[j]=true;
	}
}
//************************************************************************

ll mod=998244353;
ll dp[3005][3005];
ll a,b,c,d;

ll finddpvalue(ll x,ll y)
{
    if(x>c || y >d)
    return 0;
    if(x==c && y==d)
    return 1;
    if(dp[x][y]!=-1)
    return dp[x][y];

    ll ans=0;
    ans+=y*finddpvalue(x+1,y)%mod;
    ans%=mod;
    ans+=x*finddpvalue(x,y+1)%mod;
    ans%=mod;
    ans=(ans+mod-(finddpvalue(x+1,y+1)*(x*y)%mod)%mod)%mod;
    return dp[x][y]=ans;
}

void solve()
{
    memset(dp,-1,sizeof dp);
    cin >>a >> b >> c >> d;
    ll ans=finddpvalue(a,b);
    cout << ans << endl;
}


int main()
{ 
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
	ll t;
	//cin >> t;
	t=1;
	while(t--)
	{
		solve();
	}

	return 0;
}

Measured memory_bytes: 74608
#include <bits/stdc++.h>
#include <regex>
#ifdef _DEBUG
#include "debug.h"
#endif
#define int ll
#define float double
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define all(v) (v).begin(),(v).end()
#define mkpr make_pair
#define mktp make_tuple
#define tv(tp, i) get<(i)>(tp)
#define CLEAR(obj) obj = decltype(obj)()
#define var auto
#define OUT(type) type &
#define IN(type) const type &
#define self (*this)
#define in :
#define True true
#define False false
using namespace std; using int32 = int32_t; using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>;
using vb = vector<bool>; using vvb = vector<vb>; using vc = vector<char>; using vvc = vector<vc>;
using vf = vector<float>; using vvf = vector<vf>; using vd = vector<double>; using vvd = vector<vd>;
using str = string; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using pff = pair<float, float>; using pdd = pair<double, double>;
using psl = pair<string, ll>; using tiii = tuple<int, int, int>; using tlll = tuple<ll, ll, ll>;
static const int MGN = 10; static const int ARYSZ_MAX = (int)1e7; static const ll LINF = LLONG_MAX/2;
#ifdef int
static const int INF = LINF;
#else
static const int INF = INT_MAX/2;
#endif
static double EPS = 1e-9;
#define FASTCIN() cin.tie(0);ios::sync_with_stdio(false);
#ifdef IMPORT_SAMPLE
#define DEBUG_IMPORT(file) vs args(argv, argv+argc);str sample = make_sample(args, file);ifstream ifs(sample); cin.rdbuf(ifs.rdbuf());
#else
#define DEBUG_IMPORT(file)
#endif
static inline int ord(char c) {return (int)c;}
static inline char chr(int n) {return (char)n;}
static inline bool DBLEQ(double a, double b) {return abs(a - b) < EPS;}
static inline void EPR(str msg) {cerr << msg << endl;}
static inline void AST(bool exp, str msg) {if(!exp){EPR(msg);} assert(exp);}
static inline void TAST(bool exp, str msg) {if(!exp){EPR(msg);} while(!exp){}}


int max_cnt(IN(vector<pii>) tasks) {
    var tks = tasks;
    int N = tks.size();
    sort(all(tks), [](IN(pii) left, IN(pii) right){
        return left.second < right.second;});

    int cnt = 1;
    int t = tks[0].second;
    for(int i = 1; i<N; i++) {
        if (t <= tks[i].first) {
            t = tks[i].second;
            cnt += 1;
        }
    }

    return cnt;
}


int32 main(int32 argc, char* argv[]) {
    FASTCIN();
    DEBUG_IMPORT("sample-1");


    int N; cin>>N;
    vi X(N), L(N); REP(i,N) cin>>X[i]>>L[i];

    vector<pii> se;
    REP(i,N)
        se.emplace_back(mkpr(X[i]-L[i], X[i]+L[i]));

    int ans = max_cnt(se);
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 5104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 2e5+7;
const int N = 1e8+7;
const int INF = 1000000009;
const int MOD = 1000000009;
const double eps = 1e-2;
#define pb push_back
ll po(ll x, ll y) {
    if (y == 0) {
      return 1;
    }
      ll sq = po(x, y / 2);
      sq *= sq;
      sq = sq%MOD;
      if (y % 2 != 0) {
        sq *= x;
        sq = sq%MOD;
      }
      return sq;
}
int a[MAX], pre[MAX];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int x, k;
    cin >> x >> k;
    int a[MAX];
    for(int i = 0;i < x;i++){
        cin >> a[i];
    }
    sort(a, a+x);
    int sum = 0;
    for(int i = 0;i < k;i++){
        sum += a[i];
    }
    cout << sum << endl;
}

/*
1
4 2
0000


*/


Measured memory_bytes: 3608
//============================================================================
// Name        : hoba.cpp :)
// Author      : (O_O Diab) (Why_not) (el 3AQ)
// Version     :
// Copyright   : please, Don't touch me :(
// Description : problem in C++
//============================================================================
#include <bits/stdc++.h>
#define ll long long
#define rw freopen("input.txt","r",stdin),freopen("output.txt","w",stdout);
#define pb push_back
#define F first
#define S second
#define pf push_front
#define lp(i,a,b) for (int i=a;i<=(int)b;++i)
#define lp2(i,a,b) for (int i=a;i>=b;--i)
#define f(x) return cout<<x<<"\n",0
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define p(x) cout<<#x<<" = { "<<x<<" } \n"
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define EPS 1e-6
// to convert string to number use int a = stoi(string);
// to convert number to string use string s = to_string(int);
#define FAST ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define clr(c,x) memset(c,x,sizeof(c));
using namespace std;
const int N = 1e2 + 5, mod = (int) 1e9 + 7, INF = 0x3f3f3f3f;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const int dx[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
const int dy[] = { 1, 0, -1, 0, 1, -1, -1, 1 };

int main() {
#ifdef ONLINE_JUDGE
    FAST;
#endif
	string s;
	cin >> s;
	if (s[0]==s[s.size()-1])
	{
		if (s.size()&1) f("Second");
		f("First");
	}
	if (s.size()&1) f("First");
	f("Second");
	return 0;
}

Measured memory_bytes: 512
import sys
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache, reduce

INF = float("inf")
sys.setrecursionlimit(10 ** 7)

# 4近傍（右, 下, 左, 上）
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]


def inside(y: int, x: int, H: int, W: int) -> bool: return 0 <= y < H and 0 <= x < W


def main():
    N, Ma, Mb = map(int, input().split())
    dp = [[[INF] * 401 for j in range(401)] for i in range(N + 1)]
    dp[0][0][0] = 0
    a_b_c = [map(int, input().split()) for _ in range(N)]

    for i, (a, b, c) in enumerate(a_b_c):
        for j in range(len(dp[0])):
            for k in range(len(dp[0][0])):
                if dp[i][j][k] == INF:
                    continue

                # not use
                dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k])

                # use
                if j + a < len(dp[0]) and k + b < len(dp[0][0]):
                    dp[i + 1][j + a][k + b] = min(dp[i + 1][j + a][k + b], dp[i][j][k] + c)

    ans = INF
    for i in count(1):
        a, b = Ma * i, Mb * i
        if a >= len(dp[0]) or b >= len(dp[0][0]):
            break
        ans = min(ans, dp[-1][a][b])
    if ans != INF:
        print(ans)
    else:
        print(-1)

if __name__ == '__main__':
    main()


Measured memory_bytes: 60252
#include<stdio.h>
int main(void)
{
  long long N;int sz=0,str[12]={0};
  if(!scanf("%lld",&N))return 0;
  while(N){N--;str[sz++]='a'+N%26;N/=26;}
  for(int i=0;i<sz;i++)printf("%c",str[sz-i-1]);
}

Measured memory_bytes: 1648
import math
import copy
n = int(input())
ncopy = copy.deepcopy(n)
ans = []
while True:
    if n % 2 == 1:
        break
    ans.append(str(2))
    n //= 2
i = 3
while True:
    if i**2 > n:
        break
    if n % i == 0:
        ans.append(str(i))
        n //= i
    else:
        i += 2
if n != 1:
    ans.append(str(n))
print(str(ncopy)+": "+(" ".join(ans)))


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    ll a,b;
    cin >>a>>b;
    ll ans=max(a-2*b,0LL);
    cout <<ans <<endl;
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

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

    sort(s.begin(), s.end());
    if(s == "abc")
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  // clang-format off
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef _MY_DEBUG
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sat Apr 18 17:03:13 JST 2020
 **/

signed main() {
    Int H, W, n;
    std::cin >> H >> W >> n;
    std::vector<Int> ans;
    REP(i, n) {
        Int a;
        std::cin >> a;
        REP(j, a) ans.push_back(i + 1);
    }
    REP(i, H) {
        REP(j, W) {
            Int idx = i % 2 ? W * i + (W - 1 - j) : W * i + j;
            std::cout << ans[idx] << " ";
        }
        std::cout << "\n";
    }
}


Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<map>
#include<numeric>
#include<stack>
#include<queue>
#include<functional>
#include<cassert>
#include<set>
#include<numeric>
#define rep(a,b) for(ll a=0;a<b;++a)
#define REP(a,b,c,d) for(ll a=b;a<c;a+=d)
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define mod 1000000007
using namespace std;
using ll = long long;
using p_ll = pair<ll, ll>;
int main() {
	int N, K; cin >> N;
	string S; cin >> S;
	cin >> K;
	char c = S[K - 1];
	rep(i, N)if (S[i] != c)S[i] = '*';
	cout << S << endl;
	cin >> N;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String a = sc.next();

        if (!(a.length() % 2 == 0)) {
            System.out.println("No");
            return;
        }

        for (int i = 0; i < a.length(); i++) {
            if (i % 2 == 0) {
                if (!(a.charAt(i) == 'h')) {
                    System.out.println("No");
                    return;
                }
            } else {
                if (!(a.charAt(i) == 'i')) {
                    System.out.println("No");
                    return;
                }
            }
        }

        System.out.println("Yes");

    }

}

Measured memory_bytes: 21844