akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e18;
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
template<typename T> void cmin(T &a, T b) { a = min(a, b); }

signed main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> east(n + 1, 0), west(n + 1, 0);
  rep(i, n) {
    if (s[i] == 'E')
      east[i + 1]++;
    else
      west[i + 1]++;
  }
  rep(i, n) east[i + 1] += east[i], west[i + 1] += west[i];

  int ans = INF;
  loop(i, 1, n + 1) {
    int tmp = 0;
    tmp += east[n] - east[i];
    tmp += west[i - 1] - east[0];
    cmin(ans, tmp);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5380
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

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

    ll ans = 0;
    int mod = x % 11;
    if (mod == 0) ans = (x / 11) * 2;
    else if (1 <= mod && mod <= 6) ans = (x / 11) * 2 + 1;
    else ans = (x / 11) * 2 + 2;

    cout << ans << endl;
}


Measured memory_bytes: 256
from sys import stdin
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
A,B,C,D=list(map(int,stdin.readline().strip().split()))
C_A=(A-1)//C
C_B=B//C
D_A=(A-1)//D
D_B=B//D
CD=lcm(C,D)
CD_A=(A-1)//(CD)
CD_B=B//(CD)

print((1+B-A)-((C_B-C_A)+((D_B-D_A)-(CD_B-CD_A))))

Measured memory_bytes: 5588
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <complex>
#include <queue>
#include <stack>
#include <string>
#include <cmath>
#include <bitset>

#define rep(i,a) for(int i = 0;i < (a); i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)
#define repd(i,a,b) for(int i = (a); i >= (b); i--)
#define repit(i,a) for(__typeof((a).begin()) i = (a).begin(); i != (a).end(); i++)
#define all(u) (u).begin(),(u).end()
#define rall(u) (u).rbegin(),(u).rend()
#define UNIQUE(u) (u).erase(unique(all(u)),(u).end())
#define pb push_back
#define mp make_pair
#define INF 1e10
#define EPS 1e-10
#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef vector<int> vi;

int H, W;
vector<string> board;


#define dump(x) cerr<<#x<<" = "<<(x)<<endl;
bool solve()
{
  cin >> H >> W;
  board.clear();
  board.resize(H);
  for (int i = 0; i < H; ++i)
    cin >> board[i];

  map<char,int> mx, my, Mx, My;
  for (int y = 0; y < H; ++y) {
    for (int x = 0; x < W; ++x) {
      char c = board[y][x];
      if (c != '.') {
	if (mx.find(c) != mx.end())
	  mx[c] = min(mx[c], x);
	else
	  mx[c] = x;
	if (my.find(c) != my.end())
	  my[c] = min(my[c], y);
	else
	  my[c] = y;
	Mx[c] = max(Mx[c], x);
	My[c] = max(My[c], y);
      }
    }
  }

  while (true) {
    bool exists = false;
    repit(it,mx) {
      char c = it->first;

      //dump(c)dump(mx[c])dump(Mx[c])dump(my[c])dump(My[c])

      for (int y = my[c]; y <= My[c]; ++y)
	for (int x = mx[c]; x <= Mx[c]; ++x)
	  if (board[y][x] != c && board[y][x] != '?')
	    goto fail;
      for (int y = my[c]; y <= My[c]; ++y)
	for (int x = mx[c]; x <= Mx[c]; ++x)
	  board[y][x] = '?';
      mx.erase(mx.find(c));
      my.erase(my.find(c));
      Mx.erase(Mx.find(c));
      My.erase(My.find(c));
      exists = true;
      goto outer;
    fail:;
    }

    //    rep(y,H)cerr<<board[y]<<endl;
    //    cerr<<endl;

  outer:;
    if (!exists) break;
  }

  for (int y = 0; y < H; ++y)
    for (int x = 0; x < W; ++x)
      if (board[y][x] != '.' && board[y][x] != '?')
	return false;

  return true;
}

int main() {
  int T; cin >> T;
  while (T --> 0)
    cout << (solve() ? "SAFE" : "SUSPICIOUS") << endl;

  return 0;
}

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


def main():
    a, b, c = map(int, input().split())

    if a % 2 == 0 or b % 2 == 0 or c % 2 == 0:
        print(0)
    else:
        print(min(a * b, b * c, c * a))


if __name__ == '__main__':
    main()


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

int main() {
	int n; cin >>n;
	vector<int> v(n);
	for (int i =0; i< n;++i) cin >> v[i];
	sort(v.begin(), v.end());
	int va =0;int vb =0;
	while(v.size()){
		va +=v[v.size()-1];
		v.pop_back();
		if(v.size()){
		vb +=v[v.size()-1];
		v.pop_back();
		}
	}
	cout << va -vb << endl;
	return 0;
}

Measured memory_bytes: 256
from collections import deque

N, M = map(int, input().split())
Gs = [[] for _ in range(N+1)]

for _ in range(M):
    a, b = map(int, input().split())
    Gs[a].append(b)
    Gs[b].append(a)

ms = [0] * (N+1)
def bfs(c):
    queue = deque()
    ns = Gs[c]
    for n in ns:
        queue.append((n, c))
    while queue:
        c, p = queue.popleft()

        if ms[c] != 0:
            continue

        ms[c] = p

        ns = Gs[c]
        for n in ns:
            if n != p:
                queue.append((n, c))

bfs(1)

for m in ms[2:]:
    if m == 0:
        print('No')
        break
else:
    print('Yes')
    for m in ms[2:]:
        print(m)


Measured memory_bytes: 48808
#include <stdio.h>
#pragma warning (disable:4996)

//prototype
long long max(int, int, int, int);

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

	//decision


	//output
	printf("%lld", max(a, b, c, d));
}

long long max(int a, int b, int c, int d) {
	long long Buffer;
	Buffer = (long long)a * (long long)c;
	if (Buffer <= ((long long)a * (long long)d)) Buffer = (long long)a * (long long)d;
	if (Buffer <= ((long long)b * (long long)c)) Buffer = (long long)b * (long long)c;
	if (Buffer <= ((long long)b * (long long)d)) Buffer = (long long)b * (long long)d;
	return Buffer;
}

Measured memory_bytes: 1736
local n, m = io.read("*n", "*n")
local t = {}
for i = 1, m do
  local a, b = io.read("*n", "*n")
  local tmp = {a, b, false}
  table.insert(t, tmp)
end
table.sort(t, function(x, y)
  if x[2] == y[2] then return x[1] < y[1]
  else return x[2] < y[2] end
end
)
local curidx = 1
local ret = 0
while curidx <= m do
  local cutpos = t[curidx][2] - 1
  ret = ret + 1
  curidx = curidx + 1
  while curidx <= m and t[curidx][1] <= cutpos do
    curidx = curidx + 1
  end
end
print(ret)


Measured memory_bytes: 8320
//Priyanshu Kumar : IIIT Allahabad
#include<bits/stdc++.h>
using namespace std;

#define ll long long int
#define MAX 100005
#define MOD 1000000007
#define sz size()
#define ln length()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define pi(n) printf("%d",n)
#define pin(n) printf("%d\n",n);
#define pl(n) printf("%lld",n)
#define pln(n) printf("%lld\n",n);
#define FUCK_YEAH ios_base::sync_with_stdio(false);cin.tie(NULL)
inline ll gcd(ll x,ll y){return x%y==0?y:gcd(y,x%y);}
inline ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
inline ll powmod(ll a,ll b,ll mod) 
{
	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;
}
inline ll mulmod(ll a, ll b, ll c)
{
	if(!b)return 0;
	ll x = mulmod(a, b/2, c);
	if (b & 1)return (x+x+a)%c;
	return (x+x)%c;
}

ll compute(ll pos, ll s, ll inc) {
	return s + pos*inc;
}

int main()
{
	FUCK_YEAH;
	ll n;
	cin >> n;
	ll s[n],f[n],c[n];
	for(int i = 1; i <= n-1; i++) {
		cin >> c[i] >> s[i] >> f[i];
	}
	for(int i = 1; i <= n; i++) {
		ll ans = 0;
		//cout << i << " : \n";
		for(int j = i; j <= n - 1; j++) {
			ll low = 0, high = 1e15, pos = 1e15;
			while(low <= high) {
				ll mid = (low + high)/2;
				ll val = compute(mid,s[j],f[j]);
				if(val < ans) {
					low = mid + 1;
				}
				else {
					pos = min(pos,mid);
					high = mid - 1;
				}

				//cout << mid << " " << val << " " << pos << endl;
			}
			if(pos == 1e15) {
				pos = 0;
			}
			//cout << "pos : "<< pos << endl;
			ans = s[j] + pos*f[j] + c[j];
			//cout << "ans :" << ans << endl;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#define rep(i,n) for (int i=0;i<(n);i++)
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

int main()
{
	int k=0, a, b, n,f=1;
	string s;
	cin >> n >> a >> b >> s;

	rep(i, n) {
		switch (s[i]) {
		
		case 'a': if (k < a + b) { k++; cout << "Yes" << endl; }
				  else cout << "No" << endl; break;

		case 'b': if (k < a + b&&f <= b) { k++; f++; cout << "Yes" << endl; }
				  else cout << "No" << endl; break;
		case 'c': cout << "No" << endl; break;
		}
	}
}



Measured memory_bytes: 896
import sys
import math
MAX_INT = int(10e15)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

a = IL()
if sum(a) <= 21:
  print("win")
else:
  print("bust")

Measured memory_bytes: 38384
#include <bits//stdc++.h>
using namespace std;
int main(void){
    unsigned long long a,b,c,d,i,j,ans;
    ans=0;
    cin>>a;
    string s;
    cin>>s;
    c=s.size();
    int dp[s.size()][s.size()];
    for(i=0;i<c;i++){
        for(j=0;j<c;j++)
        dp[i][j]=0;
    }
    for(i=0;i<s.size();i++){
        for(j=0;j<s.size();j++){
            if(j<=i)
            dp[i][j]=0;
            else if(s[i]==s[j]){
                if(i!=0){
                    if(j-dp[i-1][j-1]>i)
                dp[i][j]=dp[i-1][j-1]+1;
                }
                else if(i!=0)
                dp[i][j]=dp[i-1][j-1];
                else
                dp[i][j]=1;
                if(ans<dp[i][j])
                ans=dp[i][j];
            }
        }
    }
    cout<<ans<<endl;
    
}


Measured memory_bytes: 97920
#include <iostream>

using namespace std;

int msum( const int n )
{
    return ( (n + 1) * n ) / 2;
}

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

    long ans = 0;

    for( int i = 1; i <= N; ++i )
    {
        for( int j = 0; j <= N / i; ++j )
        {
            ans += j * i; 
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>

using namespace std;

int main(){
	string o,e;
	cin>>o>>e;
	for(int i=0;i<e.size();i++){
		cout<<o[i]<<e[i];
	}
	if(o.size()>e.size())cout<<o[o.size()-1];
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <ctype.h>
 
int main() {
 
  char ch[1200];
  int i,n;
  n=0;
  char a[1200];
 
  while(1) {
    scanf("%c",&a[n]);
    if(a[n] == '\n') {
      break;
    }
    ch[n] = a[n];
    if('A' <= a[n] && a[n] <= 'Z') {
      ch[n] = a[n] + 32;
    } else if(a[n] >= 'a' && a[n] <= 'z') {
      ch[n] = a[n] - 32;
 
    }
     
     
    n = n +1;
     
  }
   
  for(i=0; i<n ; i++) {
    printf("%c" ,ch[i]);
  }
  printf("\n"); 
  return 0;
   
}



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

int main() {
    char x;
    cin >> x;
    if('A'<=x && x<='Z'){
        cout << 'A' << endl;
    }
    else if('a'<=x&& x<='z'){
        cout << 'a' << endl;
    }
}

Measured memory_bytes: 3620
#pragma region kyomukyomupurin

/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-05-02 14:02:33
 **/

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

using int64 = long long;

template <class T>
using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int flag = 0;
  for (auto e : vec) os << (flag++ ? ", " : "{") << e;
  return os << (vec.empty() ? "{}" : "}");
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int flag = 0;
  for (auto e : st) os << (flag++ ? ", " : "{") << e;
  return os << (st.empty() ? "{}" : "}");
}

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int flag = 0;
  for (auto e : mp) os << (flag++ ? ", " : "{") << e;
  return os << (mp.empty() ? "{}" : "}");
}

template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

#pragma endregion kyomukyomupurin

int dp[101010];

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

  int N, W; cin >> N >> W;

  for (int i = 0; i < N; ++i) {
    int v, w, m; cin >> v >> w >> m;
    int lim = m;
    for (int k = 1; lim > 0; k <<= 1) {
      int cur = min(k, lim);
      for (int j = W; j >= w * cur; --j) {
        dp[j] = max(dp[j], dp[j - w * cur] + v * cur);
      }
      lim -= cur;
    }
  }

  cout << dp[W] << endl;

  return 0;
}


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

int main() {
    int X;
    cin >> X;
    int ans;
    ans = 10 - (int)(X / 200);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
K = int(input())

if K == 1:
    print(1)
    print(1)
    exit()

N = 2 * ((K+3)//4)
ans = [[0]*N for i in range(N)]

for i in range(N):
    for j in range(N):
        ans[i][j] = (i+j)%N + 1
        if i%2 and ans[i][j] + N <= K:
            ans[i][j] += N

print(N)
for row in ans:
    print(*row)

Measured memory_bytes: 12304
//
//  main.cpp
//  ABC139B
//
#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
    int A,B;
    int ans=0;
    int p=0;
    cin >> A >> B;
    while (p<B) {
        p=A*ans-ans+1;
        ans++;
    }
    cout << ans-1<<endl;
    return 0;
}


Measured memory_bytes: 256
n, m, c = map(int, input().split())
b = input().split()
count = 0
for i in range(n):
    a = input().split()
    total = [int(a[j])*int(b[j]) for j in range(m)]
    if sum(total) + c > 0:
        count += 1
print(count)

Measured memory_bytes: 3060
#include <cstdio>

#define int long long
#define dotimes(i, n) for (int i : range(n))

using namespace std;

class range {
  class iterator {
    int i, s;
  public:
    iterator(int i, int s): i(i), s(s) {}
    int& operator*() {
      return i;
    }
    void operator++() {
      i += s;
    }
    bool operator!=(iterator const& that) {
      return i < that.i;
    }
  };
  iterator b, e;
public:
  range(int e): b({0, 1}), e({e, 1}) {}
  range(int b, int e): b({b, 1}), e({e, 1}) {}
  range(int b, int e, int s): b({b, s}), e({e, s}) {}
  iterator begin() {
    return b;
  }
  iterator end() {
    return e;
  }
};

int rint() {
  int n;
  scanf("%lld", &n);
  return n;
}

void wint(int n) {
  printf("%lld\n", n);
}

template<typename T>
inline int size(T container) {
  return static_cast<int>(container.size());
}

template<typename T>
inline bool maxs(T& a, T const& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template<typename T>
inline bool mins(T& a, T const& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

signed main() {
  char s[11];
  scanf("%s\n", s);
  int r = 0, l = 0;
  char *p = s, c;
  while ((c = *p++))
    switch (c) {
    case 'A':
    case 'T':
    case 'G':
    case 'C':
      l++;
      break;
    default:
      maxs(r, l);
      l = 0;
      break;
    }
  maxs(r, l);
  wint(r);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <numeric>
#include <algorithm>
//#include <iomanip> : 表示桁数, ex) cout << fixed << setprecision(15) << ...
//#include <unordered_set>

#define pi 3.14159265358979323846
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
using ld = long double;
using Byte = unsigned char;
using namespace std;

//string ans = "Yes";


void SetAns() {
	/// normal_input
	int D;
	cin >> D;

	vector<int> c(26);
	vector<vector<int>> s(D, vector<int>(26));
	rep(i, 26) cin >> c[i];
	rep(i, D) rep(j, 26) cin >> s[i][j];;

	/// special_input
	vector<int> t(D);
	rep(i, D) cin >> t[i];

	/// main process
	vector<int> last(26, -1);
	int satisfy = 0;
	rep(date, D) {
		last[t[date] - 1] = date;
		satisfy += s[date][t[date] - 1];
		rep(i, 26) 
			satisfy -= c[i] * (date - last[i]);
		cout << satisfy << endl;
	}


	//	cin >> ;
	return;
}

int main() {
	SetAns();
//	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3184
#include <bits/stdc++.h>
typedef long long ll;
typedef double db;
#define mk make_pair
#define pa pair<int,int>
using namespace std;
const int mod=1e9+9;
inline int rd() {
	int x=0,f=1;char ch=getchar();
	for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-1;
	for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return x*f;
}
int N,M;
char S[300100],T[300100];
int to[300];
ll h1[300],h2[300];
void addHash(ll vv,ll pos,ll *h) {
	h[vv]+=(ll)pos*pos%mod*pos%mod;
	h[vv]%=mod;
	//printf("h[%d]=%d\n",vv,h[vv]);
}
//main=============================
int main() {
	scanf("%s",S+1);N=strlen(S+1);
	scanf("%s",T+1);M=strlen(T+1);
	if(N==0) {
		printf("Yes");
		return 0;
	}
	for(int i='a';i<='z';++i) to[i]=i;
	for(int i=1;i<=N;++i) {
		addHash(S[i],i,h1);
	}
	for(int i=1;i<=N;++i) {
		addHash(T[i],i,h2);
	}
	sort(h1+1,h1+270),sort(h2+1,h2+270);

	for(int i=1;i<=280;++i) if(h1[i]!=h2[i]) {
		printf("No");
		exit(0);
	}
	printf("Yes");
	return 0;
}


Measured memory_bytes: 640
N,M,X=map(int,input().split())
A=[]
for i in range(0,N):
    a=list(map(int,input().split()))
    A.append(a)

possible=False
ans=1000000000000000000
for i in range(0,2**N):
    bit=i
    rikai=[]
    cost=0
    for j in range(0,M):
        rikai.append(0)
    for j in range(0,N):
        if bit%2==1:
            cost+=A[j][0]
            for k in range(0,M):
                rikai[k]+=A[j][k+1]
        bit//=2
    sub=True
    for j in range(0,M):
        if(rikai[j]<X):
            sub=False
            break;
    if sub:
        possible=True
        ans=min(ans,cost)

if possible:
    print(ans)
else:
    print(-1)


Measured memory_bytes: 9188
import sys

n = int(input())
a, b = map(int, input().split())
p = sorted(list(map(int, input().split())))
cnt_1, cnt_2, cnt_3 = 0,0,0
for i in range(n):
	if p[i] > a:
		break
	cnt_1 += 1

for j in range(i,n):
	if p[j] > b:
		break
	cnt_2 += 1

	if j == n-1:
		print(0)
		sys.exit()

cnt_3 = n-j
print(min(cnt_1,cnt_2,cnt_3))

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

int dp[301][301][301], md = 1e9 + 7;
bool bad[301][301][301];

void ad(int &x, int y) { if ((x += y) >= md)x -= md; }

int main(){
	int n, m;
	scanf("%d%d", &n, &m);
	while (m--){
		int l, r, x;
		scanf("%d%d%d", &l, &r, &x);
		f(i, 0, r)f(j, 0, r)if (i == 0 || i != j){
			int z = 1;
			if (i >= l)++z;
			if (j >= l)++z;
			if (x != z)bad[r][i][j] = true;
		}
	}
	dp[1][0][0] = dp[0][1][0] = dp[0][0][1] = 1;
	f(i, 1, n)f(j, 0, i)f(k, 0, i)if (j == 0 || j != k){
		if (bad[i][j][k])continue;
		int &r = dp[i][j][k];
		ad(dp[i + 1][j][k], r);
		ad(dp[i][i + 1][k], r);
		ad(dp[i][j][i + 1], r);
		ad(dp[i + 1][i][k], r);
		ad(dp[j][i + 1][k], r);
		ad(dp[j][i][i + 1], r);
		ad(dp[i + 1][k][i], r);
		ad(dp[j][i + 1][i], r);
		ad(dp[j][k][i + 1], r);
	}
	int an = 0;
	f(i, 0, n)f(j, 0, n)if ((i == 0 || i != j) && !bad[n][i][j])ad(an, dp[n][i][j]), ad(an, dp[i][n][j]), ad(an, dp[i][j][n]);
	printf("%d\n", an);
}

Measured memory_bytes: 131456
n, m = map(int, input().split())
A = [list(map(lambda x: int(x)-1, input().split()))[1:] for _ in range(m)]
p = list(map(int, input().split()))
ans = 0
for i in range(1<<n):
    for j in range(m):
        cnt = 0
        for k in range(n):
            if ((i>>k) & 1) and k in A[j]: cnt += 1
        if cnt%2!=p[j]: break
    else: ans += 1
print(ans)


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

using namespace std;

int calc(long long x) {
	if (!x)
		assert(false);
	int ret = 0;
	while (x)
		ret += x % 10, x /= 10;
	return ret;
}

bool test(long long x) {
	int y = 100000;
	int sn = calc(x);
	for (int i = 1; i <= y; ++i) {
		int sm = calc(x + i);
		if (x * sm > (x + i) * sn) {
//			cout << x + i << endl;
			return false;
		}
	}
	return true;
}

bool test(long long x, long long y) {
	return x * calc(y) <= y * calc(x);
}

int main() {
//	freopen("input.txt", "r", stdin);
	ios::sync_with_stdio(false);
//	cout << test(109999999999999ll, 110999999999999ll) << endl;
//	for (int i = 1; i <= 99999; ++i)
//		if (test(i))
//			cout << i << endl;
	int k;
	cin >> k;
//	if (k == 792)
//		assert(false);
//	while (k > 702);
	for (int i = 1; i <= 9 && k; ++i, --k)
		cout << i << endl;
	for (int i = 1; i <= 9 && k; ++i, --k)
		cout << i << 9 << endl;
	for (int i = 1; i <= 9 && k; ++i, --k)
		cout << i << 99 << endl;
	for (int j = 1; j <= 9; ++j) {
		for (int i = 10; i < (j + 1) * 10 && k; ++i, --k) {
			cout << i;
			for (int l = 1; l <= j + 1; ++l)
				cout << 9;
			cout << endl;
		}
		for (int i = 1 + j; i <= 9 && k; ++i, --k) {
			cout << i;
			for (int l = 1; l <= j + 2; ++l)
				cout << 9;
			cout << endl;
		}
	}
	for (int i = 10; i <= 99 && k; ++i, --k)
		cout << i << "99999999999" << endl;
	for (int i = 10; i <= 109 && k; ++i, --k)
		cout << i << "999999999999" << endl;
	for (int i = 11; i <= 99 && k; ++i, --k)
		cout << i << "9999999999999" << endl;
	if (k)
		assert(false);
//	cerr << clock() << endl;
	return 0;
}


Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

const real eps = 1e-10;

void main(){
    auto isPrime = new bool[](1000000);
    isPrime.fill(true);
    isPrime[0] = false;
    isPrime[1] = false;
    foreach(i; iota(isPrime.length)) {
        if(isPrime[i]) {
            auto j = i*2;
            while(j < isPrime.length) {
                isPrime[j] = false;
                j += i;
            }
        }
    }
    auto primes = zip(isPrime, iota(isPrime.length)).filter!(a => a[0]).map!(a => a[1].to!int).array.assumeSorted;
    while(true) {
        auto n = readInt();
        if(n == 0) {
            return;
        }
        int ans;
        foreach(i; iota(n)) {
            int p, m;
            readlnTo(p, m);
            auto x = primes.upperBound(p-m-1).lowerBound(p+m+1).length;
            ans += x-1;
        }
        writeln(ans);
    }
}

Measured memory_bytes: 4008
import java.util.*;
import java.io.*;

public class Main{

    static int INFTY = Integer.MAX_VALUE;
    public static void main (String args[]){
        //初期処理
        Scanner sc=new Scanner(System.in);
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // try{
            // int n = Integer.parseInt(br.readLine());
        int n= sc.nextInt();
        int[][] arr = new int[n][2];
        for (int i=0;i<n;i++){
            arr[i][0]=sc.nextInt();
            arr[i][1]=sc.nextInt();
        }

        Arrays.sort(arr,(a,b)->{
            if(a[1]>b[1]){
                return 1;
            } else if (a[1]<b[1]){
                return -1;
            } else{
                return 0;
            }
        });
        int sum=0;
        for (int[] eachArr : arr) {
            sum+=eachArr[0];
            if(sum>eachArr[1]){
                sum=-1;
                break;
            }
        }
        if(sum==-1){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
    }


}

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

using namespace std;

int main() {
    int n, k;

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

    long long int tmp = 0, cnd = LLONG_MAX;
    vector<int> x(n);
    for(int i = 0; i < n; i++) {
        scanf("%d", &(x[i]));
        if(i > 0) {
            tmp += x[i] - x[i - 1];
            if(i >= k) tmp -= x[i - k + 1] - x[i - k];
        }
        if(i >= k - 1) cnd = min(cnd, tmp + min(abs(x[i - k + 1]), abs(x[i])));
    }

    printf("%lld\n", cnd);

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 510000;
const int MOD = 1000000007;
//


        signed main() {
          string s[2];
          cin>>s[0];
          int q,w=0,t,f;char c;
          cin>>q;
          for(int i=0;i<q;i++){
                 cin>>t;
                 if(t==1){
                         w++;
                         continue;
                 } 
                 cin>>f>>c;
                 s[(w+f)%2].push_back(c);
          }

for(int i=0;i<s[(w+1)%2].size();i++)cout<<s[(w+1)%2][s[(w+1)%2].size()-1-i];
cout<<s[w%2];
        
        
        


      }


        


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

int main(){
  int dom[4][3][10] = {};
  int n, b, f, r, v;

  cin >> n;

  for( int i=0; i<n; i++ ){
    cin >> b >> f >> r >> v;
    dom[b-1][f-1][r-1] += v;
  }


  for(int i=0; i<4; i++){
    for(int j=0; j<3; j++){
      for(int k=0; k<10; k++){
        cout << ' ' << dom[i][j][k];
      }
      cout << endl;
    }
    if( i!=3 ) cout << "####################" << endl;
  }

  return 0;
}


Measured memory_bytes: 3084
#include <iostream>
using namespace std;
int main(){
	char s[4]={};
	cin >> s;
	bool f=true;
	for(int i=0;i<3;i++){
		if(s[i]==s[i+1]){
			f=false;
		}
	}
	if(f){
		puts("Good");
	}else{
		puts("Bad");
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
const int INF = 1e9;
const int MAX = 100;
 
int main()
{
    int n, r[MAX], c[MAX];
    int dp[MAX][MAX];
 
    scanf("%d" ,&n);
    for (int i = 0; i < n; i++) {
	scanf("%d %d", &r[i], &c[i]);
    }
 
    for (int i = 0; i < n; i++) {
	for (int j = 0; j < n; j++) {
	    dp[i][j] = INF;
	}
    }
 
    for (int i = 0; i < n; i++) {
	dp[i][i] = 0;
    }
    for (int i = 1; i < n; i++) {
	for (int j = 0; j < n-i; j++) {
	    for (int k = j; k < i + j; k++) {
		int M = r[j] * c[k] * r[k+1] * c[i+j];
		dp[j][i+j] = min(dp[j][i+j], dp[j][k] + dp[k+1][i+j] + M);
	    }
	}
    }
    printf("%d\n", dp[0][n-1]);
    return 0;
}

Measured memory_bytes: 3192
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif
#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")

#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); bool s=false; if(c=='-'){s=true;c=getchar();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); int s=0; if(c=='-'){s=1;c=getchar();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }
void rsorta_d32(void *base, const int count, const int size, const int index){
	typedef int32_t rsort_t;
	rsort_t (*a)[size] = (rsort_t(*)[size])base;
	rsort_t (*b)[size] = (rsort_t(*)[size])malloc(count*size*sizeof(rsort_t));
	int c[0x100];
	for(int k=0; k<4; k++){
		memset(c, 0, sizeof(c)); for(int i=0; i<count; i++){ c[(a[i][index]>>(k<<3))&0xFF]++; } for(int i=1; i<0x100; i++) c[i]+=c[i-1]; for(int i=count-1; i>=0; i--){ int to=--c[(a[i][index]>>(k<<3))&0xFF]; for(int j=0; j<size; j++){ b[to][j]=a[i][j]; } }{rsort_t(*t)[size]=a; a=b; b=t;}
	}
	free(b);
}

int main(void){
	long x=nextlong();
	long k=nextlong();
	long d=nextlong();
	if(x<0) x=-x;
	long m=x/d;
	long a=x-m*d;
	long b=d-a;
	long ans;
	if(k<m){
		ans=x-k*d;
	}else if((k-m)%2==0){
		ans=a;
	}else{
		ans=b;
	}
	printf("%ld\n", ans);
}


Measured memory_bytes: 1604
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
	string a, b, c; cin >> a >> b >> c;

	transform(a.begin(), a.end(), a.begin(), ::toupper);
	transform(b.begin(), b.end(), b.begin(), ::toupper);
	transform(c.begin(), c.end(), c.begin(), ::toupper);
	cout << a[0] << b[0] << c[0] << endl;
}

Measured memory_bytes: 256
class Solution:
    def solve(self, A: int, B: int) -> int:

        answer = 0

        for n in range(A, B+1):
            if str(n) == "".join(reversed(str(n))):
                answer += 1

        return answer


if __name__ == '__main__':

    # standard input
    A, B = map(int, input().split())

    # solve
    solution = Solution()
    print(solution.solve(A, B))


Measured memory_bytes: 2940
#include <iostream>
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
using namespace std;
int main(){
	int a, b;
	while(cin >> a >> b, (a || b)) {
		int hit=0, blow=0;
		int ma[4],mb[4];
		rep(i,4) {
			ma[i] = a%10, mb[i] = b%10;
			a/=10, b/=10;
		}
		rep(i,4) {
			if(ma[i]==mb[i]) {
				hit++;
				mb[i] = -1;
			}
		}
		rep(i,4) {
			if(ma[i]!=mb[i]) {
				rep(j,4) {
					if(ma[i] == mb[j]) {
						blow++;
						mb[j] = -1;
					}
				}
			}
		}
		cout << hit << " " << blow << endl;
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD (int)(1e9+7)
#define ceil(x, y) (x%y==0? (x/y) : (x/y+1))
#define FOR(i, N) for(int i = 0; i < N; ++i)
#define FOR1(i, N) for(int i = 1; i <= N; ++i)
#define vi vector <int>
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mset(a, v) memset(a, v, sizeof(a))
#define all(v) (v).begin(), (v).end()
#define INF 2e9
#define EPS 1e-9
#define int long long
using namespace std;
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    	freopen("in.txt", "r", stdin);
    	freopen("out.txt", "w", stdout);
    #endif

	int T=1;
	//cin >> T;
	FOR1(tp, T)
	{
		//cout << "Case #" << i << ": ";
		int a, b;
		cin >> a >> b;
		char c; cin >> c;
		int d; cin >> d;
		b = 100*b; b += d;
		int ans = a*b;
		ans /= 100;
		cout << ans;
		cout<<'\n';
	}
	return 0;
}

Measured memory_bytes: 3644
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
m=sum(b)-sum(a)
if m<0:
    print("No")
elif m==0:
    ok=True
    for i in range(n):
        if a[i]!=b[i]:
            ok=False
            break
    print("Yes" if ok else "No")
else:
    upb=0
    for i in range(n):
        if a[i]>b[i]:
            upb+=a[i]-b[i]
            b[i]=a[i]
    for i in range(n):
        if a[i]<b[i]:
            use=(b[i]-a[i])//2
            upb-=use
    print("Yes" if upb<=0 else "No")

Measured memory_bytes: 4600
#include<stdio.h>
int main (void)
{
    int a, b, c;
    a=1;
    for(b=1;b<10;b++){
        c=a*b;
    printf("%dx%d=%d\n", a, b, c);
  }
    a=2;
    for(b=1;b<10;b++){
        c=a*b;
    printf("%dx%d=%d\n", a, b, c);
  }
     a=3;
    for(b=1;b<10;b++){
        c=a*b;
    printf("%dx%d=%d\n", a, b, c);
  }
     a=4;
    for(b=1;b<10;b++){
        c=a*b;
    printf("%dx%d=%d\n", a, b, c);
  }
     a=5;
    for(b=1;b<10;b++){
        c=a*b;
    printf("%dx%d=%d\n", a, b, c);
  }
     a=6;
    for(b=1;b<10;b++){
        c=a*b;
    printf("%dx%d=%d\n", a, b, c);
  }
     a=7;
    for(b=1;b<10;b++){
        c=a*b;
    printf("%dx%d=%d\n", a, b, c);
  }
     a=8;
    for(b=1;b<10;b++){
        c=a*b;
    printf("%dx%d=%d\n", a, b, c);
  }
     a=9;
    for(b=1;b<10;b++){
        c=a*b;
    printf("%dx%d=%d\n", a, b, c);
  }
    return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;

int main() {
  int N;
  cin>>N;
  vector<int>A(N),B(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
    B[i]=A[i];
  }
  sort(B.begin(),B.end());
  int Max=B[N-1];
  int Max2=B[N-2];
  
  for(int i=0;i<N;i++){
    if(A[i]!=Max){cout<<Max<<endl;}
    else{cout<<Max2<<endl;}
  }
  return 0;}

Measured memory_bytes: 3200
open System
let R T = stdin.ReadLine()|> T
let RS T = stdin.ReadLine().Split()|>Array.map T
let R2 T U = RS string|>fun c-> (c.[0]|>T),(c.[1]|>U)
let R3 T U V = RS string|>fun c-> (c.[0]|>T),(c.[1]|>U),(c.[2]|>V)
let R4 T U V W = RS string|>fun c-> (c.[0]|>T),(c.[1]|>U),(c.[2]|>V),(c.[3]|>W)
let R5 T U V W X = RS string|>fun c-> (c.[0]|>T),(c.[1]|>U),(c.[2]|>V),(c.[3]|>W),(c.[4]|>X)
let outl s = stdout.WriteLine(s|>string)
let outsep ls = stdout.WriteLine(String.concat " " (ls|>Array.map string))
let outsepl ls = stdout.WriteLine(String.concat "\n" (ls|>Array.map string))
let Mod = (1e9|>int64)+7L
[<EntryPoint>]
let main argv =
    let N = R int
    let X = RS int
    let gen = seq{
        for i in [|0..100|] do
            yield (X|>Array.sumBy(fun c-> (c-i)*(c-i)))
    }
    [|for cost in gen -> cost|]
    |>Array.min
    |>outl
    0
    

Measured memory_bytes: 13524
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000000;
constexpr ll INF= 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;

int main() {
    string S;
    cin >> S;
    if(S == "AAA" || S == "BBB") {
        cout << "No" << endl;
    }
    else {
        cout << "Yes" << endl;
    }
}

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

int solve(const std::string & s) {
  int ans { 0 };
  for(int i = 0; i < 10; ++i) {
    for(int j = 0; j < 10; ++j) {
      for(int k = 0; k < 10; ++k) {
        const auto pi { s.find( std::to_string(i) ) };
        if(pi == std::string::npos) {
          continue;
        }

        const std::string sj { s.substr(pi + 1) };
        const auto pj { sj.find( std::to_string(j) ) };
        if(pj == std::string::npos) {
          continue;
        }

        const std::string sk { sj.substr(pj + 1) };
        const auto pk { sk.find( std::to_string(k) ) };
        if(pk == std::string::npos) {
          continue;
        }

        ++ans;
      }
    }
  }
  return ans;
}

int main() {
  int n;
  std::string s;
  std::cin >> n;
  std::cin >> s;
  std::cout << solve(s) << std::endl;
  return 0;
}


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

import sys

w = sys.stdin.readline().strip()
count = 0

while True:
    t = list(map(str, input().split()))

    if 'END_OF_TEXT' in t:
        break

    for i in range(len(t)):
        if t[i].lower() == w:
            count += 1

print(count)



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

int main()
{
  int K, N, ans = 1000000;
  vector<int> A(200000);

  cin >> K >> N;
  for (int i = 0; i < N; i++)
    cin >> A[i];
  for (int i = 0; i < N; i++)
  {
    if (i == N - 1)
      ans = min(ans, A[i] - A[0]);
    else
      ans = min(ans, K - (A[i + 1] - A[i]));
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
N, x = map(int, input().split())
a = list(map(int, input().split()))
min_a = {}
for i in range(N):
    min_a[i] = a[i]
ans = 10 ** 18
for i in range(N):
    s = x * i
    for j in range(N):
        min_a[j] = min(min_a[j], a[(i + j) % N])
        s += min_a[j]
    ans = min(ans, s)
print(ans)

Measured memory_bytes: 42716
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0L;i--)
#define prep(i,n) for(int64_t i=1;i <= (int64_t)(n);i++)
using namespace std;

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  int64_t array_num = 1;
  fspcnt = 0;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}

int64_t calcmodcomb(int64_t n,int64_t r){
  return (((modfact.at(n)*modinvfact.at(r))%univMod)*modinvfact.at(n-r))%univMod;
}

int64_t calcmodpositive(int64_t n){
  return (n + ((abs(n)+univMod-1)/univMod)*univMod)%univMod;
}
  
    */


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  int a,b,x;
  cin >> a >> b >> x;
  if(a <= x && x <= a+b){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
    
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

class Program{
    public static void Main(){
        string[] S = ReadLine().Split(' ');
        int D = int.Parse(S[0]);
        int N = int.Parse(S[1]);
        if(N < 100){
            WriteLine(Pow(100, D)*N);
        }
        else{
            WriteLine(Pow(100, D)*101);
        }
    } 
}

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

int64_t MOD = 1000000007;
int64_t MAX = 9223372036854775807;
double PI = 3.141592653589793;

int main()
{
    int N, tmp;
    cin >> N;
    vector<int64_t> A(N), B(N);
    for (int i = 0; i < N; i++)
        cin >> A[i] >> B[i];
    int64_t ans = 0;
    for (int i = N - 1; i >= 0; i--)
    {
        tmp = B[i] - A[i] % B[i];
        if (tmp == B[i])
            tmp = 0;
        ans += tmp;
        if (i != 0)
            A[i - 1] += ans;
    }
    cout << ans;
}

Measured memory_bytes: 1920
x = int(input())

if x >= 1800:
    print("1")
elif x >= 1600:
    print("2")
elif x >= 1400:
    print("3")
elif x >= 1200:
    print("4")
elif x >= 1000:
    print("5")
elif x >= 800:
    print("6")
elif x >= 600:
    print("7")
elif x >= 400:
    print("8")


Measured memory_bytes: 9168
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<LL, LL> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const int MOD = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL) INF;
const int MAX = 1555;


int main()
{
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    int n, m;
    scanf("%d%d", &n, &m);
    int ans = 0, h = 0;
    FOR(i, 0, n) {
        int t;
        scanf("%d", &t);
        int start = max(t, h);
        h = max(h, t + m);
        ans += max(0, t + m - start);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
i = 1
List_str = []
List_int = []

for x in range(N):
    if i % 3 == 0 and i % 5 == 0 :
        x = 'FizzBuzz'
        List_str.append(x)
        i = i + 1
    elif i % 3 == 0 and i % 5 != 0 :
        x = 'Fizz'
        List_str.append(x)
        i = i + 1
    elif i % 5 == 0 and i % 3 != 0 :
        x = 'Buzz'
        List_str.append(x)
        i = i + 1
    else :
        List_int.append(i)
        i = i + 1

V = sum(List_int)
print(V)


Measured memory_bytes: 33720
N=input()
op=""
for i in range(1<<3):
    num=N[0]
    for j in range(3):
        if i>>j & 1 == 1:
            op="+"
        else:
            op="-"
        num+=op+N[j+1]
    #print(num)
    sum=eval(num)
    #print(sum)
    if eval(num)==7 :
        print(num+"=7")
        break

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	static int[] parents;
	static int[] weights;
	static void set(int x) {
		parents[x] = x;
		weights[x] = 1; // initialize weights
	}
	static int find(int x) { // with path compression
		int curr = x;
		while (parents[curr] != curr) curr = parents[curr];
		return curr;
	}
	static void union(int x, int y) {
		int r1 = find(x);
		int r2 = find(y);
		if (r1 != r2) {
			if (weights[r1] > weights[r2]) {
				parents[r2] = r1;
				weights[r1] += weights[r2];
			} else {
				parents[r1] = r2;
				weights[r2] += weights[r1];
			}
			
		}
	}
	
	static boolean areConnected(int x, int y) {
		int r1 = find(x);
		int r2 = find(y);
		return (r1 == r2);
	}
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int users = in.nextInt();
		parents = new int[users];
		weights = new int[users];
		int relations = in.nextInt();
		for (int i = 0; i < users; i++) {
			set(i);
		}
		for (int i = 0; i < relations; i++) {
			union(in.nextInt(), in.nextInt());
		}
		int checks = in.nextInt();
		for (int i = 0; i < checks; i++) {
			if (areConnected(in.nextInt(),in.nextInt())) {
				System.out.println("yes");
			} else System.out.println("no");
		}
		in.close();
	}
}



Measured memory_bytes: 99880
/* Read input from STDIN. Print your output to STDOUT*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll n,i,j,k,l,m,o,p,q,r,s,t;
    string a;
    cin>>a;
    if(a[2]==a[3]&&a[4]==a[5])
    cout<<"Yes\n";
    else 
    cout<<"No\n";
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define N 100000
#define Q 50000

int binary(int ,int *,int );

int main(){
  int right,s[N],t[Q],x,y,i,k=0,target;

  scanf("%d",&x);
  for(i=0;i<x;i++)
    scanf("%d",&s[i]);
  scanf("%d",&y);
  for(i=0;i<y;i++)
    scanf("%d",&t[i]);
  right=x;
  
  for(i=0;i<y;i++){
    target=t[i];
    if((binary(target,s,right))==1){
      k++;
    }
  }
  printf("%d\n",k);
  return 0;
}
int binary(int target,int *s,int right){
  int left=0,mid;
  while(left<right){
    mid=(left+right)/2;
    if(target==s[mid])
      return 1;
    if(target>s[mid])
      left=mid+1;
    if(target<s[mid])
      right=mid;
  }
  return 0;
}



Measured memory_bytes: 2440
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
int main() {
	ll d,n;
	cin>>d>>n;
	if(d==0) {
		if(n<=99) {
			cout<<n<<"\n";
			return 0;
		}
		cout<<101<<"\n";
		return 0;
	}
	else if(d==1) {
		if(n<=99) {
			cout<<n*100<<"\n";
			return 0;
		}
		cout<<10100<<"\n";
		return 0;
	}
	else {
		if(n<=99) {
			cout<<n*10000<<"\n";
			return 0;
		}
		cout<<1010000<<"\n";
	}
	return 0;
}

Measured memory_bytes: 256
c = input()
al = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
for i in range(len(al)-1):
    if c == al[i]:
        print(al[i+1])
        break


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

using ll = long long int;
typedef long double ld;
typedef pair<ll,ll> pll;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<ll ,null_type,less<ll >,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//K-th smallest element(0-based)=> cout << k << "kth smallest: " << *A.find_by_order(k-1) << endl;
//NO OF ELEMENTS < X => cout << "No of elements less than " << X << " are " << A.order_of_key(X) << endl;

#define sz(v) (ll)v.size()
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define gcd(a,b) __gcd(a,b)
#define all(v) v.begin(),v.end()

ll cnt[200010];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	cin>>n;
	ll arr[n];
	for(ll i=0;i<n;i++)cin>>arr[i],cnt[arr[i]]++;
	ll ans=0;
	cnt[arr[0]]--;
	for(ll i=1;i<=n;i++)ans+=(cnt[i]*(cnt[i]-1))/2;
	cout<<ans<<"\n";
	for(ll i=1;i<n;i++)
	{
		ans-=((cnt[arr[i]])*(cnt[arr[i]]-1))/2;
		ans-=((cnt[arr[i-1]])*(cnt[arr[i-1]]-1))/2;
		cnt[arr[i]]--;
		cnt[arr[i-1]]++;
		ans+=((cnt[arr[i]])*(cnt[arr[i]]-1))/2;
		ans+=((cnt[arr[i-1]])*(cnt[arr[i-1]]-1))/2;
		cout<<ans<<"\n";
	}
	return 0;
}

Measured memory_bytes: 4736
#include <iostream>
#include <string>
#define MAX 25
#define NIL -1
using namespace std;

struct Node{
  int parent,sibling,left,right,degree,depth,height;
  string type;
  public:
  Node(){
    parent = sibling = left = right = degree = depth = height = NIL;
    type = "";
  }
};
Node nodes[MAX];

void calc_depth(int id,int d){
  nodes[id].depth = d;
  int l = nodes[id].left;
  int r = nodes[id].right;
  if(l != NIL) calc_depth(l, d+1);
  if(r != NIL) calc_depth(r, d+1);
}

int calc_height(int id){
  int hl,hr;
  hl = hr = 0;
  if(nodes[id].left == NIL &&
     nodes[id].right == NIL){
    nodes[id].height = 0;
    return 0;
  }else{
    if(nodes[id].left != NIL){
      hl = calc_height(nodes[id].left);
    }
    if(nodes[id].right != NIL){
      hr = calc_height(nodes[id].right);
    }
    int max = hl > hr ? hl+1 : hr+1 ;
    nodes[id].height = max;
    return max;
  }
}

void calc_degree(int n){
  for(int i=0;i<n;i++){
    int a = nodes[i].left !=-1 ? 1 : 0;
    int b = nodes[i].right!=-1 ? 1 : 0;
    nodes[i].degree = a + b;
  }
}

void calc_type(int n){
  for(int i=0;i<n;i++){
    if(nodes[i].parent == NIL){
      nodes[i].type = "root";
    }else
    if(nodes[i].left == NIL &&
       nodes[i].right == NIL){
      nodes[i].type = "leaf";
    }else{
      nodes[i].type = "internal node";
    }
    
  }
}

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

  for(int i=0;i<n;i++){
    int id,l,r; cin>>id>>l>>r;
    nodes[l].parent = nodes[r].parent = id;
    nodes[l].sibling = r;
    nodes[r].sibling = l;
    nodes[id].left = l;
    nodes[id].right = r;
  }
  int r;
  for(int i=0;i<n;i++){
    if(nodes[i].parent == NIL) r = i;
  }
  calc_depth(r,0);
  calc_height(r);
  calc_type(n);
  calc_degree(n);
  for(int i=0;i<n;i++){
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, %s\n",i,nodes[i].parent,nodes[i].sibling,nodes[i].degree,nodes[i].depth,nodes[i].height,nodes[i].type.c_str());
  }
}

Measured memory_bytes: 3240