akhauriyash/Code-Regression huggingface dataset:
#pragma region Include
#include <bits/stdc++.h>
// #include <algorithm>
// #include <bitset>
// #include <climits>
// #include <cmath>
// #include <iostream>
// #include <iterator>
// #include <map>
// #include <queue>
// #include <sstream>
// #include <stack>
// #include <string>
// #include <unordered_map>
// #include <unordered_set>
// #include <vector>
#pragma endregion

using namespace std;

#pragma region Macros
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#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()
#define newl "\n"
#define out(x) cout << (x) << newl
#define dump(x) \
  cout << "Line " << __LINE__ << " : " << #x << " = " << (x) << newl
template <class T>
using VV = vector<vector<T>>;
#define Uni(v) (v).erase(unique((v).begin(), (v).end()), (v).end());

template <typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
  os << "[";
  rep(i, vec.size()) os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  os << "]";
  return os;
}

template <typename T>
ostream& operator<<(ostream& os, vector<vector<T>>& mat) {
  os << "[";
  rep(i, mat.size()) os << mat[i] << (i + 1 == mat.size() ? "" : ",\n ");
  os << "]";
  return os;
}

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

template <typename V, typename H>
void resize(vector<V>& vec, const H head) {
  vec.resize(head);
}

template <typename V, typename H, typename... T>
void resize(vector<V>& vec, const H& head, const T... tail) {
  vec.resize(head);
  for (auto& v : vec) resize(v, tail...);
}
constexpr double EPS = 1e-10;
const int INF = 0x3f3f3f3f;

string tostring(int i, int digit) {
  auto cur = cout.flags();
  stringstream ss;
  ss << setw(4) << setfill('0') << i;
  string ret = ss.str();
  cout.flags(cur);
  return ret;
}

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

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

#pragma endregion

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  string S;
  cin >> S;

  int len = S.length();

  rep(i, len) {
    int d = S[i] - 'A';
    int mov = (d + N) % 26;
    char c = 'A' + mov;
    cout << c;
  }
  cout << newl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#define PP std::pair<int,int>
#define LL long long
int INF = 1 << 30;
int H, W;
std::queue<PP> q;
int D[52][52];
char HW[52][52];
int rx[4] = { 1,0,-1,0 };
int ry[4] = { 0,1,0,-1 };
int aa;

void dfs() {
	q.push({ 1,1 });
	D[1][1] = 1;
	while (!q.empty()) {
		PP p = q.front();
		q.pop();
		if (p.first == H&&p.second == W)break;
		for (int i = 0; i < 4; i++) {
			int dx = p.first + rx[i];
			int dy = p.second + ry[i];
			if (1 <= dx && dx <= H && 1 <= dy && dy <= W) {
				if (D[dx][dy] == INF) {
					if (HW[dx][dy] == '.') {
						q.push({ dx,dy });
						D[dx][dy] = D[p.first][p.second] + 1;
					}
				}
			}
		}

	}
}

int main() {
	for (int i = 0; i < 52; i++) {
		for (int j = 0; j < 52; j++) {
			D[i][j] = INF;
		}
	}
	std::cin >> H >> W;
	for (int i = 1; i <= H; i++) {
		for (int j = 1; j <= W; j++) {
			std::cin >> HW[i][j];
			if (HW[i][j] == '#')aa++;
		}
	}
	dfs();
	if (D[H][W] == INF)std::cout << "-1" << std::endl;
	else std::cout << (H*W) - aa - D[H][W] << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
typedef long long int integer;

const int NMAX = 1299800;
bool isprime[NMAX];

int main() {
  vector<integer> primes;
  set<int> prime_set;
  for (int i = 0; i < NMAX; i++) {
    isprime[i] = true;
  }
  isprime[0] = isprime[1] = false;
  for (integer n = 2; n < NMAX; n++) {
    if (!isprime[n]) continue;
    primes.push_back(n);
    prime_set.insert(n);
    integer m = 2 * n;
    while (m < NMAX) {
      isprime[m] = false;
      m += n;
    }
  }

  int n;
  while (cin >> n && n) {
    if (n <= 2 or prime_set.find(n) != prime_set.end()) {
      cout << 0 << endl;
    } else {
      auto upper = upper_bound(primes.begin(), primes.end(), n);
      auto lower = lower_bound(primes.begin(), primes.end(), n) - 1;
      cout << (*upper) - (*lower) << endl;
    }
  }
}

Measured memory_bytes: 7772
N = int(input())
h_l = list(map(int, input().split()))
h_l = [0] + h_l
dp = [99999999999] * (N + 2)
dp[1] = 0  # dp[i]->足場iに到達する最小コスト
for i in range(1, N):
    dp[i + 1] = min(dp[i + 1], dp[i] + abs(h_l[i + 1] - h_l[i]))
    if i < N-1:
        dp[i + 2] = min(dp[i + 2], dp[i] + abs(h_l[i + 2] - h_l[i]))
print(dp[N])


Measured memory_bytes: 13976
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=250000;
const int HMOD=1000000007;
const int NHASH=10;
int HMLT[NHASH];
int HINV[NHASH];
struct Op { int a[NHASH],b[NHASH]; };
int pw(int x,int n) { int ret=1; while(true) { if(n&1) ret=(ll)ret*x%HMOD; if((n>>=1)==0) return ret; x=(ll)x*x%HMOD; } }

Op combine(const Op &p,const Op &q) { Op ret; REP(i,NHASH) { ret.a[i]=(ll)p.a[i]*q.a[i]%HMOD; ret.b[i]=((ll)p.a[i]*q.b[i]+p.b[i])%HMOD; } return ret; }
void eval(const Op &p,const int q[NHASH],int ret[NHASH]) { REP(i,NHASH) ret[i]=((ll)p.a[i]*q[i]+p.b[i])%HMOD; }

int n; char s[MAXN+1];

Op opid;
Op opgt,iopgt;
Op oplt,ioplt;
Op oppl,ioppl;
Op opmn,iopmn;
Op f[MAXN];
Op g[MAXN];

Op ff[MAXN+1]; // ff[i] is composition of f for suffix starting at i
Op gg[MAXN+1]; // gg[i] is composition of g for suffix starting at i

int id[NHASH];
int fx[NHASH];
int gx[MAXN+1][NHASH];
int hx[MAXN+1][NHASH];

map<vector<int>,int> mp;

void run() {
	scanf("%d%s",&n,s);

	REP(i,n) switch(s[i]) {
		case '>': f[i]=opgt,g[i]=iopgt; break;
		case '<': f[i]=oplt,g[i]=ioplt; break;
		case '+': f[i]=oppl,g[i]=ioppl; break;
		case '-': f[i]=opmn,g[i]=iopmn; break;
		default: assert(false);
	}

	ff[n]=opid; for(int i=n-1;i>=0;--i) ff[i]=combine(f[i],ff[i+1]);
	gg[n]=opid; for(int i=n-1;i>=0;--i) gg[i]=combine(gg[i+1],g[i]);
	
	memset(id,0,sizeof(id));
	eval(ff[0],id,fx);
	REPE(i,n) eval(gg[i],id,gx[i]);
	REPE(i,n) eval(gg[i],fx,hx[i]);

	//printf("fx:"); printf(" %d\n",fx[0]);
	//printf("gx:"); REPE(i,n) printf(" %10d",gx[i][0]); puts("");
	//printf("hx:"); REPE(i,n) printf(" %10d",hx[i][0]); puts("");

	ll ret=0;
	for(int i=n;i>=0;--i) {
		vector<int> vg(NHASH),vh(NHASH); REP(j,NHASH) vg[j]=gx[i][j],vh[j]=hx[i][j];
		ret+=mp[vh]; ++mp[vg];
	}
	printf("%lld\n",ret);
}

void init() {
	REP(i,NHASH) { int x=0; REP(j,100) x=((ll)x*1000+rand()%1000)%HMOD; HMLT[i]=x; HINV[i]=pw(x,HMOD-2); }
	//printf("HMLT:"); REP(i,NHASH) printf(" %d",HMLT[i]); puts("");
	REP(i,NHASH) {
		opid.a[i]=1,opid.b[i]=0;
		opgt.a[i]=HMLT[i],opgt.b[i]=0;
		oplt.a[i]=HINV[i],oplt.b[i]=0;
		oppl.a[i]=1,oppl.b[i]=1;
		opmn.a[i]=1,opmn.b[i]=HMOD-1;
		iopgt=oplt,ioplt=opgt,ioppl=opmn,iopmn=oppl;
	}
}

int main() {
	init();
	run();
	return 0;
}


Measured memory_bytes: 160640
#include<iostream>
using namespace std;
int main(){
  int N,Y;
  cin>>N>>Y;
  int a=-1,b=-1,c=-1;
  int flag=-1;
  for(int i=0;i<=N;i++){
    for(int j=0;j<=N-i;j++){
      if(10000*i+5000*j+1000*(N-i-j)==Y){
        flag=1;
        a=i;
        b=j;
        c=N-i-j;
        break;
      }
    }
    if(flag==1)	break;
  }
  cout<<a<<" "<<b<<" "<<c<<" "<<endl;
}

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

struct node{

  struct node *right;
  struct node *left;
  struct node *p;
  int key;
};

typedef struct node * Node;

#define NIL NULL

Node root;

Node treeMinimum(Node x){

  while(x->left != NIL)
    x = x->left;

  return x;
}

Node treeMaximum(Node x){

  while(x->right != NIL)
    x = x->right;

  return x;
}

Node treeSearch(Node u, int k){

  if(u == NIL || k == u->key)
    return u;

  if(k < u->key)
    return treeSearch(u->left, k);
    
      else
    return treeSearch(u->right, k);
}

Node treeSuccessor(Node x){

  if(x->right != NIL)
    return treeMinimum(x->right);

  Node y = x->p;

  while(y != NIL && x == y->right){

    x = y;
    y = y->p;
  }

  return y;
}

void treeDelete(Node z){

  Node y; // node to be deleted
  Node x; // child of y

  if(z->left == NIL || z->right == NIL)
    y = z;

  else
    y = treeSuccessor(z);

  if(y->left != NIL)
    x = y->left;

  else
    x = y->right;

  if(x  != NIL)
    x->p = y->p;

  if(y->p == NIL)
    root = x;
    
    
  else if(y == y->p->left)
    y->p->left = x;

  else
    y->p->right = x;

  if(y != z)
    z->key = y->key;
}

void insert(int k){

  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct 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->p = 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){
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
  }
}

void preorder(Node u){

  if(u != NIL){
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
  }
}


int main(){

  int n, i, x;
  char com[20];

  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);

    if ( com[0] == 'f' ){
      scanf("%d", &x);

      Node t = treeSearch(root, x);

      if ( t != NIL )
        printf("yes\n");
      else
        printf("no\n");
    }
    else if ( com[0] == 'i' ){

      scanf("%d", &x);
      insert(x);
    }
    else if ( com[0] == 'p' ){

      inorder(root);
      printf("\n");

      preorder(root);
      printf("\n");

    } else if ( com[0] == 'd' ){

      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



Measured memory_bytes: 20440
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
int main() {
  string s;
  cin >> s;
  int k;
  cin >> k;
  set<string> ss;
  if (s.size() < 10) {
    for (int i = 0; i < s.size(); i++)
      for (int j = i + 1; j <= s.size(); j++) {
        ss.insert(s.substr(i, j - i));
      }
    auto it = ss.begin();
    for (int i = 0; i < k - 1; i++)
      it++;
    cout << *it << endl;
  } else {
    for (int i = 0; i < s.size(); i++)
      for (int j = i + 1; j <= s.size() && j - i < 7; j++)
        ss.insert(s.substr(i, j - i));
    auto it = ss.begin();
    for (int i = 0; i < k - 1; i++)
      it++;

    cout << *it << endl;
  }
  return 0;
}


Measured memory_bytes: 2176
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>

using namespace std;

#define INF 1 << 29
#define LL long long int

LL const MOD = 1000000007;

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

    LL n;
    cin >> n;

    LL ans = 0;

    for(int i = 1; i <= n; i++){
        LL count = 0;
        for(int j = 1; j <= i; j++){
            if(i%j == 0){
                count++;
            }
        }
        if(count == 8 && i&1){
            ans++;
        }
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int X, K, D;
    cin >> X >> K >> D;
    int cnt = min(K, abs(X) / D);
    if(X >= 0) X -= cnt * D;
    else X += cnt * D;
    K -= cnt;
    if(K % 2 == 0) {
        if(K == 0)
            cout << abs(X) << endl;
        else
            cout << min({abs(X), abs(X - 2 * D), abs(X + 2 * D)}) << endl;
        return 0;
    } else {
        cout << min(abs(X + D), abs(X - D)) << endl;
    }
    


    return 0;
}


Measured memory_bytes: 3636
s = input()
t = input()

a = [0] * 26
b = [0] * 26
for i, j in zip(s, t):
    if a[ord(i) - 97] != 0 or b[ord(j) - 97] != 0:
        if a[ord(i) - 97] != j or b[ord(j) - 97] != i:
            print("No")
            exit()
    a[ord(i) - 97] = j
    b[ord(j) - 97] = i

print("Yes")

Measured memory_bytes: 3632
N = int(input())
A = [list(map(int, input().split())) for _ in range(2)]

upper = [A[0][i] for i in range(N)]
for i in range(1, N):
    upper[i] += upper[i-1]

lower = [A[1][i] for i in range(N)]
for i in range(N-2, -1, -1):
    lower[i] += lower[i+1]

ans = 0
for i in range(N):
    ans = max(ans, upper[i]+lower[i])
print(ans)


Measured memory_bytes: 3064
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  string s;
  cin >> s;
  if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) {
    cout << "Bad" << endl;
  } else {
    cout << "Good" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N;
map<string,int> cnt;
void input(){
    fast_io();
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        string s; cin >> s;
        cnt[s]++;
    }
    
}

int solve(){
    vector<string> ans ={"AC","WA","TLE","RE"};
    for(auto a:ans) cout << a << " x " << cnt[a] << "\n";
    return 0;
}   

int main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 3664
#include <cstdio>
#include <algorithm>
#define maxn 500010
using namespace std;
int n,m;
int c[maxn],book[maxn],tree[maxn],ans[maxn];
struct node{
	int l,r,seq;
}q[maxn];
int lowbit(int x){
	return x&-x;
}
void add(int pos,int val){
	while(pos<=n){
		tree[pos]+=val;
		pos+=lowbit(pos);
	}
}
int sum(int pos){
	int ret=0;
	while(pos>0){
		ret+=tree[pos];
		pos-=lowbit(pos);
	}
	return ret;
}
int cmp(node a,node b){
	return a.r<b.r;
}
int main(){
	int i,j,start;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++)scanf("%d",&c[i]);
	for(i=1;i<=m;i++)scanf("%d%d",&q[i].l,&q[i].r),q[i].seq=i;
	sort(q+1,q+1+m,cmp);
	start=1;
	for(i=1;i<=m;i++){
		for(j=start;j<=q[i].r;j++){
			if(book[c[j]])add(book[c[j]],-1);
			add(j,1),book[c[j]]=j;
		}
		start=q[i].r+1;
		ans[q[i].seq]=sum(q[i].r)-sum(q[i].l-1);
	}
	for(i=1;i<=m;i++)printf("%d\n",ans[i]);
	return 0;
}

Measured memory_bytes: 17208
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

int main(void) {
  int N, tmp, i, count;
  vector<int> p, _p;
  cin >> N;
  for(i = 0; i < N; i++) {
    cin >> tmp;
    p.push_back(tmp);
    _p.push_back(tmp);
  }
  sort(_p.begin(), _p.end());
  count = 0;
  for(i = 0; i < N; i++) {
    if(p[i] != _p[i]) {
      count++;
    }
  }
  if(count <= 2) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	static void solve(){//Here is the main function
		ArrayList<String> s = nextCharArray();
		String output = "";
		for(int i = 0; i < s.size(); i++){
			if(s.get(i).equals("C") || s.get(i).equals("F")){
				output += s.get(i);
			}
		}
		myout((output.contains("CF")) ? "Yes" : "No");
	}
	//Method addition frame start



	//Method addition frame end

	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
}


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

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

	int ans = 0;
	for( int i = 0; i <= N; i++ ) {
		int j = 0;
		for( int k = 1; k <= i; j++, k *= 10 ) {
		}
		if( j % 2 ) ans++;
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = [ list(map(int, input().split())) for _ in range(N) ]

count = 0
for a in A:
  value = 0
  for i in range(M):
    value += a[i] * B[i]
  if value + C > 0:
    count += 1

print(count)

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

#define     fast()              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define     ll                  long long int
#define     test()              ll t; cin>>t; while(t--) 
#define     lp0(i,begin,end)    for(ll i=begin;i<end;i++)
#define     lp1(i,begin,end)    for(ll i=begin;i<=end;i++)
#define     rlp(i,begin,end)    for(ll i=end;i>=begin;i--)
#define     prec(n)             fixed<<setprecision(n)
#define     initial(a,i)        memset(a,i,sizeof(a))
#define     pb                  push_back
#define     PI                  3.1415926535897932384626433832795
#define     MOD                 1000000007
#define     F                   first
#define     S                   second
#define     all(a)              (a).begin(),(a).end()
#define     BPC(x)              __builtin_popcountll(x)
#define     gcd(a,b)            __gcd(a,b)

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

ll power(ll x,ll n)
{
    ll result = 1;
    while (n)
    {
        if (n & 1)
            result = result * x;
        n = n / 2;
        x = x * x;
    }
    return result;
}


// Solution Function
void solution(ll compte)
{
    // cout<<compte<<"\n";
    ll a,b;
    cin >> a >> b;
    int res;
    res = max({a+b,a-b,a*b});
    cout << res << endl;
}
// Driver Function
int main()
{
    ll compte = 1;
    //test()
    //{
        solution(compte);
        compte++;
    //}
    return 0;
}


Measured memory_bytes: 3608
// D - Lamp

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const int MOD = 1e9 + 7;

int H, W;
bool M[2000][2000];
int horizontal[2000][2000];
int vertical[2000][2000];

int get_h(int h, int w) {
	if (horizontal[h][w] != -1) return horizontal[h][w];

	int count = 0;
	int max_w = w;
	for (int i=w; i<W; i++) {
		if (M[h][i] == 1) break;

		count++;
		max_w = i;
	}

	for (int i=w; i<=max_w; i++) {
		horizontal[h][i] = count;
	}

	return count;
}

int get_v(int h, int w) {
	if (vertical[h][w] != -1) return vertical[h][w];

	int count = 0;
	int max_h = h;
	for (int i=h; i<H; i++) {
		if (M[i][w] == 1) break;

		count++;
		max_h = i;
	}

	for (int i=h; i<=max_h; i++) {
		vertical[i][w] = count;
	}

	return count;
}

int get_hv(int h, int w) {
	if (M[h][w] == 1) return 0;

	return get_h(h, w) + get_v(h, w) - 1;
}


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

	for (int i=0; i<H; i++) {
		string S;
		cin >> S;
		for (int j=0; j<W; j++) {
			if (S[j] == '#') M[i][j] = 1;
			else M[i][j] = 0;
		}
	}

	for (int i=0; i<H; i++) {
		for (int j=0; j<W; j++) {
			horizontal[i][j] = -1;
			vertical[i][j] = -1;
		}
	}

	int ans = 0;
	for (int i=0; i<H; i++) {
		for (int j=0; j<W; j++) {
			ans = max(ans, get_hv(i, j));
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 35456
using System;
using System.Linq;
using System.Text;

namespace ALDS1_9_A
{
    class Program
    {
        static void Main(string[] args)
        {
            string line;
            int[] vals;

            //入力
            line = Console.ReadLine().Trim();
            var heapSize = int.Parse(line);

            line = Console.ReadLine().Trim();
            vals = line.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Select(e => int.Parse(e)).ToArray();

            var tree = new CompleteBinaryTree(heapSize);
            for (int i = 0; i < heapSize; i++)
                tree[i + 1] = vals[i];

            tree.BuildMaxHeap();

            Console.WriteLine(" " + String.Join(" ", Enumerable.Range(1, heapSize).Select(i => tree[i]).ToArray()));
        }
    }

    class CompleteBinaryTree
    {
        private readonly int[] heap;
        public CompleteBinaryTree(int heapSize)
        {
            heap = new int[heapSize];
        }

        public int this[int i]
        {
            set { heap[i - 1] = value; }
            get { return heap[i - 1]; }
        }

        private static int Parent(int i) => i / 2;
        private static int Left(int i) => i * 2;
        private static int Right(int i) => i * 2 + 1;

        public void BuildMaxHeap()
        {
            for (int i = heap.Length / 2; i > 0; i--)
            {
                MaxHeapify(i);
            }
        }

        private void MaxHeapify(int i)
        {
            var l = Left(i);
            var r = Right(i);
            var H = heap.Length;
            var largest = (l <= H && this[l] > this[i]) ? l : i;
            if (r <= H && this[r] > this[largest])
            {
                largest = r;
            }
            if (largest != i)
            {
                var dummmy = this[i];
                this[i] = this[largest];
                this[largest] = dummmy;
                MaxHeapify(largest);
            }
        }

        public string ToString(int i)
        {
            var st = new StringBuilder();
            st.Append($"node {i}: key = {this[i]}, ");
            if (Parent(i) > 0)
            {
                st.Append($"parent key = {this[Parent(i)]}, ");
            }
            if (Left(i) <= heap.Length)
            {
                st.Append($"left key = {this[Left(i)]}, ");
            }
            if (Right(i) <= heap.Length)
            {
                st.Append($"right key = {this[Right(i)]}, ");
            }
            return st.ToString();
        }
    }
}



Measured memory_bytes: 68864
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(readline())
    ans = INF

    for x in range(1, n):
        score = 0
        a = x
        b = n - a
        while a > 0:
            score += a % 10
            a //= 10
        while b > 0:
            score += b % 10
            b //= 10
        ans = min(ans, score)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 72968
def c_traveling_salesman_around_lake():
    K, N = [int(i) for i in input().split()]
    A = [int(i) for i in input().split()]

    pos = [-(K - a) for a in A] + A[:]
    diff = [abs(pos[i + 1] - pos[i]) for i in range(len(pos) - 1)]
    ans = sum(diff[:N - 1])
    tmp = ans

    left, right = 0, N - 1
    while right != len(diff):
        tmp -= diff[left]
        tmp += diff[right]
        ans = min(ans, tmp)
        left += 1
        right += 1
    return ans

print(c_traveling_salesman_around_lake())

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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
ostream &operator<<(ostream &os, pair<ll, ll>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n,k,s;cin>>n>>k>>s;
  vector<ll>ret;
  rep(i,0,k)ret.PB(s);
  ll tmp=1e9;
  while(ret.size()!=n){
    if(s==tmp)ret.PB(1);
    else ret.PB(s+1);
  }
  debug(ret,n);
  return 0;
}

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

int main()
{
	int n, k;

	cin >> n >> k;
	vector<int> vx(n);
	vector<int> vy(n);
	vector<int> xa(n);
	vector<int> ya(n);

	for( int i = 0; i < n; i++ ) {
		int x,  y;
		cin >> x >> y;
		vx[i] = x;
		vy[i] = y;
		xa[i] = x;
		ya[i] = y;
	}

	sort( xa.begin(), xa.end() );
	sort( ya.begin(), ya.end() );

	long long ans = ((long long)xa[xa.size()-1] - (long long)xa[0]) * ((long long)ya[ya.size()-1] - (long long)ya[0]);

	for( int xi = 0; xi < n; xi++ ) {
		for( int xj = xi + 1; xj < n; xj++ ) {
			for( int yi = 0; yi < n; yi++ ) {
				for( int yj = yi + 1; yj < n; yj++ ) {
					int num = 0;
					for( int i = 0; i < n; i++ ) {
						if( xa[xi] <= vx[i] && vx[i] <= xa[xj] && ya[yi] <= vy[i] && vy[i] <= ya[yj] ) {
							num++;
						}
					}
					if( num >= k ) {
						ans = min( ans, ((long long)xa[xj] - (long long)xa[xi]) * ((long long)ya[yj] - (long long)ya[yi]) );
					}
				}
			}
		}
	}

	cout << ans << endl;

	return 0;
}


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

#define int long long

string s;

int32_t main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> s;
	for (int i = 1; i < s.size(); i++)
		if (s[i] == s[i - 1])
			return cout << "Bad\n", 0;
	cout << "Good\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <functional>
#include <utility>
#include <queue>
#include <vector>
#include <string>
#include <stack>
using namespace std;
typedef long long int ll;
const ll  MOD = 1000000007;
typedef pair<ll,ll> P;

ll N;
ll a[1010];
ll ans=1;
int main(){
  cin >> N;
  for(int i=2;i<=N;i++){
    ll t = i;
    for(int j=2;j<=N;j++){
      if(i<j) break;
      while(t%j == 0){
        a[j]++;
        t/=j;
      }
    }
  }
  for(int i=2;i<=N;i++){
    ans = (ans*(a[i]+1)) % MOD;
  }
  cout << ans << endl;
}



Measured memory_bytes: 384
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

void read();
template<typename First, typename... Rest> void read(First& first, Rest&... rest);
void write();
template<typename First, typename... Rest> void write(First first, Rest... rest);
template<typename T> void write_vec(vector<T>& v, char divider);

constexpr int MOD = 1000000007;
ll modpow(ll n, ll r, ll mod) {
    if(r == 0) return 1;
    if(n == 0) return 0;
    if(r % 2 == 0) {
        ll tmp = modpow(n, r / 2, mod);
        return tmp * tmp % mod;
    }
    else {
        return n * modpow(n, r - 1, mod) % mod;
    }
}

int main(){
    int N;
    read(N);
    vector<string> S(N);
    vector<int> P(N);
    for(int i = 0; i < N; i++){
        read(S[i], P[i]);
    }
    map<int, int> mp;
    vector<pair<string, int>> v(N);
    for(int i = 0; i < N; i++){
        P[i] *= -1;
        mp[P[i]] = i;
        v[i] = make_pair(S[i], P[i]);
    }
    sort(v.begin(), v.end());
    for(int i = 0; i < N; i++){
        cout << mp[v[i].second] + 1 << endl;
    }
    return 0;
}

//配列以外の入力を受け取る
void read(){

}
template<typename First, typename... Rest>
void read(First& first, Rest&... rest){
    cin >> first;
    read(rest...);
}
//
//配列以外を出力する
void write(){

}
template<typename First, typename... Rest>
void write(First first, Rest... rest){
    cout << first << " ";
    write(rest...);
}
//
//配列を区切って出力する
template<typename T>
void write_vec(vector<T>& v, char divider){
    for(size_t i = 0; i < v.size(); i++){
        cout << v[i] << divider;
    }
}
//

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

#define rep(i, n) for(int i=0; i<n; ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
#define ll long long int

int main(){
   int n;
   cin>>n;
   int a[200000];
   rep(i, n) cin>>a[i];

   int ax=0;
   rep(i, n) ax^=a[i];

   rep(i, n){
      cout<<(ax^a[i])<<" ";
   }
   cout<<endl;
   return 0;
}


Measured memory_bytes: 4360
#include <bits/stdc++.h>
#define rep( i, n ) for (long long i = 0; i < ( long long )(n); i++)

using namespace std;
typedef long long ll;
typedef pair< int , int > P;
typedef tuple<int, int, int> T;


int main(){
long double x;
ll ans=0;
cin>>x;
long double a =100;
//ll n=1;
ll b;
while(a<x){
  a+=(ll)(a*0.01);
  ans++;
}
cout<<ans;
}

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

int main(){
	vector<int> cnt(101,0);
	for(int i; cin>>i;){
		cnt[i]++;
	}
	int max = 0;
	vector<int> ans;
	for(int i=1; i<101; i++){
		if(cnt[i] > max){
			max = cnt[i];
			ans.clear();
			ans.push_back(i);
		}else if(cnt[i] == max){
			ans.push_back(i);
		}
	}
	for(int i=0; i<ans.size(); i++){
		cout<<ans[i]<<endl;
	}
}

Measured memory_bytes: 3132
#include <algorithm>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;

using namespace std;

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

// 最長単純現象
int main() {
  int n;
  cin >> n;
  // most large value of c
  int ans = 0;
  // count
  int c = 0;
  int prev = -1;
  rep(i, n) {
    int h;
    cin >> h;
    if (h <= prev) {
      c++;
    } else {
      c = 0;
    }
    chmax(ans, c);
    prev = h;
  }
  cout << ans << 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;
 
int main(void){
    int n;
    cin>>n;
    vector<pair<ll, ll> > v(n);
    rep(i, n) {
        ll a, b;
        cin>>a>>b;
        v[i].first=b;
        v[i].second=-a;
    }
    sort(v.begin(), v.end());
    ll nowtime=0;
    bool ok=true;
    rep(i, n){
        nowtime-=v[i].second;
        if(nowtime>v[i].first) ok=false;
    }
    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3328
function main()
  
  ns = map(x -> parse(Int, x), split(chomp(readline()), ""))
  
  ans = 0
  
  for i in ns
    ans += i
  end
  
  if ans % 9 == 0
    println("Yes")
  else
    println("No")
  end
  
end

main()

Measured memory_bytes: 170836
#include<stdio.h>
#include<string>
#include<string.h>
#include<utility>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<bitset>
#include <cmath>
#include <limits>
#include <numeric>
#include <cmath>
#include <limits>

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int main(){
    int n;
    std::string s;
    std::map<string, int> map;
    int num=0;
    cin >> n;
    REP(i,n){
        cin >> s;
        if(map.find(s)==map.end())map[s]=1;
        else map[s]+=1;
    }
    int max = -1;
    for(auto i : map){
        if(max < i.second)max=i.second;
    }
    for(auto i : map){
        if(max == i.second) cout << i.first << endl;
    }
}

Measured memory_bytes: 25216
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

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

typedef pair<int, int> pint;
typedef long long ll;

int main()
{
    string S;
    cin >> S;
    for (int i = 0; i < S.size(); i += 2)
    {
        cout << S[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K;
  cin >> N >> K;
  long long r = K;
  for(int i=1;;++i){
    if(N<r){
      cout << i << endl; return 0;
    }
    r *= K;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
 
using namespace std;
int main(void) {
  long long x;
  int a = 0, b = 0;
  int flag = 0;
  cin >> x;
  long long m[1001];
  for (long long i = 0; i <= 1000; i++) {
  	m[i] = i*i*i*i*i;
  }
  
  for (int i = 0; i < 1001; i++) {
    for (int j = 0; j < 1001; j++) {
    	if (m[i] - m[j] == x){
          a = i;
          b = j;
          flag = 1;
          break;
        } else if (m[i] + m[j] == x){
          a = i;
          b = -1*j;
          flag = 1;
          break;
        }
    }
    if (flag) {
       break;
    }
  }
  
  cout << a << " " << b << endl;
  return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;

int n, m;
int a[N], b[N];

vector<int> v[N];

int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d%d", &a[i], &b[i]);
    }
    for (int i = 1; i <= n; ++i)
    {
        if (m - a[i] >= 0)
            v[m - a[i]].push_back(b[i]);
    }
    long long ans = 0;
    priority_queue<int> q;
    for (int i = m - 1; i >= 0; --i)
    {
        for (int j = 0; j < v[i].size(); ++j)
            q.push(v[i][j]);
        if (!q.empty())
        {
            ans += q.top();
            q.pop();
        }
    }
    cout << ans << endl;
    return 0;
}


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

int n, arr[202], cvp=0;

int main(){
 cin>>n;
  for(int i=0;i<2*n;i++)cin>>arr[i];
  sort(arr, arr + 2*n);
  for(int i=0;i<2*n;i+=2)cvp+=arr[i];
  cout<<cvp;
}


Measured memory_bytes: 256
#include "iostream"
#include "math.h"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	int c = a - b * 2;
	if (c >= 0) {
		cout << c;
	}
	else {
		cout << 0;
	}
	cout << endl;
}

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

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

int n,m;
vector<int> book;

void init(){
  book.clear();
}

bool input(){
  cin>>m>>n;
  if(n==0)return false;
  rep(i,n){
    int a;
    cin>>a;
    book.push_back(a);
  }
  return true;
}

bool ok(int h){
  int len = 0;
  int sum = 0;
  rep(i,book.size()){
    if(len+book[i]<=h)len += book[i];
    else{
      len = 0;
      sum++;
      i--;
    }

    if(sum>=m)return false;
  }
  return true;
}

int solve(){
  int left = 0;
  int right = 1500000;

  while(1){
    int h = (left+right)/2;
    //printf("%d %d %d\n",left,h,right);
    if(ok(h)){
      right = h;
    }else{
      left = h;
    }
    if(left+1>=right)break;
  }

  return right;
}

int main(){
  while(init(),input())cout<<solve()<<endl;
}

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

template <class type> void printVector(vector<type> vec){
    stringstream ss;
    ll n=vec.size();
    for(ll i=0;i<n;i++)
    {
        ss<<vec[i]<<" ";
        if(i!=n-1)ss<<" ";
    }
    cout<<ss.str()<<endl;
}

template <class type> void inputVector(vector<type>& vec){
    for(ll i=0;i<vec.size();i++)
    {
        cin>>vec[i];
    }
}
int main(){
    ll N;
    cin>>N;
    if(N==0)cout<<1<<endl;
    else cout<<0<<endl;
    return 0;
}

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

int main()
{
  int mod = 1000000007;
  int n, m;
  cin >> n >> m;
  vector<int> a(n + 1);
  vector<int> dp(n + 2, 0);
  for (int i = 0; i < m; i++)
  {
    int buf;
    cin >> buf;
    a[buf] = 1;
  }
  dp[n] = 1;
  for (int i = n - 1; i >= 0; i--)
  {
    if (a[i])
    {
      continue;
    }

    dp[i] = (dp[i + 1] + dp[i + 2]) % mod;
  }
  cout << dp[0] << endl;
}


Measured memory_bytes: 3976
N = int(input())
lst = []
for z in range(N):
    a,b = input().split()
    lst.append([a, int(b)])
x = input()
idx = 0
for i in range(N):
    if lst[i][0] == x:
        idx = i
        break
s = 0
for i in range(idx+1,N):
    s += lst[i][1]
print(s)

Measured memory_bytes: 38384
//package javaapplication2;
import java.util.*;
import java.io.*;
import static java.lang.System.out;

public class Main {
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] s = br.readLine().split("\\s");
        long N = Long.parseLong(s[0]);
        long A = Long.parseLong(s[1]);
        long B = Long.parseLong(s[2]);
        System.out.println(solve(N,A,B));  
    }
    
    private static long solve(long N,long blue,long red){
        if(blue == 0) return 0;
        long div = N / (blue + red);
        long rem = N - (blue + red) *  div;
        return blue * div + (rem >= blue ? blue : rem);
    }
}


Measured memory_bytes: 22996
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInteger = readLn :: IO Integer
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readIntegers = map ( fst . fromJust . B.readInteger ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

main = do
	[ k, n ] <- readInts
	as <- readInts
	let
		as' = as ++ [ head as + k ]
		diffs = zipWith (-) ( tail as' ) as'
	print $ k - maximum diffs

Measured memory_bytes: 15740
#include <cstdio>
using namespace std;
const long long mod=1000000007;
int n;
int a[200005];
long long sum[200005];
long long cnt=0;
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;++i)scanf("%d",a+i);
	sum[0]=a[0];
	for(int i=1;i<n;++i)sum[i]=a[i]+sum[i-1];
	for(int i=0;i<n;++i){
		cnt+=((sum[n-1]-sum[i])%mod*a[i])%mod;
		cnt%=mod;
	}
	printf("%lld\n",cnt);
	return 0;
}


Measured memory_bytes: 4072
import functools

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

mod = 10**9+7

def mod_square(k):
    table = [False]*32
    squares = [1]*32
    base = 2
    for i in range(0, 32):
        squares[i] = base
        base = (base*base)%mod
    itr = 0
    while k > 0:
        if k & 1:
            table[itr] = True
            # print(itr)
        k >>= 1
        itr+=1
        
    # print(table, squares)
    return functools.reduce(lambda x,y:(x*y)%mod, [squares[i] if table[i] else 1 for i in range(32)])
    

def cmb(n, r, mod=mod):
    # g1[r]: nPr
    # g2[r]: nPr^{-1}
    if (r < 0 or r > n):
        return 0
    r = min(r, n - r)
    return g1[r] * g2[r]  % mod

N = max(a,b)
g1 = [1, n]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, N + 1):
    g1.append((g1[-1]*(n-i+1)) % mod)
    inverse.append((-inverse[mod % i] * (mod // i)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)

print((mod_square(n)-cmb(n,a) -cmb(n,b)-1)%mod)

Measured memory_bytes: 27404
from sys import stdin
import sys
import numpy as np
import collections
from functools import cmp_to_key
import heapq

##  input functions for me
def rsa(sep = ''):
    if sep == '' :
        return input().split() 
    else: return input().split(sep)
def rip(sep = ''):
    if sep == '' :
        return map(int, input().split()) 
    else: return map(int, input().split(sep))
def ria(sep = ''): 
    return list(rip(sep))
def ri(): return int(input())
def rd(): return float(input())
def rs(): return input()
##

def in_range(t, l, r):
    return l <= t and t < r

def main():
    H, W = rip()
    S = [""] * H
    for i in range(H): S[i] = rs()

    inf = int(1e9)
    ma = 0
    dx = [0,1,0,-1]
    dy = [1,0,-1,0]
    for i in range(H):
        for j in range(W):
            if S[i][j] == '#': continue

            mi = [[inf] * W for i in range(H)]
            mi[i][j] = 0
            q = collections.deque()
            q.append((i,j))
            while len(q) > 0:
                y, x = q.popleft()
                for t in range(4):
                    ny = y + dy[t]
                    nx = x + dx[t]
                    if (not in_range(nx, 0, W)) or (not in_range(ny, 0, H)) : continue
                    if S[ny][nx] == '#': continue
                    if mi[ny][nx] == inf:
                        mi[ny][nx] = mi[y][x] + 1
                        q.append((ny, nx))
            for k in range(H):
                for l in range(W):
                    if S[k][l] == '#': continue
                    ma = max(ma, mi[k][l])
    
    print(ma)




if __name__ == "__main__":
    main()


Measured memory_bytes: 12708
#include"iostream"
#include"cstring"
#include"string"
#include"algorithm"
#include"cmath"
#include"cstdio"
#include"cstdlib"
#include"vector"
#include"bitset"
#include"set"
#include"map"
#include"iomanip"
#include"queue"
#include"stack"
using namespace std;
typedef long long ll;
int ss(int s, int ans) {
	if (!s)
		return ans;
	return ss(s / 10, ans + s % 10);
}
int main() {
	int num, temp, ans;
	scanf("%d", &num);

	for (int i = 1; i < num / 2; ++i) {
		temp = ss(i,0) + ss(num - i,0);
		if (1 == i)
			ans = temp;
		ans = min(temp, ans);
	}
	if (2 == num) {
		cout << 2 << endl;
		return 0;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256