akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>

int main() {
  int W, H, x, y, r;
  std::scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);

  if (0 <= x-r && 0 <= y-r && x+r <= W && y+r <= H) {
      std::printf("Yes\n");
  } else {
      std::printf("No\n");
  }
  
}


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

int main(){
	int n, k;
	cin >> n >> k;
	vector<int> moves(n+1);
	for(int i = 1; i <= n ; i++)
		cin>> moves[i];
	vector<int> winner(k+1,2);
	for(int i = 1; i <= k; i++)
	{
		for (int j = 1; j <= n; j++)
		{

			if( i < moves[j] )
				continue;
			if(winner[i-moves[j]]==2)
				winner[i]=1;
		
		}
	}

	if(winner[k]==1)
		cout << "First" << endl;
	else
		cout << "Second" << endl;

	return 0;
}

Measured memory_bytes: 640
k = int(input())
a, b = map(int, input().split())

if k == 1:
    print("OK")
else:
    if a % k == 0 or b % k == 0:
        print("OK")

    else:
        if a//k < b//k:
            print("OK")

        else:
            print("NG")


Measured memory_bytes: 9176
#include <iostream>
#include <string>
#include <set>
#include <vector>
#include <cmath>
using namespace std;

inline int max(int x, int y){
  return (x>y)?x:y;
}
inline int min(int x, int y){
  return (x<y)?x:y;
}
inline int abs(int x){
  return (x>0)?x:-x;
}

int x[101];

int main(void){
  int n; cin >> n;
  for(int i=0;i!=n;++i){
    cin >> x[i];
  }
  int p;
  int sum=0, dsum=0;
  for(int i=0;i!=n;++i){
    sum += x[i];
    dsum+= x[i]*x[i];
  }
  p = (int)round(1.0*sum/n);
  cout << (n*p*p - 2*p*sum + dsum) << endl;
  return 0;
}

/*
7
14 14 2 13 56 2 37
2354
*/


Measured memory_bytes: 384
def pal(p):
    pp = p
    r = True
    for i in range(len(p)):
        if p[i] != pp[-i-1]:
            r = False
            break
    return r

s = input()
n = len(s)
r = 'No'
if pal(s) and pal(s[0:int((n - 1) / 2)]) and pal(s[int((n + 2) / 2):n]):
    r = 'Yes'
print(r)

Measured memory_bytes: 3060
/*putchar(((i+j)&1)?'(':')');
     
        表示交替的符号很有用
     
    */
    #include <bits/stdc++.h>
    using namespace std;
    #define rep(i,a,n) for (int i=a;i<n;i++)
    #define per(i,a,n) for (int i=n-1;i>=a;i--)
    #define pb push_back
    #define mp make_pair
    #define all(x) (x).begin(),(x).end()
    #define fi first
    #define se second
    #define SZ(x) ((int)(x).size())
    typedef vector<int> VI;
    typedef long long ll;
    typedef pair<int,int> PII;
    const ll mod=1000000007;
    ll powmod(ll a,ll b)
    {
        ll res=1;
        a%=mod;
        assert(b>=0);
        for(; b; b>>=1)
        {
            if(b&1)
                res=res*a%mod;
            a=a*a%mod;
        }
        return res;
    }
    ll gcd(ll a,ll b)
    {
        return b?gcd(b,a%b):a;
    }
    // head
     
    int main()
    {
        int D, G, p[11], c[11];
        cin >> D >> G;
        for(int i = 0; i < D; ++i)
        {
            cin >> p[i] >> c[i];
        }
        int ans = 1e9+7;
        for(int mark = 0; mark < (1<<D) ; mark++)
        {
            int num = 0, res_pos = -1, cost = 0;
            for(int i = 0; i < D ; i++)
            {
                if(mark >> i & 1) // 全选
                {
                    num = num + (i + 1)*100 * p[i] + c[i];
                    cost += p[i];
                }
                else
                    res_pos = i;
            }
     
            // 选出了一种方案了
            if(num < G)
            {
                int last = G - num; // 还缺几分
                int day = ceil(last*1.0 / (100*(res_pos+1))); // 剩下的 用最大的i 还需要几次
                if(day >= p[res_pos])
                    continue;
                cost += day;
            }
            ans = min(ans, cost);
     
        }
        printf("%d\n",ans);
    }

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

int main() {
	int A, B;
	cin >> A >> B;
	int n = 0;
	for (int i = A; i < B + 1; i++) {
		int j = i;
		int one = j % 10;
		j = (j - one) / 10;
		int two = j % 10;
		j = (j - two) / 10;
		int three = j % 10;
		j = (j - three) / 10;
		int four = j % 10;
		j = (j - four) / 10;
		int five = j % 10;
		if ((one == five) && (two == four))
			n++;
		else
			n = n;
	}
	cout << n << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int n,a[101],sum=0,i,j,temp;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);
  for(i=0;i<n-1;i++){
    for(j=i+1;j<n;j++){
      if(a[i]<a[j]){
        temp=a[i];
        a[i]=a[j];
        a[j]=temp;
      }
    }
  }
  for(i=0;i<n;i++){
    if(i%2==0)
      sum+=a[i];
    else
      sum-=a[i];
  }
  printf("%d\n",sum);
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
//#define repitr(itr, st) for(auto itr = st.begin(); itr != st.end(); ++itr)
#define P_B push_back
#define PO_B pop_back
#define E_B emplace_back
#define M_P make_pair
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << endl
//#define print(x) printf("%d\n", x)

using namespace std;
using ll = long long;
using Pii = pair<int,int>;
using Pll = pair<ll,ll>;
using VI = vector<int>;
using VL = vector<ll>;
using VVI = vector<vector<int> >;
using VVL = vector<vector<ll> >;
//int dx[4] = {1, 0, -1, 0};
//int dy[4] = {0, 1, 0, -1};
//const ll LINF = (ll)1e18 - 1;
//const int INF = 1e9 - 1;
//int:±2*10^9くらい　ll:±9*10^18くらい



void Main(){
	int r, D, x;
	cin >> r >> D >> x;
	rep(i, 10){
		x = r*x - D;
		cout << x << endl;
	}


}

int main()
{
	cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();

  return 0;
}


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

// int/long:		-2,147,483,648 - 2,147,483,648 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536,870,912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

#define	MOD 1000000007

int	main() {
	for (int i=0; i<19; i++) {
		char c;
		cin >>c;
		if (c==',')
			c=' ';
		cout <<c;
	}
	cout <<endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
#define LL long long
#define Num 1000000007
// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<long long int> a(n);
    vector<long long int> fuck(n);
    long long int sum = 0;
    rep(i, n)
    {
        long long int tmp;
        cin >> tmp;
        a[i] = tmp;
 
        long long int num = tmp - (i + 1);
       fuck[i] = num;
        sum = sum + num;
    }
    //cout<<n<<sum<<endl;
    //long long int b = (long long int)round((double)sum / (double)n);
    long long int b;
    SORT(fuck);
    int piyo = n / 2;
    b=fuck[piyo];
    sum = 0;
    rep(i, n)
    {
        long long int num = abs(a[i] - (b + i + 1));
        sum = sum + num;
    }
    b=fuck[piyo-1];
    long long int tempsum = 0;
    rep(i, n)
    {
        long long int num = abs(a[i] - (b + i + 1));
        tempsum = tempsum + num;
    }
    sum = min(sum, tempsum);
    b=fuck[piyo+1];
    tempsum = 0;
    rep(i, n)
    {
        long long int num = abs(a[i] - (b + i + 1));
        tempsum = tempsum + num;
    }
    sum = min(sum, tempsum);
    //cout << "b is " << b << endl;
    cout << sum << endl;
    return 0;
}

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

#define int int64_t
#define MAX 100005

#define INF 100000007

using namespace std;

int N;
int input[MAX];

int dp[MAX];

int f(int index) {
    if(dp[index] != -1) return dp[index];

    if(index > N) return INF;
    if(index == N) return 0;

    dp[index] = min(abs(input[index+1]-input[index])+f(index+1), 
        abs(input[index+2]-input[index])+ f(index+2));

    return dp[index];
}

signed main() {
    scanf("%lld", &N);

    for(int i = 1; i<=N; i++)
    {
        scanf("%lld", &(input[i]));
        dp[i] = -1;
    }

    dp[N+1] = -1;

    printf("%lld\n",f(1));

}


Measured memory_bytes: 3328
#include <iostream>
using namespace std;
#define MAX 10000

//int n,A[MAX];

int linearSearch(int n,int key,int A[]){
  int count=0;
  for(int i=0;i<n;i++){
    if(key==A[i]) count++;
    if(count!=0) break;
  }
  return count;
}


int main(){
  int key,m,sum=0,n;
  int A[MAX];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>A[i];
  }
  cin>>m;
  for(int i=0;i<m;i++){
    cin>>key;
    sum+=linearSearch(n,key,A);
  }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 1200
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int main() {
    string s;
    string opr;
    int n;
    cin >> s;
    scanf("%d", &n);
    while(n--) {
        cin >> opr;
        if(opr == "print") {
            int a, b;
            scanf("%d %d", &a, &b);
            for(int i = a; i <= b; i++) {
                printf("%c", s.at(i));
            }
            printf("\n");
        }
        else if(opr == "reverse") {
            int a, b;
            scanf("%d %d", &a, &b);
            while(a < b) {
                char tmp = s.at(a);
                s.at(a) = s.at(b);
                s.at(b) = tmp;
                a++;
                b--;
            }
        }
        else if(opr == "replace") {
            int a, b;
            string p;
            scanf("%d %d", &a, &b);
            cin >> p;
            for(int i = a; i <= b; i++) {
                s.at(i) = p.at(i-a);
            }
        }
    }
}


Measured memory_bytes: 3304
void main(){
	double r = _scan!double();
	double g = _scan!double();
	( 2*g-r ).writeln();
}

import std.stdio, std.conv, std.algorithm, std.numeric, std.string;

// 1要素のみの入力
T _scan(T= int)(){
	return to!(T)( readln().chomp() );
}

// 1行に同一型の複数入力
T[] _scanln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split()){
		ln ~= elm.to!T();
	}
	return ln;
}


Measured memory_bytes: 2952
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>
#include <iterator>
#include <cmath>
#include <stack>
#include <random>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

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

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

constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

signed main() {
  int n, q; cin >> n >> q;
  string s; cin >> s;

  vector<char> c(q);
  vector<bool> left(q);
  rep(i, q) {
    cin >> c[i];
    char a; cin >> a;
    if (a == 'L') {
      left[i] = true;
    }
  }
  
  int ma = n;
  int mi = -1;
  while(mi+1<ma) {
    int med = (ma+mi)/2;
    int p = med;
    //debugln(p);
    rep(i, q) {
      if (c[i] == s[p]) {
        if (left[i]) {
          p--;
        } else {
          p++;
        }
      }
      if (p < 0) {
        break;
      }
      if (p >= n) {
        break;
      }
    }
    if (p < 0) {
      mi = med;
    } else {
      ma = med;
    }
  }
  int L = ma;
  debugln(L);

  ma = n;
  mi = -1;
  while(mi+1<ma) {
    int med = (ma+mi)/2;
    int p = med;
    //debugln(p);
    rep(i, q) {
      if (c[i] == s[p]) {
        if (left[i]) {
          p--;
        } else {
          p++;
        }
      }
      if (p >= n) {
        break;
      }
      if (p < 0) {
        break;
      }
    }
    if (p >= n) {
      ma = med;
    } else {
      mi = med;
    }
  }
  int R = mi;
  debugln(R);

  cout << max(R-L+1,0) << endl;
}


Measured memory_bytes: 772
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		List<Double> list = new ArrayList<Double>();
		while (in.hasNext())
			list.add(in.nextDouble());
		Collections.sort(list);
		System.out.println(list.get(list.size()-1)-list.get(0));
	}
}

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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

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

int rem = X;
int min_m = MOD;
REP(i, N) {
    int m;
    cin >> m;

    rem -= m;
    min_m = min(min_m, m);
}

int ans = N + (rem / min_m);
print(ans);

}

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

int main(void){
    int n,k,x;
    cin>>n>>k;
    int sum = 0;
    rep(i,n){
        cin>>x;
        sum += 2*min(x,k-x);
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    int n,t = 0; while(cin>>n,n)cout<<"Case " << ++t << ": " << n << endl;
}





Measured memory_bytes: 2988
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const long double PI = acos(-1.0L);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << min(a, b)+min(c, d) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <climits>
#include <map>
#include <cmath>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <vector>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <utility>
#include <queue>

/* Raiyan Noory Rady,CSE'17,RUET
Email:raiyannooryrady@gmail.com
Smile->Desire->Unity->Effort->Struggle->Success->Again smile :)
*/

#define ll long long int
#define pf push_front
#define mod  1000000007
#define inf  1000000000000000000
#define pi  acos(-1.0)
#define maxn  1000009
#define sorted(s)  sort(s.begin(),s.end())
#define sortarr(a) sort(a,a+n)
#define slc(n) scanf("%I64d", &n)
#define sl(n)  scanf("%lld", &n)
#define sf(n)  scanf("%lf", &n)
#define si(n)  scanf("%d", &n)
#define sch(n)  scanf(" %c", &n)
#define ss(n)  scanf("%s", n)
#define prf printf
#define pb  push_back
#define fr first
#define sc second
#define all(a)  a.begin(),a.end()
#define forl(n) for(i=0;i<n;i++)
/*STL library functions

sort(first_iterator, last_iterator) – To sort the given vector.

reverse(first_iterator, last_iterator) – To reverse a vector.

*max_element (first_iterator, last_iterator) – To find the maximum element of a vector.

*min_element (first_iterator, last_iterator) – To find the minimum element of a vector.

accumulate(first_iterator, last_iterator, initial value of sum) – Does the summation of vector elements

count(first_iterator, last_iterator,x) – To count the occurrences of x in vector.

find(first_iterator, last_iterator, x) – Points to last address of vector ((name_of_vector).end())
 if element is not present in vector.

binary_search(first_iterator, last_iterator, x) – Tests whether x exists in sorted vector or not.

lower_bound(first_iterator, last_iterator, x) – returns an iterator pointing to the first element in the range [first,last)
which has a value not less than ‘x’.

upper_bound(first_iterator, last_iterator, x) – returns an iterator pointing to the first element in the range [first,last)
 which has a value greater than ‘x’.

arr.erase(position to be deleted) – This erases selected element in vector and shifts and resizes the vector elements accordingly.

arr.erase(unique(arr.begin(),arr.end()),arr.end()) – This erases the duplicate occurrences in sorted vector in a single line.

distance(first_iterator,desired_position) – It returns the distance of desired position from the first iterator.
This function is very useful while finding the index.

next_permutation(first_iterator, last_iterator) – This modified the vector to its next permutation.

prev_permutation(first_iterator, last_iterator) – This modified the vector to its previous permutation.
*/

using namespace std;

int main()
{

    ll n,i;
    cin>>n;
    ll a[n+5],c=0,maxi=0;
    for(i=0; i<n; i++)
        cin>>a[i];
    for(i=n-2; i>=0; i--)
    {
        maxi=max(maxi,c);
        if(a[i]>=a[i+1])
        {
            c++;
            if(c>maxi)
            {
                maxi=c;
            }
        }
        else
            c=0;

    }

    cout<<maxi<<endl;

    return 0;
}






Measured memory_bytes: 1024
#![allow(unused_imports)]
use proconio::input;
use proconio::marker::*;
use std::collections::HashSet;

fn main() {
  input! {
    n: usize,
    mut vals: [isize;n]
  }
  
  vals.push(0);
  let mut last = 0;
  let mut total = 0;
  for v in vals.iter() {
    total += (v - last).abs();
    last = *v;
  }
  
  last = 0;
  for i in 0..n {
    let origin = (vals[i] - last).abs() + (vals[i+1] - vals[i]).abs();
    let updated = (vals[i+1] - last).abs();
    println!("{}", total - origin + updated);
    last = vals[i];
  }
}

Measured memory_bytes: 3428
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#include <stack>
#include <utility>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cctype>
using namespace std;
 
#define rep(i,n) for(int i=0; i<n; i++)
#define repa(i,s,e) for(int i=s; i<=e; i++)
 
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

int n, q, x, lim;
map<int,int> qb;

const int MAX_N = 1 << 20;

// data for segment tree
int dat[2*MAX_N+1];
int rev[MAX_N];

// init segment tree
void init() {
	rep(i, 2*MAX_N+1) dat[i] = 0;
}

// update segment tree
void update(int xi, int p, int d, int l, int r) {
	if(l <= xi && xi < r) {
		dat[d] += p;
		if(l < r-1) {
			int mid = (l+r) / 2;
			update(xi, p, d*2+1, l, mid);
			update(xi, p, d*2+2, mid, r);
		}
	}
}

// find n-th element
int find(int xi) {
	int p = 0;
	int no = MAX_N - 1;
	int range = MAX_N;
	while(p < MAX_N) {
		int l = p * 2 + 1;
		int r = p * 2 + 2;
		range /= 2;
		if(xi <= dat[l]) {
			p = l;
			no -= range;
		} else {
			p = r;
			xi -= dat[l];
		}
	}
	return no;
}

void removeOldest() {
	int p = find(0);
	update(p, -1, 0, 0, MAX_N);
}

// incubate
void incubate(int xi) {
	if(lim <= dat[0]) {
		removeOldest();
	}
	int l = qb.size();
	qb.insert(pii(xi, l));
	update(l, 1, 0, 0, MAX_N);
	rev[l] = xi;
}

// remove at xi in array
void removeAt(int xi) {
	int p = find(xi);
	update(p, -1, 0, 0, MAX_N);
}

// remove No. xi
void removeNo(int xi) {
	int no = qb[xi];
	update(no, -1, 0, 0, MAX_N);
}

// print
void print(int xi) {
	int no = find(xi); 
	cout << rev[no] << endl;
}

int main() {
	while(cin>>n>>lim, n|lim) {
		init();
		memset(rev, -1, sizeof(int)*MAX_N);
		qb.clear();
		for(int i=0; i<n; i++) {
			cin>>q>>x;
			switch(q) {
			case 0:
				incubate(x);
				break;
			case 1:
				removeAt(x);
				break;
			case 2:
				print(x);
				break;
			case 3:
				removeNo(x);
				break;
			}
		}
		printf("end\n");
	}
}

Measured memory_bytes: 32240
#include<iostream>
#include<vector>
#include<algorithm>
#include<complex>
using namespace std;
typedef long long int llint;
int main() {
	int n;
	char s[110];
	cin >> n;
	cin >> s;
	vector<pair<int, int>>a(110);
	int acnt = 0;
	for (int i = 0;i < 110;i++) {
		a[i].first = -1;
		a[i].second = -1;
	}
	for (int i = 0;i < n;i++) {
		if (s[i] != '0') {
			for (int j = n - 1;j > i;j--) {
				if (s[i] == s[j]) {
					if (a[acnt].first == -1) {
						a[acnt].first = i;
						a[acnt].second = j;
					}
					s[j] = '0';
				}
			}
			if (a[acnt].first != -1) {
				acnt++;
			}
		}
	}
	int cnt;
	int max = 0;
	for (int i = 0;i < n;i++) {
		cnt = 0;
		for (int j = 0;j < acnt;j++) {
			if (a[j].first <= i&&i <= a[j].second) {
				cnt++;
			}
		}
		if (cnt > max) {
			max = cnt;
		}
	}
	cout << max << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string n;
  long long int k;
  cin >>n >>k;
  for(int i=0;i<n.size();i++){
    if(n[i]=='1' && k==i+1){
      cout << 1 <<endl;
      break;
    }
    else if(n[i]!='1'){
      cout << n[i] <<endl;
      break;
    }	
  }
}


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

using namespace std;
const int maxn = 105;
const int mod = 1e9+7;
const int inf = 1e9;
const int maxw = 1e5+2;

typedef long long ll;

int n, W;
ll arr[maxn], val[maxn], dp[105][maxw];

ll solve_dp (int pos, ll w){
    if (w > W) return -inf;
    if (pos - 1 == n) return 0;

    ll &ans = dp[pos][w];

    if (ans != -1) return ans;

    ans = -inf;
    ans = max(ans, solve_dp(pos + 1, w + arr[pos]) + val[pos]);
    ans = max(ans, solve_dp(pos + 1, w));
    return ans;
}

int main(){

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

    cin >> n >> W;

    for (int i = 1; i <= n; i++){
        cin >> arr[i] >> val[i];
    }

    memset(dp, -1, sizeof dp);

    cout << solve_dp(0, 0) << "\n";

    return 0;
}


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

int main() {
  
  string a,b;
  cin >> a >> b;
  
  if(a[0] == b[2] && a[1] == b[1] && a[2] == b[0]) cout << "YES" << endl;
  else cout << "NO" << endl;
  
}


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

#define PI 3.14159265359

int main(){
   long double a, b, x, angle;
  
  cin >> a >> b >> x;
  
  if(x >= a*a*b/2.0){
    angle = atan(2.0*(a*a*b - x)/(a*a*a));
    } else {
    angle = PI/2.0 - atan(2.0*x/(a*b*b));
    }
  
  cout << fixed << setprecision(10) << abs(angle)*180/PI << endl;
  
  return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    ll n;
    cin >> n;

    if (n % 2 == 1) {
        cout << 0 << endl;
        return 0;
    }

    ll res = 0;
    n /= 2;
    while(n) {
        res += n / 5;
         n /= 5;
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


int N;
int D[55];
int T[55];

int solve() {
  if (N >= 24) return 0;

  int res = 0;
  for (int bit = 0; bit < (1<<N); ++bit) {
	if (bit % 2 == 0) continue;
	int tmp = 30;
	T[0] = 0;
	for (int i = 0; i < N; ++i) {
	  if (bit & (1<<i)) T[i+1] = D[i];
	  else T[i+1] = 24 - D[i];
	}
	sort(T, T+N+1);
	for (int i = 0; i < N+1; ++i) {
	  int j = (i+1) % (N+1);
	  int diff = min( abs(T[j] - T[i]), 24 - abs(T[j] - T[i]) );
	  chmin(tmp, diff);
	}
	chmax(res, tmp);
  }
  return res;
}

int main() {
    while (cin >> N) {
	  for (int i = 0; i < N; ++i) cin >> D[i];
	  cout << solve() << endl;
    }
}



















Measured memory_bytes: 384
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
using namespace std;
signed main()
{
	int x;
	cin>>x;
	int p=100;
	int cnt=0;
	while(p<x)
	{
		p+=p/100;
		cnt++;
	}
	cout<<cnt<<endl;
}












Measured memory_bytes: 3576
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	ans := -1
	for i := 1; i <= n; i++ {
		if i*108/100 == n {
			ans = i
			break
		}
	}
	if ans == -1 {
		fmt.Println(":(")
	} else {
		fmt.Println(ans)
	}
}


Measured memory_bytes: 1776
[a,b,k] = list( map(int, input().split() ) )
for i in range(k):
	if a%2 == 1:
		a -= 1
	a //= 2
	b += a
	c = a
	a = b
	b = c
if k%2 == 1:
	c = a
	a = b
	b = c
print('{} {}'.format(a,b) )

Measured memory_bytes: 3064
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        EMitsui solver = new EMitsui();
        solver.solve(1, in, out);
        out.close();
    }

    static class EMitsui {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int MOD = (int) 1e9 + 7;
            int n = in.nextInt();
            int[] ar = new int[n];
            long res = 1;
            for (int i = 0; i < n; i++) {
                ar[i] = in.nextInt();
            }
            // max -> n-1なのでそれでいい
            int[] num = new int[n];
            for (int i = 0; i < n; i++) {
                if (ar[i] == 0) {
                    res = (res * (3 - num[0])) % MOD;
                } else {
                    res = (res * (num[ar[i] - 1] - num[ar[i]])) % MOD;
                }
                num[ar[i]]++;
            }
            out.println(res);
        }

    }
}



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

using namespace std;

int n, lvl[201]; char c;
vector<int> adj[201];

int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int k = 0; k < n; k++) {
      cin >> c;
      if (c == '1') {
        adj[i].push_back(k);
      }
    }
  }
  int res = 0;
  for (int i = 0; i < n; i++) {
    memset(lvl, -1, sizeof lvl);
    queue<int> nds;
    lvl[i] = 0;
    nds.push(i);
    bool ispos = true;
    int maxlvl = 0;
    while (!nds.empty()) {
      int i = nds.front(); nds.pop();
      for (int j : adj[i]) {
        if (lvl[j] == -1) {
          lvl[j] = lvl[i] + 1;
          maxlvl = max(maxlvl, lvl[j]);
          nds.push(j);
        } else if (lvl[j] != lvl[i] + 1 && lvl[j] != lvl[i] - 1) {
          ispos = false;
          break;
        }
      }
    }
    if (!ispos) {
      cout << -1 << endl;
      return 0;
    }
    res = max(res, maxlvl + 1);
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#define MAX_N 100
#define INF 10000000

using namespace std;

int N;
int a[MAX_N];

void solve() {
    long long ans = INF;
    for(int i = -100; i <= 100; i++) {
        long long tmp = 0;
        for(int j = 0; j < N; j++) {
             tmp += (a[j] - i) * (a[j] - i);
        }
        ans = min(ans, tmp);
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 256
from functools import reduce

def main():
    # 一文字のみを読み込み
    # s = input().rstrip().split(' ')
    
    # スペース区切りで標準入力を配列として読み込み
    # s = input().rstrip().split(' ')
    
    # 位置文字ずつ標準入力を配列として読み込み
    # s = list(input().rstrip())

    n = input().rstrip()
    slist = input().rstrip().split(' ')
    c = 0
    flag = True
    while(flag):
        i = 0
        for s in slist:
            if int(s)%2 == 1:
                flag = False
                continue            
            slist[i] = int(int(s)/2)
            i = i+1
        if flag == True:
            c = c +1
    print(c)    
   
if __name__ == '__main__':
    main()


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

using namespace std;
typedef long long ll;

int main() {
  string S; cin >> S;
  ll f0 = 0;
  ll f1 = 0;
  for (ll j=0; j < S.length(); ++j) {
    if (j % 2 == 0) {
      if (S[j] == '1') {
        f0 += 1;
      }
    } else {
      if (S[j] == '0') {
        f0 += 1;
      }
    }
  }
  for (ll j=0; j < S.length(); ++j) {
    if (j % 2 == 0) {
      if (S[j] == '0') {
        f1 += 1;
      }
    } else {
      if (S[j] == '1') {
        f1 += 1;
      }
    }
  }
  cout << min(f0, f1) << endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>

using namespace std;

int cnt[10];
int main(){
	int n;
	cin >> n;
	for(int i = 1 ; i <= n ; ++ i){
		string u;
		cin >> u;
		if(u == "AC")
			cnt[1] ++;
		if(u == "WA")
			cnt[2] ++;
		if(u == "TLE")
			cnt[3] ++;
		if(u == "RE")
			cnt[4] ++;
	}
	cout << "AC x " << cnt[1] << endl;
	cout << "WA x " << cnt[2] << endl;
	cout << "TLE x " << cnt[3] << endl;
	cout << "RE x " << cnt[4] << endl;
	return 0;
} 

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pi = pair<int, int>;
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
const int MAXN = 105;
const int MAXM = 105;

/*wtf*/
bool chk[MAXN * MAXN];
struct bpm{
	vector<int> gph[MAXN];
	int dis[MAXN], l[MAXN], r[MAXM], vis[MAXN];
	void clear(){ for(int i=0; i<MAXN; i++) gph[i].clear();	}
	void add_edge(int l, int r){ gph[l].push_back(r); }
	bool bfs(int n){
		queue<int> que;
		bool ok = 0;
		memset(dis, 0, sizeof(dis));
		for(int i=0; i<n; i++){
			if(l[i] == -1 && !dis[i]){
				que.push(i);
				dis[i] = 1;
			}
		}
		while(!que.empty()){
			int x = que.front();
			que.pop();
			for(auto &i : gph[x]){
				if(r[i] == -1) ok = 1;
				else if(!dis[r[i]]){
					dis[r[i]] = dis[x] + 1;
					que.push(r[i]);
				}
			}
		}
		return ok;
	}
	bool dfs(int x){
		if(vis[x]) return 0;
		vis[x] = 1;
		for(auto &i : gph[x]){
			if(r[i] == -1 || (!vis[r[i]] && dis[r[i]] == dis[x] + 1 && dfs(r[i]))){
				l[x] = i; r[i] = x;
				return 1;
			}
		}
		return 0;
	}
	int match(int n){
		memset(l, -1, sizeof(l));
		memset(r, -1, sizeof(r));
		int ret = 0;
		while(bfs(n)){
			memset(vis, 0, sizeof(vis));
			for(int i=0; i<n; i++) if(l[i] == -1 && dfs(i)) ret++;
		}
		return ret;
	}
	bool chk[MAXN + MAXM];
	void rdfs(int x, int n){
		if(chk[x]) return;
		chk[x] = 1;
		for(auto &i : gph[x]){
			chk[i + n] = 1;
			rdfs(r[i], n);
		}
	}
	vector<int> getcover(int n, int m){ // solve min. vertex cover
		match(n);
		memset(chk, 0, sizeof(chk));
		for(int i=0; i<n; i++) if(l[i] == -1) rdfs(i, n);
		vector<int> v;
		for(int i=0; i<n; i++) if(!chk[i]) v.push_back(i);
		for(int i=n; i<n+m; i++) if(chk[i]) v.push_back(i);
		return v;
	}
}bpm;

int n, m, a[MAXN][MAXN], b[MAXN][MAXN];
int X[MAXN][MAXN];

int main(){
	auto print_grid = [&](int v[MAXN][MAXN]){
		for(int i=0; i<n; i++){
			for(int j=0; j<m; j++){
				printf("%d ", v[i][j]);
			}
			puts("");
		}
	};
	scanf("%d %d",&n,&m);
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			scanf("%d",&a[i][j]);
		}
	}
	for(int i=0; i<m; i++){
		memset(X, 0, sizeof(X));
		for(int i=0; i<n; i++){
			for(int j=0; j<m; j++){
				if(chk[a[i][j]]) continue;
				int col = (a[i][j] - 1) / m;
				X[i][col] = a[i][j];
			}
		}
		bpm.clear();
		for(int i=0; i<n; i++) for(int j=0; j<n; j++){
			if(X[i][j]) bpm.add_edge(i, j);
		}
		assert(bpm.match(n) == n);
		for(int j=0; j<n; j++){
			b[j][i] = X[j][bpm.l[j]];
			chk[b[j][i]] = 1;
		}
	}
	print_grid(b);
	for(int i=0; i<m; i++){
		vector<int> v;
		for(int j=0; j<n; j++) v.push_back(b[j][i]);
		sort(all(v));
		for(int j=0; j<n; j++) b[j][i] = v[j];
	}
	print_grid(b);
}




Measured memory_bytes: 512
#! env/bin/local python3
# -*- coding:utf-8 -*-

# -- submit ----

# --- fetch input ---
inputs: list = []
while True:
    try:
        inputs.append(input().strip('\n'))
    except EOFError:
        break

# --- write code below ---
s = inputs[0]

if s == 'ABC':
    print('ARC')
else:
    print('ABC')


Measured memory_bytes: 9028
#include<stdio.h>
int main(){
  int n,i,max,maxp,a,b,c;
  while(1){
    scanf("%d",&n);
    if(n==0)break;
    for(i=0,max=0;i<n;i++){
      scanf("%d %d %d",&a,&b,&c);
      if((b+c)>max){
	max=b+c;
	maxp=a;
      }
    }
    printf("%d %d\n",maxp,max);
  }
  return 0;
}

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

int main(){
  ll N;
  cin>>N;
  vector<ll> A(N);
  ll S=0;
  for(ll i=0;i<N;i++){
    cin>>A[i];
    S+=A[i];
  }
  if(S%(N*(N+1)/2)){
    cout<<"NO"<<endl;
    return 0;
  }
  S/=(N*(N+1)/2);
  for(int i=0;i<N;i++){
    ll a,b;
    if(i==N-1)
      a=A[i],b=A[0];
    else
      a=A[i],b=A[i+1];
    ll c=S-(b-a);
    if(c%N||c<0){
      cout<<"NO"<<endl;
      return 0;
    }
  }
  cout<<"YES"<<endl;
}

Measured memory_bytes: 1024
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end


N,K=get_i
l=get_i.sort!{|x,y| y<=>x}
puts l[0..K-1].inject(:+)

Measured memory_bytes: 1788
h = int(input())
w = int(input())
n = int(input())

num1 = n/h
num2 = n/w

if not num1.is_integer():
  num1 = int(num1) + 1
  
if not num2.is_integer():
  num2 = int(num2) + 1
  
num1 = int(num1)
num2 = int(num2)
print(min(num1, num2))

Measured memory_bytes: 3060
#!/usr/bin/env python

import sys
import math
import itertools as it
from collections import deque

sys.setrecursionlimit(10000000)

MOD = 10 ** 9 + 7
n, k_ = map(int, raw_input().split())

m_comb = {}
m_pow = {}
m_inv = {}

def comb(N, K):
    if (N, K) in m_comb:
        return m_comb[(N, K)]
    if N == K or K == 0:
        m_comb[(N, K)] = 1
        return 1
    m_comb[(N, K)] = (comb(N - 1, K) + comb(N - 1, K - 1)) % MOD
    return m_comb[(N, K)]

def pow(N):
    if N in m_pow:
        return m_pow[N]
    ret = 1
    for i in range(n):
        ret *= N
        ret %= MOD
    m_pow[N] = ret
    return ret

def inv(N):
    if N in m_inv:
        return m_inv[N]
    pow_num = MOD - 2
    pow_cur = N
    ret = 1
    while pow_num > 0:
        if pow_num % 2 == 1:
            ret *= pow_cur
            ret %= MOD
        pow_cur *= pow_cur
        pow_cur %= MOD
        pow_num /= 2
    m_inv[N] = ret
    return ret

ans = 0
for k in range(1, k_ + 1):
    num = pow(k)
    sig = -1

    for i in range(k - 1, 0, -1):
        num += (comb(k, i) * pow(i) % MOD) * sig
        sig *= -1

    for i in range(1, k + 1):
        num *= inv(i)
        num %= MOD
    ans += num
    ans %= MOD

print ans



Measured memory_bytes: 84660
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979

using namespace std;

int main(void){
  ll n;
  cin >> n;
  cout << n * (n - 1) / 2 << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii              pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define PI              3.14159265
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define pw(b,p)         pow(b,p) + 0.1
#define __              ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define rep(i,a,b) 		for(int i=a;i<b;i++)
#define repb(i,a,b) 	for(int i=a;i>=b;i--)
#define endl			"\n"
#define m(a)		    memset(a,0,sizeof(a))
#define all(x)          begin(x), end(x)

/*
// warning this works with cpp14 only...register depricated in 17
void fastscan(int &x){
bool neg = false;register int c;
x = 0;c = getchar();
if(c=='-'){neg = true;c = getchar();}
for(; (c>47 && c<58); c=getchar()){x = x *10 + c - 48;}
if(neg){x *= -1;}}

*/

void file(){
	#ifndef ONLINE_JUDGE
	freopen("in.txt" , "r" , stdin);
	freopen("out.txt" , "w" , stdout);
	#endif
}

int bs(int a[] , int s , int e, int x){
	if(s<=e){
		int m = (s+e)/2;
		if(a[m]==x)
			return m;
		else if(a[m] > x)
			return bs(a,s,m-1,x);
		else return bs(a,m+1,e,x);
	}
	return -1;
}

#define tr(x) cout<<x<<endl;
#define tr2(x,y) cout<<x<<" "<<y<<endl;
#define tr3(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl;
#define tr4(w,x,y,z) cout<<w<<" "<<x<<" "<<y<<" "<<z<<endl;
#define tr5(v,w,x,y,z) cout<<v<<" "<<w<<" "<<x<<" "<<y<<" "<<z<<endl;
#define tr6(u,v,w,x,y,z) cout<<u<<" "<<v<<" "<<w<<" "<<x<<" "<<y<<" "<<z<<endl;

#define deb(x) cout<<#x<<"="<<x<<endl
#define deb2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
#define deb3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<endl
#define deba(a) for(auto &x:a) cout<<x<<" ";

#define sd(x) cin >> x;
#define sd2(x,y) cin >> x >> y;
#define sd3(x,y,z) cin >> x >> y >> z;
#define sd4(w,x,y,z) cin >> w >> x >> y >> z;

bool is_pal(string s) {return equal(all(s), s.rbegin());}

int fxp(int a, int b ,int p){       //(logn) fast exponentiation
    int res = 1;            		// call int x = fxp(2,5);
    while (b > 0) {
        if (b & 1)
            res = (res * a)%p;
        a = (a * a)%p;
        b >>= 1;
    }
    return (res%p);
}

void solve(){
	int n,x,t; cin >> n >> x >> t;
	int ans=0;
	ans+=(t*(n/x));
	if(n%x!=0)
		ans+=t;
	cout << ans << endl;
}

int32_t main(){	
	__;
	file();
	solve();
	return 0;
}







Measured memory_bytes: 3616
#include "bits/stdc++.h"
using namespace std;

int main() {
	long long N;
	string S;
	cin >> N >> S;
	for (int i = 0; i < S.size(); i++) {
		long long C = S[i] - 'A';
		C = (C + N) % 26;
		S[i] = (C + 'A');
	}
	cout << S << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define g(a, b) __gcd((a), (b))
#define l(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
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; }
template<class T, class U>T rem(T a, U b) { return a - b*floor(a/b); }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;

ll calc(ll n)
{
        return n*(n+1)/2;
}

int main()
{
        ll a, b;
        cin >> a >> b;
        ll diff = b - a;
        ll y = calc(diff);
        ll ans = y - b;
        cout << ans << endl;
}

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

int main() {
   ll x;
   cin >> x;

   ll bank = 100;
   for (int i=1;; i++) {
       bank = floor(bank * 1.01);
       if (bank >= x) {
           cout << i << endl;
           return 0;
       }
   }
}

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

int main(){
    int N,i;
    int l,r;
    int sum=0;

    cin >> N;

    for(i=0;i<N;i++){
        cin >> l >> r;
        sum+=(r-(l-1));
    }

    cout << sum << endl;
}

Measured memory_bytes: 256
from collections import Counter

n = int(input())
aa = list(map(int,input().split()))

c=Counter(aa)

ans = 0
z_flag = False

if n%2 == 1:  
  if c[0] != 1:  
    z_flag = True    
else:
  if c[0] != 0:  
    z_flag = True    
    
ans = 1      
for k,v in c.items():
  if k==0:
    pass
  else:
    if v//2 != 1:
      z_flag = True
      break
    else:
      ans *= v      

if z_flag:
  ans = 0
  
print(ans % (10**9+7))  

Measured memory_bytes: 14820
/*The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

//PRABHJOT SINGH A.K.A. PRABHI
//~~~~~conquizztador~~~~~


#include<bits/stdc++.h>
using namespace std;
using lli = long long int;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
const int MOD = 1000000007;
const int MOD1 = 998244353;
const int maxn = 100010;
const int lim = (int)1e9;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n = 0;
	cin >> n;
	vector<int> a(n);
	for (auto &i : a)
		cin >> i;
	lli sum = accumulate(a.begin(), a.end(), 0ll);
	lli d = sum / ((1ll * n * (n + 1)) / 2);
	if (sum % ((1ll * n * (n + 1)) / 2) != 0ll)
	{
		cout << "NO" << endl; return 0;
	}
	for (int i = 0; i + 1 < n; ++i)
	{
		lli diff = d + a[i] - a[i + 1];
		if (diff < 0ll || diff % n != 0ll)
		{
			cout << "NO" << endl;
			return 0;
		}
	}
	lli last = d + a[n - 1] - a[0];
	if (last < 0ll || last % n != 0ll)
		cout << "NO";
	else
		cout << "YES";
	cout << endl;
}

Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
typedef long long ll;
const ll inf = 1e9;
int main(){
    int n; cin >> n;
    vector<ll> a(n);
    rep(i,n)cin >> a[i];
    int q; cin >> q;
    rep(i,q){
        int b, m, e;
        cin >> b >> m >> e;
        rotate(a.begin()+b, a.begin()+m, a.begin()+e);
    }
    rep(i,n)cout << a[i] << ((i < n-1)?" ":"\n");
    return 0;
}


Measured memory_bytes: 3148
n,k = list(map(int, input().split()))
mod = 10**9+7


lst = [None for i in range(n+1)]
for i in range(n+1):
    lst[i]=i

ans = 0
for i in range(k,n+2):
    ans += (n*i - i**2 + i + 1)%mod
    ans %= mod
    # ans += ((2*n-i+1)*i)/2 - (i*(i-1))/2 + 1

print(ans)


Measured memory_bytes: 16980