akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
using namespace std;
#define MAX 300300
int primes[MAX];
signed main() {
  for (int i = 0; i < MAX; i++) primes[i] = -1;
  for (int i = 2; i < MAX; i++) {
    if (primes[i] == 0) continue;
    primes[i] = 1;
    for (int j = i*2; j < MAX; j+=i) {
      primes[j] = 0;
    }
  }

  int N;
  while (cin>>N, N!=0) {
    int ans = 0;
    for (int i = N+1; i <= 2*N; i++) {
      ans += primes[i];
    }
    cout << ans << endl;
  }
}



Measured memory_bytes: 5428
// SeeAlso: 

#include <bits/stdc++.h>

using namespace std;

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

#define MAX 100000
#define NIL -1
#define MOD 1000000007

typedef int _loop_int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define debug(x) cout<<#x<<": "<<x<<endl
#define debig_vec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) rep(i, h) { rep(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> inline void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> inline void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const long long INF = 1LL<<60;

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans = n / (a+b) * a;
    n %= (a+b);
    if(n>=a) {
        print(a+ans);
    } else {
        print(ans+n);
    }
    return 0;
}


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

int main(){
	long n, q, C = 0;
	cin >> n;
	vector<long> S(n + 1, 0);
	for (long i = 0; i < n; i++) cin >> S[i];
	cin >> q;
	vector<long> T(q, 0);
	for (long i = 0; i < q; i++) cin >> T[i];
	for (long i = 0; i < q; i++){
		long a = 0, b = n;
		while (a < b){
			if (S[(a + b) / 2] > T[i]) b = (a + b) / 2;
			else if (S[(a + b) / 2] == T[i]){C++; break;}
			else a = (a + b) / 2 + 1;
		}
	}
	cout << C << endl;
	return 0;
}

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

int N, K;

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

    double ans = 0;

    for (int i = 1; i <= N; i++) {
        int target = i;
        int count = 0;
        while (target < K) {
            target *= 2;
            count++;
        }
        ans += (double) 1 / (N * pow(2, count)); 
        // cout << count << endl;
    }

    printf("%.10f\n", ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define sim template < class c
#define ris return *this
#define dor > debug & operator <<
#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", ", d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; it++)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int N = 22;
const ll mod = 1e9 + 7;
int a[N][N], n, dp[N][1 << N];

int solve(int m, int w) {
	if (m == n) {
		if (w == 0) {
			return 1;
		}
		return 0;
	}
	if (dp[m][w] != -1) {
		return dp[m][w];
	}
	ll t = 0;
	for (int i = 0; i < n; i++) {
		int val = (1 << i);
		bool available = (((val & w) == 0)? 0 : 1);
		if (available && a[m][i]) {
			t = (t + solve(m + 1, val ^ w)) % mod;
		}
	}
	return dp[m][w] = t;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> a[i][j];
		}
	}
	memset(dp, -1, sizeof(dp));
	int ans = solve(0, ((1 << n) - 1));
	cout << ans;
	
	return 0;
}


Measured memory_bytes: 360704
#include <memory>
#include <sstream>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iterator>
#include <numeric>
#include <functional>
#include <climits>



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

class node{
public:
  node* p;
  auto_ptr<node> n;
  int v;
  bool null;
  node(node* p_, node* n_, int v_): p(p_), n(n_), v(v_), null(false){}
  node(node* p_, node* n_): p(p_), n(n_), null(true){}
};

class list{
public:
  auto_ptr<node> f;
  node* l;
  list(): f(new node(NULL, NULL)), l(new node(NULL, NULL)){
    f->n.reset(l);
    l->p = f.get();
  }
  void insert(int v){
    node* p = f.get();
    node* n = f->n.release();
    f->n.reset(new node(p, n, v));
    n->p = f->n.get();
  }
  void del(node* pos){
    if(pos == NULL) return;
    node* pre = pos->p;
    node* next = pos->n.release();
    pre->n.reset(next);
    next->p = pre;
  }
  node* find(int x){
    for(node* cur = f->n.get(); cur != l; cur = cur->n.get()){
      if(cur->v == x) return cur;
    }
    return NULL;
  }
  bool empty(){
    return f->n.get() == l;
  }
  void delf(){
    if(empty()) return;
    del(f->n.get());
  }
  void dell(){
    if(empty()) return;
    del(l->p);
  }
  void print(){
    vector<int> buf;
    for(node* cur = f->n.get(); cur != l; cur = cur->n.get()){
      buf.push_back(cur->v);
    }
    for (size_t i = 0; i < buf.size()-1; i++) {
      cout << buf[i] << " ";
    }
    cout << buf.back() << endl;
  }
};

int main(int argc, char *argv[]){
  size_t n;
  cin >> n;
  list l;
  string buf;

  char com[20];
  int key;
  for (size_t i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {l.insert(key);}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) l.delf();
	else if ( com[6] == 'L' ) l.dell();
      } else {
	l.del(l.find(key));
      }
    }
  }
  l.print();
  return 0;
}

Measured memory_bytes: 32424
from collections import deque

H, W = map(int, input().split())
grid = '#' * (W+2)
for _ in range(H):
    grid += '#' + input() + '#'
grid += '#' * (W+2)
move = [1, -1, W+2, -W-2]

def bfs(start):
  lst = [10**9] *((H+2)*(W+2))
  lst[start] = 0
  q = deque([start])
  while q:
    x = q.popleft()
    dx = lst[x]
    for d in move:
      y = x + d
      if grid[y] == '#':
        continue
      dy = dx + 1
      if dy >= lst[y]:
        continue
      lst[y] = dy
      q.append(y)
  return max(x for x in lst if x < 10**9)
  
  
print(max(bfs(i) for i in range((H+2)*(W+2)) if grid[i] != '#'))

Measured memory_bytes: 3316
H,W = [int(i) for i in input().split()]

if (H ==1) | (W ==1):
 	ans = 1
  
elif (H%2 ==1) & (W%2==1):
    ans = int(H*W//2 +1)
else:
    ans = int(H*W/2)
    
print(ans)

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main()
{
	int n,s,m;
	cin>>n;
	if(n%500==0)
	s=n*2;
	else
	{
		 m=n%500;
		
	s=(n-m)*2;
	if(m%5==0)
	{
		s+=m;
	}
	else
	s=s+(m-(m%5));
	}
	cout<<s<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)
using namespace std;
typedef long long ll;

int main() {
	ll n, m; cin >> n >> m;
	ll c[31] = {};

	rep(i, 0, n) {
		ll k; cin >> k;
		rep(j, 0, k) {
			ll a; cin >> a;
			c[a]++;
		}
	}

	ll ans = 0;
	repe(i, 1, m) {
		if (c[i] == n) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<LL> VI;
typedef vector<VI> VVI;
typedef pair<LL, LL> PII;
typedef vector<string> VS;
inline LL toInt(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(x,c) for(auto x: (c))
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define ALL(c) (c).begin(), (c).end()
#define REVERSE(c) reverse(ALL(c))
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define STABLE_SORT(c) stable_sort(ALL(c))
#define STABLE_RSORT(c) stable_sort((c).rbegin(),(c).rend())
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)), (c).end());
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
const double INF = 1e7;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define dump(x)  cerr << #x << " = " << (x) << endl;

const LL MOD = 1e9 + 7;

inline LL mod_add(LL a, LL b) {
    return (a + b) % MOD;
}

inline LL mod_sub(LL a, LL b) {
    return (a + MOD - b) % MOD;
}

inline LL mod_mul(LL a, LL b) {
    return ((a % MOD) * (b % MOD)) % MOD;
}

LL mod_bipow(LL x, LL y) {   // power using bisection method
    if (y == 0) return 1;
    else if (y == 1) return x % MOD;
    else if (y % 2 == 0) {
        LL val = mod_bipow(x, (LL)(y / 2));
        return mod_mul(val, val);
    } else {
        LL val = mod_bipow(x, (LL)(y / 2));
        return mod_mul(mod_mul(val, val), x);
    }
}

LL mod_inv(LL x) {   // compute x^{-1}=x^{MOD-2} (when MOD is a prime number) using Fermat theorem
    return mod_bipow(x, MOD - 2);
}

LL mod_div(LL a, LL b) {   // using a/b=a*b^{-1}
    return mod_mul(a, mod_inv(b));
}


int main() {
	LL N;
	cin >> N;
	VI C;
	LL prev = 0, c;
	REP(i, N) {
		cin >> c;
		if (c != prev) {
			C.PB(c);
		}
		prev = c;
	}
	N = SZ(C);

	map<LL, LL> pos;
	VI dp(N);
	LL ans = 1;
	REP(i, N) {
		if (pos.count(C[i]) != 0) {
			ans = mod_add(ans, dp[pos[C[i]]]);
			dp[i] = ans;
		} else {
			if (i == 0) {
				dp[i] = 1;
			} else {
				dp[i] = dp[i - 1];
			}
		}
		pos[C[i]] = i;
	}
	/*REP(i, N) {
		dump(dp[i]);
		}*/
	cout << ans << endl;

    return 0;
}


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

int main(){
    int d,n;
    cin >> d >> n;
    int i = pow(100,d);
    if(n != 100)cout << n*i << endl;
    else cout << 101*i << endl;
}


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

int main(void){
	int a, b, c;
	cin >> a >> b >>c;
	
	int buff;
	buff = a;
	a = b;
	b = buff;

	buff = a;
	a = c;
	c = buff;
	
	cout << a << " " << b << " " << c << endl;
	return 0;
}

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

int main ()
{
	int a,b;
	cin>>a>>b;
	
	int l=a*b;
	
	if(l%2==0){
		cout<<"Even"<<endl;
	}
	else{
		cout<<"Odd"<<endl;
	}
	


}



Measured memory_bytes: 3576
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//またはかかつか
//例外処理は最初にする
//x = p^m + q^n...の約数の個数:(n+1)*(m+1)....
//N!のどの素因数で何回割れるか
//⇔1~Nまでの数がそれぞれどの素因数で何回割り切れるかの和
//パズルの問題->一般化して全探索
//数が大きい時のせぐふぉはコードテストで試してみる
//スペルミスに注意
//stack<ll> s;
//s.push(要素);s.top();s.pop();
//queue<ll> q;
//q.push(要素);q.front();q.pop();
//同じ作業繰り返す系の問題：収束先を見つける
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll M = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}


//a,bの最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n * f(n - 1)) % M;
}

//Nをdで何回割れるか
ll divcnt(ll N, ll d) {
	ll ans = 0;
	while (1) {
		if (N%d == 0) {
			ans++;
			N /= d;
		}
		else break;
	}

	return ans;
}

//素数判定
bool prime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false;
	}
	return true;
}

//フィボナッチ数列
vector<ll> memo(pow(10, 6) + 1);
ll fibo(ll n) {
	if (n == 1) return 1;
	else if (n == 2) return 1;
	else if (memo[n] != 0) return memo[n];
	else return memo[n] = fibo(n - 1) + f(n - 2);
}

int main() {
	double H, A; cin >> H >> A;
	cout << ceil(H / A) << endl;
}

Measured memory_bytes: 8064
while n = STDIN.gets
  n = n.chomp.to_i
  count=0
  (0..9).each do |a|
    (0..9).each do |b|
      (0..9).each do |c|
        if 0 <= n-a-b-c and n-a-b-c <= 9 then
          count+=1
        end
      end
    end
  end
  puts count
end

Measured memory_bytes: 8628
#include "bits/stdc++.h"

#define rep(i,n) for(int i = 0;i<n;i++)
#define cint(a) int a; cin >> a;
#define cstr(str) string str; cin >> str;


using namespace std;
using ll = long long;

const ll mod = 1e9 + 7;

int main(void) {

	ios::sync_with_stdio(false);
	cin.tie(0);
	map<string,int> a;
	a["AC"] = 0;
	a["WA"] = 0;
	a["TLE"] = 0;
	a["RE"] = 0;


	cint(n);
	string str;
	rep(i, n) {
		cin >> str;
		a[str] += 1;



	}

	cout << "AC" << " x " << a["AC"] << endl;
	cout << "WA" << " x " << a["WA"] << endl;
	cout << "TLE" << " x " << a["TLE"] << endl;
	cout << "RE" << " x " << a["RE"] << endl;


	return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#include <complex>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-7;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int n;
set<vector<int> > st;

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		vi a(3);
		cin>>a[0]>>a[1]>>a[2];
		sort(a.begin(),a.end());
		st.insert(a);
	}
	cout<<n-st.size()<<endl;
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;

const int MOD = 1000000007;

int main() {
    int N;
    cin >> N;
    set<string> st;
    string s;
    string ns;
    cin >> s;
    st.insert(s);
    for (int i = 1; i < N; i++) {
        cin >> ns;
        if (s[s.size() - 1] != ns[0] || st.find(ns) != st.end()) {
            cout << "No" << endl;
            return 0;
        }
        st.insert(ns);
        s = ns;
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int n, m;
char map[110][110];
void dfs(int x, int y, char ch)
{
	int dir[4][2] = { 1,0,-1,0,0,1,0,-1 };//向四个方向搜索
	int x1, y1;
	map[x][y] = '.';//标记搜索过区域
	for (int i = 0; i<4; i++)//向四个方向搜索
	{
		x1 = x + dir[i][0];
		y1 = y + dir[i][1];
		if (x1 >= 0 && x1<n&&y1 >= 0 && y1<m&&map[x1][y1] == ch)//在边界内且为同类型
			dfs(x1, y1, ch);
	}
}

int main(int argc, char *argv[])
{
	char ch;
	while (cin >> n >> m)//输入地图大小
	{
		int ans = 0;
		if (n == 0 || m == 0) break;//结束文件

		for (int i = 0; i<n; i++)
			for (int j = 0; j<m; j++)
				cin >> map[i][j];//输入地图
		for (int i = 0; i<n; i++)
			for (int j = 0; j<m; j++)
				if (map[i][j] != '.')
				{
					ch = map[i][j];//标记ch类型
					ans++;//每次搜索结果为一个区域
					dfs(i, j, ch);
				}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 3944
import java.util.*;

public class Main{
    static long gcd(long a, long b){
        long p = Math.max(a, b);
        long q = Math.min(a, b);
        long r = p % q;
        while(r!=0){
            p = q;
            q = r;
            r = p % q;
        }
        return q;
    }

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long m = sc.nextLong();
        String s = sc.next();
        String t = sc.next();
        long gcd = gcd(n, m);
        long lcm = m / gcd * n;
        long a = n / gcd;
        long b = m / gcd;
        boolean flag = true;
        for(int i = 0; i < gcd; i++){
            int index1 = (int)(i * a);
            int index2 = (int)(i * b);
            if(s.charAt(index1) != t.charAt(index2)){
                flag = false;
                break;
            }
        }
        System.out.println(flag ? lcm : -1);
    }
}

Measured memory_bytes: 27904
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
int const INF = 1001001001;


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

int a,b,c;
cin >> a >> b >> c;

if(c >= a && c <= b) puts("Yes");
else puts("No");

return 0;
}

Measured memory_bytes: 256
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

while True:
    m, f, r = map(int, sys.stdin.readline().split())
    if m == -1 and f == -1 and r == -1:
        break
    elif m == -1 or f == -1:
        print('F')
    elif m+f >= 80:
        print('A')
    elif m+f >= 65:
        print('B')
    elif m+f >= 50:
        print('C')
    elif m+f >=30:
        if r >= 50:
            print('C')
        else:
            print('D')
    else:
        print('F')



Measured memory_bytes: 5604
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()
    
    if S.count('R') in (0, 1, 3):
        print(S.count('R'))
    elif S[0] == S[2]:
        print(1)
    else:
        print(2)
        
    
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 8980
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int bubble_sort(int n,vector<int> &vec);

int main() {
	int n,count;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	count=bubble_sort(n,a);
	for (int i = 0; i < n; i++) {
		cout << a[i];
		if (i != n - 1) { cout << " "; }
	}
	cout << "\n" << count << endl;


}

int bubble_sort(int n,vector<int> &vec) {
	int count = 0;
	bool flag = true;
	while (flag) {
		flag = false;
		for (int j = 1; j < n; j++) {
			if (vec[j] < vec[j - 1]) {
				swap(vec[j], vec[j - 1]);
				count++;
				flag = true;
			}
		}
	}
	return count;
}


Measured memory_bytes: 3092
#include<stdio.h>
#include<cstdio>
#include<algorithm>

using namespace std;
int main(void)
{
	int n,a[101],i,w,cnt,max1[101],j,max;
	scanf("%d",&n);
	for(i=0;i<n;i++) scanf("%d",&a[i]);
	for(i=1;i<=n;i++) max1[i]=0;
	max=-1; cnt=0; w=0;
	sort(a,a+n);	
	for(i=1;i<=n;i++){
		cnt=0;
		for(j=0;j<n;j++){
			if(i<=a[j]) cnt++;
			if(i<=cnt) max1[i]=i;
		}	
	}
	for(i=1;i<=n;i++){
		if(max<max1[i]) max=max1[i];
	}
	printf("%d\n",max);
	return 0;
}	

Measured memory_bytes: 2724
#include <bits/stdc++.h>
bool f[300];
char str[1000];
char aux[1000];
inline bool check(int n) {
    int i = 0;
    while(i < n && aux[0] == aux[i])
       i++;
    return n == i;
}
int main() {
    FILE * fi, * fout;
    int i,n;
    char ch;
    //fi = fopen("A.in" ,"r");
    //fout = fopen("A.out" ,"w");
    fi=stdin;
    fout=stdout;
    fscanf(fi,"%s" ,&str);
    n=strlen(str);
    for(i = 0; i < n; i++)
       f[str[i]] = 1;
    int ans = n;
    for(ch='a';ch<='z';ch++)
     if(f[ch]){
       memcpy(aux,str,sizeof(str));
       int sz = n;
       while(!check(sz)){
           for(i=0;i<sz;i++)
            if(ch==aux[i+1])
               aux[i]=aux[i+1];
           sz--;
       }
       ans = std::min(ans, n - sz);
     }
     fprintf(fout,"%d\n" ,ans);
    //fclose(fi);
    //fclose(fout);
    return 0;
}


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

using namespace std;

int main(){
    int H,W;
    cin >> H >> W;
    vector<string> a(H);
    for(int i = 0; i < H; i++){
        cin >> a[i];
    }

    vector<bool> row(H, false);
    vector<bool> col(W, false);
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            if(a[i][j] == '#'){
                row[i] = true;
                col[j] = true;
            }
        }
    }

    for(int i = 0; i < H; i++){
        if(row[i]){
            for(int j = 0; j < W; j++){
                if(col[j]){
                    cout << a[i][j];
                }
            }
            cout << endl;
        }
    }

}


Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n,k = map(int, input().split())
    print(n-k+1)

if __name__ == '__main__':
    main()

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


int main() {
  int N;
  cin >> N;
  int A[N];

  for (int i=0; i<N; i++) cin >> A[i];

  for (int i=0; i<N; i++) {
    int v = A[i];

    int j = i-1;
    while (j >= 0 && A[j] > v) {
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;

    for (int i=0; i<N; i++) {
      cout << A[i];
      if (i==N-1) cout << endl;
      else cout << " ";
    }
  }
}


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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

int main ()
{
    string s ;
    string t ;
    string u ;

    int a , b ;

    cin >> s >> t >> a >> b >> u ;

    if (s == u)
    {
        cout << a - 1 << ' ' << b ;

    }
    else if (t == u)
    {
        cout << a << ' ' << b - 1 ;
    }



    return 0 ;
}


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

int d;
int c[26];
int s[365][26];

map<int,int> exist[26];
int sum[26];

int sigma(int x) { return (x+1)*x/2; }

void make_sum(int i) {
    sum[i]=0;
    int last = -1;
    for (auto x:exist[i]) {
        sum[i] += sigma(x.first-last-1);
        last = x.first;
    }
    sum[i] += sigma(d-1-last);
    /*cout << "i=" << (i+1) << ":";
      for (auto x:exist[i]) cout << x << ",";
      cout <<sum[i]<< endl;*/
}


void sol_init(int order[]) {
    rep(i,26) exist[i].clear();
    rep(j,d)  exist[order[j]][j]=1;
    rep(i,26) make_sum(i);
}

int sol_val(int order[]) {
    int ans = 0;
    rep(j,d)  ans += s[j][order[j]];
    rep(i,26) ans -= c[i]*sum[i];
    return ans;
}

int diff(int order[], int j, int x) {
    int i = order[j];
    int ans = - s[j][i] + s[j][x];

    int tmp = sum[i];
    exist[i].erase(j);
    make_sum(i);
    ans -= c[i]*(sum[i]-tmp);
    sum[i]=tmp;
    exist[i][j] = 1;

    tmp = sum[x];
    exist[x][j] = 1;
    make_sum(x);
    ans -= c[x]*(sum[x]-tmp);
    sum[x]=tmp;
    exist[x].erase(j);

    return ans;
}

int diff_1opt(int order[], int j) {
    int max = 0;
    int max_i = order[j];
    rep(i,26) {
        if (i == order[j]) continue;
        int ans = s[j][i];
        int tmp = sum[i];
        exist[i][j] = 1;
        make_sum(i);
        ans -= c[i]*(sum[i]-tmp);
        sum[i]=tmp;
        exist[i].erase(j);

        if (max < ans) {
            max = ans;
            max_i = i;
        }
    }
    return max_i;
}

int main() {
    clock_t start = clock();
    cin >> d;
    rep(i,26) cin >> c[i];
    rep(j,d) {
        rep(i,26) cin >> s[j][i];
    }

    int order[d];
    rep(j,d) {
        int max=s[j][0], max_i = 0;
        rep(i,26) {
            if (max < s[j][i]) {
                max = s[j][i];
                max_i = i;
            }
        }
        order[j] = max_i;
        //cout << (max_i+1) << endl;
    }
    sol_init(order);
    //cout << sol_val(order) << endl;

    int best_val = sol_val(order);
    int best_order[d]; memcpy(best_order, order, sizeof(int)*d);
    int j=0, last_j = 0;
    while (j<d) {
        clock_t now = clock();
        if ((double)(now - start)/CLOCKS_PER_SEC > 1.9) break;
        int opt = diff_1opt(order, (last_j+j)%d);
        int dif = diff(order, (last_j+j)%d, opt);
        if (dif > -100) {
            order[(last_j+j)%d]=opt;
            sol_init(order);
            //cout << last_j+j << "->" << opt+1 << "=" << sol_val(order) << endl;
            last_j = (last_j+j)%d;
            j=0;

            if (best_val < sol_val(order)) {
                best_val = sol_val(order);
                memcpy(best_order, order, sizeof(int)*d);
            }
        }
        j++;
    }
    for (auto x:best_order) cout << (x+1) << endl;
    //cout << best_val << endl;
}


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

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

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

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

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

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

const ll INF = 1LL << 60;

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

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

int main(){
  int n; cin >> n;
  for(int i = 1; i <= 1e5; i++) {
    int num = i * 1.08;
    if(num == n){
      cout << i << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
}

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

int main(){
    int n,m;
    cin >> n >> m;
    if(n==m) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define fst first
#define scd second
int main()
{
	int n, ans = true;
	scanf("%d", &n);
	for(int i = 0, a; i < n; ++i)
	{
		scanf("%d", &a);
		ans &= (a % 2) || ((a % 3 == 0) || (a % 5 == 0));
	}
	printf(ans ? "APPROVED\n" : "DENIED\n");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
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;}
template<class T> inline T gcd(T a, T b) { return a%b ? gcd(b, a%b) : b; }
template<class T> inline T lcm(T a, T b) { return a/gcd(a,b) * b; }

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N; cin >> N;
  ull ans = 1;
  rep(i, N) {
    ull t; cin >> t;
    ans = lcm(ans, t);
  }
  cout << ans << endl;
}

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

using namespace std;
int a,b,c,i,j,k,n;
string s;
int main()
{
    while(scanf("%d%d",&n,&k)==2)
    {
      cin>>s;
      s[k-1]=s[k-1]+32;
      cout<<s;
    }
    return 0;
}


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

int main()
{
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	swap(a[0], a[1]);
	swap(a[0], a[2]);
	printf("%d %d %d\n", a[0], a[1], a[2]);
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int search(int a);

int a1[100000],n;

int search(int a){
  int left=0;
  int right=n;
  int mid;


  while(left<right){
    mid=(left+right)/2;
    if(a==a1[mid]){return 1;}

    
    if(a>=a1[mid]){left=mid+1;}
    else {right=mid;}

  }
  return 0;
}



int main(){
  scanf("%d",&n);



  int i;
  
  for(i=0;i<n;i++){
    scanf("%d",&a1[i]);
  }


  
  int a2_num;
  scanf("%d",&a2_num);



  int a2;
  int count=0;
  
  for(i=0;i<a2_num;i++){
    scanf("%d",&a2);
    if(search(a2)==1){count=count+1;}
  }




  
  printf("%d\n",count);


  
  return 0;

}



Measured memory_bytes: 2108
n = int(input())

cnt = [[0] * 10 for _ in range(10)]
for x in range(1, n + 1):
    x = str(x)
    i, j = int(x[0]), int(x[-1])
    cnt[i][j] += 1

ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += cnt[i][j] * cnt[j][i]
print(ans)

Measured memory_bytes: 40428
#include <iostream>
#include <vector>

using namespace std;

const int mod = 1000000007;

int main()
{
    int N, M;
    cin >> N >> M;
    vector<long long> broken(M);
    vector<long long> fib(3);
    bool flag = true;
    for (int i = 0; i < M; i++)
    {
        cin >> broken[i];
        if (i > 0 && broken[i] == broken[i - 1] + 1)
        {
            flag = false;
        }
    }

    fib[0] = 1;
    fib[1] = 1;
    fib[2] = 0;
    int c = 0;
    if (flag)
    {
        for (int i = 0; i < N - 1; i++)
        {
            if (c < M && i + 1 == broken[c])
            {
                fib[2] = fib[1] = fib[0];
                i++;
                c++;
                continue;
            }
            fib[2] = fib[1] + fib[0];
            fib[0] = fib[1];
            fib[1] = fib[2] % mod;
        }
    }

    if (N == 1)
        cout << 1 << endl;
    else
    {
        cout << fib[2] % mod << endl;
    }
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
int a,b;
  cin>>a>>b;
  int ar[a];
  for(int i=0;i<a;i++){
      cin>>ar[i];
     
  }int t=b,c=0;
  sort(ar,ar+a);
  for(int i=0;i<a;i++){
    t=t-ar[i];
     if(t>=0)
         ar[i]=0,c++;
    else
       break;
  }
 if(t>0)
   cout<<c-1;
  else
  cout<<c;


}

Measured memory_bytes: 256
//doaremon,squirtle is love
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define testcase ll t;cin>>t;while(t--)
#define in(x) ll x;cin>>x;
#define output(x) cout<<x<<endl;//to print (-1)
#define inputarray() ll n;cin>>n;ll arr[n];rep(0,n)cin>>arr[i];
#define deb(a) cout<<" :: "<<#a<<" = "<<a<<endl
#define deb2(a,b) cout<<" :: "<<#a<<" = "<<a<<" :: "<<#b<<" = "<<b<<endl
#define setbit(x)  __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define pii pair<int, int>
#define pll pair<long long int,long long int>
#define ub upper_bound // '>'
#define lb lower_bound // '>='
//erase,count,find,make_unique
#define len(arr) (sizeof(arr)/sizeof(arr[0]))
#define sz(x) ((long long)x.size())
#define make_unique(arr) arr.erase(unique(arr.begin(),arr.end()),arr.end()) //Makes a sorted array unique
#define rep(a,b) for(int i=a;i<b;i++)
#define updiv(a,b) (ceil)((a)*(1.0)/(b))
#define printarray(arr) cout<<"PRINT ARRAY"<<endl; rep(0,len(arr)) cout<<arr[i]<<" "; cout<<endl;
#define printvector(vect) cout<<"PRINT VECTOR"<<endl; for(auto x:vect) cout<<x<<" "; cout<<endl;
#define rev(x) reverse(all(x))
#define insideloop(x) cout<<x<<" "; cout<<endl;
//LLONG_MAX, ULLONG_MAX INT_MAX
typedef long long int ll;
typedef unsigned long long int ull;
#define M 1000000007
using namespace std;
int main()
{
//  testcase
//  {
        ll k,n;
    cin>>k>>n;ll arr[n];
    rep(0,n)
    {
        cin>>arr[i];
    }   vector<ll> vect;ll diff;
    for(ll i=0;i<n;i++)
    {
        if(i==0)
            diff=(arr[n-1]-arr[0]);
        else
            diff=(k+arr[i-1])-arr[i];
        vect.push_back(diff);
    } cout<<*min_element(all(vect))<<endl;
  //}
return 0;
}








Measured memory_bytes: 3956
plst = [1 for i in range(1000001)]
slst = [0,0]
plst[0] = plst[1] = 0
count = 0
for i in range(2,1000001):
  if plst[i] == 1:
    count += 1
    for j in range(i * 2,1000001,i):
      plst[j] = 0
  slst.append(count)
while True:
  try:
    print(slst[int(input())])
  except EOFError:
    break



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

int main(void) {
  int n;
  cin >> n;
  if (n==1 or n==2 or n==3 or n==5 or n==6 or n==9 or n==10 or n==13 or n==17) {
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
    int n, t; cin >> n >> t;
    int ans = 1<<30;
    while (n--) {
        int c, d; cin >> c >> d;
        if (d <= t) ans = min(c, ans);
    }
    if (ans == 1<<30) cout << "TLE\n";
    else cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
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(a>b){a=b;return 1;}return 0;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	debug("debug test\n");
   	int n,m;int a,b,c,d;cin>>a>>b>>c>>d;
	if(a+b>c+d){
		cout << "Left" << endl;
	}else if(a+b<c+d){

		cout << "Right" << endl;
	}else{

		cout << "Balanced" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

template <typename _Tp>
struct LazySegmentTree {
  _Tp n;
  vector<_Tp> node, lazy;

  LazySegmentTree(vector<_Tp> const& v) {
    _Tp sz = v.size();
    n = 1;
    while (sz > n) n *= 2;
    node.resize(2*n-1);
    lazy.resize(2*n-1, 0);

    for (int i = 0; i < sz; ++i) {
      node[i+n-1] = v[i];
    }

    for (int i = n-2; i >= 0; --i) {
      node[i] = node[i*2+1] + node[i*2+2];
    }
  }

  void eval(int k, int l, int r) {
    if (lazy[k] != 0) {
      node[k] += lazy[k]; // 自分自身に遅延評価を反映

      // 最下段でないならば評価を伝搬させる。
      if (r - l > 1) {
        lazy[2*k+1] += lazy[k] / 2;
        lazy[2*k+2] += lazy[k] / 2;
      }

      lazy[k] = 0;
    }
  }

  void add(int a, int b, _Tp value, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;
    eval(k,l,r);

    if (b <= l || r <= a) return;

    if (a <= l && r <= b) {
      lazy[k] += (r-l) * value;
      eval(k,l,r);
    } else {
      // 完全被覆していないときは子要素を評価。評価後、自分自身を更新する。
      add(a,b,value,2*k+1,l,(l+r)/2);
      add(a,b,value,2*k+2,(l+r)/2,r);
      node[k] = node[2*k+1] + node[2*k+2];
    }
  }

  int sum(int a, int b, int k = 0, int l = 0, int r = -1) {
    if (r < 0) r = n;
    if (b <= l || r <= a) return 0;

    eval(k,l,r);
    if (a <= l && r <= b) return node[k];
    _Tp res = 0;
    res += sum(a,b,2*k+1,l,(l+r)/2);
    res += sum(a,b,2*k+2,(l+r)/2,r);
    return res;
  }

  /* 遅延評価が必要
  int at(int i) {
    return node[i+n-1];
  }*/
};

int main() {
  int n, q;
  cin >> n >> q;
  vector<ll> v(n);
  LazySegmentTree<ll> seg_tree(v);
  rep(i, q) {
    int com; cin >> com;
    if (com == 0) {
      int s,t,n;
      cin >> s >> t >> n;
      seg_tree.add(--s,t,n);
    } else {
      int pos;
      cin >> pos;
      cout << seg_tree.sum(pos-1, pos) << endl;
    }
  }
}


Measured memory_bytes: 7888
#include<bits/stdc++.h>
#define inf 1000000000
#define eb emplace_back
#define pb push_back
#define fi first
#define se second
#define fastread ios::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
typedef map<int,int> mii;
int a[100000],b[100000];
int main()
{
    fastread;
    int i,j,k;
    int na,nb,m;
    int ma=inf,mb=inf;
    cin>>na>>nb>>m;
    for(i=0;i<na;i++){
        cin>>a[i];
        ma=min(a[i],ma);
    }
    for(i=0;i<nb;i++){
        cin>>b[i];
        mb=min(b[i],mb);
    }
    int res=ma+mb;
    for(i=0;i<m;i++){
        int x,y,c;
        cin>>x>>y>>c;
        res=min(res,a[x-1]+b[y-1]-c);
    }
    cout<<res;
}


Measured memory_bytes: 1024
def main():
    S = list(map(int, input()))
    K = int(input())

    for i in S:
        if i == 1:
            K -= 1
            if K == 0:
                print(1)
                exit()
            continue
        j = 1
        while i < 5 * 10 ** 15:
            if i ** j >= K:
                print(i)
                exit()
            j += 1
        K -= i ** j


main()


Measured memory_bytes: 3060
import java.util.*;

public class Main {
	Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}
	public Main() {
		new AOJ0217();
	}
	
	class AOJ0217{
		public AOJ0217() {
			while(true){
				int n = in.nextInt();
				if(n==0)break;
				Data data[] = new Data[n];
				for(int i=0;i<n;i++)data[i] = new Data(in.nextInt(), in.nextInt(), in.nextInt());
				Arrays.sort(data);
				System.out.println(data[n-1].ban+" "+data[n-1].sum);
 			}
		}
		class Data implements Comparable<Data>{
			int ban,sum;
			public Data(int ban,int d1,int d2) {
				this.ban = ban;this.sum = d1+d2;
			}
			public int compareTo(Data o) {
				if(this.sum>o.sum)return 1;
				else return -1;
			}
		}
	}
	
}

Measured memory_bytes: 164896
n, m = map(int, input().split())
ks = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))

s = []
ans = 0
for i in range(m):
  k = ks[i][0]
  l = [ks[i][j] for j in range(1, k+1)]
  s.append(l)

swh = [False for _ in range(n)]
for i in range(2 ** n):
  #print('######')
  flag = True
  # スイッチの状態
  for j in range(n):
    if ((i >> j) & 1): swh[j] = True
    else: swh[j] = False
      
  # 現在の状態での各電球の点灯をチェック    
  for j in range(m):
      #print('電球{}'.format(j))
      judge = [swh[si-1] for si in s[j]]
      #print(judge)
      if judge.count(True) % 2 != p[j]:
        flag = False
        break
        
  if flag: ans += 1
  #print('ans = {}'.format(ans))
      
print(ans)    

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
#define ff first
#define endl "\n"
#define ss second
#define all(v) v.begin(), v.end()
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    //  cout << x << " ";
    while (y > 0)
    {

        if (y & 1)
            res = (res * x) % p;

        y = y >> 1;
        x = (x * x) % p;
    }
    return res % p;
}
int lcm(int a, int b)
{
    return (a * b) / __gcd(a, b);
}
int fac[100001];
int inv[100001];
int comb(int a, int b)
{
    if (a < b)
        return 0;
    return ((fac[a] * inv[b]) % mod * inv[a - b] % mod);
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc;
    tc = 1;
    while (tc--)
    {
        int a, b;
        cin >> a >> b;
        int ar[b];
        int sum = 0;
        for (int i = 0; i < b; i++)
        {
            cin >> ar[i];
            sum=sum+ar[i];
        }
        if (sum >= a)
        {
            cout << "Yes" << endl ;
        }
        else
        {
            cout << "No" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1024
//Author: A_S_M_M@sud_P@rvez
#include<bits/stdc++.h>
using namespace std;
#define    MP ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define    For(i,n) for(int i=0;i<n;i++)
#define    rFor(i,n) for(int i=n-1;i>=0;i--)
#define    forn(i,n) for(int i=1;i<=n;i++)
#define    fors(i,s) for(int i=0;i<s.size();i++)
#define    all(v) v.begin(),v.end()
#define    gcd(a, b) __gcd(a , b)
#define    lcm(a,b) (a*(b/__gcd(a,b)))
#define    test   int t;cin>>t;for(int l=0;l<t;l++)
#define    min3(a,b,c)     min(a,min(b,c))
#define    max3(a,b,c)     max(a,max(b,c))
#define    min4(a,b,c,d)   min(min(a,b),min(c,d))
#define    max4(a,b,c,d)   max(max(a,b),max(c,d))
#define    Max(a)  *max_element(a,a+sizeof(a)/sizeof(a[0]))
#define    Min(a)  *min_element(a,a+sizeof(a)/sizeof(a[0]))
#define    nl     "\n"
#define    End    return 0 
#define    gt     greater<int>()
#define    ll     long long 
#define    mp     make_pair
#define    pb     push_back
#define    vi     vector<int>
#define    vl     vector<ll>
#define    mod    1000000007
#define    sp(n)  fixed<<setprecision(n)
#define    pi     acos(-1)

int main()
{
MP;
    //test
    {
        ll a,b,c,x,y,z;
        cin>>a>>b>>c;
        a=abs(a);
        if(a>=c)
        {
            a=a-c; b--;
            x=a/c;
            if(a%c!=0)x++;
            if(x<=b)
            {
                a=a-(x*c);b-=x;
                if(b%2==1)a+=c;
                cout<<abs(a);
            }
            else if(x>b)
            {
                a=a-(b*c);
                cout<<a;
            }
        }
        else 
        {
            if(b%2==0)cout<<a;
            else cout<<c-a;
        }
    }
    
End;
}


Measured memory_bytes: 3612
#include<iostream>
#include<iomanip>

using namespace std;

int main() {
	
	double n[10] = {};
	
	while(cin >> n[0]) {
	
	double sum = n[0];
	
	for(int i=1;i<10;i++) {
		
		if(i % 2)
			n[i] = n[i-1] * 2;
		
		else
			n[i] = n[i-1] / 3;
			
		sum += n[i];
		
	}
	
	cout << fixed << setprecision (8)<< sum << "\n";
	
}
	
	return 0;
}



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

int main() {
  int n, h;
  cin >> n;
  
  int mxh = 0, ans = 0;
  
  for(int i=0; i<n; i++){
    cin >> h;
    if(mxh <= h){
      mxh = h;
      ans++;
    }
  }
  cout << ans <<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
	int w,n,a,b;
	char o;
	cin>>w>>n;
	vector<int>c;
	for(int i=0;i<=w+1;i++)c.push_back(i);
	for(int i=1;i<=n;i++){
	cin>>a>>o>>b;
	swap(c[a],c[b]);
	}
	for(int i=1;i<=w;i++) cout<<c[i]<<endl;
}

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

using namespace std;

int main()
{
  int N;
  cin >> N;
  vector<int> a(N * 3);
  for (int i = 0; i < N * 3; i++)
    cin >> a[i];
  sort(a.begin(), a.end(), greater<int>());
  long long ans = 0;
  for (int i = 0; i < N; i++)
    ans += a[i * 2 + 1];
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1408
#include<stdio.h>

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

Measured memory_bytes: 128
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
function main()
    n=parseInt(readline())
    a=[parseInt(readline()) for i in 1:n]
    l=[0 for i in 1:n+1]
    r=[0 for i in 1:n+1]
    for i in 1:n
        l[i+1]=max(l[i],a[i])
        r[i+1]=max(r[i],a[n-i+1])
    end
    for i in 1:n
        println(max(l[i],r[n-i+1]))
    end
end
main()

Measured memory_bytes: 155908
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <math.h>
#include <list>
#include <stack>
#include <queue>
#include <utility>

using namespace std;

#define ll long long
#define MOD 1000000007
#define rep(i, n) for(int i = 0;i < n;i++)
template <typename T>
T gcd(T x, T y)
{
    T xy = x*y;
    if(x<y)swap(x,y);
    T r;
    r = x%y;
    while(r!=0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
};

int main()
{
    ll a,b;
    cin >> a >> b;

    ll g;

    g = gcd(a,b);
    //cout << g << endl;
    ll g_dash;
    g_dash = g;

    ll counter = 1;
    ll index;
    index = ceil(sqrt(g));
    //cout << index << endl;
    int flag;
    for (int i = 2; i < index+1; i++)
    {
        flag = 0;
        while (g%i==0)
        {
            if (flag == 0)
            {
                counter++;
                flag = 1;
                g/=i;
            }else
            {
               g/=i;
            }
        }
        
    }
    //cout << counter << endl;
    if (g_dash == 1)
    {
        cout << 1 << endl;
    }else if(counter==1)
    {
        cout << 2 << endl;
    }else
    {
        if (g==1)
        {
            cout << counter << endl;
        }else
        {
            cout << counter+1 << endl;
        }
        
        
    }

}

Measured memory_bytes: 256