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

template <int MOD_> struct modnum {
	static constexpr int MOD = MOD_;
	static_assert(MOD_ > 0, "MOD must be positive");

private:
	using ll = long long;

	int v;

	static int minv(int a, int m) {
		a %= m;
		assert(a);
		return a == 1 ? 1 : int(m - ll(minv(m, a)) * ll(m) / a);
	}

public:

	modnum() : v(0) {}
	modnum(ll v_) : v(int(v_ % MOD)) { if (v < 0) v += MOD; }
	explicit operator int() const { return v; }
	friend std::ostream& operator << (std::ostream& out, const modnum& n) { return out << int(n); }
	friend std::istream& operator >> (std::istream& in, modnum& n) { ll v_; in >> v_; n = modnum(v_); return in; }

	friend bool operator == (const modnum& a, const modnum& b) { return a.v == b.v; }
	friend bool operator != (const modnum& a, const modnum& b) { return a.v != b.v; }

	modnum inv() const {
		modnum res;
		res.v = minv(v, MOD);
		return res;
	}
	friend modnum inv(const modnum& m) { return m.inv(); }
	modnum neg() const {
		modnum res;
		res.v = v ? MOD-v : 0;
		return res;
	}
	friend modnum neg(const modnum& m) { return m.neg(); }

	modnum operator- () const {
		return neg();
	}
	modnum operator+ () const {
		return modnum(*this);
	}

	modnum& operator ++ () {
		v ++;
		if (v == MOD) v = 0;
		return *this;
	}
	modnum& operator -- () {
		if (v == 0) v = MOD;
		v --;
		return *this;
	}
	modnum& operator += (const modnum& o) {
		v += o.v;
		if (v >= MOD) v -= MOD;
		return *this;
	}
	modnum& operator -= (const modnum& o) {
		v -= o.v;
		if (v < 0) v += MOD;
		return *this;
	}
	modnum& operator *= (const modnum& o) {
		v = int(ll(v) * ll(o.v) % MOD);
		return *this;
	}
	modnum& operator /= (const modnum& o) {
		return *this *= o.inv();
	}

	friend modnum operator ++ (modnum& a, int) { modnum r = a; ++a; return r; }
	friend modnum operator -- (modnum& a, int) { modnum r = a; --a; return r; }
	friend modnum operator + (const modnum& a, const modnum& b) { return modnum(a) += b; }
	friend modnum operator - (const modnum& a, const modnum& b) { return modnum(a) -= b; }
	friend modnum operator * (const modnum& a, const modnum& b) { return modnum(a) *= b; }
	friend modnum operator / (const modnum& a, const modnum& b) { return modnum(a) /= b; }
};

template <typename T> T pow(T a, long long b) {
	assert(b >= 0);
	T r = 1; while (b) { if (b & 1) r *= a; b >>= 1; a *= a; } return r;
}

using num = modnum<998244353>;

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

	int N, S; cin >> N >> S;
	vector<num> dp(S+1);
	num ans = 0;
	for (int i = 0; i < N; i++) {
		int a; cin >> a;
		dp[0]++;
		for (int v = S-a; v >= 0; v--) {
			dp[v+a] += dp[v];
		}
		ans += dp[S];
	}
	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 256
from collections import Counter
import sys

sys.setrecursionlimit(10 ** 6)

mod = 1000000007
inf = int(1e18)

dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]


def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft


def main():
    s= list(input().split())
    a = list(map(int, input().split()))
    z = input()
    i = s.index(z)
    a[i] -= 1
    print(a[0])
    print(a[1])
    


main()


Measured memory_bytes: 3316
#include <iostream>

using namespace std;

int main()
{
    int H, W;
    string line, p;

    while (cin >> H >> W)
    {
        if (H == 0 && W == 0)
        {
            break;
        }

        for (int h = 0; h < H; h++)
        {
            line = "";
            p = "";

            for (int w = 0; w < W; w++)
            {
                if (w % 2 == 0)
                {
                    if (h % 2 == 0)
                    {
                        p = "#";
                    }
                    else
                    {
                        p = ".";
                    }
                }
                else
                {
                    if (h % 2 == 0)
                    {
                        p = ".";
                    }
                    else
                    {
                        p = "#";
                    }
                }

                line += p;
            }

            cout << line << "\n";
        }

        cout << "\n";

    }

    return 0;

}



Measured memory_bytes: 3044
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//BEGIN CUT HERE
template<Int MOD = 1000000007>
struct Mod{
  int prev=0;
  vector<Int> fact,inv,finv;
  Mod(){}
  Mod(Int n){init(n);}
  
  Int pow(Int x,Int n){
    Int res=1;
    while(n){
      if(n&1) (res*=x)%=MOD;
      (x*=x)%=MOD;
      n>>=1;
    }
    return res;
  }
  
  Int inverse(Int a){
    return pow(a,MOD-2);
  }
  
  void init(Int n){
    if(prev>=n) return;
    prev=n;
    fact=inv=finv=vector<Int>(n);
    
    fact[0]=1;
    for(Int i=1;i<n;i++)
      fact[i]=(fact[i-1]*i)%MOD;
    
    inv[1]=1;
    for(Int i=2;i<n;i++)
      inv[i]=inv[MOD%i]*(MOD-MOD/i)%MOD;
    
    finv[0]=1;
    for(Int i=1;i<n;i++)
      finv[i]=finv[i-1]*inv[i]%MOD;
  }
  
  Int comb(Int n,Int k){
    Int res=1;
    for(Int i=0;i<k;i++){
      res*=(n-i)%MOD;
      res%=MOD;
      res*=inverse(i+1);
      res%=MOD;
    }
    return res;
  }
  
  //only for prime MOD
  Int C(Int n,Int k){
    if(k<0||k>n) return 0;
    return fact[n]*finv[k]%MOD*finv[n-k]%MOD;
  }

  Int H(Int n,Int k){
    return C(n+k-1,k);
  }
  
  Int montmort(Int n){
    Int res=0,rinv=1;
    for(Int k=2;k<=n;k++){
      (rinv*=inverse(k))%=MOD;
      if(k%2) (res+=MOD-rinv)%=MOD;
      else (res+=rinv)%=MOD;
    }
    for(Int i=1;i<=n;i++)
      (res*=i)%=MOD;
    return res;
  }
  
  // calculate P(t) from given points in [0,N]
  Int LagrangePolynomial(vector<Int> &y,Int t){
    Int n=y.size()-1;
    init(n+1);
    Int num=1;
    for(Int i=0;i<=n;i++)
      num=num*((t-i)%MOD)%MOD;
    Int res=0;
    for(Int i=0;i<=n;i++){
      Int tmp=(y[i]*num%MOD)*inverse((t-i)%MOD)%MOD;
      tmp=tmp*finv[i]%MOD;
      tmp=tmp*finv[n-i]%MOD;
      if((n-i)&1) tmp=MOD-tmp;
      res=(res+tmp)%MOD;
    }
    return res;
  }
};
//END CUT HERE
  
//mod_pow
signed AOJ_NTL1B(){
  Int n,m;
  cin>>m>>n;
  Mod<> mod;
  cout<<mod.pow(m,n)<<endl;
  return 0;
}
/*
  verified on 2017/12/31
  http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_B&lang=jp
*/


//montmort
signed ARC009_C(){
  Int n,k;
  cin>>n>>k;
  const Int MMOD = 1777777777;
  Mod<MMOD> mod;
  Int a=mod.montmort(k);
  a=a*mod.comb(n,k)%MMOD;
  cout<<a<<endl;
  return 0;
}
/*
  verified on 2017/12/31
  https://arc009.contest.atcoder.jp/tasks/arc009_3
*/


signed yuki_665(){
  Int n,k;
  cin>>n>>k;
  vector<Int> y(k+2,0);
  const Int MOD = 1e9+7;
  Mod<MOD> mod;
  for(Int i=1;i<=k+1;i++) y[i]=(y[i-1]+mod.pow(i,k))%MOD;
  if(n<=k+1) cout<<y[n]<<endl;
  else cout<<mod.LagrangePolynomial(y,n)<<endl;
  return 0;
}
/*
  verified on 2018/03/10
  https://yukicoder.me/problems/no/665
*/

signed ARC033_D(){
  Int n;
  cin>>n;
  vector<Int> y(n+1);
  for(Int i=0;i<=n;i++) cin>>y[i];
  Int t;
  cin>>t;
  const Int MOD = 1e9+7;
  Mod<MOD> mod;
  if(t<=n) cout<<y[t]<<endl;
  else cout<<mod.LagrangePolynomial(y,t)<<endl;
  return 0;
}
/*
  verified on 2018/03/10
  https://beta.atcoder.jp/contests/arc033/tasks/arc033_4
*/

signed main(){
  AOJ_NTL1B();
  //ARC009_C();
  //yuki_665();
  //ARC033_D();
  return 0;
}



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

void solve(long long sx, long long sy, long long tx, long long ty){
    string ans;
    for(ll i=0; i< (ty-sy); i++) ans.push_back('U');
    for(ll i=0; i< (tx-sx); i++) ans.push_back('R');
    for(ll i=0; i< (ty-sy); i++) ans.push_back('D');
    for(ll i=0; i< (tx-sx); i++) ans.push_back('L');
    ans.push_back('L');
    for(ll i=0; i< (ty-sy+1); i++) ans.push_back('U');
    for(ll i=0; i< (tx-sx+1); i++) ans.push_back('R');
    ans.push_back('D');
    ans.push_back('R');
    for(ll i=0; i< (ty-sy+1); i++) ans.push_back('D');
    for(ll i=0; i< (tx-sx+1); i++) ans.push_back('L');
    ans.push_back('U');
    cout << ans << endl;
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long sx;
    scanf("%lld",&sx);
    long long sy;
    scanf("%lld",&sy);
    long long tx;
    scanf("%lld",&tx);
    long long ty;
    scanf("%lld",&ty);
    solve(sx, sy, tx, ty);
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <bitset>
#define MOD 998244353
using namespace std;
typedef long long ll;

template <typename Tp> inline void getint(Tp &num){
	register int ch, neg = 0;
	while(!isdigit(ch = getchar())) if(ch == '-') neg = 1;
	num = ch & 15;
	while(isdigit(ch = getchar())) num = num * 10 + (ch & 15);
	if(neg) num = -num;
}

inline int hiku(int a, const int &b) {return (a -= b) < 0 ? a + MOD : a;}

inline ll fastpow(ll bas, ll ex){
	register ll res = 1; bas %= MOD;
	for(; ex; ex >>= 1, bas = bas * bas % MOD) if(ex & 1) res = res * bas % MOD;
	return res;
}

int N, M;
bitset<300> a[300], b[300];

inline int insert(bitset<300> val){
	for(register int i = M - 1; ~i; i--) if(val[i]){
		if(!b[i][i]) return b[i] = val, 1;
		val ^= b[i];
	}
	return 0;
}

int main(){
	getint(N), getint(M); int r = 0;
	for(register int i = 0; i < N; i++)
		for(register int j = 0, v; j < M; j++) getint(v), a[i][j] = v;
	for(register int i = 0; i < N; i++) r += insert(a[i]);
	return printf("%d\n", hiku(fastpow(2, N + M - 1), fastpow(2, N + M - r - 1))), 0;
}

Measured memory_bytes: 256
// general helpers
const debug = (message?: any, ...optionalParams: any[]) => {
  if (process.env.LOCAL_DEBUG === '1') console.log(message, ...optionalParams)
}

// helpers
const parseLines = (
  lines: string[]
): any => {
  const [N, Y] = lines[0].split(' ').map(n => +n)
  const obj = { N, Y }
  debug(obj)
  return obj
}

// solver
export const solve = (lines: string[]): string => {
  const { N, Y } = parseLines(lines)
  const target = Y / 1000
  for (let i = N; 0 <= i; i--) {
    const num1man = 10 * i
    if (target - num1man < 0) {
      continue
    }
    for (let j = N - i; 0 <= j; j--) {
      const num5sen = 5 * j
      const remainYen = target - num1man - num5sen
      if (remainYen < 0) {
        continue
      }
      const remainNum = N - i - j
      if (remainYen === remainNum) {
        return `${i} ${j} ${remainNum}`
      }
    }
  }
  return '-1 -1 -1'
}

// main
const main = (lines: string[]) => {
  console.log(solve(lines))
}

// exec main function for submit
if (process.env.LOCAL_DEBUG !== '1') {
  const { stdin: input, stdout: output } = process
  input.resume()
  input.setEncoding('utf8')
  const lines: string[] = []
  require('readline')
    .createInterface({ input, output })
    .on('line', (line: string) => lines.push(line))
    .on('close', () => main(lines))
}


Measured memory_bytes: 7628
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

S = list(input())
S.sort()
if S[0]==S[1] and S[1]!=S[2] and S[2] ==S[3]:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 4332
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;




int main(){
    int n;cin >> n;
    cout << n * n * n << endl;
    return 0;
}


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

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

struct Node *root, *NIL;
void insert(int);
void inorder(struct Node*);
void preorder(struct Node*);
int main(){
  int n, i, x;
  char com[50];
  int cnt = 0;
  

  scanf("%d",&n);
  //if(n > 500000)
  // exit(1);

  for(i = 0; i < n; i++){
    scanf("%s",com);
    
    if(strcmp(com,"insert") == 0){
      scanf("%d",&x);
      if(x < -2000000000 || x > 2000000000)
	exit(1);
      insert(x);
    }
    else if(strcmp(com,"print") == 0){
      cnt++;
      if(cnt > 10)
	exit(1);
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}

void insert(int k){
  struct Node *y = NIL;
  struct Node *x = root;
  struct Node *z;

  z = (struct Node*)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->parent = y;
  
  if(y == NIL)
    root = z;
  else{
    if(z->key < y->key)
      y->left = z;
    else
      y->right = z;
  }
}

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

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



Measured memory_bytes: 25168
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<utility>//pair
#include<list>
#include<vector>//可変長配列
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<P,int>
#define F first
#define S second
int dx[8] = { 1,0,-1,0,1,-1,-1,1 };
int dy[8] = { 0,1,0,-1,1,1,-1,-1 };


int w, h;
int t[100][100];
bool visit[100][100];

void dfs(int ny, int nx) {
    if (visit[ny][nx])
        return;
    visit[ny][nx] = 1;

    rep(i, 8) {
        int x = nx + dx[i], y = ny + dy[i];
        if (x < 0 || y < 0 || x >= w || y >= h)
            continue;

        if(t[y][x]==1)
            dfs(y, x);
    }
}
int main() {
    while (cin >> w >> h, w || h) {
        rep(i, h)rep(j, w)cin >> t[i][j];
        rep(i, h)rep(j, w)visit[i][j] = 0;
        int ans = 0;
        rep(i, h) {
            rep(j, w) {
                if (!visit[i][j] && t[i][j] == 1) {
                    dfs(i, j);
                    ans++;
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3176
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
int n,k,a[2009];
int main(){
  cin>>n>>k;
  for(int i=1;i<=n;i++)cin>>a[i];
  ll ans=0,ans1=0;
  for(int i=1;i<=n;i++)
    for(int j=i+1;j<=n;j++)ans+=(a[i]>a[j]),ans1+=(a[i]<a[j]);
  cout<<(1ll*k*(k+1)/2%mod*ans%mod+1ll*k*(k-1)/2%mod*ans1%mod)%mod<<endl;
  return 0;
}

Measured memory_bytes: 256
/**
*    created: 01.07.2020 21:20:29
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
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;}
const int MOD = 1000000007;
// const int MOD = 998244353;
const long double pi = acos(-1.0);
const int INF = 1LL << 60;

signed main() {

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

    int n;
    cin >> n;
    rep(i,n) {
        char a;
        cin >> a;
        if (a == 'Y') {
            cout << "Four" << endl;
            return 0;
        }
    }
    cout << "Three" << endl;
    return 0;
}

Measured memory_bytes: 3572
// by Balloons
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define mpr make_pair
#define debug() puts("okkkkkkkk")
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)

using namespace std;

typedef long long LL;

const int inf = 1 << 30;
const int maxn=4e5+5;

int n;
int a[maxn];

int main(){
	int mx=-inf,p1=0;
	int mxx=-inf,p2=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		if(mx<a[i]){
			mx=a[i];
			p1=i;
		}
	}
	for(int i=1;i<=n;i++){
		if(i==p1)continue;
		if(mxx<a[i]){
			mxx=a[i];
			p2=i;
		} 
	}
	for(int i=1;i<=n;i++){
		if(i==p1)printf("%d\n",mxx);
		else printf("%d\n",mx);
	}
	
	return 0;
}


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

using namespace std;

int main() {
	string a, b;
	cin >> a >> b;
	if (a == "H" && b == "H") cout << "H" << endl;
	if (a == "H" && b == "D") cout << "D" << endl;
	if (a == "D" && b == "H") cout << "D" << endl;
	if (a == "D" && b == "D") cout << "H" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include<stdlib.h>
#include<string.h>
int main(void){
    char w[110],a[30],b[30]={};
    scanf("%s",w);
    for(int i=0;i<26;i++){
        a[i]=97+i;
    }
    for(int j=0;j<strlen(w);j++){
        for(int k=0;k<26;k++){
            if(w[j]==a[k])b[k]++;
        }
    }
    int ans=0;
    for(int j=0;j<26;j++){
        if(b[j]%2==1)ans++;
    }
    if(ans==0)printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <list>
#include <ctime>
#include <complex>
#include <bitset>
#include <tuple>

#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define MOD 1000000007LL
#define rep(i,a,n) for (int i=a ; i<n ; i++)
#define per(i,a,n) for (int i=n-1 ; i>=a ; i--)
#define LLINF (llong)1e18+5
#define INF 1e9+5

using namespace std;
using llong = long long;
using VI = vector<int>;
using VLL = vector<long long>;
using PII = pair<int, int>;

string s1, s2;
vector<vector<int>> dp; // dp[i][j] = s1의 i번째 index, s2의 j번째 index로부터 만들 수 있는 longest

int dfs(int index1, int index2)
{
	if (index1 == s1.length() || index2 == s2.length()) return 0;
	if (dp[index1][index2] != -1) return dp[index1][index2];
	if (s1[index1] == s2[index2]) return dp[index1][index2] = dfs(index1 + 1, index2 + 1) + 1;
	else return dp[index1][index2] = max(dfs(index1 + 1, index2), dfs(index1, index2 + 1));
}

int main()
{
	IOS;
	
	cin >> s1 >> s2;
	dp.resize(s1.length()+1);
	rep(i, 0, s1.length()+1) dp[i].resize(s2.length()+1), fill(all(dp[i]), -1);
	int ans = dfs(0, 0);
	int startY = 0, startX = 0;
	/*rep(i, 0, dp.size())
	{
		rep(j, 0, dp[i].size())
		{
			cout << dp[i][j] << " ";
		}
		cout << endl;
	}
	cout << ans << endl;*/
	if(ans > 0)
		while (1)
		{
			while (1)
				if (dp[startY + 1][startX + 1] == ans)
				{
					startY++; startX++;
				}
				else break;
			while (1)
				if (dp[startY + 1][startX] == ans) startY++;
				else break;
			while (1)
				if (dp[startY][startX + 1] == ans) startX++;
				else break;
			//cout << startY << " " << startX << endl;
			cout << s1[startY];
			ans--;
			if (ans <= 0) break;
		}

	return 0;
}



Measured memory_bytes: 38760
s = int(input())
nl = [s]
n = s
while True:
	if n % 2 == 0 and n > 0:
		n = n // 2
		nl.append(n)
		if n in nl[:-1]:
			break
	else:
		n = 3*n + 1
		nl.append(n)
		if n in nl[:-1]:
			break
print(len(nl))


Measured memory_bytes: 2940
#include <cstdio>
#include <algorithm>
using namespace std;
const int SCP=682*999/6, SPN=100001;
int a[SCP];
int n, i, j, min0, min1, ans;
struct Node{
    int p, v;
    Node(int _p=0, int _v=0){ p=_p; v=_v; }
    Node operator = (Node _node){ p=_node.p; v=_node.v; return *this; }
    bool operator < (const Node _node) const{ return v<_node.v; }
} sum[2][SCP];
int main(){
    scanf("%d", &n);
    for(i=1; i<=n; i++) scanf("%d", &a[i]);
    for(i=1; i<=SPN; i++) sum[0][i]=sum[1][i]=Node(i, n>>1);
    for(i=1; i<=n; i++) sum[i&1][a[i]].v--;
    sort(sum[0]+1, sum[0]+SPN+1);
    sort(sum[1]+1, sum[1]+SPN+1);
    ans=n;
    for(i=1; i<=5; i++){
        for(j=1; j<=5; j++) if(sum[0][i].p^sum[1][j].p){
            ans=min(ans, sum[0][i].v+sum[1][j].v);
        }
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 2304
#include <iostream>

 using namespace std;

int main()
{
   int i, h, m, s;
   cin >> i;
   h = i / 3600;
   m = i / 60 - h * 60;
   s = i % 60;
   cout << h << ":" << m << ":" << s << endl;

   return 0;
}


Measured memory_bytes: 3084
import java.util.Scanner;
class Main{
public static void main(String[] args){
 Scanner scan = new Scanner(System.in);
 
 long A = scan.nextLong();
 long B = scan.nextLong();
 long N = scan.nextLong();
 long x = B-1;
 double K = 0;
 double L = 0;
 int M = 0;
 int H = 0;
 long Y = 0;
  
 if (N < B-1){
   x = N;
 }
 else{
   x = B-1;
 }
  
  K = (A*x)/B;
  M = (int)K;
  L = x/B;  
  H = (int)L;
  Y = M - (A * H);
 
     System.out.println(Y);
 }
}

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


int main()
{
	int cnt=0,x,a,b,c,i,j,k,r,rr;
	scanf("%d%d%d%d",&a,&b,&c,&x);
     if(x%50!=0) printf("0\n");
     else
     {
     	for(i = 0;i <= a;i++)
     	{
     		r=x-i*500;
     		for(j = 0;j <= b;j++)
     		 {
     		 	rr=r-j*100;
     		 	for( k = 0;k <= c;k++)
     		 	if(rr==k*50) cnt++;//,printf("iii%d%d%d\n",i,j,k);
			  }
		 }
	 }
	 printf("%d\n",cnt);
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define arep(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> L(N);
    rep(i, 0, N) cin >> L[i];
    sort(all(L));
    ll ans = 0;
    rep(i, 0, N) {
        rep(j, i + 1, N) {
            int lb = max(L[i] - L[j], L[j] - L[i]);
            int rb = L[i] + L[j];
            auto l_pos = upper_bound(L.begin() + j + 1, L.end(), lb);
            auto r_pos = lower_bound(L.begin() + j + 1, L.end(), rb);
            ans += (ll)(r_pos - l_pos);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
struct card
{
    char suit;
    int num;
    int idx;
};
typedef struct card Card;

void bubblesort(Card C[], int N);
void selectionsort(Card C[], int N);

int main()
{
    int N,i;
    Card C1[36], C2[36];

    scanf("%d",&N);
    for(i=0; i<N; i++)
    {
        scanf(" %c%d", &C1[i].suit, &C1[i].num);
        C1[i].idx=i;
        C2[i]=C1[i];
    }
    bubblesort(C1, N);
    selectionsort(C2, N);
    return 0;
}

void bubblesort(Card C[], int N)
{
    Card temp;
    int stable,i,j;
    for(i=0; i < N-1; i++)
    {
        for(j=N-1; j>i; j--)
        {
            if(C[j].num<C[j-1].num)
            {
                temp=C[j];
                C[j]=C[j-1];
                C[j-1]=temp;
            }
        }
    }
    stable=1;
    for(i=0; i<N; i++)
    {
        printf("%c%d%c",C[i].suit,C[i].num," \n"[i==N-1]);
        if(i>0 && C[i].num==C[i-1].num && C[i].idx<C[i-1].idx)
        {
            stable=0;
        }
    }
    puts(stable ? "Stable" : "Not stable");
}
void selectionsort(Card C[], int N)
{
    Card temp;
    int mini;
    int stable;
    int i, j;
    for(i = 0; i < N; i++)
    {
        mini = i;
        for(j = i; j < N; j++)
        {
            if(C[j].num < C[mini].num)
                mini = j;
        }
        temp = C[i];
        C[i] = C[mini];
        C[mini] = temp;
    }
    stable = 1;
    for(i = 0; i < N; i++)
    {
        printf("%c%d%c", C[i].suit, C[i].num, " \n"[i==N-1]);
        if(i > 0 && C[i].num == C[i-1].num && C[i].idx < C[i-1].idx)
            stable = 0;
    }
    puts(stable ? "Stable" : "Not stable");
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vec = vector<ll>;
using vecp = vector<P>;
using mat = vector<vec>;
using matp = vector<vecp>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define all(v) v.begin(), v.end()
    

int main(){
  ll A,B;
  cin >> A >> B;
  if(B%A==0){
    cout << A+B << endl;
  }else{
    cout << B-A << endl;
  }
}

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

int main() {
    int H, W; cin >> H >> W;
    int A, B; cin >> A >> B;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if ((i < B && j < A ) || (B <= i && A <= j)) cout << '0';
            else cout << '1';
        }
        cout << '\n';
    }
    cout << endl;
}

Measured memory_bytes: 1280
import java.util.*;

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

		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int P[] = new int[N];
		int deg[] = new int[N+1];

		for(int n=0;n<N;n++){
			P[n] = sc.nextInt();
		}

		int sums = 0;
		int bef = 0;
		for(int n=0;n<N;n++){
			deg[n] = Math.abs(P[n]-bef);
			sums += deg[n];
			bef = P[n];
		}
		deg[N] = Math.abs(bef);
		sums += deg[N];
		
		for(int n=0;n<N;n++){
			int k = -deg[n]-deg[n+1];

			if(n==0) k += Math.abs(P[1]);
			else if(n==N-1) k += Math.abs(P[N-2]);
			else k += Math.abs(P[n+1] - P[n-1]);

			System.out.println(sums+k);
		}
	}
}

Measured memory_bytes: 66120
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<map>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<unordered_map>
#include<ctime>
const  int N = 1e6 + 5;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
typedef long long ll;
typedef long double ld;
#define pa pair<int,int>
#define sc(n) scanf("%lld",&n)
#define fo(i,a,b) for(int i=a;i<b;i++)
#define mem(a,b) memset(a,b,sizeof a)
using namespace std;
int n, m;
unordered_map<char, int> mp;
//struct cmp
//{
//	bool operator () (int x, int y)
//	{
//		return x > y;
//	}
//};
int main()
{
	int t;
	string s;
	cin >> s;
	int cnt = 0;
	fo(i, 0, 4)
	{
		if (!mp[s[i]])
		{
			cnt++;
			mp[s[i]] = 1;
		}
	}
	if (cnt == 2)
		puts("Yes");
	else
		puts("No");
	return 0;
}

Measured memory_bytes: 256
n,k=[int(i) for i in input().split()]
d=[]
a=set()
for i in range(k):
    d.append(int(input()))
    [a.add(int(j)) for j in input().split()]
r=0
for i in range(1,n+1):
    if not i in a:
        r+=1
print(r)


Measured memory_bytes: 9184
unittest
{
	assert( [ "1 7 9 4" ].parse.expand.solve == "YES" );
	assert( [ "1 9 7 4" ].parse.expand.solve == "YES" );
	assert( [ "1 2 9 1" ].parse.expand.solve == "NO" );
	assert( [ "4 9 0 8" ].parse.expand.solve == "NO" );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto ns = input.front.split.to!( long[] );
	return tuple( ns );
}

auto solve( long[] ns )
{
	ns.sort();
	return ( ns.equal( [ 1L, 4L, 7L, 9L ] ) ) ? "YES" : "NO";
}


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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

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

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


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

  int n;
  cin >> n;

  ll k;
  cin >> k;

  vector<int> a(n);
  rep(i, n){
    cin >> a[i];
    a[i]--;
  }

  vector<int> dist(n);
  rep(i, n){
    dist[i] = -1;
  }
  dist[0] = 0;

  int start = 0;
  int cycle = 0;

  int now = 0;
  while(true){

    int nx = a[now];

    if(dist[nx] >= 0){
      start = nx;
      cycle = dist[now] - dist[nx] + 1;
      break;
    }

    dist[nx] = dist[now] + 1;
    if(dist[nx] == k){
      cout << nx + 1 << endl;
      return 0;
    }

    now = nx;

  }

  ll nokori = k - dist[start];

  nokori = nokori % cycle;

  now = start;
  while(nokori > 0){

    now = a[now];
    nokori--;
  }

  cout << now + 1 << endl;

  return 0;
}


Measured memory_bytes: 4784
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007;
constexpr lint LINF = (1LL << 60);

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "" : " ");
	return os;
}

template <class T1, class T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
	os << p.first << " " << p.second;
	return os;
}

template <class T1, class T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
	for (const auto &e : mp) os << "[" << e << "] ";
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

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

	int N;
	cin >> N;

	vector<int> a(3 * N);
	for (int i = 0; i < 3 * N; i++) cin >> a[i];

	vector<lint> smax(3 * N, 0), smin(3 * N, 0);

	// Max
	{
		priority_queue<int, vector<int>, greater<int>> pqmax;
		lint Mtmp = 0;
		for (int i = 0; i < N; i++) {
			pqmax.emplace(a[i]);
			Mtmp += a[i];
		}
		smax[N - 1] = Mtmp;
		for (int i = N; i < 2 * N; i++) {

			if (pqmax.top() < a[i]) {
				Mtmp += a[i] - pqmax.top();
				pqmax.pop();
				pqmax.emplace(a[i]);
			}

			smax[i] = Mtmp;
		}
	}

	// min
	{
		priority_queue<int> pqmin;
		lint mtmp = 0;
		for (int i = 3 * N - 1; i >= 2 * N; i--) {
			pqmin.emplace(a[i]);
			mtmp += a[i];
		}
		smin[2 * N] = mtmp;
		for (int i = 2 * N - 1; i >= N; i--) {

			if (pqmin.top() > a[i]) {
				mtmp += a[i] - pqmin.top();
				pqmin.pop();
				pqmin.emplace(a[i]);
			}

			smin[i] = mtmp;
		}
	}

	DMP(smax, smin);

	lint ans = -LINF;
	for (int i = N; i <= 2 * N; i++) {
		ans = max(ans, smax[i - 1] - smin[i]);
	}

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 7028
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793

int main(){
    int n;
    cin >> n;
    vector<string> s(n);
    rep(i,n)cin >> s.at(i);
    map<char ,int > alph;
    for(int i='a';i<='z';i++){
        char x=char(i);
        alph[x]=100;
    }
    rep(i,n){
        int m=s.at(i).size();
        map<char ,int > alp;
        for(int i='a';i<='z';i++){
        char x=char(i);
        alp[x]=0;
        }
        rep(j,m){
            alp[s.at(i).at(j)]++;
        }
        for(int i='a';i<='z';i++){
        char x=char(i);
        alph[x]=min(alph[x],alp[x]);
        }
        
    }
    for(int i='a';i<='z';i++){
        char x=char(i);
        rep(j,alph[x]){
            cout << x ;
        }
    }
    cout << endl;

}



Measured memory_bytes: 3584
// #include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string>
// #include <deque>
// #include <queue>
// #include <array>
// #include <ctime>
// #include <list>
// #include <map>
#include <set>
// #include <cassert>
// #include <complex>
// #include <sstream>
// #include <forward_list>
// #include <unordered_set>
// #include <unordered_map>

using namespace std;

#define int long long
#define pb push_back
#define mp make_pair
#define scani(n) scanf("%d",&n);
#define EPS 1e-9
#define FOR(i,n) for(int i=0; i<n; i++)
#define X first
#define Y second
#define arrinput for(int i=0; i<n; i++) cin>>arr[i];
#define arrsum for(int i=0; i<n; i++) sum+=arr[i];
#define for0(i,n) for(int i=0; i<n; i++)
#define for1(i,n) for(int i=1; i<=n; i++)
#define forr(i,n) for(int i=n-1; i>=0; i--)
#define sz(a) (int)(a.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

const int MOD = 1e9+7;
const int n_ = 1e5+1000;
const long double PI = acos(-1.0);

ll gcd (ll a, ll b) {return ( a ? gcd(b%a, a) : b );}
ll power(ll a, ll n) {ll p = 1;while (n > 0) {if(n%2) {p = p * a;} n >>= 1; a *= a;} return p;}
ll power(ll a, ll n, ll mod) {ll p = 1;while (n > 0) {if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}

bool vowel(char ch) {
    if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u') return true;
    else return false;
}

// Union-Find Disjoint Sets Library written in OOP manner, using both path compression and union by rank heuristics
class UnionFind {                                              // OOP style
private:
    vi p, rank, setSize;                       // remember: vi is vector<int>
    int numSets;
public:
    UnionFind(int N) {
        setSize.assign(N, 1); numSets = N; rank.assign(N, 0);
        p.assign(N, 0); for (int i = 0; i < N; i++) p[i] = i; }
    int findSet(int i) { return (p[i] == i) ? i : (p[i] = findSet(p[i])); }
    bool isSameSet(int i, int j) { return findSet(i) == findSet(j); }
    void unionSet(int i, int j) { 
        if (!isSameSet(i, j)) { numSets--; 
        int x = findSet(i), y = findSet(j);
        // rank is used to keep the tree short
        if (rank[x] > rank[y]) { p[y] = x; setSize[x] += setSize[y]; }
        else                   { p[x] = y; setSize[y] += setSize[x];
                                 if (rank[x] == rank[y]) rank[y]++; } } }
    int numDisjointSets() { return numSets; }
    int sizeOfSet(int i) { return setSize[findSet(i)]; }
};

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    string str;
    cin>>str;
    int n = str.size();
    int ans = 0;
    for0(i,(n+1)/2) {
        if(str[i] == 'p') ans--;
    }
    for(int i=(n+1)/2; i<n; i++) {
        if(str[i] == 'g') ans++;
    }
    cout<<ans;

    return 0;
}   

Measured memory_bytes: 512
h, w = map(int, input().split())
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
    for j in range(a[i]):
        b.append(i + 1)
c = [[0] * w for i in range(h)]
k = 0
flag = 0
i = 0
j = 0
while k < h * w:
    c[i][j] = str(b[k])
    k += 1
    if j == w - 1 and flag == 0:
        i += 1
        flag = 1
    elif j == 0 and flag == 1:
        i += 1
        flag = 0
    elif flag:
        j -= 1
    else:
        j += 1
for i in range(h):
    print(" ".join(c[i]))

Measured memory_bytes: 4084
import java.util.*;

public class Main {

    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        char mat[][] = new char[n][m];
        for(int i=0;i<n;i++){
                mat[i] = in.next().toCharArray();
        }
        int ans[][] = new int[n][m];
        ans[0][0] = 1;
        int mod = (int)Math.pow(10,9)+7;
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                if(mat[i][j] == '.'){
                    if((j+1) < m){
                        ans[i][j+1] = (ans[i][j]%mod + ans[i][j+1]%mod)%mod;
                    }
                    if((i+1) < n){
                        ans[i+1][j] = (ans[i][j]%mod + ans[i+1][j]%mod)%mod;
                    }
                }else{
                    ans[i][j] = 0;
                }
            }
        }
     
        System.out.println(ans[n-1][m-1]);

    }

}

Measured memory_bytes: 37452
#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

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 long long MAX = 5100000;
const long long INF = 1LL << 60;
const int inf = 1 << 28;
//const long long mod = 1000000007LL;
//const long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

vector<bool> isprime;

void eratos(ll n) {
	isprime.resize(n + 1);
	for (ll i = 0; i <= n; i++) {
		isprime[i] = true;
	}
	isprime[0] = false;
	isprime[1] = false;
	for (ll i = 2; i * i <= n; i++) {
		if (isprime[i]) {
			ll j = i + i;
			while (j <= n) {
				isprime[j] = false;
				j = j + i;
			}
		}
	}
}
int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
	eratos(1000000);
	while (1) {
		ll a, d, n; scanf("%lld %lld %lld", &a, &d, &n);
		if (a == 0 && d == 0 && n == 0) break;
		ll cnt = 0;
		ll now = a;
		while (1) {
			if (isprime[now]) {
				cnt++;
				if (cnt == n) {
					printf("%lld\n", now);
					break;
				}
			}
			now += d;
		}
	}
	return 0;
	/*
		おまじないを使ったらscanfとprintf関連注意！！！！！！！！！！！！
	*/
}


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

using namespace std;
#define X first
#define Y second
#define pb push_back
typedef double db;
typedef long long ll;
typedef pair<int,int> P;
const int MAXN=305,MOD=1e9+7;
vector<P> inc[MAXN];
int n,m,l,r,x,dp[MAXN][MAXN][MAXN],res;

bool check(int x,int y,int z)
{
    int cur=max(x,max(y,z));
    for(auto t:inc[cur])
    {
        int l=t.X,op=t.Y,cnt=0;
        cnt=(x>=l)+(y>=l)+(z>=l);
        if(cnt!=op) return false;
    }
    return true;
}

int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)
        scanf("%d%d%d",&l,&r,&x),inc[r].pb(P(l,x));
    dp[0][0][1]=dp[0][1][0]=dp[1][0][0]=1;
    for(int i=0;i<=n;i++)
        for(int j=0;j<=n;j++)
            for(int k=0;k<=n;k++)
            {
                if((i==j&&i&&j)||(i==k&&i&&k)||(j==k&&j&&k)) continue;
                // cout<<i<<" "<<j<<" "<<k<<" "<<dp[i][j][k]<<endl;
                if(!check(i,j,k)) dp[i][j][k]=0;
                if(!dp[i][j][k]) continue;
                
                int cur=max(i,max(j,k));
                if(cur==n) (res+=dp[i][j][k])%=MOD;
                (dp[cur+1][j][k]+=dp[i][j][k])%=MOD;
                (dp[i][cur+1][k]+=dp[i][j][k])%=MOD;
                (dp[i][j][cur+1]+=dp[i][j][k])%=MOD;
            }
    printf("%d",res);
    return 0;
}

Measured memory_bytes: 110848
import java.util.Scanner;

public class Main {
    public static int search(int l, int r,int[] S, int target){
        int mid = (l+r)/2;
        if(mid == l || mid == r){
            return -1;
        }
        else if(S[r] < target || S[l] > target){
            return -1;
        }
        else if(S[mid] == target){
            return 1;
        }
        else if(S[r] == target){
            return 1;
        }
        else if(S[l] == target){
            return 1;
        }
        else if(S[mid] < target){
            return search(mid, r, S, target);
        }
        else{
            return search(l, mid, S, target);
        }
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int S[];
        int T[];
        int n = sc.nextInt();
        S = new int[n];
        for(int i = 0; i < n; i ++){
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        T = new int[q];
        for(int i = 0; i < q; i++){
            T[i] = sc.nextInt();
        }
        int num = 0;
        for(int i = 0; i < q; i++){
            if(search(0, n-1, S, T[i]) == 1){
                num++;
            }
        }
        System.out.println(num);
    }
}


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

int main() {
  int m;
  int a;
  int b;
  int c;
  cin >> m;
  a = m / 100;
  b = ( m - a * 100 ) / 10;
  c = m - a * 100 - b * 10;
  cout << a + b + c << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int n,f[101],p[101],k;

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&f[i]);
		k=max(k,f[i]);
		p[f[i]]++;
	}
	if(k%2){
		for(int i=1;i<=k/2;i++){
			if(p[i]){
				printf("Impossible\n");
				return 0;
			}
		}
		if(p[k/2+1]>2){
			printf("Impossible\n");
			return 0;
		}
		for(int i=k/2+2;i<=k;i++){
			if(p[i]<2){
				printf("Impossible\n");
				return 0;
			}
		}
	}else{
		for(int i=1;i<k/2;i++){
			if(p[i]){
				printf("Impossible\n");
				return 0;
			}
		}
		if(p[k/2]!=1){
			printf("Impossible\n");
			return 0;
		}
		for(int i=k/2+1;i<=k;i++){
			if(p[i]<2){
				printf("Impossible\n");
				return 0;
			}
		}
	}
	printf("Possible\n");
}

Measured memory_bytes: 3732
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> n;
  ans = LINF;
  rep(i, 1000) {
    cnt = 1000 * i;
    if (cnt < n) continue;
    ans = min(ans, cnt - n);
  }
  Cout(ans);
  return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
 
struct c{
  int a;
  int b;
  int x;
  int e;
  
  bool operator<( const c& right ) const {
        return x < right.x;
    }
  
};

int main(){
  int n,m,i;
  cin>>n>>m;
  int ban[n+1];
  vector<c> d(m);
  for(i=0;i<n+1;i++){
    ban[i]=0;
  }
  for(i=0;i<m;i++){
    d[i].a=i;
    cin>>d[i].b>>d[i].x;
  }
  sort(d.begin(), d.end());
  for(i=0;i<m;i++){
    ban[d[i].b]++;
    d[i].e=ban[d[i].b];
    d[i].x=d[i].a;
  }
  sort(d.begin(), d.end());
  for(i=0;i<m;i++){
    printf("%06d",d[i].b);
    printf("%06d\n",d[i].e);
  }
}

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

int main(){
  int N;
  cin>>N;
  int H[N];
  
  for(int i=0;i<N;i++){
    cin >> H[i];
  }
  
  for(int i=0;i<N-1;i++){
    if(H[i+1]>=H[i]){
      continue;
    }else{
      H[i+1]+=1;
      if(H[i+1]>=H[i]){
        continue;
      }else{
        cout << "No";
        return 0;
      }
    }
  }
  cout << "Yes";
  
  return 0;
}

Measured memory_bytes: 768
require 'pp'

def gets; ARGF.gets; end

class Solver

  def main
    s = gets.chomp

    a_idx = s.index('A')
    z_idx = s.rindex('Z')

    # puts a_idx
    # puts z_idx

    ans = z_idx - a_idx + 1
    puts ans
  end
end

if __FILE__ == $0
  Solver.new.main
end


Measured memory_bytes: 2552
import math
import copy
import numpy as np

n = int(input())
a = [int(i) for i in input().split()] 
x = a
num_list = []

i = n
while i > math.ceil(n/2):
  if a[i-1] == 1:
    num_list.append(i)
  i -= 1

i = math.ceil(n/2)
while i > 0:
  count = 0
  tmp = [x[i] for i in range(2*i-1, n, i)]
  s = sum(tmp)%2
  if a[i-1] == s:
    x[i-1] = 0
  else:
    x[i-1] = 1
    num_list.append(i)
  i -= 1

l = (len(num_list))

if l == 0:
  print(0)
else:
  print(l)
  print(' '.join([str(n) for n in num_list]))

Measured memory_bytes: 29064
def calc():
  n,ma,mb=map(int,input().split())
  dp=[[[5000]*401 for _ in range(401)] for _ in range(41)]
  arr=[list(map(int,input().split())) for _ in range(n)]
  dp[0][0][0]=0
  for t in range(n):
    a,b,c=arr[t]
    for i in range(401):
      for j in range(401):
        if dp[t][i][j]==5000:
          continue
        dp[t+1][i][j]=min(dp[t+1][i][j],dp[t][i][j])
        dp[t+1][i+a][j+b]=min(dp[t+1][i+a][j+b],dp[t][i][j]+c)
  ans=5000
  for i in range(1,401):
    if i*ma>400 or i*mb>400:
      break
    ans=min(ans,dp[n][i*ma][i*mb])
  if ans==5000:
    print(-1)
  else:
    print(ans)
    
calc()

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

Measured memory_bytes: 580
#include <iostream>
#include <vector>
#include <map>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <sstream>
using namespace std;

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define repp(i,k,n) for(int i=k;i<(int)n;i++)
#define rei(n) for(int i=0;i<(int)n;i++)
#define rel(n) for(int l=0;l<(int)n;l++)
#define al(s) s.begin(),s.end()

typedef pair<int, int> pi;
typedef pair<pi, pi> ppi;
typedef pair<int, ppi> pipp;


int main()
{
	int n;
	while (cin >> n)
	{
		int ans = n % 39;
		cout << "3C";
		if (ans == 0)ans = 39;
		if (ans <= 9)cout << "0";
		cout << ans << endl;
	}
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
    char v[8][8];
    for (int i=0; i<8; ++i) {
        for (int j=0; j<8; ++j) {
            cin >> v[i][j];
        }
    }
    cout << 90 << endl;
    for (int i=0; i<8; ++i) {
        for (int j=7; j>=0; --j) {
            cout << v[j][i];
        }
        cout << endl;
    }
    cout << 180 << endl;
    for (int i=7; i>=0; --i) {
        for (int j=7; j>=0; --j) {
            cout << v[i][j];
        }
        cout << endl;
    }
    cout << 270 << endl;
    for (int i=7; i>=0; --i) {
        for (int j=0; j<8; ++j) {
            cout << v[j][i];
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1140