akhauriyash/Code-Regression huggingface dataset:
/**
 * Contest : AtCoder Beginner Contest 160
 * Contest URL : https://atcoder.jp/contests/abc160
 * Problem : E - Red and Green Apples
 * Problem URL : https://atcoder.jp/contests/abc160/tasks/abc160_e
 */

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair < int, int >;

// This section is for Policy Based Data Structure, more precisely Ordered Set.
// All Functions of set works here, in addition we have order_of_key() and find_by_order() function. find_by_order() returns iterator
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<functional>
using namespace __gnu_pbds;

// 1. Custom Set
template < class T, class COMP >
using custom_set = tree < T, null_type, COMP, rb_tree_tag, tree_order_statistics_node_update >;

// 2. Ordered Set
template < class T >
using ordered_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;

// 3. Ordered Multi Set
// For storing multiple occurance of same value we need to use pair. In pair first value is our key and second is useless count variable.
// order_of_key(make_pair(key, 0)) returns first occurance of a value, order_of_key(make_pair(key, INT_MAX)) returns last occurance.
template < class T >
using ordered_multiset = tree < pair < T, int >, null_type, less < pair < T, int > >, rb_tree_tag, tree_order_statistics_node_update >;

// 4. Ordered Map
template < class T, class U >
using ordered_map = tree < T, U, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
// Policy End


void solve() {
	int x, y, A, B, C;
	cin >> x >> y >> A >> B >> C;
	vector < int > a(A), b(B), c(C);
	for (int i = 0; i < A; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < B; i++) {
		cin >> b[i];
	}
	for (int i = 0; i < C; i++) {
		cin >> c[i];
	}
	sort (a.rbegin(), a.rend());
	sort (b.rbegin(), b.rend());
	sort (c.rbegin(), c.rend());
	priority_queue < int, vector < int > , greater < int > > pq;
	ll ans = 0LL;
	for (int i = 0; i < x; i++) {
		ans += a[i];
		pq.push (a[i]);
	}
	for (int i = 0; i < y; i++) {
		ans += b[i];
		pq.push (b[i]);
	}
	for (int x : c) {
		int y = pq.top(); pq.pop();
		if (x > y) {
			ans -= y;
			ans += x;
		}
	}
	cout << ans << endl;
}

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



Measured memory_bytes: 2552
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
	int ans = 0;
	int tmp;
	int mi = INF;
	int n, x;
	cin >> n >> x;
	vector<int> m(n);
	REP(i, n){
		cin >> m[i];
		mi = min(mi, m[i]);
		x -= m[i];
		ans ++;
	}
	ans += x / mi;
	cout << ans << endl;
}

Measured memory_bytes: 256
let S = readLine()!.characters.map{$0}
let N = S.count
var ans = "NO"
for i in 0..<N {
  for j in i..<N {
    if String(S[0..<i]+S[j..<N]) == "keyence" {
      ans = "YES"
    }
  }
}
print(ans)

Measured memory_bytes: 4080
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = 2019; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}

#define MAX

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int L, R;
	int minimum = MOD;
	
	cin>>L>>R;
	
	for(int i = L; i <= R; i++){
		for(int j = i+1; j <= R; j++){
			minimum = min(minimum, (j*i)%MOD);
			if(minimum == 0){
				cout<<0<<endl;
				return 0;
			}
		}
	}
	
	cout<<minimum<<endl;
	
	return 0;
}

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

int main()
{
    int N;
    cin >> N;
    vector<int> D(N);
    for (int i = 0; i < N;i++){
        cin >> D.at(i);
    }
    sort(D.begin(), D.end());
    int now=D.at(0);
    int ans = 1;
    for (int i = 1; i < N;i++){
        if (now<D.at(i)){
            now = D.at(i);
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		while (in.hasNext()) {
			int val = in.nextInt();
			if (val != 0) {
				int oturi = 1000 - val;
				int count = 0;
				while (oturi > 0) {
					count += oturi % 5;
					oturi /= 5;
					count += oturi % 2;
					oturi /= 2;
				}
				System.out.println(count);
			}
		}
	}
}

Measured memory_bytes: 11000
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<utility>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#define maxn 1010
#define INF 0x3f3f3f3f
#define LL long long
#define ULL unsigned long long
#define E 1e-8
#define mod 1000000007
#define P pair<int,int>
using namespace std;

string str[maxn];

int main()
{
    int n,l;
    while(cin>>n>>l){
        for(int i=1;i<=n;++i){
            cin>>str[i];
        }
        sort(str+1,str+1+n);
        for(int i=1;i<=n;++i){
            cout<<str[i];
        }
        cout<<endl;
    }
    return 0;
}


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

using namespace std;
int main()
{
int A,X,Y,Z;
  cin>>X;
  cin>>Y;
  cin>>Z;
  A=Z;
  Z=Y;
  Y=X;
  X=A;
  cout<<X<<" ";
  cout<<Y<<" ";
  cout<<Z;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <deque>
#include <queue>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <fstream>
#define debug(x) cout << #x << " = " << x << endl
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,n) for(int i = (n); i > -1; i--)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const ll LINF = 1e18;
const double EPS = 1e-9;


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

  int a,b,c;
  cin>>a>>b>>c;
  cout << a * b * c / 2 / max({a,b,c}) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int N;
	cin >> N;
	int A[100];
	rep(i, N) cin >> A[i];

	int goukei = 0;
	rep(i, N) goukei += A[i];
	double heikin = 1.0 * goukei / N;

	int kotae;
	double saishou = 10000;
	rep(i, N) {
		if (saishou > abs(A[i] - heikin)) {
			saishou = abs(A[i] - heikin);
			kotae = i;
		}
	}
	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
using namespace std;

int main() {
    double N, K;
    cin >> N >> K;
    double ans = 0;
    for (ll i = 1; i <= N; ++i) {
        long double res = 1.0 / N;
        ll num = i;
        while (num < K) {
            num *= 2;
            res *= 0.5;
        }
        ans += res;
    }
    cout<<fixed;
    cout<<setprecision(10);
    cout << ans << endl;
    return 0;
}


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

int main()
{
	int n;
	cin >> n;
	std::map<int, int> l;
	std::map<int, int> r;

	for (int i = 0; i < n; i++)
	{
		int a;
		cin >> a;
		l[i + a]++;
		r[i - a]++;
	}
	long long ans = 0;
	for (auto& i : l)
	{
		ans += (long long) i.second * r[i.first];
	}
	cout << ans << endl;
}

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

const int maxn = 3010, P = 998244353;
int A, B, C, D, f[maxn][maxn];

int main() {
    scanf("%d %d %d %d", &A, &B, &C, &D);
    for (int i = A; i <= C; i++) {
        for (int j = B; j <= D; j++) {
            if (i == A && j == B) { f[i][j] = 1; continue; }
            if (i == A) {
                f[i][j] = 1LL * i * f[i][j - 1] % P;
            } else if (j == B) {
                f[i][j] = 1LL * j * f[i - 1][j] % P;
            } else {
                f[i][j] = (1LL * j * f[i - 1][j] + 1LL * i * f[i][j - 1]) % P;
                f[i][j] = (f[i][j] - 1LL * (i - 1) * (j - 1) * f[i - 1][j - 1]) % P;
            }
        }
    }
    printf("%d\n", (f[C][D] + P) % P);
    return 0;
}

Measured memory_bytes: 39096
#include "bits/stdc++.h"
#define hhh cerr<<"hhh"<<endl
#define see(x) cerr<<(#x)<<'='<<(x)<<endl
using namespace std;
typedef long long ll;
typedef pair<int,int> pr;
inline int read() {int x=0,f=1;char c=getchar();while(c!='-'&&(c<'0'||c>'9'))c=getchar();if(c=='-')f=-1,c=getchar();while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return f*x;}

const int maxn = 2e5+7;
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;

int n;
int a[maxn];
int vis[maxn];
int c, p;

void dfs(int i) {
    vis[i]=1;
    if(vis[a[i]]) { p=a[i]; return; }
    if(!vis[a[i]]) dfs(a[i]);
}

void dfs1(int i) {
    vis[i]=1; c++;
    if(!vis[a[i]]) dfs1(a[i]);
}

int main() {
    n=read(); ll k; cin>>k;
    for(int i=1; i<=n; ++i) a[i]=read();
    dfs(1);
    memset(vis,0,sizeof(vis));
    dfs1(p);
    int x=1;
    while(k&&x!=p) x=a[x], k--;
    k%=c;
    for(int i=0; i<k; ++i) {
        x=a[x];
    }
    cout<<x<<endl;
}

Measured memory_bytes: 5188
import sys

def main():
    input = sys.stdin.readline
    H, W = map(int, input().split())
    N = int(input())
    A = list(map(int, input().split()))

    B = []
    for i in range(N):
        a = A[i]
        B.append((a, i+1))
    B = sorted(B, key=lambda x: -x[0])

    C = []
    for b in B:
        C += [b[1]] * b[0]

    ans = []
    for i in range(H):
        start = i * W
        end = start + W
        row = C[start:end]
        if i % 2 == 0:
            ans.append(row)
        else:
            ans.append(row[::-1])

    for a in ans:
        print(*a)


if __name__ == '__main__':
    main()


Measured memory_bytes: 4656
use std::io::*;
use std::str::FromStr;
use std::cmp;
 
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let a = read::<String>();
    let s = a.as_bytes();
    let b = read::<String>();
    let t = b.as_bytes();
    let mut count = t.len();
    for i in 0..=(s.len()-t.len()) {
        let mut tmp = 0;
        for j in 0..t.len() {
            if s[i+j] != t[j] {
                tmp += 1;
            }
        }
        count = count.min(tmp);
    }
    println!("{}", count);
}


Measured memory_bytes: 2140
#include<bits/stdc++.h>
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
using namespace std;

int main(){
  int h1,m1,h2,m2,k;cin>>h1>>m1>>h2>>m2>>k;
  int t=(h2-h1)*60+m2-m1;
  cout<<max(0,t-k);
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin>>N;
  vector<int> L(N);
  for(int i=0;i<N;i++){
    cin>>L[i];
  }
  sort(L.begin(),L.end());
  int cnt=0;
  for(int i=0;i<N;i++){
    for(int j=i+1;j<N;j++){
      for(int k=j+1;k<N;k++){
        if(L[i]!=L[j]&&L[j]!=L[k]&&L[k]!=L[i]&&L[k]<L[i]+L[j]){
          cnt++;
        }
      }
    }
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 3584
import java.util.*;
public class Main {
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String [] Mark = new String[N];
        String [] Mark_bubble = new String[N];
        int [] Num = new int[N];
        int [] Num_B = new int[N];
        boolean  check = true;
        for(int i=0;i<N;i++){
            String now = sc.next();
            String mark  = String.valueOf(now.charAt(0));
            Mark[i] = mark;
            Mark_bubble[i] = mark;
            int num = Character.getNumericValue(now.charAt(1));
            Num[i] = num;
            Num_B[i] = num;
        }
        for(int i=0;i<N;i++){
            for(int j=N-1;j>=i+1;j--){
                if(Num_B[j-1]>Num_B[j]){
                    int min = Num_B[j];
                    String min_mark = Mark_bubble[j];
                    Num_B[j] = Num_B[j-1];
                    Mark_bubble[j] = Mark_bubble[j-1];
                    Num_B[j-1] = min;
                    Mark_bubble[j-1] = min_mark;
                }
            }
        }
        for(int i=0;i<N;i++) {
            System.out.print(Mark_bubble[i]+Num_B[i]);
            if(i<N-1) System.out.print(" ");
        }
        System.out.println();
        System.out.println("Stable");
        for(int i=0;i<N-1;i++){
           int min = i;
            for(int j=i+1;j<N;j++) if(Num[min]>Num[j]) min = j;
            int num = Num[min];
            String mark = Mark[min];
            Num[min] = Num[i];
            Mark[min] =Mark[i];
            Num[i] = num;
            Mark[i] = mark;
        }
        for(int i=0;i<N;i++) if(Mark[i]!=Mark_bubble[i]) check = false;
        for(int i=0;i<N;i++) {
            System.out.print(Mark[i]+Num[i]);
            if(i<N-1) System.out.print(" ");
        }
        System.out.println();
        if(check) System.out.println("Stable");
        else System.out.println("Not stable");
    }
}


Measured memory_bytes: 26416
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

#define DEBUG(x) cout << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<pair<T, T> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	vector<vector<int> > mat(3, vector<int> (3));
	for (int i = 0; i < 3; ++i) {
		for (int j = 0; j < 3; ++j) {
			cin >> mat[i][j];
		}
	}

	int a1 = 0;
	int b1 = mat[0][0];
	int b2 = mat[0][1];
	int b3 = mat[0][2];
	int a2 = mat[1][1] - b2;
	int a3 = mat[2][2] - b3;

	vector<int> a = {a1, a2, a3};
	vector<int> b = {b1, b2, b3};
	for (int i = 0; i < 3; ++i) {
		for (int j = 0; j < 3; ++j) {
			if (a[i] + b[j] != mat[i][j]) {
				cout << "No\n";
				return 0;
			}
		}
	}

	cout << "Yes\n";

	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
 
#define mt make_tuple
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sqr(x) ((ll)(x) * (x))
 
int main()
{
  	int n;
  	cin >> n;
    string s;
    cin >> s;
 
    vector<set<int>> v(26);
 
    for(int i = 0; i < (int)s.size(); ++i)
    {
        v[s[i]-'a'].insert(i);
    }
 
    int q;
    cin >> q;
 
    while(q--)
    {
        int instrukcija;
        cin >> instrukcija;
 
        if(instrukcija==1)
        {
            int pos;
            char c;
            cin >> pos >> c;
            --pos;
            v[s[pos]-'a'].erase(pos);
            s[pos]=c;
            v[c-'a'].insert(pos);
        }
        else
        {
            int l, r;
            cin >> l >> r;
            --l, --r;
            int odgovor = 0;
            for(int i = 0; i < 26; ++i)
            {
                auto it = v[i].lower_bound(l);
                if(it != v[i].end() && *it <= r)
                {
                    ++odgovor;
                }
            }
            cout << odgovor << '\n';
        }
    }
 
    return 0;
}

Measured memory_bytes: 24196
#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;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
// cout << fixed << setprecision(10) << ans << endl; 有効桁数指定
// *min_element(c + l, c + r) *max_element(c + l, c + r) 配列の中のmin-max

int main () {

    int n;cin>>n;
    ll a[100010],b[100010],c[100010];
    rep(i,n) cin>>a[i];
    rep(i,n) cin>>b[i];
    rep(i,n) cin>>c[i];

    sort(a,a+n);
    sort(b,b+n);
    sort(c,c+n);
    
    ll cnt[100010];
    rep(i,n) {
        auto itr = upper_bound(c,c+n,b[i]);
        cnt[i]=n-(itr-c);
    }
    ll sum[100010];
    sum[0]=0;
    rep(i,n) {
        sum[i+1]=sum[i]+cnt[i];
    }
    
    ll ans=0;
    rep(i,n) {
        auto itr = upper_bound(b,b+n,a[i]);
        ans+=sum[n]-sum[itr-b];
    }

    cout<<ans<<endl;

}

Measured memory_bytes: 4096
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    double[] x = new double[N];
    String[] u = new String[N];

    for (int i = 0; i < N; i++) {
      x[i] = sc.nextDouble();
      u[i] = sc.next();
    }

    sc.close();

    double sum = 0.0;

    for (int i = 0; i < N; i++) {
      if (u[i].equals("JPY")) {
        sum += x[i];
      } else {
        sum += x[i] * 380000;
      }
    }

    System.out.println(sum);

  }

}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define rep1(i,n)for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=(int)(n)-1;0<=i;i--)
#define rrep1(i,n) for(int i=(int)(n);1<=i;i--)

#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 

#define pcount __builtin_popcount
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define endl "\n"

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

typedef long long lint;

using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	lint n,count,r,g,b;
	string s;
	cin>>n>>s;
	r=g=b=count=0;
	rep(i,n){
		if(s.at(i)=='R')r++;
		if(s.at(i)=='G')g++;
		if(s.at(i)=='B')b++;
	}
	rep(i,n)for(int j=i;j<n;j++){
		if(j==i)continue;
		if(n<=j+j-i)continue;
		if(s[i]!=s[j]&&s[j]!=s[j+j-i]&&s[j+j-i]!=s[i])count++;
	}
	cout<<r*g*b-count<<endl;
}	

Measured memory_bytes: 3664
#include <algorithm>
#include <iostream>
#include <string>
#include <random>
#include <cassert>
#include <cstring>
#include <chrono>
#include <set>
#include <map>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

ll GCD(ll a, ll b) {
  if (a == 0) return b;
  return GCD(b % a, a);
}

int main()
{
  ll n, m;
  cin >> n >> m;
  string s, t;
  cin >> s >> t;
  int g = GCD(n, m);
  int i = 0;
  int j = 0;
  while (i < n) {
    if (s[i] != t[j]) {
      cout << -1 << endl;
      return 0;
    }
    i += n / g;
    j += m / g;
  }
  cout << n * m / g << endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define float long long float
int main() {
    int n;
    cin >> n ;
    double p[n];
    for(int i = 0 ; i < n ; i++)cin>> p[i] ;
    double dp[n+1][n+1];
    dp[0][0] = 1.0 ;
    for(int i = 1 ; i <=n ; i++){
        for(int j = 0 ; j <=i ; j++){
            if(j == 0) dp[i][j] = dp[i-1][j]*(1-p[i-1]);
            else dp[i][j] = dp[i-1][j]*(1-p[i-1]) + dp[i-1][j-1]*p[i-1];
        }
    }
    double ans = 0.0 ;
    for(int i = (n+1)/2 ; i <=n ; i++){
        ans = ans + dp[n][i];
    }
    cout << fixed<< setprecision(9) <<ans << endl ;
}


Measured memory_bytes: 70400
#include <iostream>

using namespace std;

int diff(int a, int b) {
    if (a < b) return b - a;
    return a - b;
}

int main() {
    int x, a, b;
    cin >> x >> a >> b;
    cout << (diff(x, a) < diff(x, b) ? "A" : "B") << endl;
    return 0;
}


Measured memory_bytes: 256
S = input()

if S == "keyence":
    print("YES")
    exit()

for i in range(len(S) - 1):
    for j in range(i + 1, len(S) + 1):
        # print(i, j, S[i:j], S[:i] + S[j:], S[:i] + S[j:] == "keyence")
        if S[:i] + S[j:] == "keyence":
            print("YES")
            exit()

print("NO")

Measured memory_bytes: 38512
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define times(t) int t; cin >> t; while(t--)
#define mod 1000000007

void solve() {
	string s, t;
	cin >> s >> t;
	int n = s.length(), m = t.length();
	int dp[n+1][m+1];
	memset(dp, 0, sizeof(dp));
	for(int i=1; i<=n; i++) {
		for(int j=1; j<=m; j++) {
			if(s[i-1] == t[j-1]) {
				dp[i][j] = dp[i-1][j-1] + 1;
			}
			else {
				dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
			}
		}
	}
	string temp;
	int i = n, j = m;
	while(i>0 && j>0) {
		if(s[i-1] == t[j-1]) {
			temp.push_back(s[i-1]);
			i--; j--;
			continue;
		}
		if(dp[i-1][j] > dp[i][j-1]) i--;
		else j--;
	}
	reverse(temp.begin(), temp.end());
	cout << temp << endl;
	return;
}

int main() {
	IOS;
	// #ifndef ONLINE_JUDGE
	// freopen("C:/Gen code/CompProg/input.txt", "r", stdin);
	// freopen("C:/Gen code/CompProg/output.txt", "w", stdout);
	// #endif
	solve();
	return 0;
}

Measured memory_bytes: 38824
#include <string.h>

#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>

#define rep1(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define MOD 1000000007

using namespace std;
using ll = long long;

int main(void) {
  int N;
  cin >> N;
  int cnt = 0;

  for (int i = 1; i <= N; i++) {  // Aの組み合わせ
    // Aが決定したとき取りうるCの個数は(N - 1)/i個
    cnt += (N - 1) / i;
  }

  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3628
n,t = map(lambda x:int(x), input().split())

c_min = 1001
flag = 0
for i in range(n):
    cost,time = map(lambda x:int(x), input().split())
    if time > t:
        pass
    else:
        if cost < c_min:
            c_min = cost
            flag = 1

if flag == 0:
    print("TLE")
else:
    print(c_min)





Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <numeric>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, n) for (int i = (a); i < (n); ++i)
using namespace std;
using ll = long long;
using uint = unsigned int;
const ll mod = (ll)1e9 + 7;

int main() {
  int n;
  cin >> n;
  int count = 0;
  rep(i, n) {
    int a;
    cin >> a;
    if (i % 2 == 0 && a % 2 == 1) count++;
  }
  cout << count << endl;

  return 0;
}


Measured memory_bytes: 3588
import fractions as math
n = int(input())
lst1 = list(map(int,input().split()))


def segfunc(x,y):
    return math.gcd(x,y)

def init(init_val): #渡されたリストでsegを初期化
    #set_val
    for i in range(n):
        seg[i+num-1]=init_val[i]    
    #built
    for i in range(num-2,-1,-1) :
        seg[i]=segfunc(seg[2*i+1],seg[2*i+2]) 
    
def update(k,x): #segの要素kをxに変更(セグ木全体の更新)
    k += num-1
    seg[k] = x
    while k:
        k = (k-1)//2
        seg[k] = segfunc(seg[k*2+1],seg[k*2+2])
    
def query(p,q): #区間[p,q)での、segfuncに準じた値を返す
    if q<=p:
        return ide_ele
    p += num-1
    q += num-2
    res=ide_ele
    while q-p>1:
        if p&1 == 0:
            res = segfunc(res,seg[p])
        if q&1 == 1:
            res = segfunc(res,seg[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = segfunc(res,seg[p])
    else:
        res = segfunc(segfunc(res,seg[p]),seg[q])
    return res

#####単位元######
"""
最小値のセグ木 → 10**9　(最小値の更新に影響しないため)
　　和のセグ木 → 0　(上の単位元の説明を参照)
　　積のセグ木 → 1　(上の単位元の説明を参照)
　　gcdのセグ木 → 0　(gcdを更新しない値は0)
"""
ide_ele = 0

#num:n以上の最小の2のべき乗
num =2**(n-1).bit_length()
seg=[ide_ele]*2*num #単位元の配列(計算結果に影響を及ぼさない配列)を作成

init(lst1)
ans = 0
for i in range(n):
    #iをまたいでgcdをsearchしていくことで、iを任意の整数に変えたことになる
    ans = max(ans,math.gcd(query(0,i),query(i+1,n)))
print(ans)

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

int main() {
  int n;
  cin >> n;
  
  int a, min = INT_MAX;
  for (int i = 0; i < n; i++) {
    cin >> a;
    for (int j = 0; j < min; j++) {
      if (a % 2 == 0) {
        a /= 2;
      } else {
        min = j;
        break;
      }
    }
  }
  
  cout << min << endl;
}

Measured memory_bytes: 3628
fun main(args: Array<String>){
    val n = readLine()!!.split(" ").map { it.toInt() }
    var ac = 0
    var wa = 0
    val acArray = Array(n[0]){ false }
    val waArray = Array(n[0]){ 0 }
    for (i in 0..n[1]-1){
        val a = readLine()!!.split(" ")
        val inta = a[0].toInt() - 1//提出した問題の問題番号のINT型
        if (a[1] == "AC"){
            acArray[inta] = true
        } else if (acArray[inta] == false) {
                waArray[inta]++
        }
    }

    for (i in 0..n[0]-1){
        if (acArray[i] == true){
            ac++
            wa = wa + waArray[i]
        }
    }
    println("${ac} ${wa}")
}

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

/*
vector.push_back()
vector<int> hoge(3,-1); {-1,-1,-1}
vector<vector<int>> hogehoge(2,vector<int>(2,-1)); {{-1,-1},{-1,-1}} 
cin >>temp;
scanf("%d %d %d",&A,&B,&Q);
sort(a.begin(),a.end());
a.push_back(4000000000000);
a.insert(a.begin(),-1000000000000);
upper_bound(a.begin(),a.end(),x); // list[i] > x のイテレータ取得. *itrで数値化 
    std::priority_queue<
      int,
      std::vector<int>,
      decltype(compare) // 比較関数オブジェクトを指定
    > que(comp);
*/
template <typename T> void debug(T arr);
template <typename T> void debug (T arr, int dim);

bool has_same(string &s, int length){
    if (length==0){
        return true;
    }else if(length > s.length()){
        return false;
    }else{
        map<string,int> dic;
        for (int i =0; i < s.length()-length+1; ++i){
            string temp = s.substr(i,length);
            // cout << temp << endl;
            if (dic.count(temp) == 0){
                dic[temp] = i;
            }else{
                if (dic[temp] + length <= i){
                    return true;
                }
            }
        }
        return false;
    }

};

long long bin_search(int left,int right,string &s){
    if (right-left < 3){
        long long ans = 0;
        // cout << "min_serach" << endl;
        // cout << left << " " << right << endl;
        for (int i = left; i <= right; ++i){
            if (has_same(s,i)){
                ans = i;
            }
        }
        return ans;
    }else{
        long long mid = (right+left)/2;
        if (has_same(s,mid)){
            return bin_search(mid,right,s);
        }else{
            return bin_search(left,mid,s);
        }

    }
};


int main(void){
    long long n;
    string s;
    cin >> n;
    cin >> s;
    cout << bin_search(0,5*1000,s) << endl;




};


template <typename T> void debug(T arr){
    for (auto col:arr){
        cout << col << " ";
    }
    cout <<endl;
};

template <typename T> void debug (T arr, int dim){
    for (auto raw:arr){
        for(auto col:raw){
            cout << col << " ";
        }
        cout << endl;
    }
};


Measured memory_bytes: 6720
#! /usr/bin/env perl
use strict;
use warnings;

our $dp = [0];

sub chmin{
    my ($i,$a,$b)=@_;
    if($a>$b){
        $a=$b;
    }

    $dp->[$i] = $a;
}


my $N = <>;
chomp $N;

my $a_cost = <>;
chomp $a_cost;

my $cost = [split / /,$a_cost];



for my $j (1..$N-1){
    push @$dp, 9**9**9;
    chmin($j,$dp->[$j],$dp->[$j-1]+abs($cost->[$j] - $cost->[$j-1]));
    if($j>1){
        chmin($j,$dp->[$j],$dp->[$j-2]+abs($cost->[$j] - $cost->[$j-2]));
    }
}

print($dp->[$N-1]);

Measured memory_bytes: 22436
#include<bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int MOD=1000000007;

bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int highestPowerof2(unsigned int n) 
{ 
    // Invalid input 
    if (n < 1) 
        return 0; 
  
    int res = 1;
    for (int i=0; i<8*sizeof(unsigned int); i++) 
    { 
        int curr = 1 << i; 
        if (curr > n) 
           break; 
  
        res = curr; 
    } 
  
    return res; 
} 
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}       
////////////////////////////////////////////////////////////////////

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(NULL);
  int t=1;
  while(t--)
  {
      ll n;
      cin>>n;
      ll a[n];
      REP(i,n)
      {
          cin>>a[i];
          if(i==0 || a[i]>a[i-1])a[i]--;
      }
      bool flag=true;
      for(int i=0;i<n-1;i++)
      {
          if(a[i+1]<a[i])flag=false;
          else continue;
      }
      if(flag)cout<<"Yes";
      else cout<<"No";

  }
  return 0;
}

Measured memory_bytes: 1024
import sys
input = sys.stdin.readline
def print_ans(x, a):
    """Test Case
    >>> print_ans(3, 5)
    0
    >>> print_ans(7, 5)
    10
    >>> print_ans(6, 6)
    10
    """
    if x < a:
        print("0")
    else:
        print("10")

if __name__ == '__main__':
    x, a = map(int, input().rstrip().split())
    print_ans(x, a)




Measured memory_bytes: 2940
import java.io.*;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.Scanner;
public class Main {
	
	public static void main(String[] args) {
		
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		
		int n = sc.nextInt();
		PriorityQueue<Data> que = new PriorityQueue<Data>(n,new Comp());
		for(int i = 0; i < n; i++) {
			que.add(new Data(sc.nextInt(),sc.nextInt()));
		}
		Data tmp = que.peek();
		out.println(tmp.id + " " + tmp.point);
		out.flush();
	}
	
	static class Data {
		int id;
		int point;
		Data(int a, int b) {
			id = a;
			point = b;
		}
	}
	
	static class Comp implements Comparator<Data>{

		@Override
		public int compare(Data o1, Data o2) {
			if(o1.point > o2.point) {
				return -1;
			}
			if(o1.point < o2.point) {
				return 1;
			}
			if(o1.id < o2.id) {
				return -1;
			}
			
			return 1;
		}
		
	}
}
//------------------------------//
//-----------//
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;}
    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    public boolean hasNext() { skipUnprintable(); 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() {
    	return (int)nextLong();
    }
    

}

Measured memory_bytes: 17044
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
	int k, a[1000], b[1000], c[1000], size;

	scanf("%d", &size);

	for (k = 0; k < size; k++)
		scanf("%d %d %d", &a[k], &b[k], &c[k]);

	for (k = 0; k < size; k++) {
		if (a[k] == 0 || b[k] == 0 || c[k] == 0) {
			printf("NO\n");
		}
		else if (a[k] >= b[k] && a[k] >= c[k]) {
			printf("%s\n", a[k] * a[k] == b[k] * b[k] + c[k] * c[k] ? "YES" : "NO");
		}
		else  if (b[k] >= a[k] && b[k] >= c[k]) {
			printf("%s\n", b[k] * b[k] == a[k] * a[k] + c[k] * c[k] ? "YES" : "NO");
		}
		else if (c[k] >= a[k] && c[k] >= b[k]) {
			printf("%s\n", c[k] * c[k] == a[k] * a[k] + b[k] * b[k] ? "YES" : "NO");
		}
		else 
			printf("NO\n");
	}

 	return 0;
}

Measured memory_bytes: 588
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize,
    }
    puts!("{}\n", n * n * n);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
#include<iostream>

using namespace std;
typedef long long ll;

const ll MOD = 1000003;

ll fact[1000003], fact_inv[1000003];
ll inv[1000003];//普通の数のinv

ll modpow(ll a, ll b) {
	ll ret = 1, kakeru = a;
	while (b > 0) {
		if (b & 1)ret *= kakeru, ret %= MOD;
		kakeru *= kakeru, kakeru %= MOD;
		b >>= 1;
	}
	return ret;
}

void set_fact() {
	fact[0] = 0, fact[1] = 1;
	for (int i = 2; i < MOD; i++) {
		fact[i] = fact[i - 1] * i;
		fact[i] %= MOD;
	}

	fact_inv[MOD - 1] = modpow(fact[MOD - 1], MOD - 2);

	for (int i = MOD - 2; i >= 0; i--) {
		fact_inv[i] = fact_inv[i + 1] * (i + 1);
		fact_inv[i] %= MOD;
	}
}

void set_inv() {
	for (int i = 0; i < MOD; i++) {
		inv[i] = modpow(i, MOD - 2);
	}
}

int main() {
	set_inv();
	set_fact();


	int Q;
	cin >> Q;
	for (int q = 0; q < Q; q++) {
		ll x, d, n;
		cin >> x >> d >> n;
		//全体の式を/(d^n)すると、等差1の数列の積になる。それって階乗じゃん。
		//x/dは割り切れなくても、modの世界なので整数になるので、結局問題なし。
		//階乗とそれぞれの数字に逆元を事前に計算しておけばO(1)で取得できるので解ける
		ll tmp = (x * inv[d]) % MOD;
		if (d == 0) {
			cout << modpow(x, n) << endl;
			continue;
		}
		if (n - 1 >= (MOD - tmp)) {
			cout << 0 << endl;
		}
		else {
			cout << (((fact[(tmp + n - 1) % MOD] * fact_inv[(tmp - 1 + MOD) % MOD]) % MOD) * modpow(d, n)) % MOD << endl;
		}
	}

	return 0;
}

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

using namespace std;

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

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(vi c, vi d){
	return c.S < d.S;
}

int main() {
	string s, ans="AC";
	char A = 'A', C = 'C';
	int all_c = 0;
	
	cin >> s;
	int ls = s.size();
	
	REP(i, 0, ls){
		if(i == 0 && s[i] != A){
			ans = "WA";
			break;
		}
		if(s[i] == C && (i >= 2 && i <= ls-2)) ++all_c;
		if((int)'a' - (int)s[i] > 0){
			if(s[i] != A && s[i] != C){
				ans = "WA";
				break;
			}
		}
	}
	if(all_c != 1) cout << "WA";
	else cout << ans;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<stack>
using namespace std;
int main(){
	double x,y;
	string s;
	while(getline(cin,s)){
		stack<double> box;
		s=s+' ';
		for(int i=0;i<(int)s.size()-1;i++){
			if(s[i]=='-'){
				if(!isdigit(s[i+1])){
					x=box.top();
					box.pop();
					y=box.top();
					box.pop();
					box.push(y-x);
				}
				else{
					box.push(-atof(&s[i+1]));
					for(i+=1;s[i]!=' ';i++)
					;
				}
			}
			else if(s[i]=='+'){
				x=box.top();
				box.pop();
				y=box.top();
				box.pop();
				box.push(y+x);
			}
			else if(s[i]=='*'){
				x=box.top();
					box.pop();
					y=box.top();
					box.pop();
					box.push(y*x);
			}
			else if(s[i]=='/'){
				x=box.top();
					box.pop();
					y=box.top();
					box.pop();
					box.push(y/x);
			}
			else if(isdigit(s[i])){
				box.push(atof(&s[i]));
				for(;s[i]!=' ';i++)
				;
			}
		}
		if(!box.empty()){
		printf("%.6lf\n",box.top());
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

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

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

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

int main(){
    int n, t;
    cin >> n >> t;
    vl a(n);
    rep(i, n) cin >> a[i];
    map<int, int> mp;
    int d = 0;
    int mi = 0;
    int ans = 0;
    int mi_cnt = 1;
    int ma_cnt = 0;
    REP(i, 1, n) {
        if(a[i] - a[mi] > d) {
            ans = 0;
            d = a[i] - a[mi];
            ma_cnt = 1;
        }
        else if(a[i] - a[mi] == d) {
            ma_cnt++;
        }
        if(a[i] < a[mi]) {
            ans += min(mi_cnt, ma_cnt);
            mi_cnt = 1;
            ma_cnt = 0;
            mi = i;
        }
        else if(a[i] == a[mi]) mi_cnt++;
    }
    ans += min(mi_cnt, ma_cnt);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define ppb pop_back
#define ppf pop_front
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long
#define ii pair<int,int>
#define iii pair<ii,int>
#define iiii pair<ii,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)/2)
#define all(x) x.begin(),x.end()
#define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" "
#define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar()
#define pw(x) (1ll<<(x))
#define inf 100000000000000008
#define MOD 998244352
#define N 100005	
#define M 1000003
#define C 100000
#define lab(i,j) (((i-1)*m)+j)
#define LOG 19
#define KOK 650
#define EPS 0.0001
using namespace std;
 
int a,b,c,d,e,f;
int oks[3005],okw[3005];
 
int main() {
 
//	freopen("input.txt","r",stdin);
 
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
 
	cin>>a>>b>>c>>d>>e>>f;
 
	okw[0]=oks[0]=1;
 
	for(int i=1;i<=f;i++) {
 
		okw[i]|=(i-a>=0?okw[i-a]:0)|(i-b>=0?okw[i-b]:0);
		oks[i]|=(i-c>=0?oks[i-c]:0)|(i-d>=0?oks[i-d]:0);
 
	}
 
	double ans=0;
	int t1=a,t2=0;
 
	for(int i=f;i>=0;i--) {
 
		for(int j=f;j>=0;j--) {
 
          if(i==0 && j==0) continue ;
          
			if(oks[i] && okw[j] && i+j*100<=f && j*e>=i) {
 
				if(100.0*i/(i+j*100)>ans) {
 
					ans=100.0*i/(i+j*100);	
					t1=j;
					t2=i;
 
				}
 
			}
 
		}
 
	}
 
	cout<<t1*100+t2<<" "<<t2;
 
}

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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		int first = Integer.parseInt(s.substring(0, 2));
		int second = Integer.parseInt(s.substring(2));
//		System.out.println(first + " " + second);
		
		boolean yymm = false;
		boolean mmyy = false;
		if(second > 0 && second <= 12) {
			yymm = true;
		}
		if(first > 0 && first <= 12) {
			mmyy = true;
		}
		
		if(yymm && mmyy) {
			System.out.println("AMBIGUOUS");
		} else if(yymm && !mmyy) {
			System.out.println("YYMM");
		} else if(!yymm && mmyy) {
			System.out.println("MMYY");
		} else {
			System.out.println("NA");
		}
	}
}


Measured memory_bytes: 35700
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define vv(T) vector<vector<T>>
#define coa cout << ans << endl; return 0;
using namespace std;
using ll = long long;
template<typename T>
using vec = vector<T>;
template<typename T>
using vvec = vector<vector<T>>;
using qint = queue<int>;
using sint = stack<int>;
using pii = pair<int, int>;


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

    string st = "ACL";
    string ans = "";
    rep(i, k){
        ans += st;
    }

    coa;
}


Measured memory_bytes: 3576
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    k = int(input())
    r = 0
    for i in range(k + 10):
        r = (10 * r + 7) % k
        if r == 0:
            print(i + 1)
            return
    print(-1)
resolve()

Measured memory_bytes: 62772
def solve(string):
    n, *a = map(int, string.split())
    return str(max([sum(a[:i+1]) + sum(a[-(n - i):]) for i in range(n)]))


if __name__ == '__main__':
    n = int(input())
    print(solve('{}\n'.format(n) + '\n'.join([input() for _ in range(2)])))


Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int main(){
    int a,b,c;
    int cnt;
    int ch[11];
    while(scanf("%d %d %d",&a,&b,&c) != EOF){
        memset(ch,0,sizeof(ch));
        ch[a] = 1;
        ch[b] = 1;
        ch[c] = 1;
        cnt=0;
        for(int i=1;i<=10;i++){
            if(ch[i] == 0 && 20 - (a+b) >= i) cnt++;
        }
        if(cnt >= 4) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
}

Measured memory_bytes: 1200