akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> istream& operator>>(istream& is,vector<T>& v) { for(T& t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream& os,const vector<T>& v) { for(T t:v){os<<t<<" ";} os<<"\n"; return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    ll x;
    cin >> x;
    cout << x/500*1000+x%500/5*5 << endl;
}

Measured memory_bytes: 256
n, c, k, *T = map(int, open(0).read().split())
T.sort()
ans = 1
p = 0
t = T[0]
for i in range(n):
    p += 1
    if T[i]>t+k or p>c:
        t = T[i]
        ans += 1
        p = 1
print(ans)

Measured memory_bytes: 14052
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#define ll long long
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long

#define INF 999999999

using namespace std;

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
// input
string n;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    bool is_ans = ((n[0] == n[1]) && (n[1] == n[2])) || ((n[3] == n[1]) && (n[1] == n[2]));

    if(is_ans)  cout << "Yes" << "\n";
    else cout << "No" << "\n";
}

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

using namespace std;
int main(void) {
	int n,m; cin >> n;
	double a = (double)(n / 2 + 1) / n;

	if (n % 2 == 0) {
		cout << "0.500000000000";
		return 0;
	}
	else printf("%.8f",a) ;
	return 0;
}



Measured memory_bytes: 256
import sys
def input():
    return sys.stdin.readline()[:-1]
N = int(input())
l = list(map(int, input().split()))
ANS = [0]*N

for i in range(N-1):
    k = l[i]
    ANS[k-1] += 1
for i in range(N):
    print(ANS[i])

Measured memory_bytes: 32376
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define reps(i,a,b) for(int i=a;i<b;++i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

vector<pair<long long, int>> factor(long long x) {
    vector<pair<long long, int>> res;
    for (long long i = 2; i*i <= x; ++i) {
        if (x % i) continue;
        res.emplace_back(i, 0);
        while (x % i == 0) {
            x /= i;
            res.back().second++;
        }
    }
    if (x != 1) res.emplace_back(x, 1);
    return res;
}

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

    ll n;
    cin >> n;
    auto f = factor(n);
    int ans = 0;
    rep(i, sz(f)) {
        int num = 1;
        while (f[i].se - num >= 0) {
            f[i].se -= num;
            num++;
            ans++;
        }
    }
    cout << ans << endl;
}


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

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back

using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;

int main()
{

    //ifstream cin("input.txt");
    //ofstream cout("triangles.out");

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    int dx = tx - sx, dy = ty - sy;

    for (int i = 0; i < dx; ++i) {
        cout << "R";
    }
    for (int i = 0; i < dy; ++i) {
        cout << "U";
    }
    for (int i = 0; i < dx; ++i) {
        cout << "L";
    }
    for (int i = 0; i < dy; ++i) {
        cout << "D";
    }

    cout << "D";
    for (int i = 0; i < dx; ++i) {
        cout << "R";
    }
    cout << "RU";
    for (int i = 0; i < dy; ++i) {
        cout << "U";
    }
    cout << "L";

    cout << "U";
    for (int i = 0; i < dx; ++i) {
        cout << "L";
    }
    cout << "LD";
    for (int i =0 ; i < dy; ++i) {
        cout << "D";
    }
    cout << "R\n";

}


Measured memory_bytes: 384
if __name__ == '__main__':
    n = int(input())
    S = input().split()
    q = int(input())
    T = input().split()
    a = []
    count = 0
    for i in range(q):
        for j in range(n):
            if int(T[i]) == int(S[j]): 
                if T[i] in a: break
                else :
                    a.append(T[i])
                    count += 1
                    break
    print(str(count))


Measured memory_bytes: 6068
A, B, K = map(int, input().split())

cnt = 0
for i in range(K):
    if i % 2 == 0:
        if A % 2 != 0:
            A = (A-1) // 2
        else:
            A //= 2
        B += A

    else:
        if B % 2 != 0:
            B = (B-1) // 2
        else:
            B //= 2
        A += B

    cnt += 1

print(A, B)


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

int main()
{
  int N;
  cin >> N;
  int ans = 0;
  while (N != 0)
  {
    ans++;
    N /= 2;
  }
  cout << pow(2, ans - 1) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
 
inline int next(void) {
    register int ret = 0;
    register int neg = false;
    register int bit = getchar();
    for (; bit < '0'; bit = getchar())
        if (bit == '-')neg ^= true;
    for (; bit >= '0'; bit = getchar())
        ret = ret * 10 + bit - '0';
    return neg ? -ret : ret;
}
 
int n, m;
 
int root;
int cmpk;
 
struct node {
    int id;
    int pos[2];
    int son[2];
    int min[2];
    int max[2];
    inline friend bool operator < 
        (const node &a, const node &b) {
            return a.pos[cmpk] < b.pos[cmpk];
    }
}tree[500005];
 
inline void update(int t) {
    for (int k = 0; k < 2; ++k) {
        tree[t].min[k] = tree[t].max[k] = tree[t].pos[k];
        for (int i = 0, s; i < 2; ++i)if (s = tree[t].son[i]) {
            if (tree[t].min[k] > tree[s].min[k])
                tree[t].min[k] = tree[s].min[k];
            if (tree[t].max[k] < tree[s].max[k])
                tree[t].max[k] = tree[s].max[k];
        }
    }
}
 
int build(int l, int r, int k) {
    int d = (l + r) / 2; cmpk = k;
    nth_element(tree + l, tree + d, tree + r + 1);
    tree[d].son[0] = l == d ? 0 : build(l, d - 1, k ^ 1);
    tree[d].son[1] = r == d ? 0 : build(d + 1, r, k ^ 1);
    return update(d), d;
}
 
inline void build(void) {
    for (int i = 1; i <= n; ++i) {
        tree[i].id = i - 1;
        tree[i].pos[0] = next();
        tree[i].pos[1] = next();
    }
    root = build(1, n, 0);
}
 
int st[2], ed[2], ans[500005], tot = 0;
 
inline bool judge(const node &t) {
    return t.pos[0] >= st[0]
        && t.pos[0] <= ed[0]
        && t.pos[1] >= st[1]
        && t.pos[1] <= ed[1];
}
 
inline bool check(const node &t) {
    return t.min[0] <= ed[0]
        && t.max[0] >= st[0]
        && t.min[1] <= ed[1]
        && t.max[1] >= st[1];
}
 
void query(int t) {
    if (judge(tree[t]))ans[tot++] = tree[t].id;
    if (tree[t].son[0] && check(tree[tree[t].son[0]]))query(tree[t].son[0]);
    if (tree[t].son[1] && check(tree[tree[t].son[1]]))query(tree[t].son[1]);
}
 
inline void query(void) {
    for (int i = 0; i < m; ++i, tot = 0) {
        st[0] = next();
        ed[0] = next();
        st[1] = next();
        ed[1] = next();
        tot = 0;
        query(root);
        sort(ans, ans + tot);
        for (int j = 0; j < tot; ++j)
            printf("%d\n", ans[j]);
        puts("");
    }
}
 
signed main(void) {
    n = next(); build();
    m = next(); query();
    //system("pause");
}

Measured memory_bytes: 20268
#include <bits/stdc++.h>
 
using namespace std;
inline void prep ()
{
  cin.tie (0);
  cin.sync_with_stdio (0);
};
const double pi = acos(-1.);
//printf(%.12lf\n,mid);
// __builtin_popcount(int) count 1's in binary
// get decimal part of number
/*
double intpart;
double thiss = modf((double)(n*m)/(double)k, &intpart);
*/
// round = (int)(num+.5)
long long mod = 1000000007;
 
// 32 mil = ~1 sec 
long long mymod(long long num){
  if (num< 0 && !(num%mod == 0)){
    if (mod == 1){
      return 0;
    }
    return mod-abs(num)%mod;
  }else{
    return num%mod;
  }
}
 
/*string sentence = And I feel fine...;
    istringstream iss(sentence);
*/  
 
double eps = .000000001;
vector<int> graph[100001];
bool colors[100001];
bool vis[100001];
bool good = true;
void color(int node, bool last){
    if (!good){
        return;
    }
    if (vis[node]){
        if (colors[node] != last){
            good = false;
        }
        return;
    }
    vis[node] = true;
    colors[node] = last;
    for (int i : graph[node]){
        color(i, !last);
    }
}
int main ()
{
  prep();
  long long n, m;
  cin >> n >> m;
  
  for (int i=0; i<m; i++){
      int a, b;
      cin >> a >> b;
      graph[a].push_back(b);
      graph[b].push_back(a);
  }
  color(1, 1);
  if (!good){
      cout << n*(n-1)/2-m;
      return 0;
  }
  long long white = 0;
  long long black = 0;
  for (int i=1; i<=n; i++){
      if (colors[i]){
          white++;
      }else{
          black++;
      }
      //cout << colors[i] << " ";
  }
  cout << white*black-m;
  return 0; 
}


Measured memory_bytes: 6272
import heapq as hq


def solve():
    N, M = map(int, input().split())
    pl = list(map(lambda x: int(x)*(-1), input().split()))
    hq.heapify(pl)
    
    for _ in range(M):
        tmp = hq.heappop(pl)
        hq.heappush(pl, (-1)*(-tmp // 2))
    
    print(-sum(pl))
    


if __name__ == '__main__':
    solve()

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

int main() {
	int n, m;
	cin >> n >> m;
	priority_queue<int> q;
	rep(i, n) {
		int j;
		cin >> j;
		q.push(j);
	}
	rep(i, m) {
		int j = q.top(); q.pop();
		q.push(j / 2);
	}
	int64_t o=0;
	rep(i, n) { o += q.top(); q.pop(); }
	cout << o << endl;
}

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


int main(){
  int n;
  cin >> n;
  vector<tuple<string, int, int>> a(n);
  
  for(int i = 0; i < n; i++){
    string s;
    int p;
    cin >> s >> p;
    a.at(i) = make_tuple(s, -p, i+1);
  }
  sort(a.begin(),a.end());
  for(int i = 0; i < n; i++){
    int x = get<2>(a.at(i));
    cout << x << endl;
  }
    
}

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

int main(){
    string s, t;
    cin >> s >> t;
    bool ans = false;

    for(int i = 0; i < s.size(); i++){
        if(s == t){
            ans = true;
            break;
        }
        s = s.back() + s.substr(0, s.size() - 1);
    }
    if(ans){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
// cpp219 - the 712534
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define fs first
#define sc second
#define mp make_pair
using namespace std;
const ll base = 7;
const ll N = 3e5 + 9;
const ll mod = 1e9 + 7;
typedef pair<ll,ll> LL;

ll n,a[N],b[N],i,k;
map<ll,ll> cnt;
int main(){
    ios_base::sync_with_stdio(false);
   	cin.tie(0); cout.tie(0);
    //freopen("test.inp", "r", stdin);
    cin>>n>>k;
    for(i=1;i<=n;i++){
        cin>>a[i];
        b[i] = b[i - 1] + a[i];
    }
    ll ans = 0;
    //cnt[0] = 1;
    for (i=0;i<=n;i++){
        ll p = (b[i] - i)%k;
        ans += cnt[p];
        cnt[p]++;
        if (i >= k - 1){
            ll q = i - k + 1;
            ll s = (b[q] - q)%k;
            cnt[s]--;
        }
    }
    cout<<ans;
}


Measured memory_bytes: 16384
#include<stdio.h>
int main(void)
{
	int a,b,c,d,e,sum,aum,bum;
	sum=0;
	aum=0;
	bum=0;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	scanf("%d",&e);
	if(a<40){
		sum=sum+40;
	}
	if(a>=40){
		aum=aum+a;
	}
	if(b<40){
		sum=sum+40;
	}
	if(b>=40){
		aum=aum+b;
	}
	if(c<40){
		sum=sum+40;
	}
	if(c>=40){
		aum=aum+c;
	}
	if(d<40){
		sum=sum+40;
	}
	if(d>=40){
		aum=aum+d;
	}
	if(e<40){
		sum=sum+40;
	}
	if(e>=40){
		aum=aum+e;
	}
	bum=(aum+sum)/5;
	printf("%d\n",bum);
	return 0;
}


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

int main(){
    string s, t, u;
    ll a, b;
    cin >> s >> t >> a >> b >> u;
    if(s == u) a--;
    if(t == u) b--;
    cout << a << " " << b << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <iomanip>
#include <typeinfo>
#include <iterator>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <set>
using namespace std;


typedef long long       ll;
struct edge { ll to; ll cost; };
typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<string>  vs;
typedef vector<char>    vc;
typedef vector<edge>    ve;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;
typedef vector<ve>      vve;

// マクロ
#define repr(itr, bgn, end) for (ll itr = (ll)bgn; itr < (ll)end; ++itr)
#define rep(itr, end) repr(itr, 0, end)
#define reprrev(itr, bgn, end) for (ll itr = (ll)end - 1; itr >= (ll)bgn; --i)
#define reprev(itr, end) reprrev(itr, 0, end)
#define all(container) container.begin(), container.end()
#define sortall(container) sort(all(container))
#define yn(cond) cond ? (cout << "Yes" << endl) : (cout << "No" << endl)
#define YN(cond) cond ? (cout << "YES" << endl) : (cout << "NO" << endl)

// 定数
#define LLONG_MAX 9223372036854775807
constexpr double PI = 3.14159265358979323846;
constexpr ll INF = 1 << 15;
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-7;

// よく使うもの
constexpr int dy[4] = { 0, 1, 0, -1 };
constexpr int dx[4] = { 1, 0, -1, 0 };


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
	for (T& x : vec) os << x << " ";
	return os;
}

// ***<ここから>****************************************************************

int main(void) {

	int a, b;
	cin >> a >> b;

	if (a > b) a--;

	cout << a << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>

using namespace std;

int main(){
  int i, j, n, m, q, a, b=0, x=0, sum=0;
  vector<int> data;

  cin >> n >> m;

  for(i=0; i<n-1; ++i){
    cin >> q;
    data.push_back(q);
  }

  for(i=0; i<m; ++i){
    cin >> a;

    if(a > 0){
      if(b < 0) ++x;
      for(j=0; j<a; ++j, ++x)
	sum += data[x];
    }else{
      if(b > 0) --x;
      for(j=0; j>a; --j, --x)
	sum += data[x];
    }
    b = a;

    while(sum >= 100000)
      sum -= 100000;
  }

  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 1400
N, M = map(int, input().split())
A = [int(i) for i in input().split()]

s = sum(A)

cnt = 0
for i in range(N) :
  if A[i] * 4 * M >= s :
    cnt += 1

if cnt >= M :
  print('Yes')
else :
  print('No')

Measured memory_bytes: 38384
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
using namespace std;



int main(){
	double a,max=0,min=1000000;
	while(scanf("%lf",&a) != EOF){
		if(a>max) max=a;
		if(a<min) min=a;
	}
	printf("%lf\n",max-min);
	return 0;
}


Measured memory_bytes: 3196
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    ll n; cin >> n;
    // vector<Pll> xy;
    ll ans = LLONG_MAX;
    rep(i,sqrt(n) + 1){
        if(!i)continue;
        if(n%i == 0){
            // xy.push_back(Pll(i, n/i));
            ans = min(ans, (i + n/i - 2));
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
sc = [list(map(int,input().split())) for i in range(m)]

for i in range(1000):
    num = list(str(i))
    if n != len(num):
        continue

    for s,c in sc:
        if num[s-1] != str(c):
            break
    else:
        print(i)
        exit()
    continue



print(-1)

Measured memory_bytes: 9128
#include<bits/stdc++.h>
#include<string>
#include<deque>
#include<iostream>
using namespace std;
#define int long long
#define double long double
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define pb push_back
#define pp() pop_back()
#define V vector
#define P pair
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
#define Q queue
#define all(a)  (a).begin(),(a).end()
#define elif else if

signed main(){
  string s;
  cin>>s;
  int q;
  cin>>q;
  V<char> f,g;
  int rev=1;
  fo(i,q){
    int c;
    cin>>c;
    if(c==1)
      rev++;
    else{
      int d;
      cin>>d;
      char e;
      cin>>e;
      if((d==1&&rev%2==1)||(d==2&&rev%2==0))
        f.pb(e);
      else
        g.pb(e);
    }
  }
  if(rev%2==1){
    rev(f);
    fo(i,f.size()){
      cout<<f[i];
    }
    cout<<s;
    fo(i,g.size()){
      cout<<g[i];
    }
    cout<<endl;
  }
  else{
    rev(s);
    rev(g);
    fo(i,g.size()){
      cout<<g[i];
    }
    cout<<s;
    fo(i,f.size()){
      cout<<f[i];
    }
    cout<<endl;
  }
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
  int i, n[4], beg, fin, time;

  for(i=0;i<4;i++) scanf("%d",&n[i]);
  if(n[0]<n[2]) beg=n[2];
  else beg=n[0];
  if(n[1]<n[3]) fin=n[1];
  else fin=n[3];

  time = fin-beg;
  if(time<0) time=0;
  printf("%d\n",time);

  return 0;
} 


Measured memory_bytes: 128
// +build ignore
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []byte {
	return []byte(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

func gcd(x, y int) int {
	if x%y != 0 {
		return gcd(y, x%y)
	}
	return y
}

func run(input io.Reader, output io.Writer) int {
	sc := NewScanner()
	R := sc.nextInt()

	fmt.Println(float64(R*2) * math.Pi)

	return 0
}

func main() {
	os.Exit(run(os.Stdin, os.Stdout))
}


Measured memory_bytes: 1756
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


x=int(input())

while True:
    if is_prime(x):
        print(x)
        break
    x += 1


    

Measured memory_bytes: 2940
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
x=[]
k=i1()
for s in range(1,10):
 x.append([s/sum(list(map(int, list(str(s))))),s])

for i in range(1,1000):
 for j in range(1,15):
   s=10**j*i+10**j-1
   x.append([s/sum(list(map(int, list(str(s))))),s])

y=sorted(x)
m=0
n=0
for i,j in y:
  if n>k-1:
     break
  if j>10**15:
     break
  if j>m:
     m=j
     print(j)
     n+=1   

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]B - Harshad Number
            var s = Console.ReadLine();
            int N = int.Parse(s);
            int fx = GetFx(s);

            if (N % fx == 0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }

        static int GetFx(string s)
        {
            int sum = 0;

            foreach(var c in s)
            {
                sum += int.Parse(c.ToString());
            }

            return sum;
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
typedef pair<int,int> P;

int dp[3005][3005];
int dp2[3005][3005];
int a[3005];
int b[3005];



int main() {
  int n,t;
  cin >> n >> t;
  for(int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
  }

  for(int i = 1; i <= n; i++) {
    for(int j = 0; j <= t - 1; j++) {
      dp[i+1][j] = max(dp[i+1][j],dp[i][j]);
      dp2[n-i][j] = max(dp2[n-i][j],dp2[n-i+1][j]);
      if(j >= a[i]) {
	dp[i+1][j] = max(dp[i+1][j],dp[i][j-a[i]]+b[i]);
      }
      if(j >= a[n-i+1]) {
	dp2[n-i][j] = max(dp2[n-i][j],dp2[n-i+1][j-a[n-i+1]]+b[n-i+1]);
      }
    }
  }
  int ans = 0;
  for(int i = 1; i <= n; i++) {
    for(int j = 0; j <= t - 1; j++) {
      ans = max(ans,dp[i][j] + dp2[i][t-1-j] + b[i]);
    }
  }


  cout << ans << endl;
}


Measured memory_bytes: 70784
n = int(input())
s = []
count = 0
for i in range(n):
    s1 = list(input())
    s1.sort()
    s1 = "".join(s1)
    s.append(s1)
s.sort()
s2 = list(set(s))
s2.sort()
if len(s) == len(s2):
    print("0")
else:
    j1 = 0
    j2 = 0
    count1 = 0
    while j1 < n and j2 < len(s2):
        if s[j1] == s2[j2]:
            count1 = count1 + 1
            j1 = j1 + 1
        else:
            count = count + int(count1*(count1-1)/2)
            j2 = j2 + 1
            count1 = 0
    count = count + int(count1*(count1-1)/2)
    print(count)

Measured memory_bytes: 66136
#include <iostream>
#include <string>
#include <algorithm>
#include <array>
#include <vector>

bool check(std::string s1, std::string s2, int d)
{
    bool ret = true;
    for (int i = d; i < std::min<int>(s1.length(), s2.length() + d); ++i)
    {
        if (s1[i] != s2[i - d] && s1[i] != '?' && s2[i - d] != '?')
        {
            ret = false;
            break;
        }
    }
    return ret;
}

int main()
{
    std::array<std::string, 3> abc;
    std::cin >> abc[0] >> abc[1] >> abc[2];
    std::array<std::array<std::array<bool, 4001>, 3>, 3> ok;
    std::array<int, 3> arr = {0, 1, 2};
    do
    {
        for (int j = 0; j <= 4000; ++j)
        {
            ok[arr[0]][arr[1]][j] = check(abc[arr[0]], abc[arr[1]], j);
        }
    } while (std::next_permutation(arr.begin(), arr.end()));

    int ans = 6000;
    do
    {
        for (int j = 0; j <= 2000; ++j)
        {
            if (ok[arr[0]][arr[1]][j])
            {
                for (int k = 0; k <= 2000; ++k)
                {
                    if (ok[arr[1]][arr[2]][k])
                    {
                        if (ok[arr[0]][arr[2]][j + k])
                        {
                            ans = std::min<int>(std::max({abc[arr[0]].length(), j + abc[arr[1]].length(), j + k + abc[arr[2]].length()}), ans);
                        }
                    }
                }
            }
        }
    } while (std::next_permutation(arr.begin(), arr.end()));

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

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<iomanip>
#include<sstream>
#include<map>
#include<set>
#include<cmath>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
	std::fill((T*)array, (T*)(array + N), val);
}
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1;i <=n;i++)
#define rrep(i,n) for(int i = n -1;i >= 0;i--)
#define ALL(a) a.begin(),a.end()
typedef long long ll;
typedef long double ld;
const ll INF =  1LL << 60;
const int inf = 1 << 25;
ll n, m, x, y, q, d, z, w,  sum = 0, ans = 0;
const int MAX = 510000;
const int MOD = 1000000007;
vector<int> a, b;
long long fac[MAX], finv[MAX], inv[MAX];
//fac : 階乗 finv 逆元
// テーブルを作る前処理
void COMint() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll PER(int n, int k) {
    if (n < k) return 0;
    if (n < 0 ||k < 0) return 0;
    return (fac[n] * finv[n - k]) % MOD;
}
int main(void) {
    COMint();
	cin >> n >> m;
    rep(i, n + 1) {
        x = (PER(m - i, n - i) * PER(m - i, n - i)) % MOD;
        sum = (COM(n, i) * PER(m, i)) % MOD;
        sum = (sum * x) % MOD;
        if (i % 2 == 0) {
            ans += sum; ans %= MOD;
        }
        else {
            ans = (ans - sum + MOD) % MOD;
            if (ans < 0 && i < 10000) cout << ans << " " << i << endl;
        }
    }cout << ans << endl;
}

Measured memory_bytes: 15548
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<int,int>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int n,g;
    cin>>n>>g;
    g/=100;
    vp vec(n);
    REP(i,n){
        cin>>vec[i].fi>>vec[i].se;
        vec[i].se/=100;
    }
    vvi dp(n+1,vi(g+1,INF));
    dp[0][0]=0;
    REP(i,n){
        REP(j,g+1){
            REP(k,vec[i].fi){
                chmin(dp[i+1][min(g,j+k*(i+1))],dp[i][j]+k);
            }
            chmin(dp[i+1][min(g,j+vec[i].fi*(i+1)+vec[i].se)],dp[i][j]+vec[i].fi);
        }
    }
    REP(i,n+1){
    }
    int ans=INF;
    cout<<dp[n][g]<<endl;
    return 0;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
#define P pair<int,int>
#define All(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
typedef long long ll;
using namespace std;
const int INF = 1e9, MOD = 1e9 + 7;
const ll LINF = 1e18;
int main() {
	int a, b;
	cin >> a >> b;
	if (a % 500 <= b) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
a=input().split(" ")
K,N=[int(i) for i in a]
lst=[int(i) for i in input().split(" ")]
lst1=[]
for i in range(len(lst)):
    lst1.append(lst[i]+K)
lst2=[]
for i in range(len(lst)):
    lst2.append(lst[i]+K*2)
lst=lst+lst1+lst2
dist=[]
for i in range(len(lst)-N):
    dist.append(abs(lst[i]-lst[i+N-1]))
print(min(dist))

Measured memory_bytes: 51436
#include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,n,s) for(int i=s;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a) (a).begin(),(a).end()

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

  ll l,r;
  cin >> l >> r;
  r = min(r, l+4038);
  int ans = 2018;
  for(ll i = l; i <= r; i++) {
    for(ll j = i+1; j <= r; j++) {
      int x = i*j%2019;
      ans = min(ans, x);
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		int t = sc.nextInt();
		
		// 計算
		int result = (t/a)*b;
		
		// 出力
        System.out.println(result);
	}
}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e5+7;
int main()
{
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	printf("%s\n", (a==b)&&(b==c)&&(a==c) ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 256
n = int(input())

arr_d = []
for i in range(1, n+1):
  a = [int(x) for x in input().split()]
  arr_d.append(a)

cnt = 0
ans = 'No'
for i in range(len(arr_d)):
  if arr_d[i][0] == arr_d[i][1]:
    cnt += 1
    if cnt >= 3:
      ans = 'Yes'
      break
  else:
    cnt = 0

print(ans)

Measured memory_bytes: 62492
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;

#define PI 3.14159265359
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repz(i,n) rep(i,0,n)


int main() {
	int k,x;
	cin >> k>>x;
	cout << ((k * 500 >= x) ? "Yes" : "No") << endl;



	return 0;
}

Measured memory_bytes: 888
//
//  main.cpp
//  Algorithm
//
//  Created by hua xiang on 2020/6/4.
//  Copyright © 2020 hua xiang. All rights reserved.
//

#include <iostream>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(int argc, const char * argv[]) {
    int sum = 0;
    char c;
    stack<int> S1;
    stack<pair<int, int>> S2;
    vector<int> ans;
    
    for (int i = 0; cin >> c; i++)
    {
        if (c == '\\')
        {
            S1.push(i);
        }
        else if ((c == '/') && (S1.size() > 0))
        {
            int j = S1.top();
            S1.pop();
            sum += (i - j);
            int a = i - j;
            
            while ((S2.size() > 0) && (S2.top().first > j))
            {
                a += S2.top().second;
                S2.pop();
            }
            
            S2.push(make_pair(j, a));
        }
    }
    
    while (S2.size() > 0)
    {
        ans.push_back(S2.top().second);
        S2.pop();
    }
    
    reverse(ans.begin(), ans.end());
    
    cout << sum << endl;
    cout << ans.size();
    for (int i = 0; i < ans.size(); i++)
    {
        cout << " ";
        cout << ans[i];
    }
    
    cout << endl;
    
    return 0;
}



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

using namespace std;

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

    int n;
    cin >> n;

    vector<array<int , 2> > v(n);
    for (int i = 1 ;i <= n ;i++) {
        int x;
        cin >> x;
        v[i - 1] = {x , i};
    }

    sort(v.begin() , v.end());

    for (auto &c : v)
        cout << c[1] << ' ';
}

Measured memory_bytes: 1664
import std.stdio, std.conv, std.array, std.string;
import std.algorithm;
import std.container;

void main() {
  int a, b;
  readf("%d %d\n", &a, &b);

  if (b == 1) {
    writeln("0");
  } else {
    int increase = a - 1;
    int add_count = b - 1;
    int count = add_count / increase + ((add_count % increase) > 0 ? 1 : 0);
    writeln(count);
  }
}


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

using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define reps(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define allsort(v) sort(v.begin(),v.end())
const ll mod = 1e9 + 7;
const int inf = 1e9;

int main() {
	cin.sync_with_stdio(false);
	int N;
	cin >> N;
	vector<int>L(2*N);
	for (auto &x : L)cin >> x;
	allsort(L);
	int ans = 0;
	rep(i, N) {
		ans += L[2*i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define ll long long int
#define inf 1450000090
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define sd(x) scanf("%d",&x)
#define sd2(x,y) scanf("%d%d",&x,&y)
#define sdl(x) scanf("%lld",&x)
#define nax 100010
#define mp make_pair
#define sz(x) (int)(x.size())
#define pl pair <ll , ll>
#define pii pair < int , pair <int ,int > >
#define MOD 1000000007
using namespace std;
int main(int argc, char const *argv[])
{
  //freopen("input.txt","read",stdin);
  //freopen("output.txt","write",stdout);
  string a,b;
  cin >> a >> b;
  int l1 =  a.length();
  int l2 = b.length();
  string ans = "";
  int ptr1 = 0;
  int ptr2 = 0;
  while(1)
  {
  		if(ptr1 < l1)
  		{
  			ans+=a[ptr1];
  			ptr1++;
  		}
  		if(ptr2<l2)
  		{
  			ans+=b[ptr2];
  			ptr2++;
  		}
  		//ptr1++;
  		//ptr2++;
  		if(ptr1==l1 && ptr2 == l2)
  			break;
  }
  cout<<ans << '\n';
  return 0;
}

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

int N;

int F(int n) {
  return n ? n/5 + F(n/5) : 0;
}

signed main() {
  cin >> N;
  if (N%2){
    puts("0"); 
    return 0;
  }
  cout << F(N/2) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define lowbit(x) ((x)&(-(x)))
#define mid ((l+r)>>1)
#define lson rt<<1, l, mid
#define rson rt<<1|1, mid+1, r
using namespace std;
string s;
ll k;
vector<int> v;
int main()
{
    v.clear();
	cin>>s>>k;
	int cur = 1;
	for(int i = 1; i < s.size(); ++i){
        if(s[i] != s[i-1]){
            v.push_back(cur);
            cur = 1; continue;
        }
        else{
            cur++;
        }
	}v.push_back(cur);
	if(v.size() == 1){
        ll ans = v[0]*k/2;
        cout<<ans<<endl;
	}
	else if(s[0] != s[s.size()-1]){
        ll ans = 0;
        for(int i = 0; i < v.size(); ++i) ans += v[i]/2;
        ans *= k;
        cout<<ans<<endl;
	}
	else{
        ll ans = 0;
        for(int i = 1; i < v.size()-1; ++i){
            ans += v[i]/2;
        }
        ans *= k;
        ans += (v[0] + v[v.size()-1])/2 * (k-1);
        ans += v[0]/2;
        ans += v[v.size()-1]/2;
        cout<<ans<<endl;
	}
}


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

using namespace std;

int l, r;
set<int> modNums;
vector<int> modNumsVec;
int findMin() {

    int minVal = 1e9;
    for (auto i : modNumsVec) {
        for (auto j : modNumsVec) {
            if (j==i) continue;
            minVal = min((i*j)%2019, minVal);
            // printf("(%d, %d)->minVal %d\n", i, j, minVal);
        }
    }

    return minVal;
}

int main() {
    cin>>l>>r;

    for (int i=l;i<=r;i++) {
        modNums.insert(i%2019);
        if (modNums.size()==2019) break;
    }
    
    for (auto n : modNums) {
        modNumsVec.push_back(n);
        // cout<<n<<" ";
    }
    cout<<findMin();
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int n;
  while(1){
    cin>>n;
    if(n==0)break;
    vector<string> s(n);
    vi m(n);
    vector<vi> d(n,vi(31,0)); 
    rep(i,n){
      cin>>s[i];
      cin>>m[i];
      rep(j,m[i]){
	int t;
	cin>>t;
	d[i][t]++;
      }
    }
    pii ans[20];
    rep(i,31){
      int sum=0;
      rep(j,n)sum+=d[j][i];
      rep(j,n)if(d[j][i]){
	ans[j].first+=n-sum+1;
      }
    }
    rep(i,n)ans[i].second=i;
    sort(ans,ans+n);
    int z=0;
    for(i=1;i<n;i++){
      if(ans[z].first!=ans[i].first)break;
      if(s[ans[z].second]>s[ans[i].second])z=i;
    }
    cout<<ans[z].first<<" "<<s[ans[z].second]<<endl;
  }
}

Measured memory_bytes: 3124
//#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>

using namespace std;

#define _ << " " <<
#define pb push_back
#define ff first
#define ss second


typedef long long ll;
typedef long double ld;

#define int ll

const int MAXH = 2e5 + 5;

void solve() {
    int h, w, n;
    cin >> h >> w >> n;
    swap(w, h);
    vector< vector<int> > v(h + 5, vector<int> {w + 1});
    set<pair<int, int> > p;
    int x, y;
    for (int i = 0; i < n; ++i) {
        cin >> x >> y;
        v[y].pb(x);
        p.insert({x, y});
    }
    for (int i = 0; i <= h + 1; ++i) {
        sort(v[i].begin(), v[i].end());
    }
    x = y = 1;
    int ans = -1;
    int turn = 0;
    int tmp = 0;
    while (true) {
        if (turn == 0) {
            if (x == w || p.count({x + 1, y}) == 1) {
                if (ans == -1) ans = tmp + 1;
                else ans = min(ans, tmp + 1);
                break;
            }
            ++tmp;
            ++x;
        } else {
            int mn = *lower_bound(v[y].begin(), v[y].end(), x);
            if (ans == -1 || ans > tmp + mn - x) {
                ans = tmp + mn - x;
            }
            if (y < h && p.count({x, y + 1}) == 0) ++y;
        }

        turn = (turn + 1) % 2;
        //cout << x _ y _ ans _ tmp << endl;
    }
    cout << ans;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    //freopen("out.txt", "r", stdin);
    //freopen("dominoes.out", "w", stdout);
    int test = 1;
    //cin >> test;
    while (test--) {
        solve();
    }
}


Measured memory_bytes: 25728
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a) for(ll i=0;i<a;i++)
#define jkl ll debug = 0;
#define RREP(i,a) for(ll i=a;i>0;i--)
#define rrep(i,a,b) for(ll i=a-1;i>=b;i--)
#define printall(n,array) {for(ll i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
#define mp make_pair
typedef long long ll;
typedef pair<ll, ll> Pi;
typedef pair<ll, Pi> V;
typedef vector<ll> VE;
const ll mod = 1e9 + 7; //10^9+7

ll n, a, b, c;
VE l;
ll dfs(ll num, ll nowa, ll nowb, ll nowc){
    if(num == n){
        if( nowa == 0 || nowb == 0 || nowc == 0 ) return mod;
        return abs(nowa - a) + abs(nowb - b) + abs(nowc - c) - 30;
    }
    ll cost1 = dfs(num + 1, nowa + l[num], nowb, nowc) + 10;
    ll cost2 = dfs(num + 1, nowa, nowb + l[num], nowc) + 10;
    ll cost3 = dfs(num + 1, nowa, nowb, nowc + l[num]) + 10;
    ll cost4 = dfs(num + 1, nowa, nowb, nowc);
    return min({cost1, cost2, cost3, cost4});
}

int main() {
    cin >> n >> a >> b >> c;
    l.resize(n);
    REP(i, n)cin >> l[i];
    print(dfs(0, 0, 0, 0));
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int a=count(s.begin(),s.end(),'a');
    int b=count(s.begin(),s.end(),'b');
    int c=count(s.begin(),s.end(),'c');
    int m=min(a,min(b,c));
    a-=m,c-=m,b-=m;
    if(a>1||b>1||c>1){
        cout<<"NO\n";
    }
    else {
        cout<<"YES\n";
    }
}


Measured memory_bytes: 512
S = input()
x, y = map(int, input().split())

S = S.split("T")
X_move = [len(s) for s in S[0::2]]
Y_move = [len(s) for s in S[1::2]]

x -= X_move[0]
X_move = sorted(X_move[1:])
Y_move = sorted(Y_move)

while X_move:
    mx = X_move.pop()
    if x >= 0:
        x -= mx
    else:
        x += mx

while Y_move:
    my = Y_move.pop()
    if y >= 0:
        y -= my
    else:
        y += my

if x == 0 and y == 0:
    ans = "Yes"
else:
    ans = "No"

print(ans)


Measured memory_bytes: 3188
import java.util.Scanner;

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

        if (x == y) {
            System.out.println(-1);
        } else if (x % y == 0) {
            System.out.println(-1);
        } else {
            System.out.println(x*y+x);
        }
    }
}

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

int main(){
  while(true){
    long long m,n,MAX=7368795;
    cin>>m>>n;
    if(m==0&&n==0) break;
    bool is_prime[MAX];
    int i=0;
    fill(is_prime,is_prime+MAX,true);
    while(n>0||is_prime[i]==false){
      if(is_prime[i]){
        n--;
        for(int j=1;j*(i+m)<MAX;j++){
          is_prime[j*(i+m)-m]=false;
        }
      }
      i++;
    }
    cout<<i+m<<endl;
  }
  return 0;
}

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

#define int long long
#define uint unsigned long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end());
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint=vector<int>;
using vvint=vector<vint>;
using pint=pair<int, int>;
using vpint=vector<pint>;
template<typename T> using priority_queue_rev=priority_queue<T, vector<T>, greater<T>>;
constexpr double pi = 3.1415926535897932384626433832795028;
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T1, typename T2> bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> bool chmin(T1 &a, const T2 &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct Setup {
    static constexpr int PREC = 20;
    Setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int L;
int A[220000];
signed main() {
    cin >> L;
    rep(i, L) { cin >> A[i]; }
    vvint dp(L + 1, vint(5, LLONG_MAX));
    rep(i, 5) { dp[0][i] = 0; }
    rep(i, L) {
        rep(j, 5) {
            for (int k = j; k < 5; k++) {
                int cost;
                if (k == 0 || k == 4) {
                    if (A[i] == 0) { cost = 0; }
                    else if (A[i] & 1) { cost = A[i]; }
                    else { cost = A[i]; }
                }
                if (k == 1 || k == 3) {
                    if (A[i] == 0) { cost = 2; }
                    else if (A[i] & 1) { cost = 1; }
                    else { cost = 0; }
                }
                if (k == 2) {
                    if (A[i] == 0) { cost = 1; }
                    else if (A[i] & 1) { cost = 0; }
                    else { cost = 1; }
                }
                chmin(dp[i + 1][k], dp[i][j] + cost);
            }
        }
    }
    cout<<*min_element(all(dp[L]))<<endl;

}

Measured memory_bytes: 15872
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
const int mod=1000000007 ;

void solve(){
	
	char c ;
	cin>>c ;
	cout<<char(c+1) ;
	
}

int main(){
	
	int y ;

	y=1 ;
	//cin>>y ;

	while(y--)
	{	
		solve() ;
	}

}

Measured memory_bytes: 3524
N, A, B = map(int, input().split())
S = list(input())

cnt = A + B
Bcnt = B

for i in range(len(S)):
    if S[i] == 'a' and cnt > 0:
        print('Yes')
        cnt -= 1
    elif S[i] == 'b' and cnt > 0 and Bcnt > 0:
        print('Yes')
        cnt -= 1
        Bcnt -= 1
    else:
        print('No')

Measured memory_bytes: 9872
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

def main():
    n,q=map(int,input().split())
    c=list(map(int,input().split()))
    lr=[list(map(int,input().split())) for i in range(q)]

    # Binary Indexed Tree (Fenwick Tree)
    class BIT:
        def __init__(self, n):
            self.n = n
            self.data = [0]*(n+1)
            self.el = [0]*(n+1)
        # [1,i]の足し算
        def sum(self, i):
            s = 0
            while i > 0:
                s += self.data[i]
                i -= i & -i
            return s
        def add(self, i, x):
            # assert i > 0
            self.el[i] += x
            while i <= self.n:
                self.data[i] += x
                i += i & -i
        # [i,j]の足し算
        def get(self, i, j=None):
            if j is None:
                return self.el[i]
            return self.sum(j) - self.sum(i-1)

    for i in range(q):
        lr[i].append(i)
    last=[-1]*(n+1)
    bi=BIT(n)
    lr.sort(lambda x: x[1])
    now=0

    anslst=[-1]*q
    for i in range(q):
        l,r,j=lr[i]
        while now!=r:
            now+=1
            if last[c[now-1]]!=-1:
                bi.add(last[c[now-1]],-1)
            last[c[now-1]]=now
            bi.add(last[c[now-1]],1)
        # print(last)
        # print(bi.el)
        # print(bi.get(l,r))
        anslst[j]=bi.get(l,r)

    for i in range(q):
        print(anslst[i])

main()

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

PRIME = 10**9 + 7
H, W = list(map(int, input().split()))

data = [[True for _ in range(W)] for _ in range(H)]
for h in range(H):
    S = input()
    for w, char in enumerate(S):
        if char == '#':
            data[h][w] = False

def isFloor(h, w):
    return 0 <= h < H and 0 <= w < W and data[h][w]

dp = [[0 for _ in range(W)] for _ in range(H)]
dp[0][0] = 1

for h in range(H):
    for w in range(W):
        if not isFloor(h, w):
            continue
        if isFloor(h-1, w) and isFloor(h, w-1):
            dp[h][w] = dp[h-1][w] + dp[h][w-1]
        elif isFloor(h-1, w):
            dp[h][w] = dp[h-1][w]
        elif isFloor(h, w-1):
            dp[h][w] = dp[h][w-1]
        dp[h][w] %= PRIME

print(dp[H-1][W-1])


Measured memory_bytes: 64860