akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int kurai(int a,int b){
  int m=pow(10,b),n=pow(10,b-1);
  return (a%m)/n;
}
int ketawa(int a){
  int k=0;
  rep(i,keta(a)){
  k+=kurai(a,i+1);
  }
  return k;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
int mid(int a,int b,int c){
  vector<int> k(3);
  k[0]=a;k[1]=b;k[2]=c;
  sort(all(k));
  return k[1];
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
 if(!b)return 1; if(b&1)return modpow(a,b-1,m)*a%m;
 int memo = modpow(a,b>>1,m);
 return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  int a;
  cin>>a;
  int e=0,f=0;
  rep(i,1001)rep(j,1001){
    int c=i-500;
    int d=j-500;
  if(c*c*c*c*c-d*d*d*d*d==a){
  e=c;
    f=d;
  }
  }
  cout<<e<<' '<<f<<endl;
}

Measured memory_bytes: 3680
e1,e2,e3,e4= map(int,input().split())

if e1 == e2 and e3 == e4:
    print("yes")
elif e1 == e3 and e2 == e4:
    print("yes")
elif e1 == e4 and e2 == e3:
    print("yes")
else:
    print("no")


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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

signed main() {
  string s, t;
  std::cin >> s >> t;
  int ans = 0;
  REP(i, 3)
  if (s[i] == t[i])
    ans++;
  print(ans);
}


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

int main(void) {
    int X; cin >> X;
    if(X >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3616
#include <algorithm>
#include <iostream>
#include <vector>
#include <boost/operators.hpp>
using namespace std;

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

constexpr int MOD = 1000000007;

// ax + by = gcd(a, b) を満たすような整数 x,y を返す。
pair<int64_t, int64_t> exgcd(int a, int b) noexcept {
    if (b == 0) return {1, 0};
    auto [x, y] = exgcd(b, a%b);
    return {y, x-(a/b)*y};
}

// a を m で割った余り(>=0)を返す。
constexpr inline int mod(int a, int m) noexcept {
    int r = a % m;
    return r < 0 ? r + m : r;
}

// a の逆元を返す。a は MOD と互いに素でなければならない。
inline int inverse(int a) noexcept {
    return mod(exgcd(MOD, a).second, MOD);
}

struct ModInt : private boost::operators<ModInt> {
    int value;
    constexpr ModInt() noexcept : value(0) {}
    constexpr explicit ModInt(int value) noexcept
        : value(mod(value, MOD)) {}
    constexpr ModInt& operator+=(const ModInt& rhs) noexcept {
        value += rhs.value;
        if (value > MOD) value -= MOD;
        return *this;
    }
    constexpr ModInt& operator-=(const ModInt& rhs) noexcept {
        value -= rhs.value;
        if (value < 0) value += MOD;
        return *this;
    }
    constexpr ModInt& operator*=(const ModInt& rhs) noexcept {
        value = ((int64_t)value * rhs.value) % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& rhs) noexcept {
        value = ((int64_t)value * inverse(rhs.value)) % MOD;
        return *this;
    }
    constexpr bool operator<(const ModInt& rhs) noexcept {
        return value < rhs.value;
    }
    constexpr bool operator==(const ModInt& rhs) noexcept {
        return value == rhs.value;
    }
};
ostream& operator<<(ostream& os, ModInt& rhs) {
    os << rhs.value;
    return os;
}
istream& operator>>(istream& is, ModInt& rhs) {
    int i; is >> i;
    rhs.value = mod(i, MOD);
    return is;
}
constexpr ModInt operator""_m(unsigned long long value) noexcept {
    return ModInt((int)value);
}

ModInt pow_mod(ModInt n, int64_t p) {
    ModInt ans = 1_m;
    while (p > 0) {
        if (p & 1) ans *= n;
        n *= n;
        p >>= 1;
    }
    return ans;
}

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

    // g(i): gcd(A_1,..,A_N) = i となるような {A_1,..,A_N} の数
    vector<ModInt> g(K+1);

    for (int i = K; i > 0; --i) {
        ModInt k = pow_mod(ModInt(K/i), N);
        for (int j = 2; i*j <= K; ++j) {
            k -= g[i*j];
        }
        g[i] = k;
    }

    ModInt ans = 0_m;
    for (int i = 1; i <= K; ++i)
        ans += g[i] * ModInt(i);
    cout << ans << '\n';
}


Measured memory_bytes: 3700
#include<bits/stdc++.h>
using namespace std;
int color_max=0;
int color_ans[100005];
vector<pair<int,int> > v[100005];

int dfs(int parent_color,int next_node_pointer){
  int count=1;
  for(vector<pair<int,int> >::iterator e=v[next_node_pointer-1].begin();e!=v[next_node_pointer-1].end();e++){
    if(color_ans[e->second]!=0) continue;
    if(count==parent_color)count++;
    color_ans[e->second]=count;
    dfs(count,e->first);
    if(color_max<count) color_max=count;
    count++;
  }
  return 0;
}

int main(){
  int N;
  cin >> N;
  int a[N-1],b[N-1];
  for(int i=0;i<N-1;i++){
    cin >> a[i] >> b[i];
    pair<int,int> ab;
    ab.first=a[i];
    ab.second=i;
    v[b[i]-1].push_back(ab);
    ab.first=b[i];
    ab.second=i;
    v[a[i]-1].push_back(ab);
  }
  for(int i=0;i<N;i++){
    color_ans[i]=0;
  }
  dfs(0,a[0]);
  cout << color_max << endl;
  for(int i=0;i<N-1;i++) cout << color_ans[i] << endl;
}


Measured memory_bytes: 7680
n,p = gets.split(" ").map!{|k| k.to_i}
require "prime"
a = Prime.prime_division(p)
b = 1
a.length.times do |j|
  if a[j][1] >= n
    c =  a[j][1] / n
    d =  a[j][0]**c
    b = b*d
  end
end
puts b

  

Measured memory_bytes: 2300
"""
https://atcoder.jp/contests/dp/tasks/dp_f
"""
from collections import defaultdict
s = input()
t = input()

ls = len(s)
lt = len(t)

dp = [[0] * (lt + 1) for _ in range(ls + 1)]

pre = defaultdict(lambda: defaultdict(tuple))

for i in range(ls):
    for j in range(lt):
        if s[i] == t[j]:
            dp[i + 1][j + 1] = 1 + dp[i][j]
            pre[i + 1][j + 1] = (i, j)
        else:
            if dp[i + 1][j] >= dp[i][j + 1]:
                dp[i + 1][j + 1] = dp[i + 1][j]
                pre[i + 1][j + 1] = pre[i + 1][j]
            else:
                dp[i + 1][j + 1] = dp[i][j + 1]
                pre[i + 1][j + 1] = pre[i][j + 1]

# print(dp[ls][lt])

ans = ''
y = ls
x = lt
while pre[y][x]:
    ny, nx = pre[y][x]
    ans = s[ny] + ans
    y = ny
    x = nx

print(ans)


Measured memory_bytes: 883336
abc = list(map(int, input().split()))
[a, b, c] = sorted(abc)[::-1]
if a % 2 == b % 2 == c % 2:
    print((a - b) // 2 + (a - c) // 2)
elif (a % 2 == b % 2 ) or (a % 2 == c % 2):
    print((a - b + 1) // 2 + (a - c + 1) // 2 + 1)
else:
    print((a - b) // 2 + (a - c) // 2 + 1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define sz(x) int(x.size())
#define pb push_back
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ff first
#define ss second
typedef long long ll;
typedef pair<int, int> ii;

int main(){
	fastio;
	ll a, b; cin >> a >> b;
	if(a > b) swap(a, b);
	if((b - a) % 2) cout << "IMPOSSIBLE" << endl;
	else{
		cout << (a + b) / 2 << endl;
	}
	return 0;
}



Measured memory_bytes: 3644
#include <stdio.h>

int main(void)
{
 int n;
 int a,b,c,i;

 scanf("%d",&n);

 for(a=1;a<=9;a++){
  for(b=1;b<=9;b++){
   if(a*b==n){
      printf("Yes\n");
     return 0;
    }
   }
  }
 printf("No\n");

 return 0;
}


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

int main(){
    long long N; cin >> N;
    if(N%2!=0 || N<10){
        cout << 0 << endl;
        return 0;
    } 
    long long ans = 0;
    long long i =0;
    while(10*pow(5, i)<=N){
        ans += N / (10* (long long)pow(5, i)); 
        i++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>
#include<functional>
#include<numeric>
#include <tuple>

using namespace std;
#define ll long long
#define ld long double
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-13)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define H pair<int, int>
#define P pair<int, pair<int, int>>
#define Q(i,j,k) mkp(i,mkp(j,k))
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define mkp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
#define ssp(i,n) (i==n-1?"\n":" ")
#define tpop(p) p.top();p.pop()
const int mod = 1e9 + 7;
const int Mod = 998244353;
const ll Inf = 3 * 1e18;
const int inf = 15 * 1e8;
ll read() {
	ll u, k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}
ll bitcount(ll x) {
	int sum = 0;
	for (int i = 0; i < 20; i++)
		if ((1ll << i) & x) sum++;
	return sum;
}
/*const int fn_ = 2000000;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll Mod = mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % Mod;
			comp_[i] = mod_pow(fact_[i], Mod - 2, Mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % Mod * comp_[y] % Mod;
}*/
//---------------------------------------------------
int n, m;
H a[200000];
signed main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> a[i].fs >> a[i].sc;
	}
	sort(a, a + n);
	priority_queue<int>p;
	int t = 0, ans = 0;
	for (int i = m - 1; i >= 0; i--) {
		while (t < n && a[t].fs + i <= m) {
			p.push(a[t].sc);
			t++;
		}
		if (!p.empty()) {
			ans += tpop(p);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 2936
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <math.h>

void swap(int * a, int * b)
{
    int t = *a;
    *a = *b;
    *b = t;
}

void print_int(int n)
{
    printf("%d\n",n);
    
}

void sort(int a[], int n)
{
    int h, i, j;

    for(h = 1; h < n / 9; h = h * 3 + 1)
        continue;

    for(; h > 0; h /= 3)
    {
        for(i = h; i < n; i++)
        {
            j = i;
            while(j >= h && a[j] < a[j-h])
            {
                swap(&a[j], &a[j-h]);
                j -= h;
            }
        }
    }
}

void print_list(int a[], int n)
{
    for(int i = 0; i < n; i++)
    {
        printf("%d ", a[i]);
    }
}

void intcpy(int a[], const int b[], int count)
{
    for(int i = 0; i < count; i++)
    {
        a[i] = b[i];
    }
}

int list_sum(int a[], int n)
{
    int sum = 0;

    for(int i = 0; i < n; i++)
    {
        sum += a[i];
    }

    return sum;
}


void permutate(int s[], int count, int n)
{
    if(n == count)
        return;

    for(int i = n; i < count; i++)
    {
        swap(&s[i], &s[n]);

        if(i != n)
        {
            //intcpy(result[j++], s, count);
        }
        
        permutate(s, count, n+1);
        swap(&s[i], &s[n]);
    }
}



int main(void)
{
    int a[3];
    int n;
    scanf("%d %d %d", &a[0], &a[1], &a[2]);
    scanf("%d", &n);
    sort(a, 3);
    int ans = a[2];
    for (int i = 0; i < n; i++)
    {
        ans = 2*ans;
    }
    print_int(ans+a[0]+a[1]);
    
    return 0;
}



Measured memory_bytes: 128
import fractions
a,b,c,d=map(int,input().split())
print(b-a+1-(b//c-(a-1)//c+b//d-(a-1)//d-b//int((c*d/fractions.gcd(c,d)))+(a-1)//int((c*d/fractions.gcd(c,d)))))


Measured memory_bytes: 5048
a, b, c, x, y = map(int, input().split())
ans = 0

if a + b > c * 2:
    MIN = min(x, y)
    ans += c * (MIN * 2)
    x -= MIN
    y -= MIN
    if x > 0 and a < c * 2:
        ans += x * a
    elif y > 0 and b < c * 2:
        ans += y * b
    else:
        ans += max(x, y) * (c * 2)
else:
    ans += a * x + b * y

print(ans)

Measured memory_bytes: 38256
#include<bits/stdc++.h>
#define ll long long
#define Test int t;cin>>t;while(t--)
#define PI acos(-1)
#define endl "\n"
#define fx(x) fixed<<setprecision(x)
#define sz(s) (int)s.size()
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define mem(a,n) memset((a),n,sizeof (a))
const double eps=1e-9;
const int mod=1e9+7;
int dx[]={-1,-1,-1,0,0,1,1,1};
int dy[]={-1,0,1,-1,1,-1,0,1};
ll gcd(ll x,ll y) {return(!y)?x:gcd(y,x%y);}
ll lcm(ll x,ll y) {return((x/gcd(x,y))*y);}
using namespace std;
void fast(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
int dp[1001][1001];
int n,m;
char a[1001][1001];
bool valid(int i,int j){
    return (i>=0&&i<n&&j>=0&&j<m&&a[i][j]!='#');
}
int solve(int i,int j){
    if(i==n-1&&j==m-1)return 1;
    int &ret=dp[i][j];
    if(~ret)return ret;
    ret=0;
    if(valid(i+1,j))ret+=solve(i+1,j)%mod;
    if(valid(i,j+1))ret+=solve(i,j+1)%mod;
    return ret%mod;
}
int main()
{
    mem(dp,-1);
    cin>>n>>m;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>a[i][j];
        }
    }
    cout<<solve(0,0);
    return 0;
}


Measured memory_bytes: 8604
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    lint n, k;
    cin >> n >> k;
    
    lint ans = 0;
    if (k % 2 != 0) {
        ans = (n/k) * (n/k) * (n/k);
    }
    else {
        ans = (n/k) * (n/k) * (n/k);
        ans += ((n+k/2)/k) * ((n+k/2)/k) * ((n+k/2)/k);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var H = sc.ReadInt();
        var W = sc.ReadInt();
        var A = new char[H + 1, W + 1];
        for (int i = 0; i < H; i++)
        {
            var s = sc.ReadStr();
            for (int j = 0; j < W; j++)
            {
                A[i, j] = s[j];
            }
        }
        var ok = true;
        for (int i = 0; i < H; i++)
        {
            for (int j = 0; j < W; j++)
            {
                if (A[i + 1, j] == '#' && A[i, j + 1] == '#')
                {
                    ok = false;
                }
            }
        }
        Console.WriteLine(ok ? "Possible" : "Impossible");
    }

    static Scanner sc = new Scanner();
}

class Scanner
{
    string[] S = new string[0];
    int Index = 0;
    char[] Separators = new char[] { ' ' };

    public string Next()
    {
        if (this.Index < this.S.Length) return this.S[this.Index++];
        var line = "";
        while (line == "") line = Console.ReadLine();
        this.S = line.Split(this.Separators, StringSplitOptions.RemoveEmptyEntries);
        if (this.S.Length == 0) return this.Next();
        this.Index = 0;
        return this.S[this.Index++];
    }
    public string ReadStr()
    {
        return this.Next();
    }
    public char ReadChar()
    {
        return this.Next()[0];
    }
    public int ReadInt()
    {
        return int.Parse(this.Next());
    }
    public uint ReadUInt()
    {
        return uint.Parse(this.Next());
    }
    public long ReadLong()
    {
        return long.Parse(this.Next());
    }
    public double ReadDouble()
    {
        return double.Parse(this.Next());
    }
    public int[] ReadIntArray(int n)
    {
        var array = new int[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadInt();
        }
        return array;
    }
    public long[] ReadLongArray(int n)
    {
        var array = new long[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadLong();
        }
        return array;
    }
    public double[] ReadDoubleArray(int n)
    {
        var array = new double[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadDouble();
        }
        return array;
    }
    public char[] ReadCharArray(int n)
    {
        var array = new char[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadChar();
        }
        return array;
    }
    public string[] ReadStrArray(int n)
    {
        var array = new string[n];
        for (int i = 0; i < array.Length; i++)
        {
            array[i] = this.ReadStr();
        }
        return array;
    }
}


Measured memory_bytes: 13140
# -*- coding: utf-8 -*-
# input
n, t = map(int, input().split())
a = list(map(int, input().split()))
sp = 0
ep = t
total = 0

# calc
for i in range(1, n):
    if a[i] <= ep:
        ep = a[i]+t
    elif a[i] > ep:
        total += ep-sp
        sp = a[i]
        ep = a[i]+t
# output
total += ep-sp
print(total)

Measured memory_bytes: 25200
import java.util.Scanner;
import java.util.TreeSet;
public class Main {
 
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        if(a<b)System.out.println("a < b");
        else  if(a==b)System.out.println("a == b");
        else if(a>b)System.out.println("a > b");

}
}



Measured memory_bytes: 26284
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

int n;
// はじめすべての皿に寿司が 3 つあると考える
// dp[x][y][z] := 1 つ以上食べた皿が x 枚
//　　　　　　　　　2 つ以上食べた皿が y 枚
//                3 つ以上食べた皿が z 枚
double dp[310][310][310];

double solve(int x, int y, int z){
    if(dp[x][y][z] != -1) return dp[x][y][z];
    dp[x][y][z] = 0;

    // 寿司が残っている皿を選ぶまでサイコロを振る回数の期待値
    double exp_num = 1.0 * n / (n - z);

    // 現在 0 つ食べた皿を選んだ -> 1 つ以上食べた皿の枚数が増えるので (x+1, y, z) に遷移
    if(x != n) dp[x][y][z] += (solve(x+1, y, z) + exp_num) * (n - x) / (n - z);

    // 現在 1 つ食べた皿を選んだ -> 2 つ以上食べた皿の枚数が増えるので (x, y+1, z) に遷移
    if(y != x) dp[x][y][z] += (solve(x, y+1, z) + exp_num) * (x - y) / (n - z);

    // 現在 2 つ食べた皿を選んだ -> 3 つ以上食べた皿の枚数が増えるので (x, y, z+1) に遷移
    if(z != y) dp[x][y][z] += (solve(x, y, z+1) + exp_num) * (y - z) / (n - z);

    return dp[x][y][z];
}

int main(){
    cin>>n;
    vector<int> cnt(3, 0);
    for(int i=0; i<n; i++){
        int x; cin>>x;
        cnt[(3-x)]++;
    }

    for(int i=0; i<=n; i++){
        for(int j=0; j<=n; j++){
            for(int k=0; k<=n; k++){
                dp[i][j][k] = -1;
            }
        }
    }

    dp[n][n][n] = 0;

    cnt[1] += cnt[2];

    cout << fixed << setprecision(12) << solve(cnt[1], cnt[2], 0) << endl;
}

Measured memory_bytes: 227584
#include <bits/stdc++.h>
using namespace std;
int f[100000];
int main()
{
    int n,m;
    m=0;
    cin>>n;
    for(int i=1; i<=n; i++)
    {
      scanf("%d",&f[i]);
    }
    for(int i=1; i<=n; i++)
    {
      if(i%2!=0&&f[i]%2!=0)
            m++;
    }

    printf("%d\n",m);
}


Measured memory_bytes: 3820
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e16;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define RREP(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    ll N, K; cin >> N >> K;
    string s; cin >> s;
    REP(i, s.size()){
        if(i == K-1){
            char c = (s[i] - 'A') + 'a';
            cout << c;
        }
        else{
            cout << s[i];
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <map>
#include <vector>
#include <algorithm>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(itn i=a;i>=b;i--)
using namespace std;
const int Mod=1e9+7;
typedef long long ll;
ll ans,Ans,fib[105]={1,1},x,y;
vector<pair<ll,ll> >p[105];
map<pair<ll,ll>,bool> checker;
int main(){
	rep(i,2,90) fib[i]=fib[i-1]+fib[i-2];
	//rep(i,1,100) if(fib[i]>1e18) printf("Here %d\n",i);
	p[1].push_back(make_pair(1,2));
	p[1].push_back(make_pair(1,3));
	p[1].push_back(make_pair(1,4));
	rep(i,1,90){
		for(int j=0;j<p[i].size();j++){
			ll u=p[i][j].second,v=p[i][j].first+u;
			for(;v<=fib[i+3];v+=u){
				if(checker[make_pair(u,v)]) puts("fuck i am wrong!");
				checker[make_pair(u,v)]=1;
				p[i+1].push_back(make_pair(u,v));
			}
		}
	}
	int T;
	scanf("%d",&T);
	while(T--){
		scanf("%lld%lld",&x,&y);
		if(x>y) swap(x,y);
		for(ans=1,Ans=0;fib[ans+1]<=x&&fib[ans+2]<=y;ans++); printf("%d ",ans);
		if(ans==1){
			printf("%lld\n",x*y%Mod);
			continue;
		}
		for(int j=0;j<p[ans-1].size();j++){
			ll u=p[ans-1][j].first,v=p[ans-1][j].second;
			if(v<=x) Ans=(Ans+(y-u)/v%Mod)%Mod;
			if(v<=y) Ans=(Ans+(x-u)/v%Mod)%Mod;
		}
		printf("%lld\n",Ans);
	}
	return 0;
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

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

using namespace std;
using ll = long long;
using P = pair<int, int>;

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

    int n, q;
    cin>>n;
    vector<int> As(n);
    rep(i, n) cin>>As[i];
    cin>>q;
    int i, j, k;
    rep(k, q) {
        int m;
        cin>>m;
        vector<vector<int>> dp(n + 1, vector<int>(m + 1));
        rep(i, n) {
            rep(j, m + 1) {
                chmax(dp[i + 1][j], dp[i][j]);
                if (j - As[i] < 0) continue;
                chmax(dp[i + 1][j], dp[i][j - As[i]] + As[i]);
            }
        }
        if (dp[n][m] == m) cout<<"yes"<<endl;
        else cout<<"no"<<endl;
    }
}


Measured memory_bytes: 3308
from collections import deque

data = input()
tmp = deque()
se = list()
ase = list()
lakes = list()

x = 0
#check start - end
for a in data:
  if a == '\\':
    tmp.append(x)
  if a == '/' and len(tmp) > 0 :
    s = tmp.pop()
    se.append([s,x])
  x += 1
se.sort()

# analyse s -e
if len(se) > 0 :
  ase.append(se[0])
  for i in range(1,len(se)) :
    s,e = ase[len(ase)-1]
    if e < se[i][0]:
      ase.append(se[i])

#calc lakes
for a in ase:
  lsize = 0
  deep = 0
  lx = a[0]
  for m in data[a[0]:a[1] + 1] :
    if m == '\\':
      lsize += 1 + deep
      deep += 1
    elif m == '/':
      deep -= 1
      lsize += deep
      if lx == a[1]:
        lakes.append(lsize)
    else: # '_'
      lsize += deep
    lx += 1

print(sum(lakes))
print(len(lakes),end="")
for lake in lakes:
  print(" {}".format(lake),end="")
print()


Measured memory_bytes: 7460
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
long long getDigit(long long n);      // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      ((a)/GCD((a),(b))*(b))
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;

// code
// ------------------------------------------------
int main()
{
  string s;
  cin >> s;

  map<char,ll> m;

  rep(i,sz(s))
  {
    m[s[i]] = 1;
  }

  ll flg = true;
  if(m['N'] ^ m['S'] || m['W'] ^ m['E'])
  {
    flg = false;
  }

  if(flg) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}
// funcの実体
// ------------------------------------------------
ll getDigit(ll n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 0)
      break;
    i++;
  }
  return i;
}
ll CalcSumOfDigit(ll n)
{
  ll s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const ll INF = 1000000000;

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

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

#define FIO                     ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mod                     1000000007
#define eps                     1e-9
#define setbits                 __builtin_popcount
#define gcd                     __gcd
#define rep(i,a,b)              for(int i=a;i<=b;i++)
#define repr(i,b,a)             for(int i=b;i>=a;i--)
#define forn(i,n)               for(int i=0;i<n;i++)
#define all(a)                  a.begin(), a.end()
#define in(a,b)                 ( (b).find(a) != (b).end())
#define pb                      push_back
#define fill(a,v)               memset(a, v, sizeof a)
#define endl                    "\n"
#define ff                      first
#define ss                      second
#define mp                      make_pair
#define minin(a)                *min_element (all(a))
#define maxin(a)                *max_element(all(a))
#define asort(c)                sort(all(c))
#define dsort(c)                sort(all(c), greater<int>()) 
#define PI                      3.14159265358979323846
#define int                     long long
typedef  vector<int>                 vi;
typedef  pair<int, int>              ii;
typedef  vector<ii>                 vii;
typedef  set<int>                    si;
typedef  map<int, int>              mii;
typedef  long double                 ld;

bool fun(int n)
{
  si a;
  while(n)
  {
    a.insert(n%10);
    n/=10;
  }
  return a.size()==1;
}

clock_t time_p=clock();
void timer()
{
    time_p=clock()-time_p;
    cerr<<"Execution Time: "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

int32_t main()
{
  FIO
 
  
   int n;
   cin>>n;
   rep(i,n,1000)
   {
     if(fun(i))
     {
      cout<<i; return 0;
     }
   }

  timer();
  return 0;
}  

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <list>
#include <math.h>
#include <string.h>
#include <bitset>
#include <queue>
using namespace std;

typedef pair<int, int> P;
#define INF (1LL<<60)
#define int long long
#define ll long long
#define mod 1000000007




signed main(){

	int N, M;
	cin >> N >> M;

	if (abs(N - M) > 1) {
		cout << 0 << endl;
		return 0;
	}

	int ans = 1;
	for (int i = 1; i <= N; i++){
		(ans *= i) %= mod;
	}
	for (int i = 1; i <= M; i++){
		(ans *= i) %= mod;
	}
	if (N==M)
		(ans *= 2) %= mod;

	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define Sort(v, n) sort(v, v+n);
#define VSort(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define cY cout<<"Yes";
#define cN cout<<"No";
#define cA(a) cout<<a;
const ll MOD = 1000000007;



int main() {
    string s;cin >> s;
    if(s == "Sunny") cout << "Cloudy";
    else if(s == "Cloudy") cout << "Rainy";
    else cout << "Sunny";
}



Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int N = stdIn.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = stdIn.nextInt();
        }
        stdIn.close();

        List<Integer> B = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            if (A[i] % 2 == 0) {
                B.add(A[i]);
            }
        }

        int count = 0;
        if (B == null) {
            System.out.println("DENIED");
        } else {
            for (int i = 0; i < B.size(); i++) {
                if (B.get(i) % 3 == 0 || B.get(i) % 5 == 0) {
                    count++;
                } 
            }
            if (count == B.size()) {
                System.out.println("APPROVED");
            } else {
                System.out.println("DENIED");
            }
        }
    }
}

Measured memory_bytes: 21844
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#include<assert.h>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
#define SZ(x) ((int)x.size())
using namespace std;
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
template<typename T>inline void chkmin(T &x,T y){x=x<y?x:y;}
template<typename T>inline void chkmax(T &x,T y){x=x>y?x:y;}
const int MAXN=100005;
int X[MAXN],n,S;LL P[MAXN];
int main()
{
	n=read();S=read();
	for(int i=1;i<=n;i++)X[i]=read(),P[i]=read();LL ans=0;
	int l=1,r=n,preo=-1;
	while(l<=r&&X[l]<S&&X[r]>S)
	{
		if(P[l]>=P[r])
		{
			P[l]+=P[r];
			if(preo!=2)preo=2,ans+=X[r]-X[l];
			--r;
		}
		else
		{
			P[r]+=P[l];
			if(preo!=1)preo=1,ans+=X[r]-X[l];
			++l;
		}
	}
	if(l<=r)
	{
		if(X[l]>=S)ans+=X[r]-S;
		else ans+=S-X[l];
	}pr2(ans);
	return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define sz(a) int((a).size()) 
#define pb push_back 
#define all(c) (c).begin(),(c).end() 
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++) 
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define F(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
#define VE(i,v) for(int i = 0;i < (v).size();i++)

using namespace std;
#define trace(...) cerr<<__FUNCTION__<<":"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
	cerr<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
	const char *comma=strchr(names+1,',');
	cerr.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef unsigned int ui;
typedef vector<ll> vl; 
typedef vector<vl> vvl; 
typedef pair<ll,ll> pll;
typedef vector<pll> vpll; 
 




int main()

{
	std::ios::sync_with_stdio(false);
	cin.tie(NULL);
	int T;
	T=1;
	for(int tc=1; tc<=T;tc++)
	{
		int N;
		cin>>N;
		vi arr(N);
		for(int i=0; i < N; i++)
		{
			cin>>arr[i];
		}
		int finde = 0;
		for(int i=0; i < N;i++)
			if(arr[i]==(finde+1))
					finde++;
		int ans =0;
		if(finde==0)
			ans = -1;
		else
		{
			ans = N-finde;
		}
		cout<<ans<<"\n";
	}
 
 
 
	return 0;
}
 
 


Measured memory_bytes: 1024
import math
N = int(input())
t, a = 1, 1

for i in range(N):
    T, A = map(int, input().split())
    n = max(-(-a//A), -(-t//T))  # ここ、バグが埋まってる？ math.ceilだと失敗する
    t, a = n*T, n*A
print(int(t+a))


Measured memory_bytes: 38768
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t,n;
    cin>>n;
        
    int a[n+1][4] = {0};
    for(int i=1;i<=n;++i)
    {
        for(int j=1;j<=3;++j)
        {
            cin>>a[i][j];
        }
    }
    int dp[n+1][4] = {0};

    dp[1][1] = a[1][1]; 
    dp[1][2] = a[1][2];
    dp[1][3] = a[1][3];

    for(int day = 2;day<=n;++day)
    {
        int q1 = a[day][1] + max(dp[day-1][2],dp[day-1][3]); dp[day][1] = q1;
        int q2 = a[day][2] + max(dp[day-1][1],dp[day-1][3]); dp[day][2] = q2;
        int q3 = a[day][3] + max(dp[day-1][1],dp[day-1][2]); dp[day][3] = q3;
    }
    cout<<max(dp[n][1],max(dp[n][2],dp[n][3]))<<endl;

    
    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i = 0; i < (int) n; i++)
#define forin(i, a, b) for(int i = a; i < (int) b; i++) 
#define rofin(i, a, b) for(int i = a; i > b; i--)
#define v vector
#define crap ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define debug(i) cout << #i << ": " << i << endl
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

int main() {
    crap;
    int k;
    cin >> k;
    ll sum = 0;
    forin(i, 1, k+1) {
        forin(j, 1, k+1) {
            forin(m, 1, k+1) {
                sum += (ll) __gcd(i, __gcd(j, m));
            }
        }
    }
    cout << sum << endl;

}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	for(int x=c;x<1000000;x+=60){
		if(x%(a+b)<=a){
			cout<<x<<endl;
			return 0;
		}
	}
	puts("-1");
}

Measured memory_bytes: 1164
#pragma GCC optimize("Ofast")
#include <queue>
#include <cmath>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
int n,h,w,ans;
int main()
{
	fast;
	cin>>n>>h>>w;
	for (int i=1;i<=n;i++)
	{
		int x,y;
		cin>>x>>y;
		if (x>=h && y>=w)
		   ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);



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

  int l = max(-1000000, x-(k-1));
  int r = min(100000, x+(k-1));

  for(int i = l; i <= r ; ++i){
    cout << i << " ";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 3588
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>

#define SIZE 100005
#define YOS 998244353
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
 
using namespace std;


int main()
{	
	ll A,B,C,D;
	scanf("%lld %lld %lld %lld", &A, &B, &C, &D);
	ll T[C+2][D+2];
	for(ll i=0;i<C+2;i++){
		for(ll j=0;j<D+2;j++){
		if((i<A+1)||(j<B+1)){
			T[i][j]=0;
		}
		else{
			if((i==(A+1))&&(j==(B+1))){
				T[i][j]=1;
				}
			else{
			T[i][j]=(T[i-1][j]*(j-1)%YOS+T[i][j-1]*(i-1)%YOS-T[i-1][j-1]*(i-2)*(j-2)%YOS+YOS)%YOS;
			}
		}
		}
	}

	printf("%lld", T[C+1][D+1]);
}


Measured memory_bytes: 72044
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
g = 1
lcm = 1
A = [I() for _ in range(n)]
for a in A:
    g = gcd(lcm,a)
    lcm = lcm*a//g
print(lcm)


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

#define ll long long int
#define rep(i,a,n) for(ll i=(a); i<(n); i++)

using namespace std;

signed main() {
	ll W,H,x,y;
	cin>>W>>H>>x>>y;
	if (x*2==W && y*2==H) {
		printf("%.10f %d\n", (H*W)/2.0, 1);
	} else {
		printf("%.10f %d\n", (H*W)/2.0, 0);
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<vector>
using namespace std;
#define STDIN freopen("in.txt","r",stdin); freopen("out.txt","w",stdout);
const int N = 2e5 + 10;

int a[N];
int main()
{
   // STDIN
    int x, y, z;
    cin >> x >> y >> z;
    swap(x, y);
    swap(x, z);
    printf("%d %d %d\n", x, y ,z);
}

Measured memory_bytes: 256
n, t = map(int, input().split())
T = list(map(int, input().split()))

cnt = 0
prev = None

for i in range(n):
  cnt += t

  # 途中で次がくる場合
  if prev != None and (T[i] - prev) < t:
    cnt -= t - (T[i] - prev)

  prev = T[i]


print(cnt)

Measured memory_bytes: 26708
#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;

int main () {
  int n, m, q, cnt = 0;
  vector<int> S, T;
  
  cin >> n;

  for (int i = 0; i < n; i++) {
    cin >> m;
    S.push_back(m);
  }

  cin >> q;

  for (int i = 0; i < q; i++) {
    cin >> m;
    T.push_back(m);
  }

  for (int i = 0; i < q; i++) {
    for (int j = 0; j < n; j++) {
      if (S[j] == T[i]) {
        cnt++;
        break;
      }
    }
  }

  cout << cnt << endl;

  return 0;
}



Measured memory_bytes: 3264
#include<iostream>

using namespace std;

int a[1000];
int main() {
    while(1) {
        int n;
        cin >> n;

        if (n == 0) break;

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

        int mindelta = 2000000;
        for (int i = 0; i < n; ++i) {
            for (int j = i + 1; j < n; ++j) {
                if (abs(a[i] - a[j]) < mindelta) mindelta = abs(a[i] - a[j]);
            }
        }
        cout << mindelta << endl;
    }
}

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

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

    int N;
    cin >> N;
    vector<int> v(N);
    for (int i = 0; i < N; i++) {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    double ans = v[0];
    for (int i = 1; i < N; i++) {
        ans = (ans + v[i]) / 2;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include<stdio.h>
#include<iostream>
#include<cmath>
#include<vector>
#include<string>
#include<string.h>
#include<algorithm>
#include<numeric>
#include<random>
#include <functional>
using namespace std;

int main() {
	int x = 0;
	int N = 0;
	int ans = 0;
	string s;
	cin >> N >> s;
	for (int N1 = N; N1 > 0; N1--) {
		x = 0;

		for (int i = 0; i < N1; i++) {
			if (s[i] == 'I') {
				x++;
			}
			if (s[i] == 'D') {
				x--;
			}
			ans = max(ans, x);
		}
	}

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

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

using namespace std;

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

string ss;
int ans;

int to_int(string ss) {
    if(ss=="") return 0;
    int ret;
    istringstream is(ss);
    is >> ret;
    return ret;
}

void f(int n) {

    string ss1 = ss.substr(0,n);
    string ss2 = ss.substr(n,ss.size());

    //cout<<ans<<","<<ss1<<","<<ss2<<endl;
    if(ss2.size()!=0 && ss2[0] == '0') return;

    int x2 = to_int(ss1) + to_int(ss2);
    int y2 = to_int(ss2) - to_int(ss1);
    if((x2&1)) return;
    int x = x2 / 2;
    int y = y2 / 2;
    if(x >= 0 && y >= 0) ans++;

}

int main() {
    cin>>ss;
    rep(i,ss.size()) f(i);
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 1228
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int INF = 1000000009;
bool annihilation(ll x,ll b,ll num,vector<int> h)
{
    ll bot = b*num;
    ll cnt = 0;
    rep(i, h.size())
    {
        cnt += (max((ll)0,(h[i]-bot))+x-1)/x;
    }
    return (cnt <= num);
}
int main()
{
    int n;
    cin >> n;
    int a,b;
    cin >> a >> b;
    vector<int> h(n);
    rep(i,n){
        cin >> h[i];
    }
    sort(h.rbegin(), h.rend());
    ll x = a - b;
    ll left = 0,right = 1000000000;
    while(right-left > 1){
        ll mid = left+(right-left)/2;
        if(annihilation(x,b,mid,h)){
            right = mid;
        }else{
            left = mid;
        }
    }
    cout << right << endl;
}

Measured memory_bytes: 1024
N = int(input())
n = N%10
if n == 2 or n == 4 or n == 5 or n == 7 or n == 9:
  print("hon")
elif n == 0 or n == 1 or n == 6 or n == 8:
  print("pon")
elif n == 3:
  print("bon")

Measured memory_bytes: 9108
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define MAX 100000
void inarray(int a[], int n){
    for(int i = 0; i < n; i++) cin >> a[i];
}

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

Measured memory_bytes: 3628