akhauriyash/Code-Regression huggingface dataset:
import sys 

N = int(sys.stdin.readline())
alist = map(int, sys.stdin.readline().strip().split())
summary = {}
for a in alist:
    summary[a] = summary.get(a, 0) + 1                                                                                                                                                                                                
    summary[a - 1] = summary.get(a -1, 0) + 1 
    summary[a + 1] = summary.get(a +1, 0) + 1 
print max(summary.values())

Measured memory_bytes: 16440
// -----------------------------------
// Author     : MatsuTaku
// Affiliation: Tokushima University
// Country    : Japan
// Date       : 04/05/2020
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int n; cin>>n;
  constexpr ll MOD = 1e9+7;
  vector<ll> dp(1<<n);
  dp[0] = 1;
  int in[n][n];
  for (int i = 0; i < n*n; i++)
    cin>>in[i/n][i%n];
  for (int i = 0; i < n; i++) {
    for (int mask = 0; mask < (1<<n); mask++) {
      auto popcnt = __builtin_popcount(mask);
      if (popcnt != i) continue;
      for (int j = 0; j < n; j++) {
        if ((mask&(1<<j))>0 or in[i][j]==0) continue;
        (dp[mask|(1<<j)] += dp[mask])%=MOD;
      }
    }
  }
  cout << dp[(1<<n)-1] << endl;

  return 0;
}


Measured memory_bytes: 16640
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String x = sc.next();
    char[] c = new char[x.length()];
    Boolean bool = true;
    Set<String> linkedHashSet = new LinkedHashSet<String>();
    
    for(int i=0; i<x.length(); i++) {
      c[i] = x.charAt(i);
      linkedHashSet.add("'" + c[i] + "'");
    }
    
    if(x.length() ==linkedHashSet.size()) {
      System.out.println("yes");
    } else {
      System.out.println("no");
    }
  }
}

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

int N,F;
map<pair<string,string>,int> data;
vector<string> vec;

int main(){
	cin >> N >> F;
	int t;
	data = map<pair<string,string>,int>();
	for(int I = 0; I < N; I++){
		cin >> t;
		vec = vector<string>(t);
		for(int j = 0; j < t; j++){
			cin >> vec[j];
		}
		for(int i = 0; i < t; i++){
			for(int j = i+1; j < t; j++){
				pair<string,string> pr;
				if(vec[i] < vec[j]){
					pr.first = vec[i];
					pr.second = vec[j];
				}
				else{
					pr.first = vec[j];
					pr.second = vec[i];
				}

				map<pair<string,string>,int>::iterator itr = data.find(pr);
				if(itr == data.end()){
					data[pr] = 1;
				}
				else{
					itr->second += 1;
				}
			}
		}
	}
	vector<pair<string,string> > ans = vector<pair<string,string> >();
	for(map<pair<string,string>,int>::iterator itr = data.begin(); itr != data.end(); itr++){
		if(itr->second >= F){
			ans.push_back(itr->first);
		}
	}
	sort(ans.begin(),ans.end());
	cout << ans.size() << endl;
	for(int i = 0; i < ans.size(); i++){
		cout << ans[i].first << " " << ans[i].second << endl;
	}
	return 0;
}

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

// Loops
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define _rrep(i, n) rrepi(i, n, 0)
#define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)

#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(xi, x) for (auto &&xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)

// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define perm(c)                                                                \
  sort(all(c));                                                                \
  for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))

template <class T> pair<T, size_t> max(vector<T> &x) {
  auto it = max_element(all(x));
  return mp(*it, it - x.begin());
}
template <class T> pair<T, size_t> min(vector<T> &x) {
  auto it = min_element(all(x));
  return mp(*it, it - x.begin());
}

template <class T> inline bool chmax(T &maxval, const T &newval) {
  if (maxval < newval) {
    maxval = newval;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &minval, const T &newval) {
  if (minval > newval) {
    minval = newval;
    return 1;
  }
  return 0;
}

// Utilities
// Grid world utilities
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H)

// Debug
#ifdef LOCAL
#include "dump.hpp"
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define dump(...)
#define debug(x)
#endif

// Yes or No
void yesno(bool ok, string yes = "Yes", string no = "No") {
  cout << (ok ? yes : no) << endl;
}

// Paste snippets here!!

//

void solve(long long A, long long B, long long N) {
  ll xopt = min(B-1,N);
  cout << A*xopt/B - A*(xopt/B) << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); // Magic for faster cin
  cout.precision(12);
  long long A;
  std::cin >> A;
  long long B;
  std::cin >> B;
  long long N;
  std::cin >> N;
  solve(A, B, N);
  return 0;
}


Measured memory_bytes: 3656
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        int min = a;
        int min2 = c;

        if(b<min){
            min = b;
        }
        if(d<min2){
            min2 = d;
        }
        System.out.println(min+min2);

    }
}

Measured memory_bytes: 21844
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] count = new int[100001];
        for(int i=0; i<n; i++){
            int a = sc.nextInt();
            if(a <= 100000){
                count[a]++;
            }else{
                count[0]++;
            }
        }
        sc.close();

        int ans = count[0];
        for(int i=1; i<=100000; i++){
            if(count[i] >= i){
                ans += count[i] - i;
            }else{
                ans += count[i];
            }
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 51900
N = int(input())
A = list(map(int,input().split()))

a = list(set(A))

ans = "No"

if a == [0]:
    ans = "Yes"
elif len(a) == 2:
    if (a[0] == 0 or a[1] == 0) and N % 3 == 0 and A.count(0) == N//3:
        ans = "Yes"
elif len(a) == 3:
    if a[0] ^ a[1] == a[2] and N % 3 == 0 and A.count(a[0]) == A.count(a[1]) == N//3:
        ans = "Yes"

print(ans)

Measured memory_bytes: 14708
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int N;
    cin >> N;
    vector<int> L(N);
    rep(i, N) cin >> L[i];

    sort(all(L));

    ll ans = 0;
    rep(i, N) {
        repd(j, i + 1, N - 1) {
            int bam = L[j] - L[i], bap = L[j] + L[i];
            int indexd = upper_bound(all(L), bam) - L.begin();
            int indexu = lower_bound(all(L), bap) - L.begin();
            indexu--;
            if (indexu <= j || indexd >= indexu) continue;
            // cout << i << " " << j << " " << indexd << " " << indexu << endl;
            ans += max(0, indexu - j);
        }
    }

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

Measured memory_bytes: 3536
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////

int n[4];

int main(){
    
    inrep(4,n);
    int b[4] = {1,9,7,4};
    sort(n,n+4);
    sort(b,b+4);
        
    rep(i,0,4){
        if(n[i] != b[i]){
            NO;
            ret 0;
        }
    }
    YES;
	return  0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    int n;
    cin >> n;

    vs64 a(3 * n);
    priority_queue<s64> b, c;
    vs64 sb(n + 1), sc(n + 1);
    sb[0] = sc[0] = 0;
    rep (i, 3 * n)
    {
        cin >> a[i];
        if (i < n) { b.push(-a[i]); sb[0] += a[i]; }
        else if (i >= 2 * n) { c.push(a[i]); sc[0] += a[i]; }
    }

    rep (i, n)
    {
        if (-b.top() < a[i + n])
        {
            sb[i + 1] = sb[i] + a[i + n] + b.top();
            b.pop();
            b.push(-a[i + n]);
        }
        else
        {
            sb[i + 1] = sb[i];
        }
        if (c.top() > a[2 * n - i - 1])
        {
            sc[i + 1] = sc[i] + a[2 * n - i - 1] - c.top();
            c.pop();
            c.push(a[2 * n - i - 1]);
        }
        else
        {
            sc[i + 1] = sc[i];
        }
    }

    s64 ans = -1e18;
    rep (i, n + 1)
    {
        ans = MAX(ans, sb[i] - sc[n - i]);
    }
    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 6516
#include <bits/stdc++.h>
#include <numeric>
#define M 1000000007
#define inf 1000000000000000001
#define pb push_back
#define mp make_pair
#define forz(i, s, n) for (lli i = s; i < n; i++)
#define fore(i, n, s) for (lli i = n; i >= s; i--)

#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);

typedef long long int lli;
//typedef pair<long long int, long long int> pll;
typedef unsigned long long int ull;
using namespace std;

lli recpow(lli x, lli n)
{
    if (n == 0)
        return 1;
    else if (n % 2 == 0) //n is even
        return recpow((x * x) % M, n / 2);
    else //n is odd
        return (x * recpow((x * x) % M, (n - 1) / 2)) % M;
}

bool sortbysec(const pair<pair<lli, lli>, lli> &a,
               const pair<pair<lli, lli>, lli> &b)
{
    if (a.second == b.second)
        return (a.first.second < b.first.second);
    else
        return (a.second > b.second);
}

bool comp(pair<lli, lli> a, pair<lli, lli> b)
{
    if (a.first == b.first)
        return a.second < b.second;
    else
        return a.first < b.first;
}

string rev(string s)
{
    string t;
    fore(i, s.length() - 1, 0)
    {
        t.pb(s[i]);
    }
    return t;
}

lli numfac(lli n)
{
    lli ans = 0;
    while (n % 2 == 0)
    {
        ans++;
        n /= 2;
    }
    lli lim = sqrt(n) + 1;
    forz(i, 3, lim)
    {
        while (n % i == 0)
        {
            ans++;
            n /= i;
        }
    }
    if (n > 2)
        ans++;
    return ans;
}

int lo(lli n)
{
    if (n % 2 == 0 and n % 4 != 0)
        return 1;
    else if (n % 4 == 0)
        return 2;
    else
        return 3;
}

//code begins here
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    lli n, m;
    cin >> n >> m;
    lli a[n], s = 0;
    forz(i, 0, n)
            cin >>
        a[i],
        s += a[i];
    sort(a, a + n, greater<lli>());
    double d = s;
    d /= (double)(4 * m);
    double e = a[m - 1];
    if (e < d)
        cout << "No\n";
    else
        cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <climits>
#include <vector>
#include <stack>
#include <cmath>
#include <queue>
#include <set>
#include <map>
using namespace std;

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

    vector<int> a(N);
    for (int i = 0; i < N; ++i) {
        int b;
        cin >> b;
        a[i] = b;
    }

    sort(a.begin(), a.end(), less<int>() );
    int s, t ;
    s = t  =  0;
    for (int j = 0; j < N; ++j) {
        if(j%2) s += a[j];
        else t += a[j];
    }
    cout << max(s,t) - min(s,t) << endl;


    return 0;
}

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

int main()
{
  int a, b;
  cin >> a >> b;
  if (a > 8 || b > 8)
    cout << ":(" << endl;
  else
    cout << "Yay!" << endl;

  return 0;
}

Measured memory_bytes: 256
n,m = map(int, input().split())

cn = 0
cm = 0

if n < 2:
    cn = 0
elif n == 2:
    cn = 1
else:
    cn = n * (n-1) / 2

if m < 2:
    cm = 0
elif m == 2:
    cm = 1
else:
    cm = m * (m-1) / 2

ans = cn + cm
print(int(ans))

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

using namespace std;
using ll=long long;
using vi=vector<int>;
using vl=vector<ll>;
using vs=vector<string>;

#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define rep(i, a, n) for (int i = (n); i < (a); ++i)
#define repr(i, a, n) for (int i = (n); i >= (a); --i)

template<typename T,typename U>
void Inparray(T &f,U n){
  for(int i=0;i<n;i++) cin>>f[i];
}

template<typename T,typename U>
void Printarray(T f,U n){
  for(int i=0;i<n;i++) i!=n ? cout<<f[i]<<" " : cout<<f[i];
}

void flagfunc(bool flag,string A,string B){
  flag ? cout<<A<<endl : cout<<B<<endl;
}

void flag2func(bool flag){
  flag ? cout<<"Yes"<<endl : cout<<"No"<<endl;
}

void flag3func(bool flag){
  flag ? cout<<"YES"<<endl : cout<<"NO"<<endl;
}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int n;cin>>n;
  std::map<char, bool> map;
  char s;
  int hoge=0;
  for (int i = 0; i < n; ++i){
  	cin>>s;
    auto itr = map.find(s);
    if( itr == map.end() ) {
    	map[s]==true;
    	hoge++;
    }
  }
  cout<<(hoge==3 ? "Three" : "Four")<<endl;
}


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

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

    vector<int> W(N + 1, 0);
    vector<int> s(N + 1, 0);
    for (int i = 1; i <= N; i++)
    {
        cin >> W[i];
        s[i] = s[i - 1] + W[i];
    }

    int ans = INT_MAX;
    for (int i = 1; i < N; i++)
    {
        ans = min(ans, abs(s[i] - (s[N] - s[i])));
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

H,W,K = inpl()

MAP = [input() for _ in range(H)]

ans = [[0]*W for _ in range(H)]

cnt = 0
for y in range(H):
    id = 0
    for x in range(W):
        if MAP[y][x] == '#':
            cnt += 1
            id = cnt
        ans[y][x] = id


for y in range(H):
    for x in reversed(range(W-1)):
        if ans[y][x] == 0:
            ans[y][x] = ans[y][x+1]

for y in range(H-1):
    for x in range(W):
        if ans[y][x] != 0 and ans[y+1][x] == 0:
            ans[y+1][x] = ans[y][x]

for y in reversed(range(1,H)):
    for x in range(W):
        if ans[y][x] != 0 and ans[y-1][x] == 0:
            ans[y-1][x] = ans[y][x]

for a in ans:
    print(' '.join(map(str,a)))


Measured memory_bytes: 8296
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<queue>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;
ll dx[4] = {1,0,0,-1};
ll dy[4] = {0,1,-1,0};

#define ARRAY_MAX 100005


int main(){

    int n;
    while(cin >> n,n){

        int xmaxi = 0,ymaxi = 0;
        int xmini = 0,ymini = 0;
        vector<P> a;
        a.push_back(P(0,0));
        
        int num,d;
        REP(i,n-1){
            cin >> num >> d;
            if(d == 0){
                //左
                a.push_back(P(a[num].first-1,a[num].second));
                xmaxi = max(xmaxi,a[num].first-1);
                xmini = min(xmini,a[num].first-1);
            }
            if(d == 1){
                //下
                a.push_back(P(a[num].first,a[num].second-1));
                ymaxi = max(ymaxi,a[num].second-1);
                ymini = min(ymini,a[num].second-1);
            }
            if(d == 2){
                //右
                a.push_back(P(a[num].first+1,a[num].second));
                xmaxi = max(xmaxi,a[num].first+1);
                xmini = min(xmini,a[num].first+1);
            }
            if(d == 3){
                //右
                a.push_back(P(a[num].first,a[num].second+1));
                ymaxi = max(ymaxi,a[num].second+1);
                ymini = min(ymini,a[num].second+1);
            }
        }

        cout << xmaxi-xmini+1 << " " << ymaxi-ymini+1 << endl;
        a.shrink_to_fit();
    }

    return 0;
}


Measured memory_bytes: 3072
# coding: utf-8
import sys

x = input().split(" ")

a = int(x[0])
b = int(x[1])

ch = 0
v = []
w = []

for i in range(1250):
    t = int((i + 1) * 0.08)
    if t == a :
        v.append(i + 1)
        ch = 1
    elif t != a and ch == 1 :
        break
ch = 0

for i in range(1000):
    t = int((i + 1) * 0.1)
    if t == b :
        w.append(i + 1)
        ch = 1
    elif t != b and ch == 1 :
        break
ans = -1

for i in v :
    for j in w :
        if i == j :
            ans = i
            break
    if i == j :
        break

print(ans)

Measured memory_bytes: 38512
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)






int main() {
    ll n, m;
    cin >> n >> m;
    if((n + 1) / 2 >= m){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    long long int h,w;
    cin >> h >> w;

    if(h == 1 || w == 1){
        cout << 1 << endl;
        return 0;
    }

    if(h % 2 == 0 || w % 2 == 0){
        cout << h * w / 2 << endl;
    }else{
        cout << h * w / 2 + 1 << endl;
    }
    return 0;
}
 

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

using namespace std;

int a,b;
char grid[105][105];

void pripremi(){
	for(int i = 0; i < 50; i++){
		for(int j = 0; j < 100; j++){
			grid[i][j] = '.';
		}
	}
	for(int i = 50; i < 100; i++){
		for(int j = 0; j < 100; j++){
			grid[i][j] = '#';
		}
	}
}

void tocke(){
	if(a == 0) return;
	for(int i = 99; i >= 50; i -= 2){
		for(int j = ((i+1)%2); j < 100; j += 2){
			grid[i][j] = '.';
			a--;
			if(a == 0) return;
		}
	}
}

void ljestve(){
	if(b == 0) return;
	for(int i = 0; i < 50; i += 2){
		for(int j = (i%2); j < 100; j += 2){
			grid[i][j] = '#';
			b--;
			if(b == 0) return;
		}
	}
}

void ispisi(){
	cout << 100 << " " << 100 << endl;
	for(int i = 0; i < 100; i++){
		for(int j = 0; j < 100; j++){
			cout << grid[i][j];
		}
		cout << endl;
	}
}

int main(){
	cin >> a >> b;
	a--,b--;
	pripremi();
	tocke();
	ljestve();
	ispisi();
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){

  int n,count;
  int i,j,k,l;

  while(scanf("%d" ,&n)!=EOF){

    count = 0;

  for( i = 0 ; i <= 9 ; i++ ){

    for( j = 0 ; j <= 9 ; j++ ){

      for( k = 0 ; k <= 9 ; k++ ){

	for( l = 0 ; l <= 9 ; l++ ){

	  if(  n == i + j + k + l ) count++;

	}

      }

    }

  }

  printf("%d\n" ,count);

  }
  

  return 0;

}

Measured memory_bytes: 596
#pragma GCC optimize(2)
 #include<bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define ll long long
#define _for(i,j,k) for(int i=j;i<k;i++)
#define endl  '\n'
#define inf 1<<31-1
#define ull unsigned long long  
const int mod=1e9+7;
const int MAX=500000;

int main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	int k,a;
	cin>>k;
	ll sum=0;
	for(int i=1;i<=k;i++)
	{
		for(int j=1;j<=k;j++)
		{
			for(int z=1;z<=k;z++)
			{
				a=__gcd(i,j);
				sum+=__gcd(a,z);
			 } 
		}
	 } 
	cout<<sum;
}


Measured memory_bytes: 3648
from heapq import*
s=sorted
def f(x):
 s,n,*h=0,len(x)
 while n:
  while x and x[-1][0]>=n:k,l,r=x.pop();heappush(h,(r-l,l,r))
  if h:s+=heappop(h)[1]
  n-=1
 return s+sum(r for*_,r in x+h)
z=open(0).read().split()
i=1
while i<len(z):
 n,x,*y=int(z[i]),[];i+=1
 for k,l,r in zip(*[map(int,z[i:i+n*3])]*3):
  if l>r:x+=(k,l,r),
  else:y+=(n-k,r,l),
 print(f(s(x))+f(s(y)));i+=n*3

Measured memory_bytes: 155228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dl;
#define pb push_back
#define F first
#define S second
#define inf LLONG_MAX
#define mod 1000000007
#define PI 3.1415926536
#define vll vector <ll>
#define pll pair <ll,ll>
#define dbg(n) cout<<n<<' '
#define cu continue
#define br break
#define N 1000005
#define min_pq priority_queue <pll> ,vector <pll>, greater <pll> > > 

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

    ll h,w;
    cin>>h>>w;
    ll x=ceil(1.0*w/2);
    ll y=w-x;
    ll ans=ceil(1.0*h/2)*x + (h-ceil(1.0*h/2))*y;
    if(h==1 || w==1)
        ans=1;
    cout<<ans<<'\n';
}


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

#define rep(i, n) for(int i = 0; i < n;i++)

int main()
{
    int N;
    cin >> N;
    vector<vector<pair<int, int>>> Ai;
    rep(i, N){
        int A;
        cin >> A;
        vector<pair<int, int>> tmp;
        rep(j, A){
            int x, y;
            cin >> x >> y;
            tmp.push_back(make_pair(x, y));
        }
        Ai.push_back(tmp);
    }

    int ans = -1;
    for (int i = 0;i < (1 << N);i++){
        bool flag = false;
        rep(j, Ai.size()){
            vector<pair<int, int>> tmp_vec = Ai.at(j);
            if(!((1 << j) & i)){
                continue;
            }
            rep(k, tmp_vec.size()){
                pair<int, int> tmp_pair = tmp_vec.at(k);
                int x = tmp_pair.first;
                int y = tmp_pair.second;
                if(((1 << (x-1)) & i) != (y << (x-1))){
                    flag = true;
                    break;
                }
            }
        }
        if(!flag){
            ans = max(ans, __builtin_popcount(i));
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#AGC030 A- Poisonous Cookies
a,b,c = [int(i) for i in input().split()]
if a+b>=c:
    print(b+c)
else:#毒入りのほうが多い→毒入りは薬＋１枚食べられる
    print(a+2*b+1)

Measured memory_bytes: 2940
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
// #define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	int n; cin >> n;
	vector<int> a(n + 2, 0), pref(n + 2, 0), suff(n + 2, 0);
	for (int i = 1; i <= n; i++) cin >> a[i], pref[i] = gcd(pref[i - 1], a[i]);
	for (int i = n; i >= 1; i--) suff[i] = gcd(suff[i + 1], a[i]);

	int ans = 0;
	for (int i = 1; i <= n; i++) {
		ans = max(ans, gcd(pref[i - 1], suff[i + 1]));
	}

	cout << ans;

	return 0;
}

Measured memory_bytes: 3856
import math
a, b, C = map(float, input().split())
rad = C * math.pi / 180
S = a * b * math.sin(rad) / 2
c = math.sqrt(a ** 2 + b ** 2 - 2*a*b*math.cos(rad))
L = a + b + c
h = 2 * S / a
print(f'{S} {L} {h}')



Measured memory_bytes: 5708
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string>
#include<stdexcept>
#include<stdio.h>

using namespace std;

string s; int n; long long ans=0;

void dfs(string str){
  if(str.size()==n){
    long long t=0;
    for(int i=0;i<n;i++){
      if(str[i]=='+'){
        ans += t;
        t = s[i]-'0';
      }
      else{
        t = t*10+(s[i]-'0');
      }
    }
    ans += t;
    return;
  }
  dfs(str+"0");
  dfs(str+"+");
}

int main(){
  cin >> s;
  n=s.size();
  dfs("0");
  cout << ans <<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <sstream>
#define  NUM      100
using namespace std;

string error = "overflow";

int main(){
	int n;
	cin >> n;
	bool over[NUM];
	int keta[NUM];
	string a[NUM], b[NUM];
	char c[NUM][81];
	for(int i = 0; i < NUM; i++){
		for(int j = 0; j < 81; j++){
			c[i][j] = '0';
		}
	}
	for(int i = 0; i < n; i++){
		over[i] = false;
		keta[i] = 0;
		int extra = 0;
		cin >> a[i] >> b[i];
		if(a[i].size() < b[i].size()){
			swap(a[i],b[i]);
		}
		
		for(int j = 0; j < a[i].size(); j++){
			int p, q, num;
			stringstream sa, sb, sc;
			sa << a[i][a[i].size()-j-1];
			sa >> p;
			if(j < b[i].size()){
				sb << b[i][b[i].size()-j-1];
				sb >> q;
			}
			else{
				q = 0;
			}
			if(p+q+extra < 10){
				sc << p+q+extra;
				sc >> c[i][j];
				extra = 0;
			}
			else{
				int kurai;
				kurai = (p+q+extra)%10;
				sc << kurai;
				sc >> c[i][j];
				extra = 1;
				if(j == a[i].size()-1){
					c[i][a[i].size()] = '1';
					keta[i] = 1;
				}
			}
		}
		if(c[i][80] != '0'){
			over[i] = true;
		}
	}
	for(int i = 0; i < n; i++){
		if(over[i] == true){
			cout << error;
		}
		else{
			for(int j = 0; j < a[i].size()+keta[i]; j++){
			cout << c[i][a[i].size()+keta[i]-j-1];
			}
		}
		cout << endl;
	}
}

Measured memory_bytes: 1252
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int sum = 0;
		int vote = 0;
		int[] a = new int[n];

		for(int i = 0; i < n; i++) {
			int j = sc.nextInt();
			a[i] = j;
			vote += j;
		}

		for(int i = 0; i < n; i++) {
			if(a[i] * 4 * m >= vote) {
				sum++;
			}
		}

		if(sum >= m) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		sc.close();
	}
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
#define fo(i,n) for(int i = 0; i < n; i++)
#define pb push_back
#define all(c) c.begin(),c.end()
 
 
 
int main()
{
    int n;
    long long sum = 0;
    cin >> n;
    for(int i = 1; i <=n; i++)
    {
        if(i%3 && i%5)
            sum+=i;
    }
    cout << sum;
}

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

int main(){
  int n,k,x;
  cin>>n>>k;
  int a[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
        if(a[i]<a[j]){
            x=a[i];
            a[i]=a[j];
            a[j]=x;
        }
    }
  }
  
  x=0;
  for(int i=0;i<k;i++){
    x+=a[i];
  }
  cout<<x;
}


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


int main(){
    int n;
    cin >> n;
    int ans = 0;
    int obj = 1;
    for(int i=0; i<n; i++){
        int a; cin >> a;
        if(a == obj) obj ++;
        else ans ++;
    }
    cout << (n==ans?-1:ans) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n; cin >> n;
	int a[n] = {};
	for (int i = 0; i < n; i++)
		cin >> a[i];
	int Xor = 0;
	for (int i = 0; i < n; i++)
		Xor ^= a[i];
	for (int i = 0; i < n; i++)
		cout << (Xor ^ a[i]) << ' ';
}

Measured memory_bytes: 4380
n = int(input())
A = sorted(list(map(int,input().split())))

if n%2 == 0:
    for i in range(n):
        if A[i] != (i//2)*2+1:
            print(0)
            break
    else: print(2**(n//2)%1000000007)

else:
    for i in range(n):
        if A[i] != ((i+1)//2)*2:
            print(0)
            break
    else: print(2**(n//2)%1000000007)

Measured memory_bytes: 52844
#include <bits/stdc++.h>
using namespace std;typedef long long ll;typedef vector<ll> vl;typedef vector<vl> vvl;typedef pair<ll,ll> pl;typedef vector<pl> vp;const ll INF=1001001001;const ll LINF=1001001001001001001;const ll D4[]={0,1,0,-1,0};const ll D8[]={0,1,1,0,-1,-1,1,-1,0};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;}
#define fore(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()

void solve(){
    ll n;cin>>n;
    vvl f(n,vl(10));
    rep(i,n)rep(j,10)cin>>f[i][j];
    vvl p(n,vl(11));
    rep(i,n)rep(j,11)cin>>p[i][j];

    ll ans=-LINF;
    ll cnt;
    rep(i,1<<10){
        if(i==0)continue;
        ll tmp=0;
        rep(j,n){
            cnt=0;
            rep(k,10){
                if(i>>k&1)cnt+=f[j][k];
            }
            tmp+=p[j][cnt];
        }
        chmax(ans,tmp);
    }
    cout<<ans<<endl;
}

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


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define LB(c, x) lower_bound(c.begin(), c.end(), x)
#define UB(c, x) upper_bound(c.begin(), c.end(), x)
#define LI(c, x) distance(c.begin(), LB(c, x))
#define UI(c, x) distance(c.begin(), UB(c, x))

// functions
template <class T> T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T> T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T> T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T> T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
template <class T> bool amax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
ll modpow(ll a, ll b, ll m) {
    if (b == 0) {
        return 1;
    } else if (b % 2 == 0) {
        ll h = modpow(a, b / 2, m);
        return h * h % m;
    } else {
        return a * modpow(a, b - 1, m) % m;
    }
}
ll comb(ll a, ll b, ll m) {
    if (b > a - b) {
        return comb(a, a - b, m);
    }
    ll c = 1, d = 1;
    REP(i, b) {
        c *= (a - i);
        d *= (b - i);
        c %= m;
        d %= m;
    }
    return c * modpow(d, m - 2, m) % m;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> A(N + 1), B(N);
    REP(i, N + 1) {
        cin >> A[i];
    }
    REP(i, N) {
        cin >> B[i];
    }
    ll res = 0;
    REP(i, N) {
        int d = min(A[i], B[i]);
        res += d;
        B[i] -= d;
        d = min(A[i + 1], B[i]);
        res += d;
        A[i + 1] -= d;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <forward_list>
#include <random>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 500005;

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

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    string s;
    cin >> s;
    LL k;
    cin >> k;
    LL cnt = 0;
    if( s[0] == s[s.size() - 1] && k > 1 ) {
        char tmp = s[0];
        int pos = 0;
        while( pos < s.size() && s[pos] == tmp ) {
            ++pos;

        }

        int r = s.size() - 1;
        while( r >= 0 && s[r] == tmp ) {
            --r;

        }
        if( pos == s.size() ) {
            if( s.size() % 2 != 0 ) {
                cnt = s.size() / 2 * k;
                cout << cnt + k / 2 << endl;
                return 0;

            }
            cout << s.size() / 2 * k << endl;
            return 0;

        }


        cnt = (pos + (s.size() - r - 1)) / 2 * (k - 1);
        LL tm = 0;
        for( int i = pos; i <= r; ++i ) {
            if( s[i] == s[i - 1] ) {
                ++tm;
                s[i] = '*';

            }
        }

        cnt += tm * k;
        cnt += pos / 2 + (s.size() - r - 1) / 2;
        cout << cnt << endl;
        return 0;

    }

    for( int i = 1; i < s.size(); ++i ) {
        if( s[i] == s[i - 1] ) {
            ++cnt;
            s[i] = '*';

        }
    }
    cout << cnt * k << endl;


    return 0;
}



Measured memory_bytes: 256
N = int(input())
success = True

t0,x0,y0 = 0,0,0
for i in range(N):
  t1,x1,y1 = map(int,input().split())
  dist = abs(x1-x0) + abs(y1-y0)
  time = t1 - t0
  
  check1 = (time == dist)
  check2 = (time > dist) and ((time - dist) % 2 == 0)
  if not (check1 or check2):
    success = False
    break
    
  t0,x0,y0 = t1,x1,y1
    
if success:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9216
from heapq import *

N=int(input())
A=list(map(int,input().split()))
B=[]
for i in range(N):
    heappush(B,A[i])
sumB=[sum(B)]
for i in range(N,2*N):
    heappush(B,A[i])
    poped=heappop(B)
    sumB.append(sumB[-1]-poped+A[i])

A.reverse()
C=[]
for i in range(N):
    heappush(C,A[i]*(-1))
sumC=[(-1)*sum(C)]
for i in range(N,2*N):
    heappush(C,A[i]*(-1))
    poped=heappop(C)*(-1)
    sumC.append(sumC[-1]-poped+A[i])
sumC.reverse()
ans=-10**19
for i,j in zip(sumB,sumC):
    ans=max(ans,i-j)
print(ans)


Measured memory_bytes: 121128
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define ff               first
#define ss               second
#define pb               push_back
#define all(x)           (x).begin(), (x).end()
#define mem0(x)          memset(x, 0, sizeof (x))
#define mem1(x)          memset(x, -1, sizeof (x))

typedef long long ll;
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector <ii> vii;
typedef vector<vii> vvii;
typedef vector <ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T=1, n;
    while (T--){
        string s; cin >> s; cout << s;
        if (s[s.size()-1] == 's') cout << "e";
        cout << "s\n";

    }
}

Measured memory_bytes: 3648
N,Q = gets.split.map &:to_i
C = gets.split.map &:to_i

q = Q.times.map do |i| 
    l,r = gets.split.map(&:to_i)
    [l-1,r-1,i]
end
    
q.sort_by!{|l,r,i| r}

$BIT = [0]*(N+1)

def add(x)
    while x<=N
        $BIT[x] += 1
        x += x & -x
    end
end

def sum(x)
    s = 0
    while x>0
        s += $BIT[x]
        x -= x & -x
    end
    s
end

ans = [-1]*Q
csr = 0
last = [nil]*N
q.each do |l,r,idx|
    while csr<=r
        c = C[csr]
        add(last[c]+1) if last[c]

        last[c] = csr
        csr += 1
    end

    ans[idx] = (r-l+1) - (sum(r+1) - sum(l))
end

puts ans

Measured memory_bytes: 70848
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
  	var f = parseInt(input.substring(0, 2));
  	var s = parseInt(input.substring(2));
  	var r;
  
  	if (f === 0) {
      if (s > 12) r = "NA";
      else if (s === 0) r = "NA";
      else r = "YYMM";
    }
  	else if (s === 0) {
      if (f > 12) r = "NA";
      else if (f === 0) r = "NA";
      else r = "MMYY";
    }
  	else {
      if (f > 12 && s > 12) r = "NA";
      else if (f <= 12 && s <= 12) r = "AMBIGUOUS";
      else if (f <= 12 && s > 12) r = "MMYY";
      else if (f > 12 && s <= 12) r = "YYMM";
    }
  	
	//出力
	console.log(r);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <stdio.h>
#define MAX 500010
#define INF 2000000000

int count = 0;
int A[MAX];
int L[MAX/2+2], R[MAX/2+2];

int merge(int A[], int l, int m, int r)
{
    int i;    
    for (i=0; i<m-l; i++) L[i] = A[l+i];
    for (i=0; i<r-m; i++) R[i] = A[m+i];
    
    L[m-l] = R[r-m] = INF;
    
    int p=0, q=0;
    for (i=l; i<r; i++) {
        if (L[p] <= R[q]) {
            A[i] = L[p++];
        }
        else {
            A[i] = R[q++];
        }
        count++;
    }
    
}

void mergeSort(int A[], int l, int r)
{
    if (l+1 < r) {
        int m = (l + r) / 2;
        mergeSort(A, l, m);
        mergeSort(A, m, r);
        merge(A, l, m, r);
    }
}

int main()
{
    int i;    
    int N;
    
    scanf("%d", &N);
    for (i = 0; i < N; i++) {
        scanf("%d", &A[i]);
    }
    
    mergeSort(A, 0, N); // N?????§???
    
    for (i = 0; i < N-1; i++) {
        printf("%d ", A[i]);
    }
    printf("%d\n", A[i]);
    printf("%d\n", count);
    
    return 0;
}

Measured memory_bytes: 4504
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
int main() {
    int N, H;
    cin >> N >> H;
    vector<P> v(N);
    int max_atk = 0;
    for (int i = 0; i < N; i++) {
        int a, b;
        cin >> a >> b;
        v[i] = P(b, a);
        max_atk = max(max_atk, a);
    }
    sort(v.begin(), v.end(), greater<P>());
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        if (H > 0 && v[i].first > max_atk) {
            H -= v[i].first;
            cnt++;
        }
    }
    if (H > 0) cnt += (H + max_atk - 1) / max_atk;
    cout << cnt << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string s; cin >> s;
  int n = s.length();
  if(s[n-1]=='1' || s[n-2]=='0' || s[0] =='0'){ cout << "-1" << endl; return 0;}
  for(int i=0; i<n/2;i++){
  	if(s[n-2-i]!=s[i]) {cout << "-1" << endl; return 0;}
  }
  
  s[n-1] = '1';
  vector<int> v;
  for(int i=0;i<n;i++) if(s[i]=='1') v.push_back(i);
  for(int i=0;i<n-1;i++){
    int idx = upper_bound(v.begin(), v.end(), i) - v.begin();
  	cout << i+1 << " " << v[idx]+1 << endl;
  }
  return 0;
}

Measured memory_bytes: 2040
# -*- coding: utf-8 -*-

x = []
y = []

while ( 1 ):
    
    temp_x, temp_y = map(int, input().split() )
    
    if (temp_x == 0 and temp_y == 0):
        break

    if (temp_y < temp_x):
        temp_x, temp_y = temp_y, temp_x

    x.append(temp_x)
    y.append(temp_y)

for (i,j) in zip(x,y):
    print(i,j)

Measured memory_bytes: 8012
def solve():
    c = []
    c.append(list(map(int, input().split())))
    c.append(list(map(int, input().split())))
    c.append(list(map(int, input().split())))

    a0_list = range(c[0][0]+1)

    for a0 in a0_list:
        b0 = c[0][0] - a0
        b1 = c[0][1] - a0
        b2 = c[0][2] - a0

        a1 = c[1][0] - b0
        a2 = c[2][0] - b0

        if c[1][1] != a1 + b1:
            continue
        if c[1][2] != a1 + b2:
            continue
        if c[2][1] != a2 + b1:
            continue
        if c[2][2] != a2 + b2:
            continue
        print("Yes")
        return

    print("No")
    return

solve()

Measured memory_bytes: 3064
s = input()
sl = [0] * len(s)
# sl2 = [0] * len(s)
# for i in range(len(s)):
#     if s[i] == 'R':
#         sl2[i+1] += 1
#     else:
#         sl2[i-1] += 1
for i in range(len(s)):
    if s[i] == 'R':
        if s[i+1] == 'L':
                sl[i] += 1
        for j in range(i+1, len(s)):
            if s[j] == 'R':
                break           
            elif (j - i) % 2 == 0:
                sl[i] += 1
        if i != 0 and s[i+1] == 'L':
            for j in range(i-1, -1, -1):
                if s[j] == 'L':
                    break
                elif (i - j) % 2 == 0:
                    sl[i] += 1
            
    else:
        if s[i-1] == 'R':
                sl[i] += 1
        
        for j in range(i-1, -1, -1):
            if s[j] == 'L':
                break
            elif (i - j) % 2 == 0:
                sl[i] += 1
        if i != (len(s) - 1) and s[i-1] == 'R':
            for j in range(i+1, len(s)):
                if s[j] == 'R':
                    break           
                elif (j - i) % 2 == 0:
                    sl[i] += 1
new_sl = map(str, sl)                    
print(' '.join(new_sl))

Measured memory_bytes: 10612
import sys
from collections import defaultdict
from collections import deque
import numpy as np
import heapq
from heapq import heappush, heappop

sys.setrecursionlimit(10 ** 7)


H, N = map(int, input().split())
A = list(map(int, input().split()))

a = sum(A)

if a >= H:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 22992
#include<iostream>
#include<fstream>
#include<sstream>
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<string>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<vector>
#include<cmath>
#include<ctime>
#include<locale>
using namespace std;
long a[51],b[51];
int main()
{
    long n,m;
    memset(a,0,sizeof(a));
    memset(b,0,sizeof(b));
    cin>>n>>m;
    for(long i=0;i<m;i++)
    {
        cin>>a[i]>>b[i];
    }
    for(long k=1;k<=n;k++)
    {
        long s=0;
    for(long i=0;i<m;i++)
    {
        if(a[i]==k||b[i]==k)s++;
    }
    cout<<s<<endl;
    }
	return 0;
}


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

int main(){
    float N;
    cin >> N;
    if(ceil(N/1.08) == ceil((N+1)/1.08)){
        cout << ":(" << endl;
    }else{
        cout << ceil(N/1.08) << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256