akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<(x)<<endl
#define fi first
#define se second

#define INF 2147483600

pair<long, long> solve(string str){
  long ret=0;
  long now=0;
  int cnt=0;
  rep(i,str.size()-1){
    now = now*10+str[i]-'0';
    auto p = solve(str.substr(i+1));
    ret += now*p.fi + p.se;
    cnt += p.fi;
  }
  now = now*10 + str[str.size()-1] - '0';
  ret += now;
  cnt++;
  return mp(cnt, ret);
}

int main(){
  string str;
  cin>>str;

  pair<int, long> p = solve(str);
  cout << p.se << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using  namespace std;
int main()
{
    int n,ans=0;
    cin>>n;
    for(int i=1;i<n;i++)
    {
        int t=n/i;
        if(n%i==0 ) t--;
        ans+=t;
    }
    cout<<ans<<endl;
    return 0;
}


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

#define int long long
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(), a.end()

const int mod = 1e9+7;
const int inf = 2e18;
vector<int> v[100005];
map<pair<int,int>,int> mp;

int32_t main()
{	
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int n,m;
	cin>>n>>m;

	int h[n+4];
	for (int i = 1; i<=n; ++i)
	{
		cin>>h[i];
	}


	while(m--)
	{
		int x,y;
		cin>>x>>y;
		if(x>y)
			swap(x,y);
		if(mp[{x,y}]>0)
			continue;
		v[x].pb(y);
		v[y].pb(x);
		mp[{x,y}]++;
	}	
	int cnt = 0;

	for(int i=1;i<=n;i++)
	{
		bool flag = true;
		for(int node:v[i])
		{
			if(h[i]<=h[node])
			{
				flag=false;
				break;
			}
		}
		if(flag)cnt++;
	}	

	cout<<cnt<<'\n';
	return 0;	
}	

Measured memory_bytes: 16536
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> p(N);
  for(int i=0;i<N;i++){
    cin >> p[i] ;
  }
  int count =0;
  string ans;
  for(int i=0;i<N;i++){
    if(p[i]!=i+1){
    count++;
    }
  }
  if(count ==2 || count ==0){
    ans = "YES";
  }
  else{
    ans="NO";
  }
  cout << ans << endl;
}
        

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
#define pvec(vec) {for (auto v: vec) cout << v << ' '; cout << endl;}
#define pivec(vec) {rep(i, 0, vec.size()) cout << i << ':' << vec[i] << ' '; cout << endl;}

using namespace std;
using ll = long long;

int main()
{
    ll A, B;
    cin >> A >> B;
    cout << A * B << endl;
    return 0;
}


Measured memory_bytes: 3636
def find(A):
    if A%2==1:
        num=(1+(A-1)//2)%2
        return num
    ans=A
    A-=1
    num=(1+(A-1)//2)%2
    num=ans^num
    
    return num
A,B=list(map(int,input().strip().split(' ')))
if A==0:
    print(find(B))
else:
    print(find(A-1)^find(B))

Measured memory_bytes: 38384
with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Float_Text_IO;
 use Ada.Text_IO, Ada.Integer_Text_IO, Ada.Float_Text_IO;

procedure main is
   A: Integer;
   B: Integer;
   C: Integer;
begin
   get(A);
   get(B);
   get(C);
   if (A + B + C >= 22) then put_line("bust");
   else put_line("win");
   end if;
end main;

Measured memory_bytes: 3660
#include <iostream>

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

	bool ans = false;
	for (int i = 0; 4 * i <= N; ++i)
		if ((N - 4 * i) % 7 == 0) {
			ans = true;
			break;
		}

	if (ans)
		std::cout << "Yes\n";
	else
		std::cout << "No\n";

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <set>
#include <vector>
#include <algorithm>

using namespace std;

int main(int argc, char* argv[]) {
  int A, B, K;
  cin >> A >> B >> K;

  K = min(K, B - A + 1);

  set<int> rets;
  for (int i = A; i < A + K; ++i) {
    rets.insert(i);
  }
  for (int i = B; i > B - K; --i) {
    rets.insert(i);
  }

  for (set<int>::iterator i = rets.begin(); i != rets.end(); ++i) {
    cout << *i << endl;
  }

  return 0;
}

Measured memory_bytes: 256
N = int(input())

S = []
for i in range(N):
    s = input()
    s = list(s)
    s = sorted(s)
    S.append(s)

S = sorted(S)
count = 1
ans = 0
for i in range(N-1):
    if S[i] == S[i+1]:
        count += 1
    else:
        ans += (count * (count-1)) // 2
        count = 1
ans += (count * (count-1)) // 2
        
print(ans)

Measured memory_bytes: 31640
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> static void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if (x < y) x = y; }


template<int MOD>
struct ModInt {
	static const int Mod = MOD;
	unsigned x;
	ModInt() : x(0) { }
	ModInt(signed sig) { int sigt = sig % MOD; if (sigt < 0) sigt += MOD; x = sigt; }
	ModInt(signed long long sig) { int sigt = sig % MOD; if (sigt < 0) sigt += MOD; x = sigt; }
	int get() const { return (int)x; }

	ModInt &operator+=(ModInt that) { if ((x += that.x) >= MOD) x -= MOD; return *this; }
	ModInt &operator-=(ModInt that) { if ((x += MOD - that.x) >= MOD) x -= MOD; return *this; }
	ModInt &operator*=(ModInt that) { x = (unsigned long long)x * that.x % MOD; return *this; }

	ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
	ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
	ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
};
typedef ModInt<998244353> mint;

using BitSet = unsigned __int128;
BitSet complS;
map<BitSet, mint> memo[101];
mint rec(int len, BitSet indices) {
	if (len == 0) return 1;
	auto p = memo[len].emplace(make_pair(indices, mint()));
	if (!p.second) return p.first->second;
	mint r;
	rer(L, 2, len) {
		rer(k, 2, L) if (L % k == 0) {
			int d = L / k;
			BitSet v = indices;
			rep(p, k - 1) v |= indices << ((p + 1) * d);
			r += rec(d, v) * rec(len - L, indices << L);
		}
	}
	mint mulL = !(indices & complS) ? 2 : 1;
	r += rec(len - 1, indices << 1) * mulL;
	return p.first->second = r;
}

int main() {
	string str;
	while (cin >> str) {
		int N = (int)str.size();
		complS = BitSet();
		rep(i, N) if(str[i] == '0')
			complS |= BitSet(1) << i;
		rep(i, N + 1) memo[i].clear();
		BitSet init = 1;
		mint ans = rec(N, init);
		printf("%d\n", ans.get());
	}
	return 0;
}


Measured memory_bytes: 161920
import java.util.*


fun main() {
  val (N, M) = readInts()
  val EN = Array(N) { hashSetOf<Int>() }
  repeat(M) {
    val (A, B) = readInts().map { it - 1 }
    EN[A].add(B)
    EN[B].add(A)
  }

  val memo = Array(N) { -1 }

  fun f(i: Int, n: Int): Int {
    var cnt = 0
    val stack = LinkedList<Int>()
    stack.add(i)
    while (stack.isNotEmpty()) {
      val p = stack.removeLast()
      if (memo[p] != -1) continue
      memo[p] = n
      cnt++
      EN[p].forEach {
        if (memo[it] == -1) stack.add(it)
      }
    }
    return cnt
  }

  println((0 until N).map { f(it, it) }.max())
}

fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readLong() = readString().toLong()
fun readInts() = readStrings().map { it.toInt() }
fun readLongs() = readStrings().map { it.toLong() }


Measured memory_bytes: 132596
#include <iostream>
//#include <iomanip>
#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <bitset>
//#include <math.h>
using namespace std ;
//using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

string yorn(bool a){if(a) return"Yes" ; return "No" ;}
//string YorN(bool a){if(a) return"YES" ; return "NO" ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	int n,k ;
	string s ;
	cin >> n >> s >> k ;
	for(int i=0;i<n;i++) if(s.at(i)!=s.at(k-1)) s.at(i) = '*' ;
	cout << s << endl ;
}

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

int cnt = 0;

void selectionSort(int a[], int N) {
	for (int i = 0; i < N; i++) {
		int minj = i;
		for (int j = i; j < N; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		if (a[i] != a[minj]) {
			swap(a[i], a[minj]);
			cnt++;
		}
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int N; cin >> N;
	int a[110];
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	selectionSort(a, N);
	for (int i = 0; i < N - 1; i++) {
		cout << a[i] << " ";
	}
	cout << a[N - 1] << endl;
	cout << cnt << endl;
}


Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using uint = unsigned int;
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define all(c) c.begin(),c.end()
#define si(x) int(x.size())
#define pb emplace_back
#define fs first
#define sc second
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
template<class T,class U> void chmax(T& x, U y){if(x<y) x=y;}
template<class T,class U> void chmin(T& x, U y){if(y<x) x=y;}
template<class T> void mkuni(V<T>& v){sort(all(v));v.erase(unique(all(v)),v.end());}
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
void dmpr(ostream& os){os<<endl;}
template<class T,class... Args>
void dmpr(ostream&os,const T&t,const Args&... args){
	os<<t<<" ~ ";
	dmpr(os,args...);
}
#define shows(...) cerr << "LINE" << __LINE__ << " : ";dmpr(cerr,##__VA_ARGS__)
#define dump(x) cerr << "LINE" << __LINE__ << " : " << #x << " = {";  \
	for(auto v: x) cerr << v << ","; cerr << "}" << endl;
#else
#define show(x) void(0)
#define dump(x) void(0)
#define shows(...) void(0)
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);

	int N; cin >> N;
	V<int> p(N),w(N);
	rep(i,N) cin >> p[i] >> w[i];
	int Q; cin >> Q;
	using P = pair<int,int>;
	VV<P> v2Wq(N);
	rep(q,Q){
		int v,W; cin >> v >> W; v--;
		v2Wq[v].pb(W,q);
	}
	V<int> dep(N); dep[0] = 1;
	V<int> root(N);
	VV<P> wps(N);
	rep1(i,N-1) dep[i] = dep[(i-1)/2] + 1;
	V<int> ans(Q);
	rep(i,N){
		if(dep[i] <= 12){
			root[i] = i;
			V<int> vs;
			{
				int v = i;
				rep(k,dep[i]){
					vs.pb(v); v = (v-1)/2;
				}
			}
			V<P> ps;
			rep(s,1<<dep[i]){
				int pp=0,ww=0;
				rep(j,dep[i]) if(s&1<<j) ww += w[vs[j]], pp += p[vs[j]];
				ps.pb(P(ww,pp));
			}
			sort(all(ps),[&](P l,P r){return P(l.fs,-l.sc) < P(r.fs,-r.sc);});
			{
				int mx = -1;
				for(P p: ps){
					if(p.sc > mx){
						mx = p.sc;
						wps[i].pb(p);
					}
				}
			}
			for(const auto [W,q]: v2Wq[i]){
				int idx = lower_bound(all(wps[i]),P(W+1,-1)) - wps[i].begin() - 1;
				ans[q] = wps[i][idx].sc;
			}
		}else{
			root[i] = root[(i-1)/2];
			V<int> vs;
			{
				int v = i;
				while(v != root[i]){
					vs.pb(v); v = (v-1)/2;
				}
			}
			rep(s,1<<si(vs)){
				int pp=0,ww=0;
				rep(j,dep[i]) if(s&1<<j) ww += w[vs[j]], pp += p[vs[j]];
				for(const auto [W,q]: v2Wq[i]){
					int idx = lower_bound(all(wps[root[i]]),P(W-ww+1,-1)) - wps[root[i]].begin() - 1;
					if(idx == -1) continue;
					chmax(ans[q],pp + wps[root[i]][idx].sc);
				}
			}
		}
	}
	rep(i,Q) cout << ans[i] << '\n';
}


Measured memory_bytes: 104160
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

const int N=2e5+5;
ll ans;
int n,cnt,a[N],b[N],sum[2],tot[N];
struct Node {int pos,val,type;} tmp[N<<1];
bool cmp(Node a,Node b) {return a.val<b.val;}

template <typename _Tp> inline void IN(_Tp&x) {
	char ch;bool flag=0;x=0;
	while(ch=getchar(),!isdigit(ch)) if(ch=='-') flag=1;
	while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	if(flag) x=-x;
}

int main() {
	IN(n);
	for(int i=1;i<=n;++i)
		IN(a[i]),tmp[++cnt]=(Node){i,a[i],0},
		IN(b[i]),tmp[++cnt]=(Node){i,b[i],1};
	sort(tmp+1,tmp+1+cnt,cmp);
	bool flag=false;
	for(int i=1;i<=n;++i)
		sum[tmp[i].type]++,ans+=tmp[i].val,
		flag|=(bool)(++tot[tmp[i].pos]==2);
	if(flag||max(sum[0],sum[1])==n)
		return printf("%lld\n",ans),0;
	sum[tmp[n].type]--,sum[tmp[n+1].type]++,ans+=tmp[n+1].val-tmp[n].val;
	if(tmp[n].pos!=tmp[n+1].pos||max(sum[0],sum[1])==n)
		return printf("%lld\n",ans),0;
	printf("%lld\n",ans+min(tmp[n+2].val-tmp[n+1].val,tmp[n].val-tmp[n-1].val));
	return 0;
}

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

int main() 
{ 
    string day;
    getline(cin, day);
    if(day=="SUN"){
        cout<<7;}
    if(day=="MON"){
        cout<<6;}
    if(day=="TUE"){
        cout<<5;}
    if(day=="WED"){
        cout<<4;}
    if(day=="THU"){
        cout<<3;}
    if(day=="FRI"){
        cout<<2;}
    if(day=="SAT"){
        cout<<1;}
    
    return 0; 
} 

Measured memory_bytes: 256
N = int(input())
A = [int(i) for i in input().split()]

half_len = sum(A) / 2.0
now_len = 0
most_near_len = sum(A)+1
for i in A:
    now_len += i
    if abs(half_len - now_len) <= abs(half_len - most_near_len):
        most_near_len = now_len

cnt = abs(most_near_len - half_len) / 0.5
print(int(cnt))
    

Measured memory_bytes: 88016
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <list>

using namespace std;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

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

const int V = 50;
vector<int> E[V];
bool used[V];

void func(int id){
	if(used[id]){
		return;
	}
	used[id] = true;
	for(int i = 0; i < E[id].size(); i++){
		func(E[id][i]);
	}
}

int main(){
	
	while(true){
		int N;
		cin >> N;
		if(N == 0){
			break;
		}
		for(int i = 0; i < V; i++){
			E[i].clear();
		}
		int cnt[V] = {};
		bool app[V] = {};
		for(int i = 0; i < N; i++){
			string str;
			cin >> str;
			int id1 = str[0] - 'a', id2 = str[str.size() - 1] - 'a';
			cnt[id1]++;
			cnt[id2]--;
			app[id1] = true;
			app[id2] = true;
			E[id1].push_back(id2);
		}
		bool flag = false;
		for(int i = 0; i < V; i++){
			if(cnt[i] != 0){
				flag = true;
			}
		}
		if(flag){
			cout << "NG" << endl;
			continue;
		}
		int num = 0;
		for(int i = 0; i < V; i++){
			used[i] = false;
		}
		for(int i = 0; i < V; i++){
			if(app[i] && !used[i]){
				num++;
				func(i);
			}
		}
		if(num > 1){
			cout << "NG" << endl;
		}else{
			cout << "OK" << endl;
		}
	}
	
	return 0;
}



Measured memory_bytes: 3216
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ub              upper_bound
#define lb              lower_bound
#define isrt            insert
#define clr             clear
#define rsz             resize
#define ff              first
#define ss              second
#define lli             long long int
#define pb              push_back
#define pf              push_front
#define mkp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<lli,lli>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define INF             1e9
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(v)          v.begin(),v.end()
#define endl            "\n"


typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

lli maxm(lli a, lli b)
{
  return (a >= b ? a : b);
}


lli minm(lli a, lli b)
{
  return (a <= b ? a : b);
}

lli power(lli x, lli y, lli p)
{
  lli res = 1;

  x = x % p;
  if (x == 0)
    return 0;

  while (y > 0)
  {

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


    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}

lli nCrmodp(lli n, lli r, lli p)
{
  if (r == 0)
    return 1;
  if (r == 1)
    return n;


  lli pro = 1, k = n;
  while (k > r)
  {
    pro *= k;
    pro %= p;
    --k;
  }

  k = 2;
  while (k <= (n - r))
  {
    pro *= power(k, (p - 2), p);
    pro %= p;
    ++k;
  }

  return pro;
}


string num_str(lli n, lli k)
{
  string str = "";
  lli x = n;
  while (x != 0)
  {
    string s = to_string(x % k);
    str = s + str;
    x /= k;
  }

  return str;
}

void c_p_c()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

#define MAXN 100010
vector<int> adj[MAXN];
int dp[MAXN];

int dfs(int s)
{
  if (dp[s] == -1)
  {
    if (adj[s].size() == 0)
      dp[s] = 0;
    else
    {
      int max_len = 1;
      for (auto it : adj[s])
        max_len = max(max_len, 1 + dfs(it));

      dp[s] = max_len;
    }
  }

  return dp[s];
}

int main()
{
  c_p_c();

  int n, m, u, v;

  cin >> n >> m;
  memset(dp, -1, sizeof(dp));

  for (int j = 0; j < m; ++j)
  {
    cin >> u >> v;
    adj[u].pb(v);
  }

  int max_len = 0;

  for (int j = 1; j <= n; ++j)
    max_len = max(max_len, dfs(j));

  cout << max_len << endl;

  return 0;
}

Measured memory_bytes: 11464
isValid n = n > 0 && n <= 12

main = do
  (a,b) <- splitAt 2 <$> getLine
  let p = isValid $ read a
  let q = isValid $ read b
  putStrLn $ case (p,q) of
    (True,True) -> "AMBIGUOUS"
    (True,False) -> "MMYY"
    (False,True) -> "YYMM"
    otherwise -> "NA"


Measured memory_bytes: 508
#include<bits/stdc++.h>
 
using namespace std;
 
int main()
{
	string s;
	cin >> s;
	int j = 0, k = 0;
	int n = s.size();
	for(int i = 0; i < n; i++)
	{
		if(s[i] == 'S')
		{
			j++;
		}
		if(s[i] == 'T' && j > 0)
		{
			j--;
			k++;
		}
	}
	cout << n - (2 * k);
}


Measured memory_bytes: 640
n = int(input())
l = [[int(i) for i in input().split()] for _ in range(n)]
l2 = []
for i in l:
    l2.append([i[0] - i[1],i[0] + i[1]])
    
l2 = sorted(l2,key = lambda x : x[1])

prev = []
ans = 0
for i in range(n):
    if not prev:
        ans += 1
        prev = l2[i]
    elif l2[i][0] >= prev[1]:
        ans += 1
        prev = l2[i]
    else:
        pass

print(ans)

Measured memory_bytes: 40232
#include <algorithm>
#include <array>
#include <climits> // INT_MAX, LONG_MAX, LLONG_MAX, UINT_MAX, ULONG_MAX, ULLONG_MAX
#include <cmath>
#include <cstdint>
#include <cstring> // memset
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

#define ALL(x) (x).begin(), (x).end()
#define INF 1e9
#define LOG(x) cout << #x << " = " << (x) << endl
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)

using namespace std;

int main() {
    int n;
    cin >> n;
    map<int, int> a;
    REP(i, n) {
        int ai;
        cin >> ai;
        a[ai] += 1;
    }

    int count = 0;
    
    for (auto i: a) {
        if (i.second > i.first) {
            count += i.second - i.first;
        } else if (i.second < i.first) {
            count += i.second;
        }
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#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() {
 ll n,k ;
 cin>>n>>k ;

  cout <<n-k+1<<endl ; 
    return 0;

}


Measured memory_bytes: 256
/* I have already deleted My old account because somebody stole my code
and i have no idea how. If you are copying this code atleast make it look different 
Yours Faithfully
Shobhit Yadav */

#include<bits/stdc++.h>
using namespace std;
#define ll long long 

ll N;
/*ll freq[200005];*/
void solve(){
	 /*memset(freq,0,sizeof(freq));*/
  string S;
  cin>>S;

  if(S[2] == S[3] && S[4] == S[5])
    cout<<"Yes"<<'\n';

  else
    cout<<"No"<<'\n';


}



int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
   solve();

	return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>
using namespace std;

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

Measured memory_bytes: 256
N = int(input())
ds = list(map(int, input().split()))
ds_srtd = sorted(ds)
dvdr = int(N / 2)
if ds_srtd[dvdr - 1] == ds_srtd[dvdr]:
    print(0)
else:
    print(ds_srtd[dvdr] - ds_srtd[dvdr - 1])


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

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

int MOD=1e9+7;
ll INF=1e18;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};

int main(){
    int n, m; cin>>n>>m;
    cout << n+m/2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define LINF 3e18+7
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

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; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const double PI = acos(-1.0);
const double EPS = 1e-10;

struct RollingHash {
    typedef long long int_type;
    typedef pair<int_type,int_type> hash_type;
 
    int_type base1;
    int_type base2;
    int_type mod1;
    int_type mod2;
    vector<int_type> hash1;
    vector<int_type> hash2;
    vector<int_type> pow1;
    vector<int_type> pow2;
 
    void init(const string &s) {
        int n = s.size();
 
        hash1.assign(n+1,0);
        hash2.assign(n+1,0);
        pow1.assign(n+1,1);
        pow2.assign(n+1,1);
 
        for(int i=0;i<n;i++) {
            hash1[i+1] = (hash1[i]+s[i]) * base1 % mod1;
            hash2[i+1] = (hash2[i]+s[i]) * base2 % mod2;
            pow1[i+1] = pow1[i] * base1 % mod1;
            pow2[i+1] = pow2[i] * base2 % mod2;
        }
    }
 
    RollingHash() : base1(1009), base2(1007), mod1(1000000007), mod2(1000000009) {}
 
    hash_type get(int l,int r) {
        int_type t1 = ((hash1[r] - hash1[l] * pow1[r-l]) % mod1 + mod1) % mod1;
        int_type t2 = ((hash2[r] - hash2[l] * pow2[r-l]) % mod2 + mod2) % mod2;
        return make_pair(t1, t2);
    }
 
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    string s;
    cin >> n >> m >> s;
    set<RollingHash::hash_type> S;
    RollingHash rh;
    rh.init(s);

    int l = 0, r = 1;
    REP(i,m){
        string q;
        cin >> q;
        if(q == "R++") r++;
        if(q == "R--") r--;
        if(q == "L++") l++;
        if(q == "L--") l--;
        S.insert(rh.get(l,r));
    }
    cout << S.size() << endl;
}


Measured memory_bytes: 31180
/*
 * FileName:     the_number_of_inversions_fix
 * CreatedDate:  2020-06-05 16:25:10 +0900
 * LastModified: 2020-07-06 22:22:35 +0900
 */

#include <stdio.h>
#include <stdlib.h>
#define unko 1e12
long int sort(long int *a, int left, int middle, int right){
    long int l_arr[middle-left+1], r_arr[right-middle+1];
    long int cnt = 0;
    for(int i=0;i<middle-left;i++)l_arr[i] = a[i+left];
    for(int i=0;i<right-middle;i++)r_arr[i] = a[i+middle];
    l_arr[middle-left] = unko;
    r_arr[right-middle] = unko;
    int l=0, r=0;
    for(int i=0;i<right-left;i++){
        if( l_arr[l]<=r_arr[r] ){
            a[left+i] = l_arr[l++];
        }
        else{
            a[left+i] = r_arr[r++];
            cnt += middle-left-l;
        }
    }
    return cnt;
}
long int merge(long int *a, int left, int right){
    if(left+1<right){
        int middle = (left+right)/2;
        long int x1 = merge( a, left, middle);
        long int x2 = merge( a, middle, right);
        long int x3 = sort( a, left, middle, right);
        return x1+x2+x3;
    }
    else{
        return 0;
    }
}

int main(void){
    int n;scanf("%d",&n);
    long int *a = malloc(n*sizeof(long int));
    for(int i=0;i<n;i++)scanf("%ld",a+i);
    printf("%ld\n", merge( a, 0, n));
    free(a);
    return 0;
}



Measured memory_bytes: 4716
#include <stdio.h>
#include <string.h>
 
int main() {
  int ac = 0, wa = 0, tle = 0, re = 0, n;
  char temp[5];
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", &temp);
    if(strcmp(temp, "AC") == 0){
      ac++;
    }
    if(strcmp(temp, "WA") == 0){
      wa++;
    }
    if(strcmp(temp, "TLE") == 0){
      tle++;
    }
    if(strcmp(temp, "RE") == 0){
      re++;
    }
  }
  printf("AC x %d\n", ac);
  printf("WA x %d\n", wa);
  printf("TLE x %d\n", tle);
  printf("RE x %d\n", re);
}

Measured memory_bytes: 1704
#include<bits/stdc++.h>
#define mov(i,a,b) for(int i = a; i < b; i++)
#define MOD 1000000007
#define INF 1e9+5
typedef long long ll;
using namespace std;
bool isPowerOfTwo(ll n){
	return (ceil(log2(n)) == floor(log2(n)));
}
long long binpow(long long a, long long b){
	long long res = 1;
	while(b>0){
		if(b&1) res *= a;
		a = a*a;
		b >>= 1;
	}
	return res;
}
int main(){
	
	ll H,W;
	ll h,w;
	cin>>H>>W;
	cin>>h>>w;
	
	ll area = H*W;
	area -= h*W;
	ll t = H-h;
	area -= t*w;
	cout<<area<<"\n";
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>
// using namespace __gnu_pbds;
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>ordered_set;
/////////////////// TYPES & MACROS ///////////////////////////////
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define vv vector
#define exist(s,e) (s.find(e)!=s.end())
using ll=long long int; using dd=double;
using pii=pair<int,int>; using pll=pair<ll,ll>;
typedef vector<int> vi;
ll INFLL=(ll)2e18, MOD=1'000'000'007;
const int INF=0x3f3fffff ;
/////////////////// DEBUG /////////////////////////////////////////
#define D(x) cerr<<#x<<" is: "<<x<<'\n';
#define DD(x,y) cerr<<"("<<#x<<","<<#y<<") are: "<<x<<" "<<y<<'\n';
/////////////////// VARIABLES & FUNCTIONS//////////////////////////
vv<vi> adj; vv<vv<int>> vis;
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1},dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
inline ll mexp(ll x,ll n,ll m){ll res=1;while(n){if(n&1)res=(res*x)%m;n>>=1;x=((x%m)*(x%m))%m;}return res;}
inline bool ispow2(ll x){ return x && (!(x&(x-1)));}
inline ll gcd(ll x, ll y){ pll p{x,y}; while(p.ss) p={p.ss,p.ff%p.ss}; return p.ff;}


/////////////////// MAIN STARTS //////////////////////////////////
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
cout<<fixed;cerr<<fixed; cout<<setprecision(10); cerr<<setprecision(3);
// random_device rd; mt19937 genr(rd());

#ifdef DEBUG
  auto tStart = chrono::system_clock::now(); //freopen("op.txt","w",stdout);
#endif

int r,c; cin>>r>>c;
char mat[r][c];
for(int i=0;i<r;i++) for(int j=0;j<c;j++) cin>>mat[i][j];
bool dr[r], dc[c];
memset(dr,0,sizeof(dr));
memset(dc, 0, sizeof(dc));
for(int i=0;i<r;i++){
  int ct=0;
  for(int j=0;j<c;j++) if(mat[i][j]=='.') ++ct;
  if(ct==c) dr[i]=true;
}
for(int j=0;j<c;j++){
  int ct=0;
  for(int i=0;i<r;i++){
    if(mat[i][j]=='.') ++ct;
  }
  if(ct==r) dc[j]=true;
}
for(int i=0;i<r;i++){
  if(dr[i]) continue;
  for(int j=0;j<c;j++){
    if(dc[j]) continue;
    else cout<<mat[i][j];
  }
  cout<<endl;
}

#ifdef DEBUG
  auto diff=chrono::system_clock::now()-tStart;
  cerr<<"\nExecution time: "<<chrono::duration<dd,milli>(diff).count()<<" ms.\n";
#endif
return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int N, Q;
	int M, data;
	//int canAttend[100];
	int i,j;
	int maxMember,maxMemberdata;
	while(1){
		int canAttend[100]={};
		scanf("%d%d",&N,&Q);if(N+Q==0) break;
		maxMember=Q-1;
		maxMemberdata=0;
		//for(j=0;j<100;j++) canAttend[j]=0;
		for(i=0;i<N;i++){
			scanf("%d", &M);
			for(j=0;j<M;j++){
				scanf("%d", &data);
				canAttend[data]=canAttend[data]+1;
			}
		}
		for(i=0;i<100;i++){
			if(canAttend[i]>maxMember){
				maxMember=canAttend[i];
				maxMemberdata=i;
			}
		}
		printf("%d\n",maxMemberdata);
	}
	return 0;
}

Measured memory_bytes: 600
from collections import defaultdict

n = int(input())
rem = defaultdict(int)

def prime_f(m):
    pf = {}
    for i in range(2, int(m**0.5) + 1):
        while not m % i:
            pf[i] = pf.get(i, 0) + 1
            m //= i
    if m > 1:
        pf[m] = 1
    return pf


cnt = 0
for i in range(3, 100000, 2):
    a = tuple(prime_f(i).values())
    if len(a) == 1 and a[0] == 1:
        b = tuple(prime_f((i+1)//2).values())
        if len(b) == 1 and b[0] == 1:
            cnt += 1
            rem[i] = cnt
        else:
            rem[i] = cnt
    else:
        rem[i] = cnt

for i in range(n):
    a, b = map(int, input().split())
    print(rem[b] - rem[a - 2])


Measured memory_bytes: 58332
#include <bits/stdc++.h>
using namespace std;
int f(int n)
{
    if (n % 2 == 0) {
        return n / 2;
    }

    return 3 * n + 1;
}

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

    vector<int> A;

    A.push_back(s);
    A.push_back(f(A[0]));
    A.push_back(f(A[1]));

    while (true) {
        int nextValue = f(A.back());
        if (find(A.begin(), A.end(), nextValue) != A.end()) {
            break;
        }
        A.push_back(nextValue);
    }

    cout << A.size() + 1;

    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<queue>
#include<set>
using namespace std;
const int N=2e5+5;
set<int>se[N];
typedef set<int>::iterator it;
int n,now,v[N],c[N],b[N],nex[N],head[N];
struct each{
	int a,id;
}a[N];
queue<int>que;
inline int read(){
	register int x=0;
	register char ch=getchar();
	while(ch<'0'||ch>'9')	ch=getchar();
	while(ch>='0'&&ch<='9')	x=x*10+(ch^48),ch=getchar();
	return x;
}
int get(int x){
	int last=-1;
	it i=se[x].begin();
	for(;i!=se[x].end();++i)
		if(last+1==*i)	++last;
		else	break;
	return ++last;
}
int vis[N],tm[N],p[N];
int main(){
	//freopen("graph.out","w",stdout);
	//freopen("graph.in","r",stdin);

	n=read();
	for(register int i=1;i<=n;i++)
		++b[p[i]=read()];
	for(register int i=1;i<=n;i++)
		if(!b[i])	que.push(i);
	while(!que.empty()){
		int x=que.front(),k=get(x);
		que.pop(),se[p[x]].insert(k);
		if(!(--b[p[x]]))	que.push(p[x]);
	}
	int st;
	for(int i=1;i<=n;i++)
		if(b[i]){
			st=i,que.push(i);
			break;
		}
	while(!que.empty()){
		int x=que.front();
		que.pop(),tm[x]=get(x);
		if(se[p[x]].count(tm[x]))	vis[x]=1;
		se[p[x]].insert(tm[x]);
		if(p[x]==st){
			if(tm[x]==tm[st])	break;
			else{
				puts("POSSIBLE");
				return 0;
			}
		}
		que.push(p[x]);
	}
	for(int i=1;i<=n;i++)
		if(b[i]&&!vis[i])	se[p[i]].erase(tm[i]);
	int end=tm[st];
	que.push(st),se[st].insert(end);
	while(!que.empty()){
		int x=que.front();
		que.pop(),tm[x]=get(x);
		se[p[x]].insert(tm[x]);
		if(p[x]==st){
			if(tm[x]!=end)	break;
			else{
				puts("POSSIBLE");
				return 0;
			}
		}
		que.push(p[x]);
	}
	puts("IMPOSSIBLE");
	return 0;
}


Measured memory_bytes: 25984
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
//#define mod 998244353
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }

const ll INF=1e18;

void chmax(P &a,P b) {
  if (a.ft<b.ft) a.sc=max(a.ft,b.sc), a.ft=b.ft;
  else a.sc=max(a.sc,b.ft);
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n;
    cin>>n;
    V<ll> a((1<<n));
    V<P> dp(1<<n);
    rep(i,(1<<n)){
        cin>>a[i];
        dp[i]=make_pair(a[i],-INF);
    }
    rep(j,n){
        rep(i,(1<<n)){
            if(i>>j&1){
                chmax(dp[i],dp[i^(1<<j)]);
            }
        }
    }
    ll ans=-INF;
    rep(i,(1<<n)){
        ll tmp=dp[i].ft+dp[i].sc;
        ans=max(ans,tmp);
        if(i) cout<<ans<<'\n';
    }
}

Measured memory_bytes: 9216
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <fstream>
using namespace std;
double pie=3.14159265358979;
long long mod=998244353;
//
int main(){
	long long n,m,k;
	cin>>n>>m>>k;
	long long a[200001]={};
	long long b[200001]={};
	for(int i=0;i<n;i++){
		cin>>a[i+1];
	}
	for(int i=0;i<m;i++){
		cin>>b[i+1];
	}
	for(int i=0;i<n;i++){
		a[i+1]+=a[i];
	}
	for(int i=0;i<m;i++){
		b[i+1]+=b[i];
	}
	long long ans=0;
	for(int i=0;i<=n;i++){
		if(a[i]<=k){
			long long id=upper_bound(b,b+m+1,k-a[i])-b;
			id--;
			ans=max(ans,i+id);
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

const int mod = 1000000007;
struct mint {
  long long x;
  mint(long long x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(long long t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
int N;
int main(){
    cin>>N;
    vector<long long>A(N+1),acc(N+1);
    for(int i=1;i<=N;i++)cin>>A[i];
    acc[0]=0LL;
    for(int i=1;i<=N;i++)acc[i]=acc[i-1]+A[i];
    mint ans=0LL;
    for(int i=1;i<=N-1;i++){
        mint a=A[i];
        a*=acc[N]-acc[i];
        ans+=a;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 6336
#include <stdio.h>
int main(void){
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    
    if(a<b){
        if(b<c){printf("Yes\n");}
        else{printf("No\n");}
    }
    else{printf("No\n");}
    
}



Measured memory_bytes: 2088
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        List<Element> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            list.add(new Element(a, b));
        }
        Collections.sort(list, (e1, e2) -> e1.a - e2.a);
        sc.close();

        long ans = 0;
        int needsNum = m;
        while (needsNum > 0) {
            Element e = list.remove(0);
            if (e.b <= needsNum) {
                ans += (long) e.a * (long) e.b;
                needsNum -= e.b;
            } else {
                ans += (long) e.a * (long) needsNum;
                needsNum = 0;
            }
        }
        System.out.println(ans);
    }

    static class Element {
        int a;
        int b;

        Element(int a, int b) {
            this.a = a;
            this.b = b;
        }
    }
}


Measured memory_bytes: 65316
#include<bits/stdc++.h>
#define PI acos(-1.0)
#define pb push_back
#define F first
#define S second
#define debug puts
#define setp cout << fixed << setprecision(15)
#define FAST_IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
const int N=3e5+5;
const int MOD=998244353;

int main(void){
    FAST_IO;
    int n;
    cin >> n;
    vector<int> l(n+1),r(n+1);
//    cout << a[0]<<endl;
    for(int i=1;i<=n;i++){
        int a,b;
        cin >> a >>b;
        l[i]=a,r[i]=b;
    }
    sort(l.rbegin(),l.rend());
    sort(r.begin(),r.end());
    ll ans=0;
    for(int i=0;i<=n;i++){
        if(l[i]>r[i]){
            ans+=2*(l[i]-r[i]);
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
import java.util.*;
class Main
{
	public static void main(String[] args)                                        
	{
		Scanner sc=new Scanner(System.in);
		int t,k,l;
		String p;
		t=sc.nextInt();
		
		l=t/500;
		int a=t%500;
				int ans=l*1000+((a/5)*5);
				System.out.println(ans);

		
		
		
		
		
	
		
	}
	
	
			
	
		
}



Measured memory_bytes: 22740
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
	    Scanner stdIn = new Scanner(System.in);
	    
	    int r = stdIn.nextInt();
	    int D = stdIn.nextInt();
	    
	    int []a = new int [11];
	    a[0] = stdIn.nextInt();
	    
	    for (int i = 0 ; i < 10; i++) {
	    	a[i+1] = r * a[i] - D;
	    System.out.println(a[i + 1]);
	    
	    
	    }
		

	}

}

Measured memory_bytes: 20692
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		String s = sc.next();
		char[] after = s.toCharArray();
		after[k - 1] = s.toLowerCase().toCharArray()[k - 1];
		System.out.println(String.valueOf(after));
	}
}

Measured memory_bytes: 23760
#include<stdio.h>
#include<string.h>
int main(void)
{
	int i,ans=0;
	char s[3];
	
	scanf("%s",s);
	
	for(i=0;i<3;i++){
		if(s[i]=='1'){
			ans++;
		}
	}
	
	printf("%d",ans);
	
	return 0;
}

Measured memory_bytes: 128
#include <iostream>

int main()
{
    int n;
    std::cin >> n;
    std::string str;
    std::getline(std::cin, str); //dump
    std::getline(std::cin, str);
    
    int open_exceed = 0;
    int open_insert = 0;
    for (int i = 0; i < n; i++) {
        if (str[i] == '(') {
            open_exceed ++;
        } else {
            open_exceed --;
        }
        if (open_exceed < 0) {
            open_exceed = 0;
            open_insert ++;
        }
    }

    for (int i = 0; i < open_insert; i++) {
        std::cout << '(';
    }
    std::cout << str;
    for (int i = 0; i < open_exceed; i++) {
        std::cout << ')';
    }
    std::cout << std::endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.regex.*;
import java.math.*;

public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		//int a = sc.nextInt();
		// スペース区切りの整数の入力
		//int b = sc.nextInt();
		//int c = sc.nextInt();
		// 文字列の入力
		//String s = sc.next();
		//1文字ずつ
		//s.atChar(i);
		// 出力
		//System.out.println("");
		//double countx=0;

		int H=sc.nextInt();
		int W=sc.nextInt();
	
		int[][] a=new int[H][W];
		
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				a[i][j]=sc.nextInt();
			}
		}
		int co=0;
		int[] x=new int[H*W];
		int[] xd=new int[H*W];
		int[] y=new int[H*W];
		int[] yd=new int[H*W];

	
		int k=0;
		int wpoint=0;
		int wend=0;
		if(H%2!=0){
			wend=W-1;
		}
		while(k<H){
			//System.out.println("wp:"+wpoint);
			if(k==H-1 && wpoint ==wend){
				break;
			}
			if(k%2==0){
				
				if(wpoint==W-1){
					if(a[k][W-1]%2==1){
						
						y[co]=k+1;
						yd[co]=k+2;
						x[co]=wpoint+1;
						xd[co]=wpoint+1;
						co++;
						a[k][W-1]--;
						a[k+1][W-1]++;
						
						
					}
					k++;
				}else{
				
					if(a[k][wpoint]%2==1){
						y[co]=k+1;
						yd[co]=k+1;
						x[co]=wpoint+1;
						xd[co]=wpoint+2;
						co++;
						a[k][wpoint]--;
						a[k][wpoint+1]++;
						
					}
					wpoint++;
					
				}
			}else{
				
				if(wpoint==0){
					if(a[k][0]%2==1){
						y[co]=k+1;
						yd[co]=k+2;
						x[co]=wpoint+1;
						xd[co]=wpoint+1;
						co++;
						a[k][0]--;
						a[k+1][0]++;
						
						
					}
					k++;
				}else{
					
				
					if(a[k][wpoint]%2==1){
						y[co]=k+1;
						yd[co]=k+1;
						x[co]=wpoint+1;
						xd[co]=wpoint;
						co++;	
						a[k][wpoint]--;
						a[k][wpoint-1]++;
						
					
					}
					wpoint--;
					
				}
			}
		}
	
		System.out.println(co);
		for(int i=0;i<co;i++){
			System.out.println(y[i]+" "+x[i]+" "+yd[i]+" "+xd[i]);
		}
		
		
	}
}

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

using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset

typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;

#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'

char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
bool isect (int l1, int r1, int l2, int r2){
    pii p1,p2;
    p1 = mp(l1,r1); p2 = mp(l2,r2);
    if(p1>p2)swap(p1,p2);
    if(p2.fi <= p1.se)return true;
    else return false;
}
ll fexp (ll num1, ll num2, ll MOD){
    if(num2==0)return 1;
    else if(num2==1)return num1;
    else{
        ll temp = fexp (num1,num2/2,MOD); ll res = ((temp%MOD) * (temp%MOD))%MOD;
        if(num2%2==1) res = ((res%MOD)*(num1%MOD))%MOD; return res;
    }
}
ll invmod (ll num, ll MOD){return fexp (num,MOD-2,MOD);}
ll gcd (ll num1, ll num2){
    if(num1 < num2) swap(num1,num2); ll num3 = num1 % num2 ;
    while(num3 > 0){ num1 = num2; num2 = num3; num3 = num1 % num2;}
    return num2;
}
ll lcm (ll num1 , ll num2){return (ll) (num1/gcd(num1,num2))*num2;}


// end of Template

double ans;
int n;
int main(){

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

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for(int i=1;i<=n;i++){
        double temp;
        cin>>temp;
        ans += (1/temp);
    }
    ans = 1/ans;
    cout<<fixed<<setprecision(10)<<ans<<newl;

}


Measured memory_bytes: 256
#include <functional>
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <queue>
#include <string>
#include <cstring>
#include <math.h>
using namespace std;


int main() {
   int n;
   cin >> n;
int a[n];

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

}
  
//sort(a, a + n); 
  

int min = 100000000000;
  
for(int i = 0;i<n-1;i++){
  
   int l = 0;
  
   for(int j = 0;j<i+1;j++){
     
   
      l = l+a[j];
 
   }
  
  // cout << l << endl;
    int m = 0;
    for(int k = i+1;k<n;k++){
      
      m = m+a[k];
   

   }

  // cout << m << endl;
  
   int abss = abs(l-m);
  
   if(min>abss){
     
     
     min = abss;
     
   }
   
  
}
  
  cout << min << endl;

  return 0;
}

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

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



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

int main() {
  int N;
  cin >> N;
  vector<int> l(N);
  for (int i=0; i<N; ++i) {
    cin >> l.at(i);
  }
  sort(l.begin(), l.end(), greater<int>());
  int sum = 0;
  int longest = l.at(0);
  for (int i=1; i<N; ++i) {
    sum += l.at(i);
  }
  if (longest < sum) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n, sums[110], X;
int main() {
	cin >> n >> X;
	for (int i = 1; i <= n; ++i) cin >> sums[i];
	sort(sums + 1, sums + 1 + n);
	int ans = 0, cnt = 0;
	for (int i = 1; i <= n; ++i) {
		cnt += sums[i];
		if (cnt <= X) ++ans;
		else break;
	}
	if (cnt < X) --ans;
	cout << ans << endl;
	return 0;
}


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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++)
    cin >> a.at(i);
  vector<int> cost(201);
  for(int k : a){
    for(int i = 0; i < 201; i++){
      cost.at(i) += ((i-100)-k)*((i-100)-k);
    }
  }
  sort(cost.begin(), cost.end());
  cout << cost.at(0) << endl;
}

Measured memory_bytes: 256