akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <cctype>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, std::less<>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;
typedef long long int64;
typedef unsigned long long uint64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//*/998244353;
const int base = 2187;
const double eps = 1e-9;
const int N = 300'000;
const int LOGN = 19;

int n, m, k;

void solve(int) {
  cin >> n;
  int64 s = 0;
  for (int i = 1; i <= n; ++i) {
    if (i % 3 != 0 && i % 5 != 0) {
      s += i;
    }
  }
  cout << s << '\n';
}

void precalc() {
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i) {
    solve(i);
  }
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}



Measured memory_bytes: 3648
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

#pragma region _define

#define int LL
#define f(i,a,b) for(LL i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define ei else if
#define all(a) a.begin(),a.end()
#define size(s) ((LL)s.size())
#define F first
#define S second
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl
#define int_INF 1<<29
#define ll_INF 1LL<<60
#define MOD 1000000007

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vc = vector<char>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using qi = queue<LL>;
using qc = queue<char>;
using qs = queue<st>;
using si = stack<LL>;
using sc = stack<char>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using mll = map<LL, LL>;
using vpi = vector<pi>;

#pragma endregion

#pragma region _graph

#define node 50  //グラフの最大位数　適宜変更
//bool graph[node][node]; bool visited[node] = { false };
#define link(a,b,m) f(i,0,m){cin>>a[i]>>b[i]; a[i]--; b[i]--; graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;}

#pragma endregion


LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

//素数判定
bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}

//階乗計算
LL factorial(LL n) {
	LL a = 1, ret = 1;
	while (a < n) {
		a++;
		ret *= a;
		ret %= MOD;
	}
	return ret;
}

#pragma endregion 



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

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

	int x, y;
	cin >> x >> y;
	int ans = 0;
	if (x > y) {
		x *= -1;
		ans++;
	}
	ans+=min(abs(y - x), min(abs(y - (-x)) + 1, min(abs(-y - x) + 1, abs(-y - x) + 2)));
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//adds two more functions to set
//(1)*(set.find_by_order(k))[kth element in the sorted set]
//(2)set.order_of_key(k)[count of elements strictly less than k]
#define ll long long
#define ld long double
#define vv vector
#define pp pair
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
typedef pair<ll, ll> pll;
typedef vv<bool> vbool;
typedef vv<ll> vll;
typedef vv<ld> vld;
typedef vv<pll> vpll;
#ifdef LOCAL
#include "prettyprint.hpp"
#define LG(args...)                           \
{                                             \
	string _s = #args;                        \
	replace(_s.begin(), _s.end(), ',', ' ');  \
	stringstream _ss(_s);                     \
	err(istream_iterator<string>(_ss), args); \
	cerr << endl;                             \
}
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << "(" << *it << ":" << a << ") ";
	err(++it, args...);
}
#define fastio
#else
#define LG(...)
#define fastio                    \
	ios_base::sync_with_stdio(0); \
	cin.tie(0);
#define endl "\n"
#endif
//:::::::::::::::::::::::::::::::::::::::::::::
const ll INF = 9e18;
const ll MOD = 1e9 + 7;

int main(){
	fastio;
	ll x,k,d;
	cin>>x>>k>>d;
	x = abs(x);
	ll a = x/d;
	ll ans = INF;
	if(a >=k){
		ans = x - k*d;
		cout<<ans;
		return 0 ;
	}
	ll b = x%d;
	ll c= abs(b-d);
	ll l = k-a;
	if(l%2 == 0){
		ans =b;
	}
	else
		ans = c;
	cout<<ans;

}

Measured memory_bytes: 3652
#include <stdio.h>
#define rep(i,l,r) for((i)=(l);(i)<(r);(i)++)
int main(){
    int i,j,h,w;
    scanf("%d%d",&h,&w);
    char s[h][w];
    int row[h],col[w];
    rep(i,0,w)col[i]=1;
    rep(i,0,h){
        scanf("%s",s[i]);
        row[i]=1;
        rep(j,0,w){
            if(s[i][j]!='.'){
                col[j]*=0;
                row[i]*=0;
            }
        }
    }
    rep(i,0,h){
        rep(j,0,w){
            if(row[i]||col[j])w+=0;
            else printf("%c",s[i][j]);
        }
        if(i<h-1&&!row[i])printf("\n");
    }
}

Measured memory_bytes: 128
import sys

n = int(input())

used = []  # 使用した単語
for i in range(n):
    cur = input()
    if i != 0:
        if cur[0] != gobi or cur in used:
            print("No")
            sys.exit()
    used.append(cur)
    gobi = cur[-1]
    
print("Yes")
    
        
    

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

int main(){
  int n;
  cin>>n;
  ll vec[n],vecb[n],vecc[n];
  for(int i=0;i<n;i++){
    cin>>vec[i];
  }
  for(int i=0;i<n;i++){
    cin>>vecb[i];
  }
  for(int i=0;i<n;i++){
    cin>>vecc[i];
  }
  sort(vec,vec+n);sort(vecb,vecb+n);sort(vecc,vecc+n);
  ll ans=0;
  for(int i=0;i<n;i++){
    ll s=lower_bound(vec,vec+n,vecb[i])-vec;
    s*=n-(lower_bound(vecc,vecc+n,vecb[i]+1)-vecc);
    ans+=s;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 5920
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <bitset>
#include <sstream>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <climits>
using namespace std;

#define PI acos(-1.0)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define fi first
#define se second

#define eps 1e-8
#define mod 1000000007

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<vector<int>> vvi;

// 扩展欧几里得算法 res[1] * a + res[2] * b = res[0] = gcd(a, b)
vector<int> extendGcd(int a, int b) {
    if (b == 0) {
        return {a, 1, 0};
    } else {
        vector<int> tmp = extendGcd(b, a % b);
        return {tmp[0], tmp[2], tmp[1] - (a / b) * tmp[2]};
    }
}

// 带模快速幂
ll power_mod(ll base, int exp) {
    ll res = 1;
    while (exp) {
        if (exp & 1) res = res * base % mod;
        base = base * base % mod;
        exp >>= 1;
    }
    return res;
}

// 快速幂
ll power(ll base, int exp) {
    ll res = 1;
    while (exp) {
        if (exp & 1) res *= base;
        base *= base;
        exp >>= 1;
    }
    return res;
}

// 求逆元
ll inv(ll a) {
    return power_mod(a, mod - 2);
}

#define MAXFAC 100010

ll fac[MAXFAC];

void initFac() {
    fac[0] = 1;
    for (int i = 1; i < MAXFAC; ++i) {
        fac[i] = i * fac[i - 1] % mod;
    }
}

ll Combine(ll a, ll b) {
    return (fac[a] * inv(fac[b]) % mod) * inv(fac[a - b]) % mod;
}

/******************************** template ********************************/

int n, m;
vector<ll> a, con, linear;

int main() {
    cin >> n >> m;
    a.resize(n);
    con.assign(m + 2, 0), linear.assign(m + 2, 0);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    for (int i = 0; i < n - 1; ++i) {
        if (a[i] < a[i + 1]) {
            con[1] += a[i + 1] - a[i];
            con[a[i] + 1] -= (a[i + 1] - a[i]);
            con[a[i] + 1] += a[i + 1] + 1;
            con[a[i + 1] + 1] -= (a[i + 1] + 1);
            con[a[i + 1] + 1] += (a[i + 1] - a[i]);
            --linear[a[i] + 1];
            ++linear[a[i + 1] + 1];
        } else {
            con[1] += a[i + 1] + 1;
            con[a[i + 1] + 1] -= (a[i + 1] + 1);
            con[a[i + 1] + 1] += (m - a[i] + a[i + 1]);
            con[a[i] + 1] -= (m - a[i] + a[i + 1]);
            con[a[i] + 1] += (a[i + 1] + m + 1);
            --linear[1];
            ++linear[a[i + 1] + 1];
            --linear[a[i] + 1];
        }
    }

    ll res = LONG_LONG_MAX;
    for (int i = 1; i <= m; ++i) {
        con[i] += con[i - 1];
        linear[i] += linear[i - 1];
        res = min(res, con[i] + linear[i] * i);
    }

    cout << res;

    return 0;
}

Measured memory_bytes: 2560
from itertools import combinations
MOD = 10**9+7

def main():
    N, k = map(int, input().split(' '))
    count = 0

    if k > N:
        print('1')
        exit(0)
    for i in range(k,N+2):
        maxsum = (N*(N+1) - (N-(i-1))*(N-i))//2
        minsum = (i-1)*i//2
        count += maxsum - minsum + 1

    print(count%MOD)



if __name__ == "__main__":
    main()


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

int main(){
  int h, w, n, sr, sc;
  cin >> h >> w >> n;
  cin >> sr >> sc;
  string s, t;
  cin >> s;
  cin >> t;
  int lt[n+1] = {}, rt[n+1] = {}, ut[n+1] = {}, dt[n+1] = {}, la[n+1] = {}, ra[n+1] = {}, ua[n+1] = {}, da[n+1] = {};
  rep(i, n){
    if(s[i] == 'L') lt[i+1] = lt[i] + 1, rt[i+1] = rt[i], ut[i+1] = ut[i], dt[i+1] = dt[i];
    if(s[i] == 'R') lt[i+1] = lt[i], rt[i+1] = rt[i] + 1, ut[i+1] = ut[i], dt[i+1] = dt[i];
    if(s[i] == 'U') lt[i+1] = lt[i], rt[i+1] = rt[i], ut[i+1] = ut[i] + 1, dt[i+1] = dt[i];
    if(s[i] == 'D') lt[i+1] = lt[i], rt[i+1] = rt[i], ut[i+1] = ut[i], dt[i+1] = dt[i] + 1;
  }
  rep(i, n-1){
    if(t[i] == 'L'){
      if(la[i+1]+1-rt[i+1] < sc) la[i+2] = la[i+1] + 1;
      else la[i+2] = la[i+1];
      ra[i+2] = ra[i+1], ua[i+2] = ua[i+1], da[i+2] = da[i+1];
    }
    if(t[i] == 'R'){
      if(ra[i+1]+1-lt[i+1] < w+1-sc) ra[i+2] = ra[i+1] + 1;
      else ra[i+2] = ra[i+1];
      la[i+2] = la[i+1], ua[i+2] = ua[i+1], da[i+2] = da[i+1];
    }
    if(t[i] == 'U') {
      if(ua[i+1]+1-dt[i+1] < sr) ua[i+2] = ua[i+1] + 1;
      else ua[i+2] = ua[i+1];
      la[i+2] = la[i+1], ra[i+2] = ra[i+1], da[i+2] = da[i+1];
    }
    if(t[i] == 'D') {
      if(da[i+1]+1-ut[i+1] < h+1-sr) da[i+2] = da[i+1] + 1;
      else da[i+2] = da[i+1];
      la[i+2] = la[i+1], ra[i+2] = ra[i+1], ua[i+2] = ua[i+1];
    }
  }
  bool ans = true;
  for(int i = 1; i <= n; i++){
    if(rt[i]-la[i] >= w-sc+1 || lt[i]-ra[i] >= sc || ut[i]-da[i] >= sr || dt[i]-ua[i] >= h-sr+1) ans = false;
  }
  cout << (ans? "YES" : "NO") << endl;
  return 0;
}


Measured memory_bytes: 7048
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

//素因数分解
vector<pair<ll,int>> factorize(ll n){
    vector<pair<ll,int>>res;
    for(ll i=2;i*i<=n;i++){
        if(n%i)continue;
        res.emplace_back(i,0);
        while (n%i == 0)
        {
        n /= i;
        res.back().second++;
        }
        
    }
    if(n != 1) res.emplace_back(n,1);
    return res;
}

int main(){
    int N,X;
    cin >> N >> X;
    int L[N];
    for(int i=0;i<N;i++)cin >> L[i];
    int ans = 1,D=0;
    for(int i=1;i<=N;i++){
            D = D + L[i-1];
        if(D<=X)ans++;
    }
    cout << ans << endl;
}


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

int main() {
	ios_base::sync_with_stdio( false );

	int r, g, b;
	cin >> r >> g >> b;
	cout << ((r*100 + g*10 + b) % 4 == 0 ? "YES" : "NO") << endl;

	return 0;
}


Measured memory_bytes: 256
n = int(input())
values = []

values = [int(input()) for _ in range(n)]
boro = max(values)
index = values.index(max(values))
del values[index]
boro = int(boro / 2.0)
values.append(boro)
sum = 0

for i in values:
    sum += i

print(sum)



Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#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;
}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e15;
const int INF=1e9;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	string s,t;
	cin>>s>>t;
	string ans;
	rep(i,n){
		ans+=s[i];
		ans+=t[i];
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n,count=0, ans=0, left, right, mid;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    for(int i=0; i<n-2; i++) {
        for(int j=i+1; j<n-1; j++) {
            left=j+1;
            right=n;
            while(right-left>1) {
                mid=(left+right)/2;
                if(a[i]+a[j]<=a[mid]) {
                    right=mid;
                }
                else {
                    left=mid;
                }
            }
            if(a[i]+a[j]>a[left]) ans +=(left-j);
        }
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

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

  if (a*b>=c*d) printf("%d\n", a*b);
  else if (a*b<c*d) printf("%d\n", c*d);

  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define RFOR(i,a,b) for(int i=(b-1); i>=(a); i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
using ll = long long;
using D = double;
using LD = long double;
using P = pair<int, int>;
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; }

int main(){
    int x; cin >> x;
    int ans = 0;
    ans += (x/500) * 1000;
    x %= 500;
    ans += (x/5)*5;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <limits.h>
#include <float.h>
#include <math.h>

int main(int argc, char *argv[])
{
    int n, m;
    int a[100000];
    long long way[100001];
    int i;
    int p;
    long long ans;

    scanf("%d %d", &n, &m);

    for (i = 0; i < m; i++) {
        scanf("%d", &a[i]);
    }
    a[m] = INT_MAX;

    for (i = 0; i < n; i++) {
        way[i] = 0;
    }

    p = 0;
    way[0] = 1;
    if (a[0] != 1) {way[1] = 1;} else {p++;}
    for (i = 2; i <= n; i++) {
        if (a[p] == i) {
            p++;
            continue;
        }
        way[i] = way[i - 1] + way[i - 2];
        way[i] %= 1000000007;
    }

    ans = way[n];

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

    return 0;
}


Measured memory_bytes: 1280
#include <stdio.h>

int main()
{
	int a, b;
	char s;

	while (1)
	{
		scanf("%d %c %d", &a, &s, &b);

		if (s == '+')
			printf("%d\n", a + b);
		else if (s == '-')
			printf("%d\n", a - b);
		else if (s == '*')
			printf("%d\n", a * b);
		else if (s == '/')
			printf("%d\n", a / b);
		else
			break;
	}

	return(0);

}

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

int main() {
    int n, sum = 0;
    cin >> n;
    int a[n];
    for (int i = 0; cin >> a[i]; i++) {
        sum += a[i];
    }
    sum /= n;
    auto dist = [&](int y) {
        int result = 0;
        for (int i : a) {
            result += (i - y) * (i - y);
        }
        return result;
    };
    cout << min(dist(sum), dist(sum + 1));
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main() {
	int n, i;
	double x1, x2, x3, y1, y2, y3, a1, b1, c1, a2, b2, c2, px, py, r;
	
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
		a1 = 2 * (x2 - x1);
		b1 = 2 * (y2 - y1);
		c1 = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2;
		a2 = 2 * (x3 - x1);
		b2 = 2 * (y3 - y1);
		c2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3;
		px = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
		py = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);
		
		r = sqrt((px-x1)*(px-x1)+(py-y1)*(py-y1));
		
		printf("%.3lf %.3lf %.3lf\n", px, py, r);
	}
	return 0;
}

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

#undef DEBUG

void
solver(int n, char *s)
{
    int i;
    int h;
    if (n%2) {
        printf("No\n");
        return;
    }
    h = n/2;
    for (i=0; i<h; i++) {
        if (s[i]!=s[i+h]) {
            printf("No\n");
            return;
        }
    }
    printf("Yes\n");
    return;
}

int
main(int argc, char *argv[])
{
    int N;
    char S[101];
#ifdef DEBUG
#else
    scanf("%d", &N);
    scanf("%s", S);
#endif
    solver(N, S);

    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

/**
  *http://abc042.contest.atcoder.jp/tasks/abc042_a
 * @author Cummin
 */
public class Main {

    public static void main(String[] args) {
        int A, B, C ;
        int Five = 0 ;
        int Seven= 0 ;
         // データの読み込み
        Scanner sc = new Scanner(System.in);
        A = sc.nextInt();
        B = sc.nextInt();
        C = sc.nextInt();
        
        if (A==5) Five ++ ;
        if (A==7) Seven++ ;
        if (B==5) Five ++ ;
        if (B==7) Seven++ ;
        if (C==5) Five ++ ;
        if (C==7) Seven++ ;
        if ((Five==2) && (Seven==1)) {
            System.out.println("YES") ;
        } else {
            System.out.println("NO") ;
        }
    }
    
}


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

int main(){
    int n,m;
    while(scanf("%d %d",&n,&m), n != 0 || m != 0){
        int t[101]={0}, h[101]={0}, st=0, sh=0;
        for(int i=0;i<n;++i){
            scanf("%d",&t[i]);
            st += t[i];
        }
        for(int i=0;i<m;++i){
            scanf("%d",&h[i]);
            sh += h[i];
        }
        int dif = st - sh;
        if(dif % 2 != 0){
            printf("-1\n");
            continue;
        }
        bool flag=false;
        int mini = INT_MAX, a,b;
        for(int i=0;i<n;++i){
            for(int j=0;j<m;++j){
                int d = t[i] - h[j];
                if(d == dif/2){
                    if(t[i] + h[j] < mini){
                        a = t[i];
                        b = h[j];
                        mini = a + b;
                    }
                    flag = true;
                }
            }
            if(flag)break;
        }
        if(flag == false)printf("-1\n");
        else printf("%d %d\n",a,b);
    }

    return 0;
}

Measured memory_bytes: 3100
#include<bits/stdc++.h>
    using namespace std;
    
    //                                 (POLICY BASED DS)
    // #include <ext/pb_ds/assoc_container.hpp>
    // #include <ext/pb_ds/tree_policy.hpp>
    // using namespace __gnu_pbds;
    // template<typename T>
    // using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
    // template<typename T>
    // using ordered_multiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;
    //                      ( find_by_order( )  ,  order_of_key( ) )
    
    typedef long long ll;
    typedef long double ld;
    typedef unsigned long long ull;
    typedef vector<int> vi;
    typedef vector<long long> vll;
    typedef pair<ll,ll> pll;
     
    const ll mod = 1e9 + 7;
    const ld PI = 3.1415926535897932384626;
    const ld eps = 1e-9;                            
     
    #define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
    #define sidha(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
    #define ulta(i,a,b) for(ll i=(ll)(a);i>=(ll)(b);--i)
    #define stl(container,itr) \
        for(auto itr = container.begin(); itr != container.end(); itr++)
    #define sab(v) v.begin(), v.end()
    #define rall(v) v.rbegin(), v.rend()            
    #define test ll t;cin>>t;while(t--)
    #define sz size()
    #define pb push_back
    #define mp make_pair
    #define fi first
    #define se second
    #define LOG2(X) (63ll - __builtin_clzll(X))
    #define endl '\n'
    #define modinv(x) power(x, mod-2)
    #define ncr(n,r) ( n >= r ? ((((fact[n]*modinv(fact[r]))%mod)*modinv(fact[n-r]))%mod) : (ll)0)
    #define MAX 100005
     
    ll power(ll x, ll y) { 
        ll ans=1;
        x=x%mod;
        while(y>0) { 
            if (y&1) 
                ans=(ans*x)%mod; 
            y=y>>1;
            x=(x*x)%mod; 
        } 
        return ans; 
    }
    
    // vector<ll> adj[MAX];
    // ll visit[MAX];
    // void dfs(ll node){
    //     visit[node]=1;
    //     for(auto i : adj[node]){
    //         if(!visit[i]) dfs(i);
    //     }
    // }
    
    // ll spf[MAX];
    // void sieve(){
    //     sidha(i,1,MAX)  spf[i]=i;
    //     for(ll i=4;i<MAX;i+=2)  spf[i]=2;
    //     for(ll i=3;i*i<=MAX;i++){
    //         if(spf[i]==i){
    //             for(ll j=i*i;j<MAX;j+=i){
    //                 if(spf[j]==j)   spf[j]=i;
    //             }
    //         }
    //     }
    // }

    int main()
    {
        boost;
        ll n,count=0,ans=0;
        cin>>n;
        ll arr[n],suff[n];
        sidha(i,0,n)    cin>>arr[i];
        ulta(i,n-1,0){
            suff[i]=count;
            count=((count+arr[i])%mod);
        }
        sidha(i,0,n){
            ans=((ans+((arr[i]*suff[i])%mod))%mod);
        }
        cout<<ans;
        return 0;
    }
    

Measured memory_bytes: 6736
#include<bits/stdc++.h>
#define Rint register int
using namespace std;
int m, k;
int main(){
	scanf("%d%d", &m, &k);
	if(k >= (1 << m)){
		puts("-1");
		return 0;
	}
	if(m == 1){
		puts(k ? "-1" : "0 0 1 1");
		return 0;
	}
	if(k == 0){
		for(Rint i = 0;i < (1 << m);i ++) printf("%d ", i);
		for(Rint i = (1 << m) - 1;~i;i --) printf("%d ", i);
		return 0;
	}
	if(k == 1){
		printf("2 1 2 3 0 ");
		for(Rint i = 4;i < (1 << m);i ++) printf("%d ", i);
		printf("1 ");
		for(Rint i = (1 << m) - 1;i > 3;i --) printf("%d ", i);
		printf("0 3");
		return 0;
	}
	printf("1 %d 1 %d 0 ", k, 1 ^ k);
	for(Rint i = 2;i < (1 << m);i ++)
		if(i != (1 ^ k) && i != k) printf("%d ", i);
	printf("%d ", k);
	for(Rint i = (1 << m) - 1;i > 1;i --)
		if(i != (1 ^ k) && i != k) printf("%d ", i);
	printf("0 %d", 1 ^ k);
}

Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main(){
	int k,x,sum;
	while(cin>>k,k){
			sum=0;
			for(int i=0;i<(k-1)*k/2;i++){
				cin>>x;
				sum+=x;
			}
		cout<<sum/(k-1)<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
a,b,n=map(int,input().split())
"""
m=-1

for i in range(b+1):
  w=int(a*i/b)-a*int(i/b)
  if m<w or m==-1:
    m=w
print(m)
"""
if b<=n:
  print(int(a*(b-1)/b)-a*int((b-1)/b))
else:
  print(int(a*n/b)-a*int(n/b))


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

int main() {
  char C;
  cin >> C;

  string alphabet = "abcdefghijklmnopqrstuvwxyz";

  for (int i = 0; i < alphabet.size(); i++) {
    if (C == alphabet.at(i)) {
      cout << alphabet.at(i + 1) << endl;
    }
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int compare(string a,string b)
{
    int sum=0;
    for(int i=0;i<a.length();i++)
    {
        if(a[i]!=b[i])
            sum++;
    }
    return sum;
}
int main(void)
{ int d, t,s;
    string s1,s2;
    cin>>s1>>s2;
    int min=s2.size();
    for(int i=0;i<s1.length()-s2.length()+1;i++)
    {
        int h = compare(s1.substr(i,s2.length()),s2);
        if(h<min)
            min =h;
    }
    cout<<min;
    return 0;
}



Measured memory_bytes: 3608
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		boolean flg = true;
		for(int i=0;i<W.length()-1;i++){
			if(W.charAt(i) == W.charAt(i+1)){
				System.out.println("Bad");
				flg = false;
				break;
			}

		}
		if(flg)
			System.out.println("Good");
	}
}


Measured memory_bytes: 20948
#include<bits/stdc++.h>
 
using namespace std;
 
using   ll=long long;
using   ld=long double;
 
#define fast           ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl           "\n"
#define int            long long 
#define pb             push_back
#define mp             make_pair
#define vll            vector<ll>
#define ff             first
#define ss             second
#define pll            pair<ll,ll>
#define ALL(v)         v.begin(),v.end()
#define ALLR(v)        v.rbegin(),v.rend()
#define pii            3.14159265358979323
#define inf			   LLONG_MAX

void solve()
{
    ll n,x,y,z;
    
    cin>>n;
    
    ll dp[n+1][3];
    
    dp[0][0]=0;
    dp[0][1]=0;
    dp[0][2]=0;
    
    for(int i=1;i<=n;i++)
    {
    	cin>>x>>y>>z;
    	
    	dp[i][0] = x + max(dp[i-1][1],dp[i-1][2]);
    	dp[i][1] = y + max(dp[i-1][0],dp[i-1][2]);
    	dp[i][2] = z + max(dp[i-1][0],dp[i-1][1]);
    }
    
    cout<<max({dp[n][0],dp[n][1],dp[n][2]});
}
 
signed main()
{
 
    fast;
 
    ll t;
    
    t=1;
    
    //cin>>t;
    
    while(t--)
    {
        solve();
    }
 
    return 0;
}

Measured memory_bytes: 2688
using System;

namespace tst
{
    class Program
    {
        public static void Main()
        {
            string[] In = Console.ReadLine().Split(' ');
            long A = long.Parse(In[0]);
            long B = long.Parse(In[1]);
            long K = long.Parse(In[2]);
            if (A >= K)
            {
                A -= K;
            }
            else
            {
                K -= A;
                A = 0;
                if (B >= K)
                {
                    B -= K;
                }
                else
                {
                    B = 0;
                }
            }
            Console.WriteLine("{0} {1}", A, B);
        }

    }
}

Measured memory_bytes: 13140
#include "bits/stdc++.h"

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<int, int> P;
struct Edge{ll from, to, cost;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N, A, B;
  cin >> N >> A >> B;
  string S;
  cin >> S;
  ll a=0, b=0;
  rep(i, N){
    if(a+b<A+B){
      if(S[i]=='a'){
        a++;
        cout << "Yes"<<endl;
      }else if(S[i]=='b' and b < B){
        cout << "Yes" << endl;
        b++;
      }else{
        cout << "No" << endl;
      }
    }else{
      cout << "No" << endl;
    }
  }
  return 0;
}


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

int main() {
    int n;
    cin >> n;
    int t[110000], x[110000], y[110000];
    t[0] = 0;
    x[0] = 0;
    y[0] = 0;
    for (int i = 1; i < n+1; ++i) cin >> t[i] >> x [i] >> y[i];
    bool ok = true;
    
    for (int i = 0; i < n; ++i) {
        int dt = t[i+1] - t[i];
        int p_diff = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);
        if (dt < p_diff) {
            ok = false;
            break;
        }
        if (dt % 2 != p_diff % 2) {
            ok = false;
            break;
        }
    }

    if (ok == true) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 4612
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define all(vec) vec.begin(),vec.end()
#define MOD 1000000007
#define int long long

signed main(){
    int x;cin>>x;
    int m=sqrt(x)+1;
    int ans=1;
    for(int i=2;i<m;i++){
        int v=i;
        while(v<=x)v*=i;
        v/=i;
        ans=max(ans,v);
    }
    cout<<ans<<endl;
}

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

typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

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

const ll INF = 1e18;
const ll MOD = 998244353;
const ll MX = 1000001;

int K;
string S;

void solve() {
   cin >> K >> S;
   if (S.size() <= K) cout << S;
   else {
	   for (int i = 0; i < K; i++) cout << S[i];
	   cout << "...";
   } 
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
    ll T = 1; // cin >> T;
    while (T--) solve();
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


Measured memory_bytes: 3652
#include "bits/stdc++.h"
#ifndef err
#define err(...)(void)0
#endif
using namespace std;
using ll = long long;
using ull = decltype(1ull);
template<class T>int size(T&&a) { return a.size(); }
#define REP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.first,_l##t=a.second;t<_l##t;t++)
#define RREP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.second-1,_l##t=a.first;t>=_l##t;t--)
template<class B>pair<int, B>make_pair(B b) { return{ 0,b }; }
#define rep(t,...)REP(t,make_pair(__VA_ARGS__))
#define rrep(t,...)RREP(t,make_pair(__VA_ARGS__))
#define all(a)begin(a),end(a)
#define rall(a)a.rbegin(),a.rend()
#define var(t, ...) t __VA_ARGS__;in,__VA_ARGS__;

void Calc();
int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr);
  cin.exceptions(istream::failbit | istream::badbit);
  cout << fixed << setprecision(15); Calc(); cout.flush(); return 0;
}
template<class A>void amax(A&a, A b) { a = max(a, b); }
template<class A>void amin(A&a, A b) { a = min(a, b); }
template<class A>int comp(A a, A b) { return a < b ? 1 : b < a ? -1 : 0; }
struct Scanner {
  template<class A = string>A Next() { A a; cin >> a; return a; }
  template<class A = int>vector<A>Array(int n) { vector<A>a(n); for (A&i : a) cin >> i; return a; }
  string Line() const { string s; getline(cin, s); return s; }
  template<class A>Scanner&operator,(A&a) { a = Next<A>(); return *this; }
  template<class A>operator A() { return Next<A>(); }
}in;

/*---------------------------------------------------------------------*/


void Calc() {

  string s = in;
  set<char> c;
  for (auto& i : s) {
    c.insert(i);
  }
  rep(i, 'a', 'z' + 1)if (c.count(i) == 0) {
    cout << ((char)i) << endl;
    return;
  }
  cout << ("None") << endl;

}


Measured memory_bytes: 512
#include<iostream>
#include<string>
#include <stdio.h>
#include <float.h>
using namespace std;

int main() {
  int N;
  double A[1100];
  double x;
  cin >> N;
  for (int i = 1; i<=N; ++i) {
    cin >> A[i];
      }
  for(int i = 1; i<=N; ++i){
    x = 1/A[i]+x;
      }
  double y = 1/x;
  cout << y <<endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000000LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
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; }

bool flag;
string S;
int len;
vector<bool> sign;

void func(int n){
    if(n == len){
        flag = true;
        return;
    }

    rep(i, 4){
        string a;
        if(i == 0) a = "dream";  if(i == 1) a = "dreamer";
        if(i == 2) a = "erase";  if(i == 3) a = "eraser";
        int al = a.size();
        //cout <<"len:" << len << " n+al:" << n+al << ln;
        if(n + al > len) continue;
        bool same = false;
        string s;
        rep(j, al){
            s += S[n + j];
        }
        if(s == a) same = true;
        //cout << "s:" << s << " a:" << a << ln;
        if(same &&!sign[n + al]){
            func(n + al);
            sign[n + al] = true;
        }
    }
}

int main() {
    cin >> S;
    len = S.size();
    flag = false;
    sign.resize(len + 10);

    func(0);

    if(flag) cout << "YES" << ln;
    else cout << "NO" << ln;
}
    

Measured memory_bytes: 4096
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include <unordered_set>

using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

ll dp[2010][2010];
ll s[2010],t[2010];
int n,m;

void solve(){
  rep(i,n+1)dp[i][0]=1;
  rep(j,m+1)dp[0][j]=1;
  for(int i=1;i<=n;i++){
    for(int j=1;j<=m;j++){
      dp[i][j]=(dp[i-1][j]+dp[i][j-1])%mod;
      dp[i][j]%=mod;
      if(s[i]==t[j]){
        dp[i][j]+=dp[i-1][j-1];
        dp[i][j]%=mod;
      }
      dp[i][j]+=mod-dp[i-1][j-1];
      dp[i][j]%=mod;
    }
  }
}

int main(){
  cin >> n >> m;
  rep(i,n)cin >> s[i+1];
  rep(i,m)cin >> t[i+1];
  solve();
  cout << dp[n][m] << endl;
  /*
  rep(i,n+1){
    rep(j,m+1){
      cout << "(i,j): (" << i << ',' << j << ") dp[i][j]:" << dp[i][j] << endl;
    }
  }
  */
return 0;}

Measured memory_bytes: 31744
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int>pi;
#define elif else if
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define Rep(x,y) for(int k=x;k<y;k++)
#define all(x) x.begin(),x.end()
#define pb push_back
#define vint vector<int>
#define vvint vector<vector<int>>
#define vtr vector<string>
#define vouble vector<double>
#define vvtr vector<vector<string>>
#define vhar vector<char>
#define vvhar vector<vector<char>>
#define mis map<int,str>
#define msi map<str,int>
#define mid map<int,double>
#define mod 100000007
#define elif else if
#define str string
int digitsum(int a){
  int b=0;
  while(a){
    b+=a%10;
    a/=10;
  }
  return b;
}
signed main(){
  int k,n,m,c=0,c2=0;
  string s,t;
  char C;
  double d;
  cin>>n;
  m=100;
  while(1){
    m+=m/100;
    c++;
    if(n<=m){
      cout<<c<<endl;
      break;
    }
  }
}


Measured memory_bytes: 3628
import java.util.*;
public class Main {
	Scanner sc;
	void run() {
		sc = new Scanner(System.in);
		while(true) {
			int n = sc.nextInt();
			int r = sc.nextInt();
			if ( n == 0 && r == 0) break;
			LinkedList<Integer> list = new LinkedList<Integer>();
			for (int i=0;i<n;i++) 
				list.add(i+1);
			for (int i=0;i<r;i++) {
				int p = sc.nextInt();
				int c = sc.nextInt();
				for (int j=0;j<c;j++) {
					list.addLast(list.remove(n-(p-1+c)));
				}
			}
			System.out.println(list.getLast());
		}
	}
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <string>
using namespace std;
int main(){

  char a[3][3]={'A','B','C','D','E','F','G','H','I'};
  string b;
  int x,y,blank,i,j,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};

  for(int k=0;k<1000;k++){
    
  cin>>b;
  
  for(i=0;i<3;i++) for(j=0;j<3;j++){
      if(a[i][j]==b[0]){
        y=i;
        x=j;
        break;
      }
    }

  if(b.size()==1){
    cout<<b<<endl;
    continue;
  } else {

    for(i=1;i<b.size();i++){
      blank=0;
      for(j=0;j<4;j++){
        if(0<=x+dx[j] && x+dx[j]<3 && 0<=y+dy[j] && y+dy[j]<3){
          if(b[i]==a[y+dy[j]][x+dx[j]]){
            y=y+dy[j];
            x=x+dx[j];
            blank=1;
            break;
          }
        }
      }
      if(blank==0) break;
    }

    if(blank==1) cout<<b<<endl;

  }

  }

  return 0;

}
                                                                                
      
        
      

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

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

    string s;
    int Q;
    cin >> s >> Q;
    list<char> lst(s.begin(), s.end());
    bool flag = true;
    while (Q--) {
        int q;
        cin >> q;
        if (q == 1) {
            flag = not flag;
        } else {
            int f; char c;
            cin >> f >> c;
            if (f == 1) {
                if (flag) lst.push_front(c);
                else lst.push_back(c);
            } else {
                if (flag) lst.push_back(c);
                else lst.push_front(c);
            }
        }
    }
    if (not flag) lst.reverse();
    string s1(lst.begin(), lst.end());
    cout << s1 << endl;
}

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

int main()
{
    int k;
    string s;
    cin>>k>>s;
    if(s[k] == '\0'){
        cout<<s<<endl;
        return 0;
    }else{
        for(int i=0;i<k;i++){
            cout<<s[i];
        }
        cout<<"..."<<endl;
        return 0;
    }
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull usigned long long
#define two(n) 1<<n
#define l(v) (int)v.size()
#define p_b push_back
#define m_p make_pair
const int pi=acos(-1.0);
const int int_max=1e9;
const long long ll_max=1e18;
int a,b;
int main()
{
	cin>>a>>b;
	if(b==1)
	{
		cout<<0;
		return 0;
	}
	if(a%b==0)
	{
		cout<<1;
		return 0;
	}
	if(a>b)
	{
		cout<<1;
		return 0;
	}
	int sum=0;
	int ans=1;
	while(ans++)
	{
		sum=0;
		sum+=(ans-1)*(a-1)+a;
		if(sum>=b)
		{
			cout<<ans;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
program main
   implicit none
   integer A, B, i, countN
   character(11) S
   read(*, *) A, B
   read(*, *) S
   countN = 0
   do i = 1, A+B+1
       if(S(i:i) == '-') then
           countN = countN + 1
       end if
   end do
   if(countN == 1 .and. S(A+1:A+1) == '-') then
       write(*, *) 'Yes'
   else
       write(*, *) 'No'
   end if
end program main

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<cmath>
#define int long long
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define c(n) cout<<n<<endl;
signed main(){
	int a,b; 
	cin>>a>>b;
	int aa=a;
	int bb=b;
	rep(i,1000){
		aa=aa%bb;
		if(aa==0){
			c(a*b/bb)
			return 0;
		}	
		bb=bb%aa;
		if(bb==0){
			c(a*b/aa)
			return 0;
		}
	}
}			

Measured memory_bytes: 256
from functools import reduce
from itertools import chain

# 入力
N, M = map(int, input().split())
A = list(map(int, input().split()))
B, C = (
    zip(*(map(int, input().split()) for _ in range(M))) if M else
    ((), ())
)

# 最終形について、大きい整数から順に整数を割り当てる
ans, _ = reduce(
    lambda acc, t: (
        acc[0] + t[0] * min(N - acc[1], t[1]),
        min(N, acc[1] + t[1])
    ),
    sorted(
        chain(
            ((a, 1) for a in A),
            zip(C, B)
        ),
        reverse=True
    ),
    (0, 0)
)

# 出力
print(ans)


Measured memory_bytes: 63000
taro,hana=0,0
  ($stdin.gets.to_i).times do
    iT,iH=$stdin.gets.split
    case iT<=>iH
    when -1; hana+=3
    when 0; (taro+=1;hana+=1)
    when 1; taro+=3
    end
  end
  puts [taro,hana].join " "


Measured memory_bytes: 6852
#include <stdlib.h>//必須
#include <stdio.h>
int compare_int(const void *a, const void *b)//事前に入れる
{
    return *(int*)a - *(int*)b;
}

int main(void){
    int n,a,b,c;
    scanf("%d",&n);
    int l[n];
    int head[n][n][n];
    long ans =0;
    for(a=0;a<n;a++){
        scanf("%d",&l[a]);
    }
   
   a=0;
   b=1;
   c=2;

    qsort(l, n, sizeof(int), compare_int);//ソート関数（配列めい、総数、固定、比較方法）
    
    while(a<n){
        while(b<n){
            while (c<n && l[c]<l[a]+l[b]){
                ans++;
                c++;
            }
            b++;
            c=b+1;
        }
        a++;
        b=a+1;
        c=b+1;
    }
    printf("%ld\n",ans);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;


int main() {
//    cout << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n, k;
    string s;
    cin >> n >> s >> k;
    char c = s[k - 1];
    for (char ch : s) {
        cout << (ch == c ? ch : '*');
    }

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fast_I_O ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int mod = 1e9+7 , INF = 1e9 ,  mx = 100005 ;
main()
{
    fast_I_O;
    int i,j,n,m,x,y,sum=0,p=0,l,k;
    cin>>n;
    n>=30?cout<<"Yes":cout<<"No";
    return 0;
}

Measured memory_bytes: 3636
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    s=SI()
    print(len(s)//2-s.count("p"))

main()

Measured memory_bytes: 3316
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int main() 
{
	int a;
	cin >> a;
	cout << 3 * a * a << endl;
}

Measured memory_bytes: 256
char s[50][99];
h,w;
d[5]={0,1,0,-1};
dis[50][50];
i,j,tx,ty,x,y,r;f,l;cnt;
P[1<<17][2];
main()
{
	scanf("%d%d\n",&h,&w);
	for(i=0;i<h;)gets(s+i++);
	dis[0][0]=1;
	P[l][0]=P[l++][1]=0;
	while(f<l)
	{
		x=P[f][0],y=P[f++][1];
		for(r=0;r<4;r++)
		{
			tx=x+d[r],ty=y+d[r+1];
			if(tx>=0&&ty>=0&&tx<h&&ty<w&&(!dis[tx][ty]||dis[tx][ty]>dis[x][y]+1)&&s[tx][ty]-'#')
				dis[tx][ty]=dis[x][y]+1,P[l][0]=tx,P[l++][1]=ty;
		}
	}
	for(i=0;i<h;i++)for(j=0;j<w;j++)cnt+=s[i][j]=='.';
	if(dis[h-1][w-1])
	{
		printf("%d",cnt-dis[h-1][w-1]);
	}
	else printf("%d",-1);
}

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

int main()
{
	int a,b;
	
	cin>>a>>b;
	
	if(a>b)
		cout<<"a > b"<<endl;
	else if(a<b)
		cout<<"a < b"<<endl;
	else
		cout<<"a == b"<<endl;
	return 0;
	
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for(int i =0 ; i < n; ++i)
#define pii pair < int, int >
typedef vector<int> vi;
typedef   long long ll;
const int mod =1e9+7;




void solve(){
	vi v(3);
	cin>>v[0]>>v[1]>>v[2];
	int cnt=0;
	while(true){
		if(v[0]==v[1] && v[1]==v[2])break;
		sort(all(v));
		if(v[0]<v[2] && v[1]<v[2])v[0]++,v[1]++;
		else if(v[0]<v[1])v[0]+=2;
		cnt++;
	}
	cout<<cnt;

}


int main(){
	Red;
	int t=1;
	//cin>>t;
	while(t--)
	solve();
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;

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

int main(){
    ll n; cin >> n;
    double t,a; cin >> t >> a;
    vector<double> h(n);
    rep(i,n) cin >> h[i];
    auto f = [&](double h){
        return abs( a - (t - h * 0.006));
    };

    using Pd = pair<double, int>;
    Pd ans = {numeric_limits<double>::max(), -1};
    rep(i,n){
        chmin(ans, {f(h[i]), i+1});
    }

    std::cout << ans.second << endl;
}

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;
using P = pair<int,int>;

int main() {
   int a[5];
   cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
   rep(i,5) {
      if(a[i] == 0) cout << i+1 << endl;
   }
   return 0;
}

Measured memory_bytes: 3524
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int h,w,i,j;
	char s[101][101];
	cin>>h>>w;
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			cin>>s[i][j];
		}
	}
	for(i=0;i<=h+1;i++){
		for(j=0;j<=w+1;j++){
			if(i==0||i==h+1){
				cout<<"#";
			}else{
				if(j==0||j==w+1){
					cout<<"#";
				}else{
					cout<<s[i-1][j-1];
				}
			}
		}
		cout<<endl;
	}
	return 0;
}

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


void solve()
{
   int n,x,t;
   cin>>n>>x>>t;

   int ans = n/x;

   if(ans*x < n)
    ans++;

   cout<<ans*t<<endl;


    return;
}


int main()
{

  int t = 1;
  //cin>>t;

  while(t--)
    solve();

  return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793

int main(){
   int a,b,c,d,e;
   cin >> a >> b >> c >> d >> e;
   if(a==0)cout << 1 << endl;
   if(b==0)cout << 2 << endl;
   if(c==0)cout << 3 << endl;
   if(d==0)cout << 4 << endl;
   if(e==0)cout << 5 << endl;
}

Measured memory_bytes: 3632