akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.AbstractCollection;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BFoodsLovedByEveryone solver = new BFoodsLovedByEveryone();
        solver.solve(1, in, out);
        out.close();
    }

    static class BFoodsLovedByEveryone {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            HashSet<Integer> answer = new HashSet<>();
            for (int i = 1; i <= m; i++)
                answer.add(i);

            for (int i = 0; i < n; i++) {
                int k = in.nextInt();
                HashSet<Integer> foods = new HashSet<>();
                for (int j = 0; j < k; j++) {
                    foods.add(in.nextInt());
                }
                answer.retainAll(foods);
            }

            out.println(answer.size());
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21460
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <utility>

using namespace std;
using pii = pair<int, int>;

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; ++i){ cin >> a[i]; }
	int argmax = 0;
	for(int i = 1; i < n; ++i){
		if(abs(a[i]) > abs(a[argmax])){ argmax = i; }
	}
	vector<pii> solution;
	const int maxval = a[argmax];
	for(int i = 0; i < n; ++i){
		if(i == argmax){ continue; }
		solution.emplace_back(argmax, i);
	}
	if(maxval >= 0){
		for(int i = 1; i < n; ++i){ solution.emplace_back(i - 1, i); }
	}else{
		for(int i = n - 1; i > 0; --i){ solution.emplace_back(i, i - 1); }
	}
	cout << solution.size() << endl;
	for(const auto& p : solution){
		cout << p.first + 1 << " " << p.second + 1 << endl;
	}
	return 0;
}



Measured memory_bytes: 256
from sys import stdin

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))

b = []
ki = []
gu = []

for i in range(n):
    if i % 2 == 1:
        ki.append(li[i])
    else:
        gu.append(li[i])

if n %2 == 1:
    gu = gu[::-1]
    print(*(gu+ki))
else:
    ki = ki[::-1]
    print(*(ki+gu))

Measured memory_bytes: 25156
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

template <ll Mod>
struct modint {
  ll n;

  modint(const ll x = 0) : n(x) { while (n < 0) n += Mod; n %= Mod; }
  modint operator+(const modint r) const { return modint(*this) += r; }
  modint operator-(const modint r) const { return modint(*this) -= r; }
  modint operator*(const modint r) const { return modint(*this) *= r; }
  modint operator/(const modint r) const { return modint(*this) /= r; }
  modint &operator+=(const modint r) {
    n += r.n;
    if (n >= Mod) n -= Mod;
    return *this;
  }
  modint &operator-=(const modint r) {
    if (n < r.n) n += Mod;
    n -= r.n;
    return *this;
  }
  modint &operator*=(const modint r) { n = n * r.n % Mod; return *this; }
  modint &operator/=(const modint r) { return *this *= r.inv(); }
  modint pow(ll x) const {
    modint<Mod> ret(1), tmp(*this);
    while (x) {
      if (x&1) ret *= tmp;
      tmp *= tmp;
      x >>= 1;
    }
    return ret;
  }
  modint inv() const { return pow(Mod-2); }
  friend ostream& operator<<(ostream& os, const modint& obj) { return os << obj.n; }
  friend istream& operator>>(istream& is, modint& obj) { ll t; is >> t; obj = modint(t); return is; }
};
constexpr ll mod = 998244353;
using mint = modint<mod>;

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

  ll n;
  cin >> n;
  vl a(n);
  rep(i, n) {
    cin >> a[i];
  }

  vl cnt(n);
  ll maxi = 0;
  rep(i, n) {
    cnt[a[i]]++;
    cmax(maxi, a[i]);
  }

  if (cnt[0] != 1) {
    cout << 0 << endl;
    return 0;
  }

  rep(i, n-1) {
    if (a[i+1] == 0) {
      cout << 0 << endl;
      return 0;
    }
  }

  mint ans = 1;
  ll pre;
  rep(i, n) {
    if (cnt[i] == 0 && i <= maxi) {
      cout << 0 << endl;
      return 0;
    }
    if (i != 0) ans *= mint(pre).pow(cnt[i]);
    pre = cnt[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 9999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
//#define int long long


using namespace std;


int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[9] = { 0, 0,0,1,1,1,-1,-1,-1 };
int dyy[9] = { 0, 1,-1,0,1,-1,0,1,-1 };




ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

long long power_mod(long long x, long long n, long long m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return power_mod(x * x % m, n / 2, m);
	else
		return x * power_mod(x, n - 1, m) % m;
}

long long power(long long a, long long n) {//aのn乗を計算します。
	long long x = 1;
	while (n > 0) {//全てのbitが捨てられるまで。
		if (n & 1) {//1番右のbitが1のとき。
			x = x * a;
		}
		a = a * a;
		n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
	}
	return x;
}



long long nCr(long long n, long long r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	long long i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}



const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

bool arr[100000100];
vector<ll>sosuu;
void Eratosthenes() {
	ll N = 10000010;
	int c = 0;
	for (int i = 0; i < N; i++) {
		arr[i] = 1;
	}
	for (ll i = 2; i < sqrt(N); i++) {
		if (arr[i]) {
			for (ll j = 0; i * (j + 2) < N; j++) {
				arr[i *(j + 2)] = 0;
			}
		}
	}

	for (ll i = 2; i < N; i++) {
		if (arr[i]) {
			sosuu.pb(i);
			//cout << sosuu[c] << " ";
			c++;
		}
	}
	//cout << endl;
	//cout << c << endl;
}

ll stoL(string s) {
	ll n = s.length();
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		ans += power(10, n - i - 1)*(ll)(s[i] - '0');
	}
	return ans;
}



int main() {
	int A, B;
	cin >> A >> B;
	if ((A + 1) / 2 >= B) {
		print("YES");
	}
	else print("NO");
}


Measured memory_bytes: 256
import sys

n=int(input())
a=[int(x) for x in input().rstrip().split()]
a.sort()
max_val=max(a)
dp=[True for i in range(max_val)]
done=[0 for i in range(max_val)]
cnt=0
ans=0

for i in a:

  if 1<=done[i-1]:
    done[i-1]+=1
    continue

  done[i-1]+=1
  cnt=1
  while(i*cnt<=max_val):
    cnt+=1
    if cnt*i<=max_val:
      done[cnt*i-1]+=1

for i in a:
  if done[i-1]==1:
      ans+=1

print(ans)

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

using namespace std;

const int N = 10107;

int a[N], b[N];
int na, nb;
int l[N], r[N];

int main() {
	ios_base::sync_with_stdio(false);
	int n;
	string s, t;
	cin >> n >> s >> t;
	
	for (int i = 1; i < n; ++i) {
		if (s[i] != s[i - 1]) {
			a[na++] = i;
		}
		
		if (t[i] != t[i - 1]) {
			b[nb++] = i;
		}
	}
	
	int ans = 1e9;
	bool eq = s[0] == t[0];
	for (int i = -n - 1; i <= n + 1; ++i) {
		if ((i % 2 == 0) != eq) {
			continue;
		}
		
		int nl = 0, nr = 0;
		
		if (i > 0) {
			fill(l, l + i, 0);
			nl = i;
		} else {
			fill(r, r + (-i), 0);
			nr = -i;
		}
		
		copy(a, a + na, l + nl);
		copy(b, b + nb, r + nr);
		
		nl += na;
		nr += nb;
		
		while (nl < nr) {
			l[nl++] = n;
		}
		
		while (nr < nl) {
			r[nr++] = n;
		}
		int nw = 0;
		for (int j = 0; j < nl; ++j) {
			nw += abs(l[j] - r[j]);
		}
		
		ans = min(ans, nw);
	}
	
	printf("%d\n", ans);
}

Measured memory_bytes: 384
#include<stdio.h>
#include<math.h>
int main(void)
{
   int a, b, c, d;

   scanf("%d%d%d%d", &a,&b,&c,&d);

   if( sqrt((c - a) * (c - a))  <= d)
     printf("Yes\n");
   else if((sqrt((c - b) * (c - b)) <= d) && (sqrt((a - b) * (a - b)) <= d))
     printf("Yes\n");
   else
     printf("No\n");
   return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
ll INF=1LL<<60;
ll MOD=1000000007;


ll N;ll M;


vector<vector<ll>> graph(100005, vector<ll>(0));  // DAG
vector<ll> order(0);  // トポロジカルソートされた頂点を格納
vector<bool> used(100005,0);  // 訪問済みフラグ

// 辿れるところまで辿る深さ優先探索
void dfs(ll u){
    if(used[u]) return;
    used[u] = true;
    for(ll v : graph[u]) dfs(v);
    order.emplace_back(u);     // 帰りがけ順で頂点を入れていく
}

// トポロジカルソート
//Nは頂点数
void tsort(ll N){
    for(ll v = 1; v <= N; v++) dfs(v);
    reverse(order.begin(), order.end());
}


int main(){
    cin >> N;
    cin >> M;
    vector<vector<ll>> parent(N+1, vector<ll>(0));
    for(ll i=0;i<N+M-1;i++){
        ll A,B;
        cin>>A>>B;
        graph[A].emplace_back(B);
        parent[B].emplace_back(A);
    ;}
    tsort(N);
    vector<ll> ans(N+1,0);
    vector<ll> where(N+1,0);
    for(ll i=1;i<=N;i++){
        where[order[i-1]]=i-1
    ;}
    for(ll i=1;i<=N;i++){
        ll Min=-INF;
        for(auto p: parent[i]){
            Min=max(where[p]-where[i],Min)
        ;}
        if(Min!=-INF){
            for(auto p: parent[i]){
                if(where[p]-where[i]==Min){
                    ans[i]=p;break;
                }
            ;}
        }
        
    ;}
   
    

    for(ll i=1;i<=N;i++){
        cout<<ans[i]<<endl;
    ;}


    return 0;
}


Measured memory_bytes: 17400
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define vi vector<int>
#define pb push_back
#define i197 1000000007
#define MAX_N 200002
using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<Pii,int> Piii;
typedef pair<int,ll> Pil;
typedef pair<ll,ll> Pll;
typedef pair<string,int> Psi;
typedef pair<Psi,int> Psii;

const int inf=1000000000;
struct edge{
	int myc,to,c,cost;
};
struct pos{
	int to,cost,color;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main() {
	string str;
	cin>>str;
	string flg="No";
	if(str[0]==str[1]&&(str[2]==str[3]&&str[0]!=str[2]))flg="Yes";
	if(str[0]==str[2]&&(str[1]==str[3]&&str[0]!=str[1]))flg="Yes";
	if(str[0]==str[3]&&(str[1]==str[2]&&str[0]!=str[2]))flg="Yes";
	cout<<flg<<endl;

	return 0;
}


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

int main(){
  long long X, Y, Z;
  cin >> X;
  
  Y = X / 100;
  Z = X % 100;
  
  if(Y*5 >= Z) cout<< 1 <<endl;
  else		  cout<< 0 <<endl;
  return 0;
}

Measured memory_bytes: 256
//  main.cpp
//  CppTest

#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, const char * argv[]) {
    // input from txt （提出時にこの箇所は削除すること）
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
    
    // cinを高速にするためのおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    /////////////////////
    // Write code below /
    /////////////////////

    int N,n=1;
    cin>>N;
    vector<int>d(N);
    for(int i=0;i<N;i++){
        cin>>d.at(i);
    }
    sort(d.begin(),d.end());
    for(int i=0;i<N-1;i++){
        if(d.at(i)<d.at(i+1)){
            n++;
        }
    }
    cout<<n<<endl;
    
    
    
    
    
    return 0;
}


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

long long mod = 998244353;
int n;
long long dp[200001][3][3][2];


int main(){
    string S;
    cin >> S;
    n = S.length();

    if(n == 2){
        if(S[0] == S[1]){
            cout << 1 << endl;
            return 0;
        }else{
            cout << 2 << endl;
            return 0;
        }
    }

    if(n == 3){
        int cnt[3] = {};
        for(int i = 0; i < 3; i++){
            cnt[S[i] - 'a'] ++;
        }
        if(cnt[0] && cnt[1] && cnt[2]){
            cout << 3 << endl;
            return 0;
        }
        if(cnt[0] == 3 || cnt[1] == 3 || cnt[2] == 3){
            cout << 1 << endl;
            return 0;
        }
        if(S[0] == S[1] || S[1] == S[2]){
            cout << 6 << endl;
            return 0;
        }
        cout << 7 << endl;
        return 0;
    }

    bool is_same_chars = true;
    for(int i = 0; i + 1 < n; i++){
        if(S[i] != S[i+1]){
            is_same_chars = false;
        }
    }
    if(is_same_chars){
        cout << 1 << endl;
        return 0;
    }
    
    for(int c = 0; c < 3; c++){
        dp[1][c][c][0] = 1;
    }

    for(int i = 1; i < n; i++){
        for(int m = 0; m < 3; m++){
            for(int c = 0; c < 3; c++){
                for(int b = 0; b < 2; b++){
                    for(int c_ = 0; c_ < 3; c_++){
                        if(c == c_){
                            dp[i+1][(m+c_)%3][c_][1] += dp[i][m][c][b];
                            dp[i+1][(m+c_)%3][c_][1] %= mod;
                        }else{
                            dp[i+1][(m+c_)%3][c_][b] += dp[i][m][c][b];
                            dp[i+1][(m+c_)%3][c_][b] %= mod;
                        }
                    }
                }
            }
        }
    }

    int m = 0;
    for(int i = 0; i < n; i++){
        m += S[i] - 'a';
        m %= 3;
    }
    bool has_conti = false;
    for(int i = 0; i < n - 1; i++){
        if(S[i] == S[i+1]){
            has_conti = true;
        }
    }
    cout << (dp[n][m][0][1] + dp[n][m][1][1] + dp[n][m][2][1] + (has_conti?0:1)) % mod << endl;
}


Measured memory_bytes: 28676
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
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 main(){
    string s; cin >> s;
    int n = s.size();
    string a = s.substr(0, (n-1)/2);
    string b = s.substr((n+3)/2-1);
    string ar = a, br = b, sr = s;
    reverse(all(ar)), reverse(all(br)), reverse(all(sr));
    if(s==sr && a==ar && b==br)cout << "Yes" << ln;
    else cout << "No" << ln;
}

Measured memory_bytes: 3516
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

signed main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
     cout.tie(0);   
 #ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
 #endif
 
// -------------------------------------Code starts here---------------------------------------------------------------------     

  string s;
  cin>>s;
  for(int i=0;i<3;i++)
  {
    if(s[i]=='7')
    {
      cout<<"Yes";
      return 0;
    }
  }  
  cout<<"No";

// -------------------------------------Code ends here------------------------------------------------------------------
     clock_t clk;
 	clk = clock();
 
    clk = clock() - clk;
 	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
 	return 0;
 }
 

Measured memory_bytes: 3768
n = gets.to_i
d = gets.chomp.split.map(&:to_i)

ary = []

d.each do |d|
	if d%2 == 0
		ary << d
	end
end

i = 0
count = 0

ary.each do |a|
	while a%2 == 0
		a = a/2
		count += 1
	end
end

puts count

Measured memory_bytes: 2428
import bisect
import sys
input = sys.stdin.readline
n = int(input())
L = list(map(int, input().split()))

L.sort()
ans = 0
for i in range(n):
    for j in range(i + 1, n):
        A = L[i] + L[j] - 1
        sa = abs(L[i] - L[j]) + 1
        big = bisect.bisect_right(L, A)
        sml = bisect.bisect_left(L, sa)
        num = big - sml
        if sa <= L[i] <= A:
            num -= 1
        if sa <= L[j] <= A:
            num -= 1
        if num > 0:
            ans += num
print(ans//3)


Measured memory_bytes: 48984
#include<bits/stdc++.h>
#include<iostream>
#include<set>
#define ll long long
using namespace std;
int main(){
   ll t;
   cin >>t;
   ll num=0;
   map<string , int> a;
   while(t--){
    string s;
    cin >>s;
    sort(s.begin(),s.end());
    num +=a[s]++;
   }
   cout<<num<<endl;
     return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (ll)(n); i++)

int main() {
  ll a, b; cin >> a >> b;
  if (a%2) {
    bitset <50> s(a);
    rep(i, (b-a)%4) {
      bitset <50> tmp(b-i);
      s = s ^ tmp;
    }
    ll res = 0;
    rep(i, 50) {
      if (s.test(i)) res += (ll)pow(2, i);
    }
    cout << res << endl;
  } else {
    bitset <50> s(0);
    rep(i, (b-a+1)%4) {
      bitset <50> tmp(b-i);
      s = s ^ tmp;
    }
    ll res = 0;
    rep(i, 50) {
      if (s.test(i)) res += (ll)pow(2, i);
    }
    cout << res << endl;
  }
}

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

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

  int d, t, s;
  cin >> d >> t >> s;
  if (t*s >= d) cout << "Yes\n";
  else cout << "No\n";
}

Measured memory_bytes: 3648
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

partial class Solver
{
    public void Run()
    {
        var r = ni();
        var D = ni();
        var x2000 = ni();
        long current = x2000;
        for (int i = 2001; i <= 2010; i++)
        {
            current = r * current - D;
            cout.WriteLine(current);
        }
    }
}


// PREWRITEN CODE BEGINS FROM HERE
partial class Solver : Scanner
{
    public static void Main(string[] args)
    {
        new Solver(Console.In, Console.Out).Run();
    }

    TextReader cin;
    TextWriter cout;

    public Solver(TextReader reader, TextWriter writer)
        : base(reader)
    {
        this.cin = reader;
        this.cout = writer;
    }
    public Solver(string input, TextWriter writer)
        : this(new StringReader(input), writer)
    {
    }

    public int ni() { return NextInt(); }
    public int[] ni(int n) { return NextIntArray(n); }
    public long nl() { return NextLong(); }
    public long[] nl(int n) { return NextLongArray(n); }
    public double nd() { return NextDouble(); }
    public string ns() { return Next(); }
}

public class Scanner
{
    private TextReader Reader;
    private Queue<String> TokenQueue = new Queue<string>();
    private CultureInfo ci = CultureInfo.InvariantCulture;

    public Scanner()
        : this(Console.In)
    {
    }

    public Scanner(TextReader reader)
    {
        this.Reader = reader;
    }

    public int NextInt() { return Int32.Parse(Next(), ci); }
    public long NextLong() { return Int64.Parse(Next(), ci); }
    public double NextDouble() { return double.Parse(Next(), ci); }
    public string[] NextArray(int size)
    {
        var array = new string[size];
        for (int i = 0; i < size; i++) array[i] = Next();
        return array;
    }
    public int[] NextIntArray(int size)
    {
        var array = new int[size];
        for (int i = 0; i < size; i++) array[i] = NextInt();
        return array;
    }

    public long[] NextLongArray(int size)
    {
        var array = new long[size];
        for (int i = 0; i < size; i++) array[i] = NextLong();
        return array;
    }

    public String Next()
    {
        if (TokenQueue.Count == 0)
        {
            if (!StockTokens()) throw new InvalidOperationException();
        }
        return TokenQueue.Dequeue();
    }

    public bool HasNext()
    {
        if (TokenQueue.Count > 0)
            return true;
        return StockTokens();
    }

    private bool StockTokens()
    {
        while (true)
        {
            var line = Reader.ReadLine();
            if (line == null) return false;
            var tokens = line.Trim().Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            if (tokens.Length == 0) continue;
            foreach (var token in tokens)
                TokenQueue.Enqueue(token);
            return true;
        }
    }
}


Measured memory_bytes: 11220
temp = list(map(int, input().split()))
X = temp[0]
Y = temp[1]
ansT = 2*X - Y/2
ansK = Y/2 - X
if Y / X in(2, 4):
  print("Yes")
elif int(ansT) == ansT and int(ansK) == ansK and ansT > 0 and ansK > 0:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 61844
def main():
    # n=int(input())
    a,b,m= map(int, input().split())
    l1= list(map(int, input().split()))
    l2= list(map(int, input().split()))
    mi=min(l1)+min(l2)
    for i in range(m):
        p, q, r = map(int, input().split())
        cal=l1[p-1]+l2[q-1]-r
        mi=min(mi,cal)
    print(mi)
    return
main()

Measured memory_bytes: 18612
#include <stdio.h>

int main() {
    int a,b,ans=0;
    scanf("%d%d",&a,&b);
    if (a>b) {
        ans+=a;
        a--;
    }else {
        ans+=b;
        b--;
    }
    if (a>b) {
        ans+=a;
        a--;
    }else {
        ans+=b;
        b--;
    }
    printf("%d\n",ans);
    
}


Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
int main(){
	char s[10];

  	scanf("%s",s);

	if(s[0] == 'C'){
	    printf("Rainy\n");
	}
	if(s[0] == 'R'){
	    printf("Sunny\n");
	}
	if(s[0] == 'S'){
	    printf("Cloudy\n");
	}
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define fill(x, y) memset(x, y, sizeof(x))
 
using namespace std;
 
template<class T>bool chmax(T &a, const T &b) { if(a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(b<a) { a=b; return 1; } return 0; }
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int MOD = 1e9+7;
const double EPS = 1.0e-12;
const double PI = acos(-1.0);

const int mx[2] = {0,1},my[2] = {1,0};

int dp[1010][1010];

int main() {
	int h,w;
	cin >> h >> w;
	char a[h][w];
	rep(i,h) rep(j,w) cin >> a[i][j];

	rep(i,1010) rep(j,1010) dp[i][j] = 0;
	dp[0][0] = 1;
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			if(a[i][j] == '#') continue;
			if(i != 0) dp[i][j] = (dp[i][j]+dp[i-1][j])%MOD;
			if(j != 0) dp[i][j] = (dp[i][j]+dp[i][j-1])%MOD;
		}
	}
	cout << dp[h-1][w-1] << endl;

	return 0;
}

Measured memory_bytes: 5248
var
n,a,b,i,f,g,h,p,cnt:integer;
begin
readln(n);
read(a,b);
for i:=1 to n do begin
read(p);
if(p<=a)then f:=f+1;
if(a<p)and(p<=b)then g:=g+1;
if(b<p)then h:=h+1;
end;
cnt:=n;
if(f<cnt)then cnt:=f;
if(g<cnt)then cnt:=g;
if(h<cnt)then cnt:=h;
writeln(cnt);
end.

Measured memory_bytes: 1380
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int a = scanner.nextInt();
        int b = scanner.nextInt();

        if (a < b) {
            System.out.println("a < b");
        } else if (a > b) {
            System.out.println("a > b");
        } else {
            System.out.println("a == b");
        }
    }
}

Measured memory_bytes: 26168
#include<stdio.h>
#define MAX 50
#define NIL (-1)
int dp[MAX];

int dpcheck(int num){
  if(num == 0 || num == 1)return dp[num] = 1;
  else if(dp[num] != NIL)return dp[num];
  else{
    return dp[num] = dpcheck(num - 1) + dpcheck(num - 2);
  }
}

int main(){
  int num,i;
  for(i=0;i<MAX;i++){
    dp[i] = NIL;
  }
  scanf("%d",&num);
  printf("%d\n",dpcheck(num));

  return 0;
}



Measured memory_bytes: 2104
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<queue>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<functional>
#include<set>
#include<map>
#include<climits>
#include<utility>
#define ul unsigned long long int
#define ll long long int
#define MAX 1000000+1
using namespace std;
#define F first
#define S second
#define pi 2*acos(0.0)
#define PB push_back
#define CL clear()







int main()
{
    ll a, b, c;
    ll t = 0, n;
    cin >> a >> b >> c;
    if(a%2)
        n++;
    if(b%2)
        n++;
    if(c%2)
        n++;
    if(n==2)
    {
        if(a%2)
            a++;
        if(b%2)
            b++;
        if(c%2)
            c++;
        t++;
    }
    if(n==1)
    {
        if(a%2==0)
            a++;
        if(b%2==0)
            b++;
        if(c%2==0)
            c++;
        t++;
    }
 if(a > b) swap(a,b);
 if(b > c) swap(b, c);
 if(a > b) swap(a,b);

  t+= (c-b)/2;
  t+= (c-a)/2;
  cout << t;



    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main()

{
  int a,b;
  scanf("%d%d",&a,&b);
  int ans=0;
  if(a>b)
  {
  	ans+=a;
    a--;
  }
  else{
    ans+=b;
    b--;
  }if(a>b)
  {
  	ans+=a;
    a--;
  }
  else{
    ans+=b;
    b--;
  }
  printf("%d",ans);

}

Measured memory_bytes: 128
a,b,c,x,y = gets.split.map(&:to_i)
ans = a * x + b * y

z=[x,y].min
ans = [ans, 2*z*c + a*(x-z) + b*(y-z)].min

z = [x, y].max
ans = [ans, 2*z*c].min
p ans


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

int main(){
	int N, K;
	cin >> N >> K;
	vector<int> p(N);
	for(int i=0; i<N; i++){
		cin >> p.at(i);
	}

	sort( p.begin(), p.end() );

	int ans=0;
	for(int i=0; i<K; i++){
		ans += p.at(i);
	}
	cout << ans << endl;

}


Measured memory_bytes: 3600
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
import copy
 
def dfs(A, times):
    if times == N:
        if min(A[1:M+1]) >= X:
            ans[0] = min(A[0], ans[0])
        return
    dfs(copy.copy(A), times+1)
    for i in range(M+1):
        A[i] = A[i] + L[times][i]
    dfs(copy.copy(A), times+1)

N, M, X = map(int, input().split())
L = [0] * (N)
for i in range(N):
    L[i] = [int(x) for x in input().split()]

INF = float('inf')
ans = [INF]
tmp = [0] * (M+1)
dfs(tmp, 0)
if ans[0] == INF:
    ans[0] = -1
print(ans[0])

Measured memory_bytes: 9388
#include <iostream>

using namespace std;

int mod(int x,int y){
    if(x>=y)return x-y;
    else return y-x;
}
int main(int argc, const char * argv[]) {
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)cin>>arr[i];
    int bp[n];
    bp[0] = 0;
    
    bp[1] = mod(arr[1],arr[0]);
    
    for(int i=2;i<n;i++){
        bp[i] = min(bp[i-1] + mod(arr[i],arr[i-1]),bp[i-2] + mod(arr[i],arr[i-2]));
    }
    cout<<bp[n-1]<<endl;
    return 0;
}


Measured memory_bytes: 4344
// CPP program to find the minimum number of
// characters to be replaced in string S2, such
// that S1 is a substring of S2
 
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

using namespace std;
 
// Function to find the minimum number of
// characters to be replaced in string S2, such
// that S1 is a substring of S2
int minimumChar(string S1, string S2)
{
    // Get the sizes of both strings
    int n = S1.size(), m = S2.size();
 
    int ans = INT_MAX;
 
    // Traverse the string S2
    for (int i = 0; i < m - n + 1; i++)
    {
        int minRemovedChar = 0;
 
        // From every index in S2, check the number of
        // mis-matching characters in substring of
        // length of S1
        for (int j = 0; j < n; j++)
        {
            if (S1[j] != S2[i + j])
            {
                minRemovedChar++;
            }
        }
 
        // Take minimum of prev and current mis-match
        ans = min(minRemovedChar, ans);
    }
 
    // return answer
    return ans;
}
 
// Driver Code
int main()
{
    string S1, S2;
    cin >> S1 >> S2;
 
    cout << minimumChar(S2, S1);
 
    return 0;
}

Measured memory_bytes: 3168
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  int L[N];
  int max=0;
  int length=0;
  for(int i=0;i<N;i++) {
    cin >> L[i];
    if(max<L[i])max=L[i];
    length+=L[i];
  }
  if(length-max>max) cout << "Yes";
  else cout << "No";
}


Measured memory_bytes: 256
MOD = 10**9+7

kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n): return kaijo_memo[n]
  if(len(kaijo_memo) == 0): kaijo_memo.append(1)
  while(len(kaijo_memo) <= n): kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n): return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0): gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n): gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if n == r: return 1
  if n < r or r < 0: return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

H,W,N = list(map(int,input().split()))
wall = [0,H*W-1]
for i in range(N):
  r,c = list(map(int,input().split()))
  wall.append((r-1)*W+(c-1))
  
wall.sort()

graph = [[] for i in range(N+2)]

for i in range(N+2):
  y,x = wall[i]//W, wall[i]%W
  for j in range(i+1,N+2):
    ny,nx = wall[j]//W, wall[j]%W
    if nx<x or ny<y: continue
    graph[j].append(i)

dp = [0 for i in range(N+2)]
for j in range(1,N+2):
  y,x = wall[j]//W, wall[j]%W
  dp[j] = nCr(y+x,y)
  for i in graph[j]:
    py,px = y-(wall[i]//W), x-(wall[i]%W)
    dp[j] -= nCr(py+px,py)*dp[i]
    dp[j] %= MOD

print(dp[-1])

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

using namespace std;

int n, m;
int a[101][101], b[101][101];
bitset<20001> f[101][101];

int main(int argc, char** argv)
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	cin >> n >> m;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
			cin >> a[i][j];
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
			cin >> b[i][j];
	f[1][1].set(10000);
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
		{
			int v1 = a[i][j] - b[i][j];
			int v2 = b[i][j] - a[i][j];
			if (v1 >= 0)
			{
				f[i + 1][j] |= (f[i][j] << v1);
				f[i][j + 1] |= (f[i][j] << v1); 
			}	
			else
			{
				v1 = -v1;
				f[i + 1][j] |= (f[i][j] >> v1);
				f[i][j + 1] |= (f[i][j] >> v1); 
			}	
			if (v2 >= 0)
			{
				f[i + 1][j] |= (f[i][j] << v2);
				f[i][j + 1] |= (f[i][j] << v2);
			}
			else
			{
				v2 = -v2;
				f[i + 1][j] |= (f[i][j] >> v2);
				f[i][j + 1] |= (f[i][j] >> v2);
			}	
		}
	int ans = 1e9;
	for (int i = 0; i <= 20000; i++)
		if (f[n][m].test(i))
		{       
			int v1 = i + a[n][m] - b[n][m];
			int v2 = i + b[n][m] - a[n][m];
			ans = min(ans, min(abs(v1 - 10000), abs(v2 - 10000)));
		} 
	cout << ans;	
}

Measured memory_bytes: 20084
import java.util.Scanner;

class Main {
  private final static String INSERT = "insert";
  private static Tree ROOT = null;
  private static Tree END = null;

  public static void main(String... args) {
    Scanner sc = new Scanner(System.in);
    int times = sc.nextInt();

    for (int i = 0; i < times; i++) {
      if (sc.next().equals(INSERT)) {
        insert(sc.nextInt());
      } else {
        createBuilderInorder(ROOT);
        System.out.println();
        createBuilderByRoot(ROOT);
        System.out.println();
      }
    }
  }

  public static void insert(int key) {
    Tree y = null;
    Tree x = ROOT;
    Tree z = new Tree();
    z.key = key;

    while (x != null) {
      y = x;
      if (z.key < x.key) {
        x = x.left;
      } else {
        x = x.right;
      }
    }

    z.parent = y;

    if (y == null) {
      ROOT = z;
    } else if (z.key < y.key) {
      y.left = z;
    } else {
      y.right = z;
    }
  }

  public static void createBuilderInorder(Tree tree) {
    if (tree != null) {
      createBuilderInorder(tree.left);
      System.out.print(" ");
      System.out.print(tree.key);
      createBuilderInorder(tree.right);
    }
  }

  public static void createBuilderByRoot(Tree tree) {
    if (tree != null) {
      System.out.print(" ");
      System.out.print(tree.key);
      createBuilderByRoot(tree.left);
      createBuilderByRoot(tree.right);
    }
  }
}

class Tree {
  public int key;
  public Tree left;
  public Tree right;
  public Tree parent;

  public Tree() { }
}



Measured memory_bytes: 221596
#pragma GCC optimize("O3")

//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN NEEDED)
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

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

typedef long long ll;

const ll mod = 1e9+7;
const int MAX = 2100000;
const int N = 21;

int mat[N][N];
int n;

ll DP[N][MAX];

ll add(ll a ,ll b){
    ll rta = a+b;
    return rta >= mod ? rta - mod : rta;
}

ll dp(int m, int i){
    if(i==n) return 1;
    if(DP[i][m]!=-1) return DP[i][m];
    ll rta = 0;
    for(int j = 0; j<n; ++j){
        if(mat[i][j] && ! (m&(1<<j)) ){
            //cout<<"holi"<<"\n";
            int d = dp(m | 1<<j, i+1);
            rta=add(rta, d);
        }
    }
    return DP[i][m] = rta;
}

int main(){

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

    memset(DP, -1, sizeof(DP));
    cout<<dp(0,0)<<"\n";


}



Measured memory_bytes: 344832
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##_len=(int)(n);i<i##_len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define REPW(i,n) for(i=0;i<(int)(n);++i)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)   // c++14
#define SZ(c) ((int)c.size())
#define EXIST(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,v) os << *i << (i==end(v)-1 ? "" : " "); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,v) is >> * i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.first >> p.second; return is; }
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
    }
} before_main_function;
//------------------------------------------------------------------------------

signed main() {
    string s,t;
    cin>>s>>t;
    int q;
    cin>>q;
    vi sums(SZ(s),0);
    vi sumt(SZ(t),0);
    sums[0]=(s[0]=='A'?1:2);
    sumt[0]=(t[0]=='A'?1:2);
    REP(i,SZ(s)-1) sums[i+1]+=sums[i]+(s[i+1]=='A'?1:2);
    REP(i,SZ(t)-1) sumt[i+1]+=sumt[i]+(t[i+1]=='A'?1:2);
    while(q--) {
        int a,b,c,d;
        cin>>a>>b>>c>>d;
        int x=sums[b-1]; if(a-2>=0) x-=sums[a-2];
        int y=sumt[d-1]; if(c-2>=0) y-=sumt[c-2];
        if(x%3==y%3) {
            cout<<"YES"<<endl;
        }
        else {
            cout<<"NO"<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 2512
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const int MOD = 1000000007; 

int main() {
    int n;
    cin >> n;
    vector<int> as(9, 0);
    rep(i, n) {
        int a; 
        cin >> a;
        int idx = min(a/400, 8);
        ++as[idx]; 
    }
    int vmin = 0;
    rep(i, 8) if(as[i]) ++vmin;
    int vmax = vmin + as[8];
    if (vmin == 0) vmin = 1;
    cout << vmin << " " << vmax << endl; 
    return 0;
}

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

int main() {
    string s;
    cin >> s;
    int ans = 0;
    for (int i = 0; i <= (s.size() - 1) / 2; ++i) {
        if (s.at(i) != s.at(s.size() - 1 - i)) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
(let* ((n (read))
       (k (read))
       (a (make-array n))
       (cnt (make-hash-table))
       (diff (list))
       (dcnt 0))
  (dotimes (i n)
    (setf (aref a i) (read)))
  (loop for ai across a do
        (multiple-value-bind (v p)
          (gethash ai cnt 0)
          (unless p
            (push ai diff)
            (incf dcnt))
          (setf (gethash ai cnt)
                (1+ v))))
  (let* ((del (- dcnt k))
         (least (sort diff #'(lambda (x y) (< (gethash x cnt)
                                              (gethash y cnt))))))
    (format t "~A~%"
            (loop repeat del
                  for l in least
                  sum (gethash l cnt)))))

Measured memory_bytes: 59752
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define MAX 300000
typedef long long ll;

int main(){
  ll ans=0;
  string s;
  cin>>s;
  char pre=s[0];
  for(int i=1;i<s.size();i++){
    if(pre==s[i]) continue;
    ans++;
    pre=s[i];
  }
  cout<<ans<<endl;
}


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

int main() {
	int X, Y; cin >> X >> Y;

	int sum = 0;
	if (X == 1) sum += 300000; if (Y == 1) sum += 300000;
	if (X == 2) sum += 200000; if (Y == 2) sum += 200000;
	if (X == 3) sum += 100000; if (Y == 3) sum += 100000;
	if (X == 1 && Y == 1) sum += 400000;

	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int N;
    long long D;
    long long X[200000];
    long long Y[200000];
    int i;
    long long sum=0;
    long long tmp=0;
    int cnt=0;

    scanf("%d %lld",&N,&D);

    tmp = D*D;
 //   printf("%lld\n",tmp);
    for(i=0;i<N;i++){
        scanf("%lld",&X[i]);
        scanf("%lld",&Y[i]);
    }

    for(i=0;i<N;i++){
 //       printf("X=%d\n",X[i]);
 //       printf("Y=%d\n",Y[i]);
        sum = X[i]*X[i] + Y[i]*Y[i];
 //       printf("%d\n",sum);

    
        if (sum <= tmp){
            cnt++;
        }
    }
    printf("%d",cnt);
}

Measured memory_bytes: 4836
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      if (String.valueOf(i).length()%2 == 1) {
        ans++;
      }
    }
    System.out.println(ans);
  }
}

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

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		char[] t = stdIn.next().toCharArray();
		
		
		//文字の長さ１のとき例外
		if(t.length == 1) {
			if(t[0]=='?') {
				System.out.println('D');
				return;
			}else {
				System.out.println(t[0]);
				return;
			}
			
		}
		
		
		
		for(int i = 0; i < t.length-1; i++) {
			if(i==0) {
				if(t[i]=='?' &&  t[i+1] == 'D') {
					System.out.print('P');
				}else if(t[i]=='?' && t[i+1]== 'P') {
					System.out.print('D');
				}else if(t[i]=='?' && t[i+1]=='?') {
					System.out.print('P');
				}else {
					System.out.print(t[i]);
				}
			
			}else {
				if(t[i]=='?' && t[i+1]=='?' && t[i-1]!='?') {
					
					if(t[i-1] == 'P') {
						System.out.print('D');
					}else {
						System.out.print('P');
					}
					
					
				}else if(t[i]=='?' && t[i+1]=='?' && t[i-1]=='?') {
					System.out.print('D');
				
				}else if(t[i] == '?') {
					System.out.print('D');
					
					
				}else {
					System.out.print(t[i]);
				}
				
				
				
			}
			
		}
		
		if(t[t.length-1] == '?') {
			System.out.print('D');
			
		}else {
			System.out.println(t[t.length-1]);
		}
		
		
		
		
	}

}


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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 29)
#define MOD 1000000007
//int dx[4] = {1,0,0,-1};
//int dy[4] = {0,1,-1,0};


int main(){

  int n,res = 0,max = -1;
  cin >> n;
  map<int,int> mp;
  REP(i,n){
    int x;cin >> x;x;
    mp[x]++;
    max = std::max(max,x);
  }
  vector<int> s(max+2);
  s[0] = 0;
  REP(i,max+1)s[i+1] = s[i] + mp[i];
  if(max == 0)res = s[1];
  else if(max == 1)res = s[2]-s[0];
  else REP(i,max)if(i)res = std::max(res,s[i+2]-s[i-1]);
  cout << res << endl;


  return 0;
}


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

using namespace std;

long long gcd(long long a, long long b)
{
    if(a < b) swap(a, b);
    if(b == 0) return a;
    else return gcd(b, a%b);
}

long long lcm(long long a, long long b)
{
    return a*b/gcd(a, b);
}

int main(){
    long long a,b;
    cin >> a >> b;
    cout << lcm(a, b) << endl;
    return 0;
}

Measured memory_bytes: 256
#ifdef __APPLE__
#include "bits:stdc++.h"
#else
#include <bits/stdc++.h>
#endif

using namespace std;
typedef long long LL;
typedef pair<LL, LL> PLL;
auto scan = []{ static LL a; scanf("%lld", &a); return a;};


string s, noxs;
bool ispal(string &s) {
  for (LL i = 0; i < s.size(); ++i) if(s[i] != s[s.size() - 1 - i]) return false;
  return true;
}
int main() {
  cin >> s;
  LL ans = 0;
  for(auto c : s) if(c!='x') noxs.push_back(c);
  if (ispal(noxs)){
    LL beg = 0, ed = s.size() - 1;
    while (beg < ed ) {
      if (s[beg] != 'x' && s[ed] != 'x') {
        if (s[beg] != s[ed]) return 0 * puts("-1");
        else ++beg, --ed;
      }
      else {
        if (s[beg] == 'x' && s[ed] == 'x') ++beg, --ed;
        else if(s[beg] == 'x' && s[ed] != 'x') ++beg, ++ans;
        else ++ans, --ed;
      }
    }
    printf("%lld\n",ans);
  }
  else puts("-1");
  
}




/*
 4
 3
 0 0
 1 1
 1 2
 3
 1 2
 2 4
 4 8
 4
 1 1
 2 2
 3 3
 4 4
 5
 0 0
 2 0
 0 2
 2 2
 1 1
 
 */


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

int main() {
	int a, b, c;

	cin >> a;
	cin >> b;
	cin >> c;

		
	string s;

	s = "No";


	if (b == c) {
		s = "Yes";
	}

	if (a == b || a == c) {
		if (b == c) {
			s = "No";
		}
		else {
			s = "Yes";
		}
		
	}

	cout << s;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);

		int A = sc.nextInt();
		int B = sc.nextInt();

		System.out.print((A + B) % 2 == 0 ? (A + B) / 2 : "IMPOSSIBLE");

	}
}

Measured memory_bytes: 21972
n,m=gets.split.map(&:to_i)
rr=[]
m.times do |i|
  a,b=gets.split.map(&:to_i)
  rr << Range.new(a,b)
end
rr.sort!{|r1,r2|  r1.end <=> r2.end}
ans=[]
rr.each do |r|
  unless ans.any? && r.include?(ans.last)
    ans << r.end-1
  end
end
puts ans.size


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

long long gcd(long long x, long long y)
{
    if (y == 0)
        return x;
    return gcd(y, x % y);
}

long long lcm(long long x, long long y)
{
    if (x == 0 || y == 0)
        return 0;
    return x / gcd(x, y) * y;
}

int main()
{
    string S, T;
    cin >> S >> T;
    int n = S.size();
    int m = T.size();
    string ans = "";
    bool flag = true;
    for (int i = n - m; i >= 0; i--)
    {
        string s = S;
        for (int j = 0; j < m; j++)
        {
            if (s[i + j] == '?')
                s[i + j] = T[j];
            else if (s[i + j] != T[j])
            {
                flag = false;
                break;
            }
        }
        if (flag)
        {
            for (int i = 0; i < n; i++)
            {
                ans += (s[i] == '?' ? 'a' : s[i]);
            }
            break;
        }
        flag = true;
    }
    if (ans == "")
        ans = "UNRESTORABLE";
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
vector<int> G[200010];
int cnt[200010] = {};
void dfs(int s, int p){
	for(auto v:G[s]){
		if(v==p) continue;
		cnt[v] += cnt[s];
		dfs(v,s);
	}
}
		
int main(){
	int i,n,q;
	cin >> n >> q;
	for(i=0;i<n - 1;i++){
		int a,b; cin >> a >> b; a--; b--;
		G[a].push_back(b); G[b].push_back(a);
	}
	for(i=0;i<q;i++){
		int a,b; cin >> a >> b; a--; cnt[a] += b;
	}
	dfs(0,-1);
	for(i=0;i<n;i++){
		cout << cnt[i] << " ";
	}
	cout << endl;
}

Measured memory_bytes: 23424