akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<math.h>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;

int main() {

	int N, L;
	cin >> N >> L;

	vector<int>taste;
	int sum = 0;

	for (int i = 1; i <= N; i++) {
		taste.push_back(L + i - 1);
		sum += L + i - 1;
	}


	int min = 1000000;

	int sum3;

	for (int i = 0; i < N; i++) {
		int sum2 = 0;
		for (int j = 0; j < N; j++) {
			if (j != i) {
				sum2 += taste[j];
			}
		}
		if (abs(sum2-sum)<min) {
			min = abs(sum-sum2);
			sum3 = sum2;
		}
	}

	cout << sum3 << endl;

	return 0;

}

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

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

    int n, q;
    cin >> n >> q;

    string s;
    cin >> s;

    vector<int> ac(n, 0);
    int cnt = 0;
    REP(i, n - 1) {
        ac[i] = cnt;
        if (s[i] == 'A' && s[i + 1] == 'C')
            cnt++;
    }
    ac[n - 1] = cnt;

    REP(i, q) {
        int l, r;
        cin >> l >> r;
        cout << ac[r - 1] - ac[l - 1] << '\n';
    }
    return 0;
}


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

using namespace std;

typedef vector<int> V;

int main() {
    int n, m;
    cin >> n >> m;
    V mm = V(m);
    for (int i = 0; i < n; i++) {
        int k;
        cin >> k;
        for (int j = 0; j < k; j++) {
            int a;
            cin >> a;
            ++mm[a-1];
        }
    }
    int c = 0;
    for (int i = 0; i < m; i++) {
        if (mm[i] == n) {
            ++c;
        }
    }
    cout << c << "\n";
}

Measured memory_bytes: 256
package main

import(
  "fmt"
)

func main() {
  var n, a, b int
  fmt.Scan(&n, &a, &b)
  fmt.Print(n/(a+b)*a + min(n%(a+b), a))
}

func min(x, y int) int {
  if x>=y {
    return y
  }else {
    return x
  }
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<cstring>

bool canCreateM(const std::vector<int>& A,const int m){
	bool dp[A.size()+1][m+1];
	int n=A.size();
	memset(dp,0,sizeof(dp));
	dp[0][0]=true;
	for(int i=0;i<n;i++){
		for(int j=0;j<=m;j++){
			dp[i+1][j]|=dp[i][j];
			if(j>=A[i]) dp[i+1][j]|=dp[i][j-A[i]];
		}
	}
	return dp[n][m];

}

int main(void){
    int n,q;
	std::vector<int> A;
	std::cin>>n;
	A.resize(n);
	for(int i=0;i<n;i++) std::cin>>A[i];
	std::cin>>q;
	while(q--){
		int m;
		std::cin>>m;
		std::cout<<(canCreateM(A,m)?"yes":"no")<<std::endl;
	}
	return 0;
}



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

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

typedef long long ll;

const int INF = 2e9 + 5;
const int alength=100100;

int main() {
	ll n,a,b;
	cin>>n>>a>>b;
	if(a>b||(a!=b&&n==1)){
		cout<<0;
		return 0;
	}
	cout<<(b-a)*(n-2)+1;
}

Measured memory_bytes: 3624
def floor_linear_sum(n,m,a,b):
    """
    returns sum((a*i+b)//m for i in range(n))
    """
    res = 0
    while True:
        if a >= m:
            res += (n-1)*n*(a//m)//2
            a %= m
        if b >= m:
            res += n * (b//m)
            b %= m

        y_max = (a*n+b)//m
        if y_max == 0:
            return res
        nx_max = b - y_max*m
        res += (n + nx_max//a)*y_max
        n,m,a,b = y_max, a, m, nx_max%a

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

T = int(readline())
m = map(int,read().split())
for t in zip(m,m,m,m):
    print(floor_linear_sum(*t))


Measured memory_bytes: 98892
#include <iostream>
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main(void)
{
    int n;
    cin >> n;

    string s;
    cin >> s;

    ll r = 0, g = 0, b = 0;

    rep(i, n)
    {
        switch (s[i])
        {
        case 'R':
            r++;
            break;
        case 'G':
            g++;
            break;
        case 'B':
            b++;
            break;
        }
    }

    ll ans = r * g * b;

    rep(i, n)
    {
        for (int j = 1; i + j * 2 < n; ++j)
        {
            ll tj = i + j, tk = i + 2 * j;
            if (s[i] != s[tj] && s[i] != s[tk] && s[tj] != s[tk])
                ans--;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3640
n = int(input())
c = [int(input()) for _ in range(n)]
mod = 10 ** 9 + 7
MAX = 2 * 10 ** 5

cc = []
prev = 0
for e in c:
    if e != prev:
        cc.append(e)
        prev = e

ln = len(cc)

dp = [0] * (ln + 1)
dp[0] = 1
acc = [0] * (MAX + 1)

for i, e in enumerate(cc, 1):
    dp[i] = dp[i-1] + acc[e]
    dp[i] %= mod

    acc[e] += dp[i-1]
    acc[e] %= mod

print(dp[ln])


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

int main() {
  int A,B,C;cin>>A>>B>>C;
  if(A<=C && C<=B) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-10;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
int dx[] = { -1, 0, 1, 0 }; int dy[] = { 0, 1, 0, -1 };
bool valid(int x, int y, int h, int w) { return (x >= 0 && y >= 0 && x < h&&y < w); }
int place(int x, int y, int w) { return w*x + y; }

/*--------------------template--------------------*/

int n, m;
string ans;
vs fld;
void solve(int x, int y, int d)
{
	bool f = true;
	REP(i, n)REP(j, m) if (fld[i][j] == 'o') f = false;
	if (f)
	{
		cout << ans << endl;
		return;
	}
	for (int i = -1; i <= 1; i++)
	{
		int dir = (i+d+4)%4;
		int dirx = dx[dir], diry = dy[dir];
		int tx = x, ty = y;
		int nx, ny;
		while (1)
		{
			tx += dirx, ty += diry;
			if (!valid(tx, ty, n, m)) goto next;
			if (fld[tx][ty] == 'o')
			{
				nx = tx, ny = ty;
				break;
			}
		}
		fld[nx][ny] = '.';
		if (dir == 0) ans += 'U';
		if (dir == 1) ans += 'R';
		if (dir == 2) ans += 'D';
		if (dir == 3) ans += 'L';
		solve(nx, ny, dir);
		fld[nx][ny] = 'o';
		ans.pop_back();
	next:;
	}
}

int main()
{
	cin >> n >> m;
	fld.resize(n);
	REP(i, n) cin >> fld[i];
	int sx, sy, d;
	REP(i, n)REP(j, m)
	{
		if (fld[i][j] == 'U') d = 0;
		else if (fld[i][j] == 'R') d = 1;
		else if (fld[i][j] == 'D') d = 2;
		else if (fld[i][j] == 'L') d = 3;
		else continue;
		sx = i, sy = j;
		fld[sx][sy] = '.';
	}
	solve(sx, sy, d);
	return 0;
}

Measured memory_bytes: 3208
#include<bits/stdc++.h>
using namespace std;
typedef long long giant;
inline char nchar() {
	static const int bufl=1<<20;
	static char buf[bufl],*a=NULL,*b=NULL;
	return a==b && (b=(a=buf)+fread(buf,1,bufl,stdin),a==b)?EOF:*a++;
}
template<class T> inline T read() {
	T x=0,f=1;
	char c=nchar();
	for (;!isdigit(c);c=nchar()) if (c=='-') f=-1;
	for (;isdigit(c);c=nchar()) x=x*10+c-'0';
	return x*f;
}
const int q=1e9+7;
inline int Plus(int x,int y) {return x+y>=q?(x+y-q):(x+y);}
inline int Sub(int x,int y) {return x<y?(x-y+q):(x-y);}
inline int Multi(int x,int y) {return 1ll*x*y%q;}
inline int& Pe(int &x,int y) {return x=Plus(x,y);}
inline int& Se(int &x,int y) {return x=Sub(x,y);}
inline int& Me(int &x,int y) {return x=1ll*x*y%q;}
const int maxn=1e5+10;
int n,axt[maxn],bxt[maxn];
giant A,B,a[maxn];
class arr {
public:
	int c[maxn],tic[maxn],tim,now;
	arr ():tim(0),now(0) {
		memset(c,0,sizeof c);
		memset(tic,0,sizeof tic);
	}
	inline int& C(int x) {
		if (tic[x]!=tim) tic[x]=tim,c[x]=0;
		return c[x];
	}
	void clear() {
		++tim;
	}
	void flow() {
		--now;
		C(now)=C(now+1);
	}
} f[2];
int main() {
	n=read<int>(),A=read<giant>(),B=read<giant>();
	generate_n(a+1,n,read<giant>);
	if (n==1) return puts("2"),0;
	for (int i=n,j=n+1,k=n+1;i>0;--i) {
		for (;a[j-1]-a[i]>=A;--j);
		for (;a[k-1]-a[i]>=B;--k);
		axt[i]=j,bxt[i]=k;
	}
	f[0].c[n+1]=f[1].c[n+1]=1;
	f[0].now=f[1].now=n+1;
	for (int i=n-1;i>0;--i) {
		f[0].flow(),f[1].flow();
		int fir=f[1].C(axt[i]);
		int sec=f[0].C(bxt[i]);
		if (axt[i]!=i+1) f[0].clear();
		Pe(f[0].C(i+1),fir);
		if (bxt[i]!=i+1) f[1].clear();
		Pe(f[1].C(i+1),sec);
	}
	int ans=0;
	for (int i=0;i<2;++i) {
		f[i].flow();
		Pe(ans,f[i].C(1));
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main()
{
  char b;
  cin >> b;
  if (b =='A')
  {
    cout << "T" << endl;
  }
  if (b =='T')
  {
    cout << "A" << endl;
  }
  if (b =='G')
  {
    cout << "C" << endl;
  }
  if (b =='C')
  {
    cout << "G" << endl;
  }
}

Measured memory_bytes: 256
M = 10**9+7
def comb(n, r):
    x = 1
    y = 1
    for i in range(r):
        x *= n - i
        x %= M
        y *= (i + 1)
        y %= M 
    return x * pow(y, M-2, M) % M

n, a, b = map(int, input().split())

print((pow(2, n, M) - comb(n, a) - comb(n, b) - 1 ) % M)

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

int main(){
  int n,m;
  cin >> n >> m;
  int mat[100][100]={{}},vec[100]={};
  for(int i=0;i<n;i++){
    for(int j=0;j<m;j++){
      cin >> mat[i][j];
    }
  }
  for(int i=0;i<m;i++){
    cin >> vec[i];
  }
  for(int i=0;i<n;i++){
    int x=0;
    for(int j=0;j<m;j++){
      x+=vec[j]*mat[i][j];
    }
    cout << x << endl;
  }
  return 0;
}

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

int main()
{
    string s;
    while(cin >> s)
    {
        bool valid = s[0] == 'A';
        if(valid)
        {
            int c = 0;
            for(int i = 1; c < 2 && valid && i < s.size(); i++)
            {
                if(i > 1 && i + 1 < s.size() && s[i] == 'C')
                    c++;
                else if(isupper(s[i]))
                    valid = 0;
            }
            valid = valid && (c == 1);
        }

        if(valid)
            cout << "AC" << endl;
        else
            cout << "WA" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#if defined(DAIJOBU)
#include "/home/ichigo/includes.hpp"
#include "/home/ichigo/debug.hpp"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}

using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int main(){
	FIO
	
	int a, b;
	cin >> a >> b;
	cout << (a + b) % 24 << '\n';
	return 0;
}


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

int main(){
    int n, r;
    int maxv, minv;
    
    cin >> n;
 
    int count = 1;
    cin >> minv;
    while(count <= n - 1){
        cin >> r;
        if(maxv < (r - minv) || count == 1){
            maxv = r - minv;
        }
        if(minv > r){
            minv = r;
        }
        
        count++;
    }
    
    cout << maxv << endl;
}


Measured memory_bytes: 3116
#pragma GCC optimize("O3", "unroll-loops")
#include <bits/stdc++.h>

using namespace std;
string s;
long long ans = 0, cnt = 0;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> s;
	for (int i = 0; i < (int)s.size(); i++)
		if (s[i] == 'W')
			ans += (i - cnt++);
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 720
#include<stdio.h>
int main() {
	int a=0, b=0,c=0;
	scanf("%d %d %d", &a, &b,&c);
	if (a < b && b < c) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
	return 0;
}


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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int r,g; cin >> r >> g;
  int ans = 2*g-r;

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


Measured memory_bytes: 3636
#include <iostream>

using namespace std;

int main(){
  string s;
  int cnt = 0;
  cin >> s;
  int c[256] = {0};
  for(int i = 0; i < 4; i ++)
    c[s[i]] ++;
  for(int i = 0; i < 256; i++){
    if(c[i] % 2 == 1){
      cout << "No";
      return 0;
    }
    if(c[i] != 0) cnt++;
  }
  if(cnt != 2)
    cout << "No";
  else
    cout << "Yes";
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

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

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }

std::vector<ll> Get(ll x) {
  std::vector<ll> rtn;
  for(int i=1; i<=std::sqrt(x); i++) {
    if ( x % i == 0 ) {
      rtn.push_back(i);
      if ( x/i != i ) rtn.push_back(x/i);
    }
  }
  return rtn;
}

ll sol( std::vector<ll> &a ) {
  std::vector<bool> b (sz(a));
  rep(i, sz(a)) b[i] = true;
  rep(i, sz(a)){
    if( b[ i ] ) {
      for(int j=i+1; j<sz(a); j++) {
        if ( gcd(a[j],a[i]) != 1 ) b[ j ] = false;
      }
    }
  }
  ll ans = 0;
  rep(i,sz(a)) if (b[i]) ans++;
  return ans;
}


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  ll A, B; std::cin >> A >> B; 

  ll M = gcd(A,B);
  auto m = Get(M); std::sort( all(m) );

  std::cout << sol(m) << std::endl; 
  return 0;
}


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

int main(void) {
  int N;
  cin >> N;
  vector<int> P(N), Q(N);
  int a = 0, b = 0;
  for (int i = 0; i < N; i++) {
    cin >> P[i];
  }
  for (int i = 0; i < N; i++) {
    cin >> Q[i];
  }
  vector<int> index(N);
  iota(index.begin(), index.end(), 1);
  int cnt = 1;
  do {
    if (P == index) a = cnt;
    if (Q == index) b = cnt;
    cnt++;
  } while (next_permutation(index.begin(), index.end()));
  cout << abs(a - b) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
const int INF = 1e9;
const LL MOD = 1e9 + 7;

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;}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int len_s = s.size();
  VLL a(len_s+1, -1LL);
  if (s[0] == '<')
  {
    a[0] = 0LL;
    REP2(i, 1, len_s+1)
    {
      if (s[i] == '>') break;
      else a[i] = a[i-1] + 1LL;
    }
  }
  if (s[len_s-1] == '>')
  {
    a[len_s] = 0;
    REPR(i, len_s-1)
    {
      if (s[i] == '<') break;
      else a[i+1] = a[i+2] + 1LL;
    }
  }
  REP(i, len_s-1)
  {
    if (s[i] == '>' && s[i+1] == '<')
    {
      a[i+1] = 0LL;
      REPR(j, i)
      {
        if (s[j] == '<') break;
        else a[j+1] = a[j+2] + 1LL;
      }
      REP2(j, i+2, len_s+1)
      {
        if (s[j] == '>') break;
        else a[j] = a[j-1] + 1LL;
      }
    }
  }
  LL ans = 0LL;
  REP(i, len_s+1)
  {
    if (a[i] == -1 && 0 < i && i < len_s-1) a[i] = max(a[i+1], a[i-1]) + 1LL;
    else if (a[i] == -1 && i == 0) a[i] = a[i+1] + 1LL;
    else if (a[i] == -1 && i == len_s-1) a[i] = a[i-1] + 1LL;
    ans += a[i];
  }
  cout << ans << endl;

  return 0;
}


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

int main() {
    int k, a, b;
    cin >> k >> a >> b;
    string ans = "NG";
    for (int i=a;i<=b;i++) {
        if (i % k == 0) {
            ans = "OK";
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a.at(i);
	int ans = 1000000000;
	for(int k = -100; k <= 100; k++){
		int sum = 0;
		rep(i,n) sum += (a.at(i) - k) * (a.at(i) - k);
		ans = min(ans, sum);
	}
	cout << ans << endl;
}


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

int main() {

	int N;
	scanf("%d", &N);
	int ans = 0;
    for(int i = 1; i <= N; i++) {
        int t = i, cnt = 0;
        while(t) {
            t /= 10;
            cnt++;
        }
        if(cnt%2) ans++;
    }
    printf("%d", ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

ll d[4][2] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}};

struct S {
    ll y, x, cnt;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    ll h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i, h) cin >> s[i];
    ll ans = 0;
    rep(i, h) {
        rep(ii, w) {
            if (s[i][ii] == '#') continue;
            ll tmp = 0;
            vector<vector<ll>> dist(h, vector<ll>(w, LONG_LONG_MAX));
            queue<S> q;
            q.push((S){i, ii, 0});
            dist[i][ii] = 0;
            while(!q.empty()) {
                S pos = q.front(); q.pop();
                rep(iii, 4) {
                    ll nx = d[iii][0] + pos.x;
                    ll ny = d[iii][1] + pos.y;
                    ll ncnt = pos.cnt + 1;
                    if ((nx < 0) || (nx >= w) || (ny < 0) || (ny >= h) || (s[ny][nx] == '#')) continue;
                    if (dist[ny][nx] <= ncnt) continue;
                    tmp = max(tmp, ncnt);
                    dist[ny][nx] = ncnt;
                    q.push((S){ny, nx, ncnt});
                    // printf("(%lld, %lld)->(%lld, %lld)[%lld]\n", i, ii, ny, nx, ncnt);
                }
            }
            ans = max(ans, tmp);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる



int main() {
  int n,m;
  cin>>n>>m;
  
  int s = 123456;
  int d = 0;
  
  vector<bool> p(n,false);
  rep(i,m){
  int a,b;
  cin >> a >> b;
    d=max(d,a);
    s=min(s,b);
  }

  
  cout << max(s-d+1,0) << endl;
}


Measured memory_bytes: 256
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    x, y = list(map(int, input().rstrip('\n').split()))
    d = collections.defaultdict(list)
    if x % y == 0:
        print(-1)
    else:
        print(x)


if __name__ == '__main__':
    slove()


Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#define ll long long int

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n, res = 0LL, a;
    cin >> n;
    while(n--){
        cin >> a;
        while(a%2== 0){
            res++;
            a /= 2;
        }
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 256
program alphabet
	implicit none
    integer:: i
    character(len=1)::x
    character(len=26),parameter :: large='ABCDEFGHIJKLMNOPQRSTUVWXYZ'

	read(*,fmt='(a)') x
    
    do i = 1, 26
    	if ( x==large(i:i) ) then
    		write(*,fmt='(a)') 'A'
    	    stop
        end if 
    end do
    write(*,fmt='(a)') 'a'
    stop
end program alphabet




Measured memory_bytes: 2932
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
 
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
 
using namespace std;
//using namespace __gnu_pbds;
 
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> myds;
 
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define int long long int
#define F first
#define S second
#define vec(x) vector<x> 
#define pi(x,y) pair<x,y>
#define pqq(x) priority_queue<x> 
#define min_heap(x) priority_queue<x, vector<x>, greater<x> >
#define all(x) x.begin(),x.end()
#define rep(i,x,y) for(int i=x;i<y;i++)
#define repd(i,x,y,k) for(int i=x;i<y;i+=k)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define rev(x) reverse(all(x))
#define uniq(x) x.resize(distance(x.begin(),unique(all(x))))
#define full(x,a) memset(x,a,sizeof(x))
#define lcm(x,y) ((x*y)/__gcd(x,y))
#define mod 1000000007
#define bitcount __builtin_popcountll
#define pb push_back
//#define indexof order_of_key
//#define valueat find_by_order
 
int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
int dxx[8]={0,0,1,-1,-1,-1,1,1};
int dyy[8]={1,-1,0,0,-1,1,1,-1};
 
int gcdextended(int a,int b,int &x,int &y){if(!a){x=0,y=1;return b;}int x1,y1;int ans=gcdextended(b%a,a,x1,y1);x=y1-(b/a)*x1;y=x1;return ans;}
int inv(int a){int x,y;int ans=gcdextended(a,mod,x,y);return(x%mod+mod)%mod;}
int nCr(int n,int k){int res=1;k=(k>n-k)?n-k:k;rep(i,0,k){res*=(n-i);res/=(i+1);}return res;}
int POW(int x,int y){int res=1;x=x%mod;while(y>0){if(y&1)res=(res%mod*x)%mod;y=y>>1;x=(x*x)%mod;}return res;}
//void seive(){prime[0]=0;prime[1]=0;rep(i,2,10002)prime[i]=1;for(int i=2;i*i<=10000;i++){if(prime[i]){for(int j=i*i;j<=10000;j+=i)prime[j]=0;}}} 

int x,y,z;

void input(){
    cin>>x>>y>>z;
}

void solve(){
    if(x+y+z>=22)
        cout<<"bust"<<endl;
    else
        cout<<"win"<<endl;
}

main(){
    fastio;
    int t;
    t=1;
    while(t--){
        input();
        solve();
    }
}

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

int main(void) {
    int n, i, j;
    int cnt;
    char words[100][11];

    scanf("%d", &n);

    for (i = 0; i < n; i++) {
        scanf("%s", words[i]);
    }

    for (i = 1; i < n; i++) {
        if (words[i][0] != words[i - 1][strlen(words[i - 1]) - 1]) {
            printf("No\n");
            return 0;
        }
    }

    
    for (i = 0; i < n; i++) {
        cnt = 0;
        for (j = i; j < n; j++) {
            if (strcmp(words[i], words[j]) == 0) {
                cnt++;
            }
        }
        if (cnt != 1) {
            printf("No\n");
            return 0;
        }
    }
    

    printf("Yes\n");
    return 0;
}


Measured memory_bytes: 128
import java.util.*;

class Main {
    enum Color {
        WHITE,
        GRAY,
        BLACK,
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = Integer.parseInt(scanner.nextLine());

        int[][] weight = new int[n][n];

        for (int i = 0; i < n; i++) {
            String[] line = scanner.nextLine().split(" ", n+1);
            for (int j = 0; j < n; j++) {
                int a = Integer.parseInt(line[j+1]);
                weight[i][j] = (a == -1 ? Integer.MAX_VALUE : a);
            }
        }

        System.out.println(prim(weight, n));
    }

    private static int prim(int[][] weight, int n) {
        Color[] color = new Color[n];
        int[] dMin = new int[n];
        int[] parent = new int[n];

        Arrays.fill(dMin, Integer.MAX_VALUE);
        Arrays.fill(parent, -1);
        Arrays.fill(color, Color.WHITE);

        dMin[0] = 0;

        while (true) {
            // linear search
            int minInd = -1;
            int minCost = Integer.MAX_VALUE;
            for (int i = 0; i < n; i++) {
                if (color[i] != Color.BLACK && dMin[i] < minCost) {
                    minInd = i;
                    minCost = dMin[i];
                }
            }

            if (minInd == -1)
                break;

            color[minInd] = Color.BLACK;

            for (int v = 0; v < n; v++) {
                if (color[v] != Color.BLACK && weight[minInd][v] != Integer.MAX_VALUE
                        && weight[minInd][v] < dMin[v]) {
                    dMin[v] = weight[minInd][v];
                    parent[v] = minInd;
                    color[v] = Color.GRAY;
                }
            }
        }

        int result = 0;
        for (int i = 0; i < n; i++) {
            if (parent[i] != -1) {
                result += dMin[i];
                //result += weight[i][parent[i]];
            }
        }
        return result;
    }
}



Measured memory_bytes: 29608
#include <iostream>
#include <bitset>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
using namespace std;
using ll = long long int;
#define REP(i,n) for(int i=0;i<n;i++)

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

    long student_x[51], student_y[51];
    long checkpoint_x[51], checkpoint_y[51];

    REP(i, N)
    {
        /* code */
        cin >> student_x[i] >> student_y[i];
    }
    REP(i, M)
    {
        cin >> checkpoint_x[i] >> checkpoint_y[i];
    }

    REP(index, N)
    {
        long d_min = 1e9;
        int index_min;
        REP(i, M)
        {
            long d_temp = abs(student_x[index] - checkpoint_x[i]) + abs(student_y[index] - checkpoint_y[i]);
            if (d_min > d_temp)
            {
                d_min = d_temp;
                index_min = i;
            }
        }

        cout << index_min + 1 << endl;
    }
    
    
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<stack>
#include<queue>
#include<numeric>
#include<algorithm>
#include<string>
#include<map>
#include<bitset>
#include<set>
#include<cmath>
#define int long long
#define inf 1145141919ll
#define oku 1000000007ll
using namespace std;
int a,b,c,d,e,f,g;
int dx[]={0,-1,0,1,0};
int i,j,k,n;
struct A{

};
int q[100][100];
bool pri(int u){
	int x;
	for(x=2;x*x<=u;x++)
		if(u%x==0)
			return false;
	return true;
}
signed main(){
	cin>>a;
	n=1;
	for(i=2;i<=a;i++){
		int u=0;
		if(pri(i)==false)
			continue;
		b=a;
		while(b/=i)
			u+=b;
		n*=u+1;
		n%=oku;
	}
	cout<<n<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
const ll INF = 1LL << 60;

int main() {
    string S, T; cin >> S >> T;
    int n = S.size();
    bool flag = true;
    for (int i = 0; i < n; i++) {
        if (S[i] != T[i]) flag = false;
    }
    if (flag) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3628
import java.io.*;
 
public class Main {
    public static void main(String[] args) {
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        try {
            String[] str = br.readLine().split(" ");
            int W = Integer.parseInt(str[0]);
            int H = Integer.parseInt(str[1]);
            int x = Integer.parseInt(str[2]);
            int y = Integer.parseInt(str[3]);
            int r = Integer.parseInt(str[4]);
            if(x >= r && y >= r && (H - r) >= y && (W - r) >= x) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        } catch(IOException e) {
            e.printStackTrace();
        }
    }
}

Measured memory_bytes: 24336
n = int(input())
al = list(map(int, input().split()))
q = int(input())
bl = []
cl = []
for i in range(q):
    b,c = map(int, input().split())
    bl.append(b)
    cl.append(c)

shoki = sum(al)

dic = {}
for i in al:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1


for i in range(q):
    b = bl[i]
    c = cl[i]
    if b in dic:
        bcount = dic.pop(b)
    else:
        bcount = 0
    if c in dic:
        dic[c] += bcount
    else:
        dic[c] = bcount
    shoki += (c - b)*bcount
    print(shoki)



Measured memory_bytes: 100432
#include<iostream>
using namespace std;
int main(){
  int w,h,n;
  cin>>w>>h>>n;
  int arr[h][w]={0};
  int x,y,a;
  int ans=0;
  for(int i=0;i<n;i++){
    cin>>x>>y>>a;
    if(a==1){
      for(int j=0;j<h;j++){
        for(int k=0;k<x;k++){
          arr[j][k]++;
        }
      }
    }
    else if(a==2){
      for(int j=0;j<h;j++){
        for(int k=x;k<w;k++){
          arr[j][k]++;
        }
      }
    }
    else if(a==3){
      for(int j=0;j<y;j++){
        for(int k=0;k<w;k++){
          arr[j][k]++;
        }
      }
    }
    else if(a==4){
      for(int j=y;j<h;j++){
        for(int k=0;k<w;k++){
          arr[j][k]++;
        }
      }
    }
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(arr[i][j]==0)ans++;
    }
  }
  if(ans==6)ans=9;
  cout<<ans<<endl;
}


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

using namespace std;

int main()
{
    vector<int> a(4), b(4);
    while (cin >> a[0]) {        
        for (int i = 1; i < 4; i++) {
            cin >> a[i];
        }
        for (int i = 0; i < 4; i++) {
            cin >> b[i];
        }
    
        int hit = 0, blow = 0;
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 4; j++) {
                if (a[i] == b[j] && i == j) {
                    hit++;
                } else if (a[i] == b[j] && i != j) {
                    blow++;
                }
            }
        }    
        cout << hit << " " << blow << endl;
    }
    return 0;
}

Measured memory_bytes: 3064
#include<stdio.h>
 int main(void)
 {
     long h[100000];
     int N,K,L=0,i;

     scanf("%d%d",&N,&K);

     for(i=0;i<N;i++)
       scanf("%ld",&h[i]);

     for(i=0;i<N;i++)
       if(K<=h[i]) L++;

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

     return 0;
 }



Measured memory_bytes: 896
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("faild to read char") as char)
        .take_while(|c| !c.is_whitespace())
        .collect();
    token
        .parse()
        .ok()
        .expect("faild to parse token")
}

fn main(){
    let t: f64 = read();
    let x: f64 = read();

    println!("{:.8}", t / x);
}


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

int main() {
  int N;
  string S;
  cin>>N>>S;
  int dp[5005][5005];
  int ans = 0;
  for(int i=N-1;i>=0;--i){
    for(int j=N-1;j>=0;--j){
      if(S[i]==S[j]) dp[i][j]=dp[i+1][j+1]+1;
      else dp[i][j]=0;
    }
  }
  rep(i,N) rep(j,N) ans = max(ans, min(dp[i][j],abs(i-j)));
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 98048
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int main() {
  string s;
  cin >> s;
  int m = s.size();
  int n;
  cin >> n;
  int res = 0;
  while(n--) {
    string t;
    cin >> t;
    t += t;
    REP(i,t.size() - m + 1) {
      if (s == t.substr(i, m)) {
        res++;
        break;
      }
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};

struct L {
    int a, b, c;
    L(int a, int b, int c): a(a), b(b), c(c) {}
};


int main(){
    int n, m;
    cin >> n >> m;
    vector<L> lh;
    vector<L> lv;
    map<int, int> mpx;
    map<int, int> mpy;
    mpx[0] = 0;
    mpy[0] = 0;

    rep(i, n) {
        int a, b, c;
        cin >> a >> b >> c;
        lh.emplace_back(a, b, c);
        mpx[a] = 0;
        mpx[b] = 0;
        mpy[c] = 0;
    }
    rep(i, m) {
        int d, e, f;
        cin >> d >> e >> f;
        lv.emplace_back(e, f, d);
        mpx[d] = 0;
        mpy[e] = 0;
        mpy[f] = 0;
    }

    vector<int> xs;
    vector<int> ys;

    for (auto& m: mpx) {
        m.second = xs.size();
        xs.push_back(m.first);
    }
    for (auto& m: mpy) {
        m.second = ys.size();
        ys.push_back(m.first);
    }
    int nx = xs.size() * 2;
    int ny = ys.size() * 2;

    vector<vector<int>> g(nx, vector<int>(ny));
    rep(i, n) {
        int a = mpx[lh[i].a]*2;
        int b = mpx[lh[i].b]*2;
        int c = mpy[lh[i].c]*2;
        for (int x=a; x<=b; x++) g[x][c] = -1;
    }
    rep(i, m) {
        int a = mpy[lv[i].a]*2;
        int b = mpy[lv[i].b]*2;
        int c = mpx[lv[i].c]*2;
        for (int y=a; y<=b; y++) g[c][y] = -1;
    }

    queue<P> q;
    P start = P(mpx[0]*2, mpy[0]*2);
    g[start.first][start.second] = 1;
    q.push(start);
    //debug(nx);

    while (!q.empty()) {
        auto now = q.front();
        q.pop();
        int x = now.first;
        int y = now.second;
        rep(i, 4) {
            int ix = x + dx[i];
            int iy = y + dy[i];
            if (ix<0 || ix>=nx || iy<0 || iy>=ny) continue;
            if (g[ix][iy]!=0) continue;
            g[ix][iy] = 1;
            q.emplace(ix, iy);
        }
    }

    ll ans = 0;
    rep(i, nx) rep(j, ny) {
        if (g[i][j]!=1) continue;
        if (i==0 || i==nx-1 || j==0 || j==ny-1) {
            cout << "INF" << endl;
            return 0;
        }
        if (i%2==0 || j%2==0) continue;
        ll dx = xs[i/2+1] - xs[i/2];
        ll dy = ys[j/2+1] - ys[j/2];
        ans += dx*dy;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 144428
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#define int long long
using namespace std;
const int maxn = 110;

int read(){
	int x=0,f=1;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+c-48;c=getchar();}
	return x*f;
}

int to[maxn<<1],net[maxn<<1],h[maxn],w[maxn<<1],cost[maxn<<1],e=1;
inline void add(int x,int y,int C,int z){
	to[++e]=y;net[e]=h[x];h[x]=e;w[e]=z;cost[e]=C;
}

int k,m,n;
struct node{
	int u,v,a,b;
}p[maxn];	
int c[maxn],d[maxn];
int dp[51][2501],max_=2500;
queue<pair<int,int> > q;
signed main(){
	n=read();m=read();int s=read();
	for(register int i=1;i<=m;i++){
		p[i].u=read();p[i].v=read();p[i].a=read();p[i].b=read();
		add(p[i].u,p[i].v,p[i].a,p[i].b);
		add(p[i].v,p[i].u,p[i].a,p[i].b);
	}
	for(register int i=1;i<=n;i++){
		c[i]=read();d[i]=read();
	}
	memset(dp,0x3f,sizeof(dp));
	for(register int i=0;i<=min(s,max_);i++)dp[1][i]=0;
	for(register int i=s+1;i<=max_;i++){
		int x=max(i-c[1],0ll);
		dp[1][i]=dp[1][x]+d[1];
	}
	for(register int i=0;i<=max_;i++)q.push(make_pair(1,i));
	while(!q.empty()){
		int x=q.front().first,now=q.front().second;q.pop();
		//cout<<x<<" "<<now<<" "<<dp[x][now]<<endl;
		for(register int i=1;i*c[x]+now<=max_;i++){
			if(dp[x][i*c[x]+now]>dp[x][now]+i*d[x]){
				dp[x][i*c[x]+now]=dp[x][now]+i*d[x];
				q.push(make_pair(x,i*c[x]+now));
			}
		}
		for(register int i=h[x];i;i=net[i]){
			int y=to[i];
			if(cost[i]>now)continue;
			if(dp[y][now-cost[i]]>dp[x][now]+w[i]){
				dp[y][now-cost[i]]=dp[x][now]+w[i];
				q.push(make_pair(y,now-cost[i]));
			}
		}
	}
	for(register int i=2;i<=n;i++){
		int min_=1e15;
		for(register int j=0;j<=max_;j++)min_=min(min_,dp[i][j]);
		printf("%lld\n",min_);
	}
	return 0;
}

Measured memory_bytes: 12212
#include<bits/stdc++.h>
using namespace std;
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define int long long int 
#define fi first
#define se second
#define FIO {ios::sycnt2_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
#define pow10(n) stoll("1"+string(n,'0'))
//fill(all(arr),1)
//if(map.count(key)){}
//bitset<20>(n);
//int mini=min({a,b,c,d,e});
#define int long long int
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef long double ld;
int32_t main()
{
   int n,x,t;
   cin>>n>>x>>t;
  cout<<setprecision(10)<<ceil(n/(double)x)*t;
}

Measured memory_bytes: 3748
import java.util.*;

public class Main {
    public static void main(String args[]){

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int d = sc.nextInt();

        int ans = n/(2*d+1);

        if (n%(2*d+1)==0){
            System.out.println(ans);
        }else{
            System.out.println(ans+1);
        }



    }
}


Measured memory_bytes: 21972
N = int(input())
CSF = [[int(i) for i in input().split()] for _ in range(N - 1)]

for i in range(N):
    t = 0
    for c, s, f in CSF[i:N - 1]:
        if t < s:
            t = s
        elif t % f != 0:
            t += f - t % f

        t += c
    print(t)

Measured memory_bytes: 3188
N,X=map(int,input().split())
S=list(map(int,input().split()))
pr=10**9+7
b={X:1}
S.sort(reverse=1)
def ir(k,v):
    global d
    if k in d:
        d[k]=(d[k]+v)%pr
    else:
        d[k]=v
for i in range(N):
    t=S[i]
    n=N-i-1
    d={}
    for k,v in b.items():
        ir(k%t,v)
        ir(k,v*n)
    b=d
a=0
for k,v in b.items():
    a=(a+k*v)%pr
print(a)

Measured memory_bytes: 6064
#include<iostream>
int main(){int l[999],i,f;for(i=0;i<999;i++)l[i]=0;while(std::cin>>i)l[i-1]++;for(i=0,f=0;i<999;i++)if(f<l[i])f=l[i];for(i=0;i<999;i++)if(l[i]==f)std::cout<<i+1<<"\n";}

Measured memory_bytes: 0
#include <functional>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;

int main() {
  int N;
  cin >> N;
  double v;
  priority_queue<double, vector<double>, greater<double>> qs;
  for(int i = 0; i < N; ++i) {
    cin >> v;
    qs.push(v);
  }
  while(qs.size() > 1) {
    auto fst = qs.top();
    qs.pop();
    auto snd = qs.top();
    qs.pop();
    qs.push((fst + snd) / 2.0);
  }
  auto ans = qs.top();
  cout << ans << endl;
  return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

    int n;
    cin >> n;
    vector<int> h(n);
    for (int i = 0; i < n; i++)
        cin >> h[i];
    int res = 0;
    while (true)
    {
        int ma = 0;
        vector<int> v;
        for (int i = 0; i < n; i++)
        {
            if (h[i] > ma)
            {
                ma = h[i];
                v.clear();
                v.push_back(i);
            }
            else if (h[i] == ma)
            {
                v.push_back(i);
            }
        }
        if (ma == 0)
            break;
        res++;
        for (auto i : v)
            h[i]--;
        for (int i = 1; i < (int)v.size(); i++)
        {
            if (v[i] != v[i - 1] + 1)
                res++;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	string s; 
	cin>>n>>s;
	for(int i=0;i<s.size();i++)
	{
		s[i]=(s[i]+n);
		while(s[i]>'Z')s[i]=s[i]-26;
	}
	cout<<s;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>& p) { os << p.first << " " << p.second; return os; }
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i + 1 != v.size() ? " " : ""); return os; }

void solve()
{
    int n; cin >> n;
    vector<double> v(n);
    for(int i = 0; i < n; i++)
    {
        cin >> v[i];
    }
    sort(v.begin(), v.end(), greater<double>()); 
    while(v.size() >= 2)
    {
        double a = v.back();
        v.pop_back();
        double b = v.back();
        v.pop_back();
        v.push_back((a + b) / 2);
    }
    assert(v.size() == 1);
    cout << v.front() << endl;
}

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

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

int main(){
	string s; cin >> s;
	bool vis[26] = {};
	for(int i = 0 ; i < s.size() ; ++i) vis[s[i] - 'a'] = 1;
	for(int i = 0 ; i < 26 ; ++i) if(!vis[i]){cout << (s + (char)('a' + i)); return 0;}
	string str = s;
	if(next_permutation(str.begin() , str.end()))
		for(int i = 0 ; i < str.size() ; ++i){
			putchar(str[i]); if(s[i] != str[i]) break;
		}
	else puts("-1");
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <iomanip>
#include <math.h>
using namespace std;
int main(){

  int N;
  cin >> N;
  int x[N];
  int MAX = 1000000,MIN = -1000000;
  int min=MIN-1,max=MAX+1;
  long sum=0;

  for(int i=0;i<N;i++){
    cin >>x[i];
    sum += x[i];
    if(min > x[i] || min < MIN) min = x[i];
    if(max < x[i] || max > MAX) max = x[i];
  }

  cout << min <<" "<<max<<" "<<sum<<endl;

}



Measured memory_bytes: 3124
#include <stdio.h>
int x, y, i, j;
int main(){
    scanf("%d %d",&x ,&y );
    while(!(x==0 && y==0)){
        for (i=1;i<=x;i++){
            for(j=1;j<=y;j++){
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
        scanf("%d %d",&x ,&y );
    }
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1000000000;
const long INF64 = 1000000000000000ll;
const int MOD = 1000000007;
ll dp[51][51][2501];
int main(){

	int n,a;
	std::cin >> n>>a;
	std::vector<int> x(n);
	rep(i,n)std::cin >> x[i];

	dp[0][0][0]=1;
	rep(i,n){
		rep(j,n){
			rep(k,n*a+1){
				if(dp[i][j][k]==0)continue;
				dp[i + 1][j+1][k + x[i]] += dp[i][j][k];
				dp[i + 1][j][k] += dp[i][j][k];
			}
		}
	}
	ll ans=0;
	for (int i = 1; i <= n; i++) {
		/* code */ans+=dp[n][i][i*a];
	}
	std::cout << ans << std::endl;
}
	

Measured memory_bytes: 48128
from collections import deque
from typing import List
import sys


def bfs(adj_list: List[List[int]]) -> List[int]:
    n = len(adj_list)
    result: List[int] = [sys.maxsize for _ in range(n)]
    result[0] = 0
    queue: deque = deque()
    queue.append(0)

    while len(queue) > 0:
        cur = queue.popleft()
        for vertex in adj_list[cur]:
            if result[cur] + 1 < result[vertex]:
                result[vertex] = result[cur] + 1
                queue.append(vertex)

    return result


if __name__ == "__main__":
    num_vertices = int(input())
    adj_list: List[List[int]] = [[] for _ in range(num_vertices)]

    for _ in range(num_vertices):
        vertex, num_adjs, *adjs = map(lambda x: int(x), input().split())
        for i in range(num_adjs):
            adj_list[vertex - 1].append(adjs[i] - 1)

    result = bfs(adj_list)

    for i in range(num_vertices):
        if sys.maxsize == result[i]:
            result[i] = -1
        print(f"{i + 1} {result[i]}")



Measured memory_bytes: 7240