akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N; cin >>N;
  bool flag=true;
  for(int i=0; i<N; i++){
    int tmp; cin >>tmp;
    if(tmp%2==0){
      if(tmp%3!=0 && tmp%5!=0){
        flag=false;
      }
    }
    if(!flag) break;
  }
  if(flag) cout <<"APPROVED" <<endl;
  else cout <<"DENIED" <<endl;
}


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

int main(void){
    ll n, k;
    cin >> n >> k;

    map<ll, ll> a;
    rep(i, n){
        ll tmp;
        cin >> tmp;
        a[tmp]++;
    }

    vector<ll> b;
    for(auto m: a){
        b.push_back(m.second);
    }

    ll num = b.size();
    ll count = 0;
    sort(b.begin(), b.end());
    rep(i, b.size()){
        if(num > k && b[i] != 0){
            num--;
            count += b[i];
        }
    }

    cout << count << endl;
    return 0;
}


Measured memory_bytes: 14964
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char>cvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
int main()	{
  int n;
  cin>>n;
  string s;
  map<string,int>score;
  rep(i,n){
    cin>>s;
    score[s]++;
  }
  cout<<score.size()<<endl;
}

Measured memory_bytes: 19264
#include<iostream>
#include<cmath>
#include<cstring>
#define INF 100000
using namespace std;
int n;
char seki[101],c;
void SetA(short);
void SetB();
void SetC(bool);
void SetD(bool);
int main(){
  int m;
  while(cin >> n >> m && n||m){
    memset(seki,'#',sizeof(seki));
    for(int i=0;i<m;i++){
      cin >> c;
      if(c=='A') SetA(1);
      else if(c=='B') SetB();
      else if(c=='C') SetC((i==0 ? false : true));
      else SetD((i==0 ? false : true));
    }
    for(int i=0;i<n;i++) cout << seki[i];
    cout << endl;
  }
}
void SetA(short ab){  // とりあえず左の席
  for(int i=0;i<n;i++){
    if(seki[i]=='#'){
      seki[i] = (ab==1 ? 'A' : (ab==2 ? 'B' : 'D'));
      return;
    }
  }
}
void SetB(){  // 隣にAがいなければHappy
  for(int i=n-1;i>=0;i--){
    if(seki[i-1]!='A' && seki[i]=='#' && seki[i+1]!='A'){
      seki[i] = 'B';
      return;
    }
  }
  SetA(2);
}
void SetC(bool k){ // 人が好き
  if(!k){
    seki[(n%2==1 ? (n+1)/2 : (n/2+1)) -1] = 'C';
    return;
  }
  for(int i=0;i<n;i++){
    if(seki[i] != '#'){
      if(seki[i+1] == '#'){
	seki[i+1] = 'C';
	return;
      }
      if(seki[i-1] == '#'){
	seki[i-1] = 'C';
	return;
      }
    }
  }
}
void SetD(bool k){ // 人が嫌い
  if(!k){
    seki[0] = 'D';
    return;
  }
  int MAX=0,j,m,MAXi;
  for(int i=0;i<n;i++){
    if(seki[i]=='#'){
      for(j=i-1;j>=0;j--) if(seki[j]!='#') break;
      for(m=i+1;m<n;m++) if(seki[m]!='#') break;
      if(j==-1) j = INF;
      if(m==n) m = INF;
      if(j==INF){
	if(k-i > MAX) MAX = m-i,MAXi=i,MAXi=i;
      } else if(m==INF){
	if(i-j > MAX) MAX = i-j,MAXi=i;
      } else{
	if(min(m-i,i-j) > MAX) MAX=min(m-i,i-j),MAXi=i;
      }
    }
  }
  if(MAX==0) SetA(3);
  else seki[MAXi] = 'D';
}

Measured memory_bytes: 1156
A, B, C, X, Y = map(int, input().split())
tmp = A*X + B*Y
if X >= Y:
    tmp = min(tmp,2*Y*C+(X-Y)*A)
else:
    tmp = min(tmp,2*X*C+(Y-X)*B)
tmp = min(tmp,max(X,Y)*2*C)
print(tmp)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
using ll = long long;
const ll mod = 1000000007;
const ll INF = 100000000000000000LL;
signed main(){
    int n;
    cin>>n;
    if(n%10==9||n/10==9)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	double moun[2];
	double max = 0;
	double min;
	double diff;
	int i = 0;
	
	while (scanf("%lf", &moun[i]) != EOF){
		if (i == 0){
			min = moun[i];
			max = moun[i];
			i++;
		}
		else if (min > moun[i]){
			min = moun[i];
		}
		else if (max < moun[i]){
			max = moun[i];
		}
	}
	
	diff = max - min;
	
	printf("%.1lf\n", diff);
	
	return (0);
}

Measured memory_bytes: 652
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  int x, y;
  cin >> x >> y;
  for (int i = 0; i <= x; i++) {
    if (2 * i + 4 * (x - i) == y) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3636
#define _GLIBCXX_DEBUG
typedef long long ll;
#include <bits/stdc++.h>

using namespace std;

ll mod = 1000000007;

template<class Type> inline bool chmax(Type& a, Type b) { if (a < b) { a = b; return 1; } return 0; }
template<class Type> inline bool chmin(Type& a, Type b) { if (a > b) { a = b; return 1; } return 0; }

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

template<class Type>
Type gcd(Type x, Type y)
{
	Type r;
	if (x < y)
	{
		swap(x, y);
	}

	while (0 < y)
	{
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}

template<class Type>
bool isPrime(Type x)
{
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;

	for (Type i = 3; i <= sqrt(x); i += 2)
	{
		if (x % i == 0) return false;
	}
	return true;
}

template<class Type>
vector<bool> eratos(Type n)
{
	vector<bool> isPrime(n + 1, true);
	isPrime[0] = isPrime[1] = false;
	for (Type i = 2; i <= n; i++)
	{
		if (isPrime[i])
		{
			Type j = i + i;
			while (j <= n)
			{
				isPrime[j] = false;
				j = j + i;
			}
		}
	}
	return isPrime;
}

int main()
{
	int n;
	string s;
	cin >> n >> s;

	int west = 0, east = 0;
	for (int i = 0; i < n; i++)
	{
		if (s[i] == 'W')
		{
			west++;
		}
	}
	east = n - west;

	// i番目までのwの数を前処理で求める（累積和）
	vector<int> sum(n + 1);
	for (int i = 0; i < n; i++)
	{
		sum[i + 1] = (s[i] == 'W') ? sum[i] + 1 : sum[i];
	}

	int ans = INT_MAX;
	for (int i = 0; i < n; i++)
	{
		int tmp = 0;
		if (s[i] == 'W')
		{
			tmp = sum[i] + east - i + sum[i];
		}
		else
		{
			tmp = sum[i] + east - i + sum[i] - 1;
		}
		ans = min(ans, tmp);
	}

	cout << ans << endl;
}

Measured memory_bytes: 1796
#include <bits/stdc++.h>
using namespace std;
int main(){
int N,K;
cin >> N >> K;
string S;
cin >> S;
if(S.at(K-1)=='A'){
  S.at(K-1)='a';
}
if(S.at(K-1)=='B'){
  S.at(K-1)='b';
}
if(S.at(K-1)=='C'){
  S.at(K-1)='c';
}
  cout << S <<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main() {
int n, count;
scanf("%d",&n);
while(n != 0) {
count = 0;
while(n != 1) {
if(n % 2) {
n = n * 3 + 1;
} else {
n /= 2;
}
count++;
}
printf("%d\n",count);
scanf("%d",&n);
}
return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
 
#ifndef ONLINE_JUDGE
#define freopen freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#else
#define freopen //comment
#endif
#define io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define pb push_back
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

 main() 
{
   //#define int long long int 
  // freopen
   io
   int h,w,k;
   cin>>h>>w>>k;
   char v[h+1][w+1];
   int ans=0;
   for(int i=0;i<h;i++)for(int j=0;j<w;j++){cin>>v[i][j];}
   
   for(int i=0;i<(1<<h);i++)
   {
    for(int j=0;j<(1<<w);j++)
    {
      int black=0;
      for(int row=0;row<h;row++)
      {
        for(int col=0;col<w;col++)
        {
          if(((1<<row)&i)==0 && ((1<<col)&j)==0 && v[row][col]=='#')black++;
        }
      }
      if(black==k)ans++;
    }
   }
   cout<<ans<<endl;

   
  return 0;

}


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

// Shrotening
#define fst first
#define snd second
#define pb push_back

// Loop
#define FOR(i,a,b) for(auto i=(a);i<(b);++i)
#define RFOR(i,a,b) for(auto i=(a);i>=(b);--i)

#define REP(i,a) for(long i=0;i<(a);++i)
#define RREP(i,a) for(long i=(a);i>=0;--i)

#define EACH(i,a) for(auto (i)=(a).begin(),_END=(a).end();i!=_END;++i)
#define REACH(i,a) for(auto (i)=(a).rbegin(),_END=(a).rend();i!=_END;++i)

//Algorithm
#define ALL(a) (a).begin(), a.end()
#define RALL(a) (a).rbegin(), a.rend()
#define EXIST(a,x) ((a).find(x)!=(a).end())
#define SORT(a) std::sort((a).begin(), (a).end())
#define UNIQUE(a) std::sort((a).begin(), a.end()), a.erase(std::unique((a).begin(), a.end()), a.end());
#define SUM(a) std::accumulate((a).begin(), (a).end(), 0);

//Setting
#define OPT std::cin.tie(0);std::ios::sync_with_stdio(false);

//debug message
bool debug = true;
#define MSG(s)   if(debug){std::cout << s << std::endl;}
#define DEBUG(x) if(debug){std::cout << "debug(" << #x << "): " << x << std::endl;}

//alias
typedef long long LL;
typedef std::vector<char> VC;
typedef std::vector<int>  VI;
typedef std::vector<long> VL;
typedef std::vector<long long> VLL;

typedef std::vector< VC > VC2;
typedef std::vector< VI > VI2;
typedef std::vector< VL > VL2;
typedef std::vector< VLL > VLL2;

typedef std::pair<int,int> PII;

std::string s;
int K;
int len;

int main() {
    std::cin >> s;
    std::cin >> K;
    len = s.length();

    std::set< std::string > subset;

    int k, l, L = std::min(len, 5);
    for(l=1; l<=L; ++l) {
        for(k=0; k+l<=len; ++k) {
            auto sub = s.substr(k, l);
            subset.insert(sub);
        }
    }

    std::vector< std::string > v(subset.begin(), subset.end());
    SORT(v);
    
    std::cout << v[K-1] << std::endl;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
using namespace std;

struct Node {
    int key;
    Node *right, *left, *parent;
};

Node *root, *NIL;

Node * find(Node *u,int k){
    while(u != NIL && k != u->key){
        if(k < u->key) u = u->left;
        else u = u->right;
    }
    return u;
}

void insert(int k){
    Node *y = NIL;
    Node *x = root;
    Node *z;
    
    z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;
    
    while(x != NIL){
        y = x;
        if(z->key < x->key){
            x = x->left;
        }else{
            x = x->right;
        }
    }
    z->parent = y;
    if(y == NIL){
        root = z;
    }else{
        if(z->key < y->key){
            y->left = z;
        }else{
        y->right = z;
       } 
    }    
}

void inorder(Node *u){
    if(u == NIL) return;
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}
void preorder(Node *u){
    if(u == NIL) return;
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
}

int main(){
    int n,i,x;
    string com;
    
    scanf("%d",&n);
    
    for(i=0;i<n;i++){
        cin >> com;
        if(com[0] == 'f'){
            scanf("%d",&x);
            Node *t = find(root,x);
            if(t != NIL) printf("yes\n");
            else printf("no\n");
        }else if( com =="insert" ){
            scanf("%d",&x);
            insert(x);
        }else if(com == "print"){
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }
    
    return 0;
}


Measured memory_bytes: 22032
def solve(n, k, c, s):
    # greedy from first
    g_f = [0] * n
    last_worked = - c - 1
    cnt = 0
    for i in range(n):
        if last_worked + c + 1 <= i and s[i] == "o":
            cnt += 1
            g_f[i] = cnt
            last_worked = i
        if cnt == k:
            break
    # print(g_f)

    # greedy from last
    g_l = [0] * n
    last_worked = n + c
    cnt = k
    for i in range(n - 1, -1, -1):
        if i + c + 1 <= last_worked and s[i] == "o":
            g_l[i] = cnt
            cnt -= 1
            last_worked = i
        if cnt == 0:
            break
    # print(g_l)

    res = []
    for i in range(n):
        if 0 < g_f[i] == g_l[i]:
            res.append(i + 1)
    return res


def main():
    n, k, c = map(int, input().split())
    s = input()
    res = solve(n, k, c, s)
    for r in res:
        print(r)


def test():
    assert solve(11, 3, 2, "ooxxxoxxxoo") == [6]
    assert solve(5, 2, 3, "ooxoo") == [1, 5]
    assert solve(5, 1, 0, "ooooo") == []
    assert solve(16, 4, 3, "ooxxoxoxxxoxoxxo") == [11, 16]


if __name__ == "__main__":
    test()
    main()


Measured memory_bytes: 27232
#include <stdio.h>

int main(void) {
	int count[3] = {0};
	char S[8];
	int i;
	if (scanf("%7s", S) != 1) return 1;
	for (i = 0; S[i] != '\0'; i++) count[S[i] - 'a']++;
	puts(count[0] == 1 && count[1] == 1 && count[2] == 1 ? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 128
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

N = int(input())

# exp[i]: iの指数
exp = [0] * (N + 1)
primes = primes(N)
for n in range(2, N + 1):
    num = n
    for prime in primes:
        while num % prime == 0:
            exp[prime] += 1
            num //= prime

cnt = lambda X: len([e for e in exp if e >= X])

ans = cnt(74)
ans += cnt(14) * (cnt(4) - 1)
ans += cnt(24) * (cnt(2) - 1)
ans += cnt(4) * (cnt(4) - 1) * (cnt(2) - 2) // 2

print(ans)

Measured memory_bytes: 38512
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int> a
#define pb push_back
#define sz(x) int(x.size())

#define mp make_pair
#define all(a) (a).begin(), (a).end()

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

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

ll keta(ll n)
{
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1, 0, -1, 0};
const int dw[4] = {0, 1, 0, -1};

struct Edge
{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind
{
public:
  vi Parent;
  UnionFind(int n)
  {
    Parent = vi(n, -1);
  }

  int root(int a)
  {
    if (Parent[a] < 0)
      return a;
    else
      return Parent[a] = root(Parent[a]);
  }

  int size(int a)
  {
    return -Parent[root(a)];
  }

  bool merge(int a, int b)
  {
    a = root(a);
    b = root(b);
    if (a == b)
      return false;

    if (size(a) < size(b))
      swap(a, b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }
};

class Factrial
{
public:
  vl Fac;
  Factrial(int MAX)
  {
    Fac = vl(MAX + 1);
    rep(i, MAX)
    {
      if (i == 0)
        Fac[i + 1] = 1;
      else
        Fac[i + 1] = ((i + 1) * Fac[i]) % MOD;
    }
  }
};

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

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

int main() {
    ll n,k;
    cin >> n >> k;

    vector<ll> h(n);
    rep(i,n) cin >> h.at(i);

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

    rep(i,k) {
        h.pop_back();
        n--;
    }
    ll sum=0;
    rep(i,n) sum += h.at(i);

    cout << sum << endl;
}


Measured memory_bytes: 1792
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>; 
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    int n, a; cin >> n >> a;
    cout << n*n-a << ln;
}




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

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
  	cin.tie(0);
	
	int A, B;
	cin >> A >> B;
	if (A >= 13)
		cout << B << endl;
	else if (A >= 6 && A <= 12)
		cout << B / 2 << endl;
	else
		cout << 0 << endl;
    return 0;
}


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

using namespace std;


//repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define euc_dis(x, y) sqrt(x*x + y*y)

#define MOD 1e9+7
#define sp ' '


using ll = long long;


ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}

int main(){

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

    int n;
    cin >> n;
    map<ll, ll> mp;
    set<ll> st;
    rep(i, n){
        ll tmp; cin >> tmp;
        mp[tmp]++;
        st.insert(tmp);
    }

    ll cnt = 0;
    for(auto x : st){
        if(x <= mp[x]){
            cnt += mp[x] - x;
        }
        else{
            cnt += mp[x];
        }
    }


    ppp(cnt);



    return 0;
}


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

typedef unsigned long long ull;

int exp(int A, int B, int C)  
{  
    if (A == 0)  
        return 0;
    if (B == 0)  
        return 1;
    ull y;  
    if (B % 2 == 0) {  
        y = exp(A, B / 2, C);  
        y = (y * y) % C;  
    }
    else {  
        y = A % C;
        y = (y * exp(A, B - 1, C) % C) % C;
    }
    return (int)((y + C) % C);  
}  

int main(){
	ull MOD = 1000000007;
	int K;
	string S;
	cin >> K >> S;
	ull ans = 0;
	int size = K + S.size() + 10;
	ull fact[size];
	ull inv[size];
	fact[0] = 1;
	inv[0] = 1;
	for(int a = 1; a < size; a++){
		fact[a] = (fact[a - 1] * a) % MOD;
		inv[a] = exp(fact[a], MOD - 2, MOD);
	}
	ull tf[size];
	ull ts[size];
	tf[0] = 1;
	ts[0] = 1;
	for(int a = 1; a < size; a++){
		tf[a] = (tf[a - 1] * 25) % MOD;
		ts[a] = (ts[a - 1] * 26) % MOD;
	}
	for(int a = 0; a <= K; a++)
		ans = (ans + ((((fact[K - a + S.size() - 1] * inv[K - a]) % MOD * inv[S.size() - 1]) % MOD * tf[K - a]) % MOD * ts[a]) % MOD) % MOD;
	cout << ans << endl;
}

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

int main(int argc, const char * argv[]) {



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

    /////////////////////
    // Write code below /
    /////////////////////
    long long int X,n=100,cnt=0;

    cin>>X;

    while(1){
        n=n*1.01;
        cnt++;
        if(n>=X)
            break;
    }
    cout<<cnt<<endl;


    return 0;
}


Measured memory_bytes: 3612
from itertools import accumulate as acc
N, C = map(int, input().split())
ds, vs = [], []
for i in range(N):
  d, v = map(int, input().split())
  ds.append(d)
  vs.append(v)
rvcs = list(acc(vs))
lvcs = list(acc(vs[:: -1]))
rds = ds
lds = [C - d for d in ds[:: -1]]
re = [v - d for d, v in zip(rds, rvcs)]
le = [v - d for d, v in zip(lds, lvcs)]
remax = [0]
lemax = [0]
for i in range(N):
  remax.append(max(remax[-1], re[i]))
  lemax.append(max(lemax[-1], le[i]))
res = 0
#i個のスシを補給する時、右回り直進、左回り直進、右回り反転左回り、左回り反転右回りがある
#反転の際はエネルギー累積maxを使わないと同じスシを２回食べちゃうかも
#反転しない際は取れるだけ取らせてみてもいい
for i in range(N):
  res = max(res, re[i], le[i], re[i] + lemax[N - i - 1] - rds[i], le[i] + remax[N - i - 1] - lds[i])
print(res)

Measured memory_bytes: 82552
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <string>
#include <algorithm>
#include <cmath>
#include <climits>
#define REP(i, n) for(int i=0; i<(n); i++)
#define FOR(i, a, n) for(int i=(a); i<(n); i++)
using namespace std;

int main(){
    string ans;
    cin >> ans;
    ans[3] = '8';
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

int main() {
  //freopen("input.in","r",stdin);
  //freopen("output.out","w",stdout);

  int A, B, C;
  cin >> A >> B >> C;

  cout << min(B/A, C) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
#define MAX 12
#define mk make_pair
#define INF 1<<28
string s[20];
bool vis[20][20];
int dx[]={0,0,1,-1},dy[]={1,-1,0,0};
int n,w,h,d[MAX][MAX],c;
int dp[1<<MAX][MAX];
int rec(int s,int v){
  if(dp[s][v]>=0)return dp[s][v];
  if(s==(1<<n)-1&&v!=0)return dp[s][v]=0;
  int res=INF;
  for(int u=0;u<n;u++) 
    if(!(s>>u&1))
      res=min(res,rec(s|1<<u,u)+d[v][u]);
  return dp[s][v]=res;
}
void bfs(int x2,int y2,int k){
  r(i,20)r(j,20)vis[i][j]=0;
  queue<pair<pair<int,int>,int> > q;
  vis[x2][y2]=1;
  q.push(mk(mk(x2,y2),0));
  while(!q.empty()){
    pair<pair<int,int>,int>p=q.front();q.pop();
    int p1=p.first.first,p2=p.first.second,p3=p.second;
    r(i,4){
      int x=dx[i]+p1;
      int y=dy[i]+p2;
      if(x>=0&&x<w&&y>=0&&y<h)
        if(!vis[x][y]&&(s[y][x]!='x')){
          if(0<=s[y][x]&&s[y][x]<12)
            d[k][(int)s[y][x]]=p3+1;
          else if(k!=0&&s[y][x]=='o')
            d[k][0]=p3+1;
          q.push(mk(mk(x,y),p3+1));
          vis[x][y]=1;
        }
    }
  }
}
int main(){
  while(cin>>w>>h,w){c=1;
    int a,b;
    vector<pair<int,int> >v;
    r(i,h)cin>>s[i];
    r(j,w)r(i,h)if(s[i][j]=='*')s[i][j]=c++,v.push_back(make_pair(j,i));
  memset(dp,-1,sizeof(dp));
  n=c;
  r(i,MAX)r(j,MAX)d[i][j]=INF;
  r(j,w)r(i,h)if(s[i][j]=='o')a=j,b=i;
  bfs(a,b,0);
  r(i,c-1)bfs(v[i].first,v[i].second,i+1);
  int p=rec(1,0);
  if(p==INF)p=-1;
  cout<<p<<endl;
  }
}

Measured memory_bytes: 3348
#include <iostream>
#include <string>
#include <vector>

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

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

  cout << "ABC" << std::to_string(N) << endl;

  return 0;
}


Measured memory_bytes: 256
# 2019/04/20
# AtCoder Beginner Contest 082 - C

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

dict = {}
for i in range(n):
    if dict.get(a[i]) == None:
        dict[a[i]] = 1
    else:
        dict[a[i]] += 1

cnt = 0

for keys, vals in dict.items():
    if keys > vals:
        cnt += vals
    elif keys < vals:
        cnt += vals - keys

print(cnt)


Measured memory_bytes: 18164
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        sc.nextLine();
        for(int i = 0;i<n;i++){
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
            sc.nextLine();
        }
        int[] c = new int[m];
        int[] d = new int[m];
        for(int i = 0;i<m;i++){
            c[i] = sc.nextInt();
            d[i] = sc.nextInt();
            sc.nextLine();
        }
        int[] answer = new int[n];
        int tmp = Integer.MAX_VALUE;
        int min = Integer.MAX_VALUE-1;
        for(int i = 0;i<n;i++){
            for(int j = 0;j<m;j++){
                tmp = Math.min(tmp,Math.abs(a[i] - c[j]) + Math.abs(b[i]-d[j]));
                if(min > tmp){
                    min = tmp;
                    answer[i] = j+1;
                }
            }
            tmp = Integer.MAX_VALUE;
            min = Integer.MAX_VALUE-1;
        }
        for(int i = 0;i<n;i++){
            System.out.println(answer[i]);
        }
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)

/* exchange */
#define chmin(a, b) (a) = min((ll)(a), (ll)(b))
#define chmax(a, b) (a) = max((ll)(a), (ll)(b))

/* output */
#define I(x) cin >> x;
#define D(x) cerr << (x) << " ";
#define BR cerr << "\n";
#define P(x) cout << (x) << endl;
#define FIX cout << fixed << setprecision(10);

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
ll ret = 0;

int main(void){
  ll A, B;
  I(A);
  I(B);

  if (A >= 13) {
    P(B);
  } else if (A >= 6) {
    P(B/2);
  } else {
    P(0);
  }

}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<functional>
#include<vector>
#include<map>

using namespace std;
#define endl '\n'
#define pb push_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1e9 + 7)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define REP(i,n) for(int i = 0;i < (n);i++)
#define FOR(i,a,b) for(int i = (a);i <= (b);i++)
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl


typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vector<int>> vii;

template <class T = int> T in() { T x; cin >> x; return (x); }
template <class T = int> void out(T x) { cout << (x) << endl; }

int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

void solve() {

	int N;
	cin >> N;

	int ans = 0;

	vi a(N);
	REP(i, N) {
		cin >> a[i];
		ans += a[i] - 1;
	}

	out(ans);

	return;

}

int main() {

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

	solve();

	return 0;

}

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

int main(){
  int N,ans=0;
  cin >> N;
  int d[N],num[100]={};
  for(int i=0;i<N;i++){
    cin >> d[i];
    num[d[i]-1]++;
  }
  for(int j=0;j<100;j++){
    if(num[j]>0){
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define ALL(c) (c).begin(), (c).end()
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin >> a >> b;
    int ans = 1e9;
    rep(i,2000)
    {
        if (((int)(floor(0.08*i))) == a && ((int)(floor(0.1 * i)) == b))
        {
            ans = i;
            break;
        }
    }
    if (ans == 1e9)
    {
        cout << -1 << endl;
    }
    else
    {
        cout << ans << endl;
    }
    

    
    
}




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

int main(){
 int a,b,N;
  cin >> a >> b;
  N = b - a;
  int c = 0;
  int i;
  for(i = 0; i <= N; i++){
        c += i;
  } 
  
  cout << c - b << endl;
}

Measured memory_bytes: 256
H, W, K = map(int, input().split())
fi = []
for _ in range(H):
    s = input()
    fi.append(s)
a = 2 ** H
b = 2 ** W
total = 0

for i in range(a * b):
    lh = list()
    lw = list()

    for j in range(H):
        if i & (1 << j):
            lh.append(1)
        else:
            lh.append(0)
    for j in range(W):
        if i & (1 << (j + H)):
            lw.append(1)
        else:
            lw.append(0)
    # print(lh)
    # print(lw)

    cnt = 0
    for j in range(H):
        for l in range(W):
            if lh[j] == 1 or lw[l] == 1:
                continue
            if fi[j][l] == '#':
                cnt += 1
    # print(cnt)
    if cnt == K:
        total += 1

print(total)


Measured memory_bytes: 9148
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>


#define fs first
#define sc second

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;


int main(){
    int N;
    cin >> N;
    vector<int> L;
    for(int i = 0; i < N; i++){
        int l;
        cin >> l;
        L.push_back(l);
    }

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

    auto itr1 = L.begin();
    ll res = 0;
    for(int i = 0; i < N-2; i++){
        auto itr2 = itr1;
        int a = L[i];
        for(int j = i+1; j < N-1; j++){
            int b = L[j];
            itr2++;
            auto itr3 = itr2;
            itr3++;
            if(b - a > *itr3){
                itr3 = upper_bound(L.begin(), L.end(), b-a);
            }
            auto itr4 = lower_bound(L.begin(), L.end(), a+b);
            if(itr4 - itr3 > 0){
                res += itr4 - itr3;
            }
        }
        itr1++;
    }

    cout << res << endl;



    return 0;
}


Measured memory_bytes: 256
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    Main abc120C = new Main();
    System.out.println(abc120C.solve(S));
  }

  public int solve(String S) {
    ABC120CSolve abc120CSolve = new ABC120CSolve();
    return abc120CSolve.solve(S);
  }

  class ABC120CSolve {
    static final int ZERO = (int) '0';

    public int solve(String S) {
      int ans = 0;
      LinkedList<Integer> list = new LinkedList();

      for (char c : S.toCharArray()) {
        int i = (int) c - ZERO;
        if (list.size() == 0) {
          list.addLast(i);
        } else {
          if (list.getLast() != i) {
            list.removeLast();
            ans += 2;
          } else {
            list.addLast(i);
          }
        }
      }
      return ans;
    }
  }
}


Measured memory_bytes: 28692
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <math.h>
#include <unordered_map>
#include <numeric>
#include <sstream>
using namespace std;

int main()
{
	int n,d,x;
	std::vector<int> a(200);
	std::vector<int> b(200);

	std::cin >> n >> d >> x;

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

	for (int i = 0; i < n; i++) {
		int j = 0;
		while((j * a[i] + 1) <= d){
			b[i] = 1 + j++;
		}
	}
	printf("%d\n", std::accumulate(b.begin(), b.end(), 0) + x);

	return 0;
}


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

int main(){
  int n;
  cin >> n;
  vector<int> l(n);
  for (int i = 0; i < n; i++)
  {
    cin >> l[i];
  }
  sort(l.begin(),l.end());
  reverse(l.begin(),l.end());
  
  int ans = 0;
  for (int i = 0; i < n-2; i++)
  {
    for (int j = i+1; j < n-1; j++)
    {
      int c = l[i]-l[j];

      int left = j+1;
      int right = n-1;

      if(left==right){
        if(l[left]>c) ans++;
        break;
      }
      if(l[left]<=c){
        break;
      }
      if(l[right]>c){
        ans += right - j;
        continue;
      }

      while(right-left > 1){
        int mid = (right+left)/2;
        if(l[mid]>c){
          left = mid;
        }
        else{
          right = mid;
        }
      }
      ans += left-j;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
#define endl '\n'
#define fi first
#define se second
#define pi pair<ll,ll>
#define pii pair<ll,pi>
#define pb push_back
#define mk make_pair
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll x, k, d;
	cin >> x >> k >> d;
	x = abs(x);
	ll reach = x / d;
	if (reach <= k) {
		ll des = abs(x - reach * d);
		ll left = k - reach;
		if (left % 2 != 0)
			cout << abs(min({abs(des + d), abs(des - d)})) << endl;
		else
			cout << abs(des) << endl;
	}
	else {
		ll des = abs(x - k * d);
		cout << abs(des) << endl;
	}
}





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

int main(){
    double H, W;
    cin >> H >> W;

    double x, y;
    cin >> x >> y;

    double ans = 0;
    ans = H * W / 2.0;

    int frag = 2;
    if(x == H / 2.0 && y == W / 2.0){
        frag = 1;
    }else{
        frag = 0;
    }

    cout << fixed << setprecision(6) << ans << " " << frag << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const int N = 3003;
int dp[N][N];

int main(){
    string s,t;
    cin >>s >>t;
    int S = s.size(), T = t.size();

    rep(i,S+1)rep(j,T+1){
        if(i<S) dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
        if(j<T) dp[i][j+1] = max(dp[i][j+1], dp[i][j]);
        if(i<S && j<T && s[i]==t[j]) dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]+1);
    }

    int x = S, y = T;
    string ans = "";
    while(x>0 || y>0){
        // printf(" x y %d %d\n", x, y);
        if(x>0 && y>0 && s[x-1]==t[y-1] && dp[x][y] == dp[x-1][y-1]+1){
            ans += s[x-1];
            --x;
            --y;
            continue;
        }

        if(x>0 && dp[x][y] == dp[x-1][y]){
            --x;
            continue;
        }
        if(y>0 && dp[x][y] == dp[x][y-1]){
            --y;
            continue;
        }
        assert(false);
    }

    reverse(all(ans));
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 35456
#include<cstdio>
#include<set>
#include<cstring>
#include<algorithm>
using namespace std;
int len,k;
char c[10];
int bit[10];
int dis[10],to[10];
int fir;
void go()
{//puts("__");
    int wei=len;
    for(int i=1;i<=wei;i++)
    {//printf("wei = %d\n",wei);
        if(bit[i]>9)
        {
            bit[i+1]+=bit[i]/10;
            bit[i]=bit[i]%10;
            if(i==len)wei=len+1;
        }
        if(to[bit[i]]==-1)
        {
            bit[i]=fir,bit[i+1]++;
            if(i==len)wei=len+1;
        }
        else if(to[bit[i]]>bit[i])
        {
            for(int j=i-1;j;j--)bit[j]=fir;
            bit[i]=to[bit[i]];
        }
        else bit[i]=to[bit[i]];
    }
    for(int i=wei;i;i--)printf("%d",bit[i]);puts("");
}
int main()
{
    while(~scanf("%s%d",c+1,&k))
    {
        len=strlen(c+1);
        int id=1;
        for(;c[id]=='0';id++);
        for(int i=1;i<=len-id+1;i++)
        {
            c[i]=c[i-1+id];
        }
        len=len-id+1;
        //printf("len  = %d\n",len);
        for(int i=1;i<=len;i++)bit[i]=c[len+1-i]-'0';bit[len+1]=0;
        memset(dis,0,sizeof dis);
        fir=9;
        while(k--)
        {
            int x;scanf("%d",&x);dis[x]=1;
        }
        for(int i=0;i<=9;i++)
        {
            if(!dis[i])
            {
                fir=i;break;
            }
        }
        for(int i=0;i<=9;i++)
        {
            to[i]=-1;
            for(int j=i;j<=9;j++)
            {
                if(!dis[j])
                {
                    to[i]=j;break;
                }
            }
        }
        go();
    }
}


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

long long solve(int N, int W, int w[], int v[]){
  long long sumv[W];
  long long sumvp[W];
    
  for(int j = 0; j <= W; ++j){
    if(j < w[0]){
      sumv[j] = 0;
    }else{
      sumv[j] = v[0];
    }
  }
  copy(sumv, sumv+W+1, sumvp);
  
  for(int i = 1; i < N; ++i){
    for(int j = 0; j <= W; ++j){
      if(j < w[i]) continue;
      sumv[j] = max(sumvp[j-w[i]] + v[i], sumv[j]);
    }
    copy(sumv, sumv+W+1, sumvp);
  }
  
  return sumv[W];
}


int main(){
  int N, W;
  cin >> N >> W;
  int w[N], v[N];
  for(int i = 0; i < N; ++i){
    cin >> w[i] >> v[i];
  }
  cout << solve(N, W, w, v) << endl;
  return 0;
}


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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int n,a,b;
bool memo[300001];
vector<int> v;

signed main() {
    cin >> n >> a >> b;
    if (n > a*b || n < a+b-1) {
        cout << -1 << endl;
        return 0;
    } else {
        int now=b,cnt=n;
        while(1) {
            rep(i,b) {
                if (i==b-1) a--;
                cnt--;
                cout << now-i << " ";
                memo[now-i] = true;
                if (a == cnt) {
                    rep1(k,n) if (!memo[k]) cout << k << " ";
                    return 0;
                }
            }
            now = min(n,now+b);
        }
    }
}


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

using namespace std;
typedef long long ll;
const ll INF = 1e14;
const ll MOD = 1e9 + 7;
int main() {
    ll n, m, k;
    ll i, j, h;
    cin >> n;
    vector<ll> a(n+1),b(n);
    for(i=0;i<n+1;i++){
        cin >> a[i];
    }
    for(i=0;i<n;i++){
        cin >> b[i];
    }
    ll cnt=0;
    for(i=0;i<n;i++){
        if(a[i]>b[i]){
            cnt+=b[i];
            b[i]=0;
        }else{
            cnt+=a[i];
            cnt+=min(a[i+1],b[i]-a[i]);
            a[i+1]=max(0LL,a[i+1]-(b[i]-a[i]));
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <limits.h>

using namespace std;

int main(){
	int n,tmp,min=INT_MAX,max=INT_MIN;
	scanf("%d",&n);
	for(int i = 0; i < n; i++){
		scanf("%d",&tmp);
		if(max < tmp-min) max = tmp - min;
		if(min > tmp) min = tmp;
	}
	printf("%d\n",max);
	return 0;
}


Measured memory_bytes: 2756
#include <algorithm>
#include <functional>
#include <iostream>
using namespace std;

int main() {
  int a;
  int b;


  cin >> a >> b ;

  if ((a+b)%2==0){
    cout << (a+b)/2 << endl;
  }

  else{
    cout << (a+b)/2+1 << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

constexpr long long MOD = 1000000007;

int main()
{
  long long W, H, x, y;
  std::cin >> W >> H >> x >> y;
  double A = (double)(W * H) / 2.0;
  bool b = false;
  if (W % 2 == 0 && H % 2 == 0 &&
      W/2 == x && H/2 == y)
    b = true;
  std::cout << std::fixed << std::setprecision(10) << A << " " << (b ? 1 : 0) << std::endl;
  return 0;
}



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

typedef long long ll;

const int maxn = 2e5 + 5;

int main(int argc, const char * argv[])
{
    ll n, a[maxn], sum[maxn] = {0}, x[maxn] = {0}, ans = 0;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        scanf("%lld", &a[i]);
        sum[i] = sum[i-1] + a[i];
        x[i] = x[i-1] ^ a[i];
    }

    for(int l = 1, r = 1; r <= n; r++) {
        while (sum[r] - sum[l-1] != (x[r] ^ x[l-1])) l++;
        ans += r - l + 1;
    }

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

Measured memory_bytes: 4992
import java.util.*;
public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        byte[] daikeihen = new byte[3];
        for(int i = 0;i <= 2; i++){
      	daikeihen[i] = sc.nextByte();
        }System.out.println((daikeihen[0] + daikeihen[1]) * daikeihen[2] / 2);
    }
}

Measured memory_bytes: 20560
from collections import defaultdict

MOD = 998244353
N,S = map(int,input().split())
A = map(int,input().split())

dp = [0]*(S+1)
dp[0] = 1
for a in A:
    ndp = [0]*(S+1)
    for total,cnt in enumerate(dp):
        ndp[total] += dp[total]*2
        ndp[total] %= MOD
        if total+a <= S:
            ndp[total+a] += dp[total]
            ndp[total+a] %= MOD
    dp = ndp

print(dp[-1]%MOD)

Measured memory_bytes: 68952
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main()
{
	int n,a,b;
	cin >> n;
	if (n == 1)
	{
		cout << "Hello World";
	}
	else
	{
		cin >> a >> b;
		cout << a + b;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using u32 = uint32_t;
using vi = vector<int>;    using vvi = vector<vi>;
using vb = vector<bool>;   using vvb = vector<vb>;
using vl = vector<ll>;     using vvl = vector<vl>;
using vd = vector<double>; using vvd = vector<vd>;

#define REP(i,n) for(auto i = 0 * (n), i##_len = (n); i < i##_len; ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i,s,n) for(ll i=s, i##_len=(ll)(n); i<i##_len; ++i)
#define TEN(x) ((ll)1e##x)
const ll mod = TEN(9) + 7;

int main() {
#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
#endif
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(50);
	ll n; cin >> n;
	vl t(n), a(n);
	REP(i, n) cin >> t[i];
	REP(i, n) cin >> a[i];

	vl b(n, -1);
	vl x(n, 1);
	b[0] = t[0];
	b[n - 1] = a[n - 1];

	if (a[0] != t[n - 1]) {
		cout << 0 << endl;
		return 0;
	}

	REP(i, n) {
		if (i > 0 && t[i] > t[i - 1]) {
			if (b[i] != -1 && b[i] != t[i]) {
				cout << 0 << endl;
				return 0;
			}
			b[i] = t[i];
		}
		if (i < n - 1 && a[i] > a[i + 1]) {
			if (b[i] != -1 && b[i] != a[i]) {
				cout << 0 << endl;
				return 0;
			}
			b[i] = a[i];
		}
		if (b[i] != -1 && (b[i] > a[i] || b[i] > t[i])) {
			cout << 0 << endl;
			return 0;
		}
		x[i] = min(t[i], a[i]);
	}

	ll ans = 1;
	REP(i, n) {
		if (b[i] != -1) continue;
		ans = ans * x[i] % (TEN(9) + 7);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3456
import math
a,b,c,d=map(int,input().split())
lcm=c*d//math.gcd(c,d)
a1,a2,a3=(a-1)//c,(a-1)//d,(a-1)//lcm
b1,b2,b3=b//c,b//d,b//lcm
ans=b-a+1-(b1+b2-b3-a1-a2+a3)
print(ans)


Measured memory_bytes: 9176
#include <bits/stdc++.h>
using namespace std;
long long mod=1e9+7;
int main(void)
{
	long long fact[100001];
	fact[0]=1;
	for(int i=1;i<=100000;i++)
	{
		fact[i]=(i%mod*fact[i-1]%mod)%mod;
	}
	long long n,m;
	scanf("%lld %lld",&n,&m);
	if(m==n)
	{
		printf("%lld\n",(2%mod*fact[m]%mod)%mod*(fact[n]%mod)%mod);
	}
	else if(m==n-1||n==m-1)
	{
		printf("%lld\n",(fact[n]%mod*fact[m]%mod)%mod);
	}
	else
		printf("0\n");
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

const int DAT_SIZE=(1<<18)-1;

ll data[DAT_SIZE];
ll datb[DAT_SIZE];

void add(int a,int b,int x,int k,int l,int r){
  if(a<=l&&r<=b){
    data[k]+=x;
  }
  else if(l<b&&a<r){
    datb[k]+=(min(b,r)-max(a,l))*x;
    add(a,b,x,k*2+1,l,(l+r)/2);
    add(a,b,x,k*2+2,(l+r)/2,r);
  }
}

ll sum(int a,int b,int k,int l,int r){
  if(b<=l||r<=a){
    return 0;
  }
  else if(a<=l&&r<=b){
    return data[k]*(r-l)+datb[k];
  }
  else{
    ll res=(min(b,r)-max(a,l))*data[k];
    res+=sum(a,b,k*2+1,l,(l+r)/2);
    res+=sum(a,b,k*2+2,(l+r)/2,r);
    return res;
  }
}


int main(){
  int n,m;
  cin>>n>>m;
  vector<pair<int,pair<int,int>>> v;
  for(int i=0;i<n;i++){
    int l,r;
    cin>>l>>r;
    v.push_back(make_pair(r-l,make_pair(l,r)));
  }
  sort(v.begin(),v.end());

  int mit=0;
  for(int q=1;q<=m;q++){
    int z=lower_bound(v.begin(),v.end(),make_pair(q,make_pair(0,0)))-v.begin();
    int ans=n-z;
    int nextmit=z;
    for(int i=mit;i<nextmit;i++){
      pair<int,int> u=v[i].second;
      add(u.first,u.second+1,1,0,0,m+1);
    }

    mit=nextmit;
    for(int i=q;i<=m;i+=q){
      ans+=sum(i,i+1,0,0,m+1);
    }
    cout<<ans<<endl;
  }

  return 0;
}


Measured memory_bytes: 9452
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>

using namespace std;

int main() {

    string S;
    cin >> S;

    if (S == "Sunny") {
        cout << "Cloudy" << endl;
    } else if (S == "Cloudy") {
        cout << "Rainy" << endl;
    } else {
        cout << "Sunny" << endl;
    }

    return 0;
}


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


ll N, K;
int R , S, P;
string T;

int main(){

  cin >> N >> K;
  cin >> R >> S >> P;
  cin >> T;
  string TT;
  ll ans = 0;
  ll co = 0;
  for(char c : T){
    if(c == 'r'){
      if(co - K >= 0){
        if(TT[co-K] == 'p'){
          // cout << " aa";
          TT += 'a';
        }else{
          ans += P;
          TT += 'p';
          // cout << "パー";
        }
      }else{
        ans += P;
        TT += 'p';
        // cout << "パー";
      }

    }else if(c == 's'){
      if(co - K >= 0){
        if(TT[co-K] == 'r'){
          // cout << " aa";
          TT += 'a';
        }else{
          ans += R;
          TT += 'r';
          // cout << "ぐー";
        }
      }else{
        ans += R;
        TT += 'r';
        // cout << "ぐー";
      }

    }else if(c == 'p'){
      if(co - K >= 0){
        if(TT[co-K] == 's'){
          // cout << " aa";
          TT += 'a';
        }else{
          ans += S;
          TT += 's';
          // cout << "チョキー";
        }
      }else{
        ans += S;
        TT += 's';
        // cout << "チョキー";
      }
    }
    co += 1;
  }
  // cout << TT << endl;

  cout << ans << endl;
}


Measured memory_bytes: 640
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  string s; cin >> s;
  if(s.size()%2==1){
    cout << "No" << endl;
    return 0;
  }
  rep(i,s.size()){
    if(i%2==0&&s[i]!='h'||i%2==1&&s[i]!='i'){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 256