akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll 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 {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll 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 {
    mint res(*this);
    return res/=a;
  }
};

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

  vector<vector<mint>> dp(s.size()+1, vector<mint>(4));
  dp.at(s.size()).at(0) = dp.at(s.size()).at(1) = dp.at(s.size()).at(2) = 0;
  dp.at(s.size()).at(3) = 1;
  rrep(i, s.size()){
    char c = s.at(i);
    int m;
    if(c == '?') m = 3;
    else m = 1;
    dp.at(i).at(3) = dp.at(i+1).at(3) * m;
    rep(j, 3){
      int m1, m2;
      if(c == '?') m1 = 3;
      else m1 = 1;
      if(c == '?' || c == 'A' + j) m2 = 1;
      else m2 = 0;
      dp.at(i).at(j) = dp.at(i+1).at(j)*m1 + dp.at(i+1).at(j+1)*m2;
    }
  }
  cout << dp.at(0).at(0).x << endl;
  return 0;
}

Measured memory_bytes: 7424
# ABC155 A
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(str, input().split())
nl = lambda: list(map(int, input().split()))
a,b,c=nm()
d=set()
d.add(a)
d.add(b)
d.add(c)
if len(d)==2:
    print('Yes')
else:
    print('No')

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

int main() {
  int N, K;
  cin >> N >> K;
  int d, A;
  set<int> notrick{};
  for (int i = 0; i < K; i++){
    cin >> d;
    for (int j = 0; j < d; j++){
      cin >> A;
      notrick.insert(A);
    }
  }
  cout << N - notrick.size() << endl;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb               push_back
#define sz(c)            (int)c.size()
#define len(c)           (int)c.length()
#define vec              vector
#define int              long long int
#define mp(x,y)          make_pair(x,y)
#define all(c)           c.begin(), c.end()
#define rall(c)          c.rbegin(), c.rend()
#define trav(a,i)        for(auto& i: a)
#define loop(n,i,a)      for(int i=a;i<n;i++)
#define invect(v,n)       for(int i=0;i<n;i++ ){int arb;cin>>arb;v.pb(arb);}
#define inset(s,n)        loop(n,i,0){int aset;cin>>aset;s.insert(aset);}
#define display(c)        trav(c,i) cout<<i<<" ";
#define F                 first
#define S                 second
#define pii               pair<int,int>
#define pp               pop_back
#define endl              "\n"
#define copy(a,b)         copy(all(a),back_inserter(b));
#define intersect(a,b,w)    set_intersection(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define union(a,b,w)      set_union(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define diff(a,b,w)       set_difference(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define symdiff(a,b,w)    set_symmetric_difference(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
//int m=10000009;
//int arr[100000];
#define M                   1000000007
#define mm  998244353  
//set<int> st;
bool palin(string s , int l , int r)
{
    int f = 1;
    for(int i=l;i<=(r-l+1)/2;i++)
    {
        if(s[i] != s[r-i])
            f = 0;
    }
    return f;
}
signed main()
{
    fast
    string s;
    cin>>s;
    int n = sz(s);
    if(palin(s,0,n/2-1) && palin(s,n/2+1,n-1) && palin(s,0,n-1)) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

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);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int A = in.nextInt();
			int B = in.nextInt();
			int C = in.nextInt();
			int K = in.nextInt();
			int tmp = Math.max(A, Math.max(B, C));
			int total = A + B + C - tmp;
			for(int i = 0; i < K; i++) {
				tmp *= 2;
			}
			total += tmp;
			out.println(total);
		}
	}
		
	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: 22740
#include <bits/stdc++.h>
using namespace std;

int main(){
    int k, s;
    cin >> k >> s;
    long long sum=0;

    for (auto x = 0; x < k+1; x++)
    {
        for (auto y = 0; y < k+1; y++)
        {
            int z = s - x - y;
            if(z >= 0 && z<=k){
                sum += 1;
            }
        }
        
    }

    cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORe(i, k, n) for(int i = (k); i <= (n); i++)
#define FORr(i, k, n) for(int i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(int i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

const int INF = 1001001001;

bool a[31][30];

int main(void){
  int n, m;
  cin >> n >> m;
  REP(i, m) a[0][i] = true;
  REP(i, n){
    int k;
    cin >> k;
    REP(j, k){
      int t;
      cin >> t;
      t--;
      a[i+1][t] |= a[i][t];
    }
  }
  int ans = 0;
  REP(i, m) if(a[n][i]) ans++;
  cout << ans << endl;
  return 0;
}

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

int main() {
    string s; cin >> s;
    const int n = s.size();
    int ans = 0;
    bool ng = false;
    int dir = 0;
    for(int i = 0; i < n; ++i) {
        if(s[i] == 'R') {
            dir = (dir + 1) % 4;
            if(dir == 0) {
                ans += !ng;
                ng = false;
            }
        } else {
            dir = (dir + 3) % 4;
            if(dir == 3) {
                ng = true;
            }
            if(dir == 0) {
                ng = false;
            }
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 3180
#include<stdio.h>
#include<math.h>

long long queue[500000];

int main(){
  int i;
  int k;
  int head;
  int tail;
  long long x;

  for(i = 1;i <= 9;i++) queue[i] = i;

  scanf("%d", &k);

  head = 1;
  tail = 10;

  for(i = 1;i < k;i++){
    x = queue[head++];

    if((x % 10) != 0)
      queue[tail++] = x*10 + (x % 10) - 1;

    queue[tail++] = x*10 + (x % 10);

    if((x % 10) != 9)
      queue[tail++] = x*10 + (x % 10) + 1;
  }

  printf("%lld\n", queue[head]);

  return 0;
}


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

A = list(map(int, input().split()))

A = list(sorted(A))

a = A[-1]
b = a//2
ans = 0
if n == 2:
    print(a, A[0])
else:
    m = A[-1]
    for i in A[:-1]:
        if m >= abs(b - i):
            m = abs(b - i)
            ans = i

    print(a, ans)


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

int main()
{
   int k;
   cin>>k;
   string s;
   cin>>s;
   if(s.length()<=k){
      cout<<s<<endl;
   }
   else {
      s.erase(k,s.length()-k);
      s+="...";
      cout<<s<<endl;
   }
   return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
const int mod = 1e9+7, A = 1e3+5;

int main()
{
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int a, b, c;
  	cin >> a >> b >> c;
  cout << c << ' ' << a << ' ' << b;
	
	return 0;
}


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

sc = ["" for i in range(0, 26)]
tc = ["" for i in range(0, 26)]
scf = False
tcf = False
for i in range(0, len(s)):
    sci = sc[ord(s[i]) - ord('a')]
    if sci != "" and t[i] != sci:
        print("No")
        scf = True
        break
    else:
        sc[ord(s[i]) - ord('a')] = t[i]

if not scf:
    for i in range(0, len(t)):
        tci = tc[ord(t[i]) - ord('a')]
        if tci != "" and s[i] != tci:
            print("No")
            tcf = True
            break
        else:
            tc[ord(t[i]) - ord('a')] = s[i]
    if not tcf:
        print("Yes")

Measured memory_bytes: 3760
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#define debug(x) cerr << __LINE__ << ' ' << #x << ':' << x << '\n'
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
template<class T> using pque = priority_queue<T, vector<T>, greater<T>>;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr int mod1e9 = 1000000007;
constexpr int mod998 = 998244353;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
constexpr ll ten(int n) { return n ? 10 * ten(n - 1) : 1; };
int dx[] = { 1,0,-1,0,1,1,-1,-1 }; int dy[] = { 0,1,0,-1,1,-1,1,-1 };
void fail() { cout << "-1\n"; exit(0); }
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }
template<class T> istream &operator >> (istream &s, vector<T> &v) { for (auto &e : v) s >> e; return s; }
template<class T> ostream &operator << (ostream &s, const vector<T> &v) { for (auto &e : v) s << e << ' '; return s; }

struct fastio {
	fastio() {
		cin.tie(0); cout.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(20);
		cerr << fixed << setprecision(20);
	}
}fastio_;

class unionfind {
	vector<int> par;
	vector<int> sz;
public:
	unionfind(int n) {
		par = vector<int>(n);
		for (int i = 0; i < n; i++) par[i] = i;
		sz = vector<int>(n, 1);
	}
	int find(int x) {
		if (par[x] == x) return x;
		else return par[x] = find(par[x]);
	}
	int size(int x) { return sz[find(x)]; }
	bool same(int x, int y) { return find(x) == find(y); }
	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return;
		if (sz[x] < sz[y]) {
			par[x] = y;
			sz[y] += sz[x];
		}
		else {
			par[y] = x;
			sz[x] += sz[y];
		}
	}
};

int main() {
	int n, q;
	cin >> n >> q;
	unionfind d(n);
	while (q--) {
		int t, u, v;
		cin >> t >> u >> v;
		if (t == 0) d.unite(u, v);
		else cout << d.same(u, v) << '\n';
	}
}

Measured memory_bytes: 4620
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if(abs(a-c)<=d || (abs(a-b) <= d && abs(b-c) <= d)){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <cstdlib>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <tuple>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repd(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define repdm(i, a, b) for (ll i = (ll)(a); i > (ll)(b); i--)
const ll INF = 1LL << 60;

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;
}

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

  ll h[N];
  rep(i, N) cin >> h[i];

  ll dp[N];
  rep(i, N) dp[i] = INF;
  dp[0] = 0;

  repd(i, 1, N)
  {
    chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
    if (i == 1)
      continue;
    chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
  }
  cout << dp[N - 1];
}


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

int n, a, b;

int main(void){
	cin >> n >> a >> b;
	int ans = 0;
	for(int i = 1; i <= n; i++){
		int x = i;
		int s = 0;
		while(x){
			s+=x%10;
			x/=10;
		}
		if(a <= s && s <= b) ans+=i;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3636
#include<stdio.h>
int partition(int A[],int p,int r);
int main()
{
  int i,j,n,x,q,tmp,r;
  scanf("%d",&n);
  int A[n+1];
  for(i=1;i<=n;i++){
    scanf("%d",&A[i]);
  }
  //partition(a,1,n);
  r=n;
   x=A[r];
  i=0;
  for(j=1;j<r;j++){
    if(A[j]<=x){
      i=i+1;
      tmp=A[i];
      A[i]=A[j];
      A[j]=tmp;
    }
  }
  tmp=A[i+1];
  A[i+1]=A[r];
  A[r]=tmp;
  q=i+1;
  for(i=1;i<=n;i++){
    if(i==q)printf("[");
    printf("%d",A[i]);
    if(i==q)printf("]");
    if(i!=n)printf(" ");
  }
  printf("\n");
  return 0;
}
/*int partition(int A[],int p,int r){
  int x,i,j,tmp;
  x=A[r];
  i=p-1;
  for(j=p;j<r;j++){
    if(A[j]<=x){
      i=i+1;
      tmp=A[i];
      A[i]=A[j];
      A[j]=tmp;
    }
  }
  tmp=A[i+1];
  A[i+1]=A[r];
  A[r]=tmp;
  return i+1;
  }*/



Measured memory_bytes: 2108
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

#define _USE_MATH_DEFINES

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <unordered_map>
#include <stack>
#include <list>
#include <math.h>
#include <bitset>
#include <iterator>
#include <map>
#include <iomanip>
#include <functional>
#include <string>
#include <algorithm>
#include <queue>
#include <random>
#include <numeric>
#include <set>
#include <cassert>
#include <cmath>
#include <cinttypes>

using namespace std;

template<class T> ostream& operator<<(ostream& os, const vector<T>& v) {
	for (auto i = begin(v); i != end(v); i++) os << *i << (i == end(v) - 1 ? "" : " "); return os;
}
template<class T> istream& operator>>(istream& is, vector<T>& v) {
	for (auto i = begin(v); i != end(v); i++) is >> *i; return is;
}
template<class T> T read_val() { throw 1; }
template<> int read_val() { int tmp; scanf("%" PRId32, &tmp); return tmp; }
template<> long long read_val() { long long tmp; scanf("%" PRId64, &tmp); return tmp; }
auto read_int = read_val<int>; auto read_long = read_val<long long>;
template<class T> void scanf_vec(vector<T>& vec) { for (int i = 0; i < vec.size(); i++) vec[i] = read_val<T>(); }

#define MOD 1000000007
#define inf 2000000000
#define FWT_SIZE 2000000
#define pii pair<int,int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define sort_all(x) sort(all(x))
#define make_unique(x) (x).erase(unique(all(x)), (x).end())



int main() {

#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

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

	int n, k;
	cin >> n >> k;
	vector<int> p(n);

	cin >> p;
	stack<int> min_p;
	int nearest = n, ans = 0, been_none=0;
	set<int> ss;
	for (int j = p.size() - 1; j >= 0; j--)
	{
		if (j + k < n)
			ss.erase(p[j + k]);

		while (min_p.size() > 0 && p[min_p.top()] >= p[j])
			min_p.pop();

		bool changes = false;
		if (min_p.size() > 0 && p[j] > p[min_p.top()])
		{
			changes = min_p.top() < j + k;
			nearest = min(nearest, min_p.top());
		}
		if (j + k < n && p[j + k] < *ss.rbegin())
			changes = true;

		min_p.push(j);
		ss.insert(p[j]);

		if (j + k - 1 < n && nearest < j + k && (j+k==n || changes))
		{
			ans++;
		}

		if (j + k - 1 < n && nearest >= (j + k))
			been_none = 1;
	}

	cout << ans+been_none;

	return 0;
}

Measured memory_bytes: 10368
n = int(input())
L = [int(input()) for i in range(5)]
ans = 5

max_ = -1
for l in L:
    if n <= l:
        continue
    else:
        q, r = divmod(n, l)
        if r == 0:
            max_ = max(max_, q-1)
        else:
            max_ = max(max_, q)
if max_ != -1:
    ans += max_
print(ans)


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



int main() {
	int n;
	cin>>n;
	char c[20];
	string s;
	map<string,bool>A;
	for(int i=0;i<n;i++){
		cin>>c;
		if(c[0]=='i'){
			cin>>s;
			A[string(s)]=true;
		}
		else if(c[0]=='f'){
			cin>>s;
			if(A[string(s)]){
				cout <<"yes"<<endl;
			}
			else{
				cout << "no"<<endl;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 52620
import math
A,B = map(int,input().split())

a = math.ceil(A/0.08)
b = math.ceil(B/0.1)
a2 = math.ceil((A+1)/0.08)
b2 = math.ceil((B+1)/0.1)
ans = max(a,b)
if a > b:
    if a >= b2:
        ans = -1
else:
    if b >= a2:
        ans = -1
print(int(ans))

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
  static final int INF = Integer.MAX_VALUE / 2;
  static int n;
  static int[] a;

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

    n = sc.nextInt();
    a = new int[n];
    for(int i = 0; i < n; i++){
      a[i] = sc.nextInt();
    }

    int min = INF;
    for(int i = -100; i <= 100; i++){
      int sum = 0;
      for(int j = 0; j < n; j++){
        sum += (a[j] - i) * (a[j] - i);
      }
      min = Math.min(min, sum);
    }

    System.out.println(min);
  }
}

Measured memory_bytes: 9676
#include <bits/stdc++.h>
#define ll long long
#define  p push_back
#define rep(i,j,n) for(ll i=j;i<n;i++)
#define MOD 1000000009
#define babo ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
int main()
{
	babo
    // ll t;cin>>t;while(t--)
    {
    	ll n,i;
    	cin>>n;
    string s ;
    s="ACL";
    for(i=0;i<n;i++)
    cout<<s;
    cout<<"\n";
    }
    // }
}


Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<unordered_map>
#include<unordered_set>

using namespace std;
typedef long long int ll;typedef pair<int, int> P;
const long long mod = 1e9 + 7;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define ALL(a) (a).begin(),(a).end()



int main(void) {
	int n; cin >> n;
	int ans = 0;
	int count = 0;
	for (int hi = 1; hi <= n; hi+=2) {
		for (int wi = 1; wi <= hi; wi++) {
			if (hi % wi == 0)count++;
		}
		if (count == 8)ans++;
		count = 0;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define FILE_READ_IN freopen("input.txt","r",stdin);
#define FILE_READ_OUT freopen("output.txt","w",stdout);
#define Fast ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define deb(x) cout<<#x<<" "<<x<<endl;
#define all(v) v.begin(),v.end()
#define endl '\n'
using namespace std;

void judge() {
#ifndef ONLINE_JUDGE
	FILE_READ_IN
	FILE_READ_OUT
#endif
}
const int N = 5e5 + 1;
int tree[N];
int n;

void update(int a, int val) {
	for (int i = a; i <= n; i += (i & (-i))) {
		tree[i] += val;
	}
}

int quer(int a) {
	int ans = 0;
	for (; a >= 1; a -= (a & (-a))) {
		ans += tree[a];
	}
	return ans;
}

int main() {
	Fast;
	int t = 1;
	judge();
	// cin >> t;
	while (t--) {
		int q;
		cin >> n >> q;
		set<int> s;
		int c[n + 1];
		for (int i = 1; i <= n; i++) {
			cin >> c[i];
		}
		int ans[q];
		unordered_map<int, vector<pair<int, int>>> query;
		unordered_map<int, int> last;
		for (int i = 0; i < q; i++) {
			int l, r;
			cin >> l >> r;
			query[r].push_back({l, i});
		}
		for (int i = 1; i <= n; i++) {
			if (last.count(c[i]))update(last[c[i]], -1);
			update(i, 1);
			last[c[i]] = i;
			for (auto j : query[i]) {
				ans[j.second] = quer(i) - quer(j.first - 1);
			}
		}
		for (int i = 0; i < q; i++) {
			cout << ans[i] << endl;
		}
	}
}

Measured memory_bytes: 66792
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef unsigned long long ull;

const int MOD = 1000000007 ; //  , 1000000009 , 1000000023 ,998244353
const ll INF = ll(1e18);
const ld PI = 4*atan((ld)1);

ll power(ll x,ll n) {
  ll result=1;
  while(n>0){
    if(n&1)result = (result * x)%MOD;
    x=(x*x)%MOD;
    n >>= 1;
  }
  return result%MOD;
}
ll gcd(ll a,ll b){
  if(a==0)return b;
  return gcd(b%a,a);
}
int main() {
  #ifdef AVI  
    freopen("input.txt" , "r" , stdin);
  #endif
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(20);

  ll n,m;
  cin >> n >> m;
  vector<ll>ar(n+1,0) , dp(n+1);
  for(ll i=0 ; i<m ; i++){
    ll x;
    cin >> x;
    ar[x] = -1;
  } 
  dp[0] = 1 ;
  if(ar[1]==-1)dp[1] = 0;
  else dp[1] = 1;
  for(ll i=2 ; i<=n ; i++){
    if(ar[i]==-1){dp[i] = 0;continue;}
    dp[i] = dp[i-1] + dp[i-2];
    dp[i] %= MOD;
  }
  cout << dp[n]%MOD;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using Int = long long;

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;

//少数点表示
//cout <<std::fixed << std::setprecision(14)

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

    string s;
    cin >> s;
    int ss=s.size();
    bool af=false,bf=false;
    rep(i,ss){
        if(s[i]=='A'){
            af=true;
        }
        if(s[i]=='B'){
            bf=true;
        }
    }
    if(bf && af){
        cout << "Yes";
    }else{
        cout << "No";
    }

}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

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

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

const int MAX = 100'000 + 5;
vector<bool> isPrime(MAX, true);

void init() {
  isPrime[0] = isPrime[1] = false;
  for (int i = 2; i*i <= MAX; i++) {
    if (!isPrime[i]) continue;
    for (int j = i*i; j <= MAX; j+=i) {
      isPrime[j] = false;
    }
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << std::setprecision(10);

  init();
  vi vec(MAX);
  for (int x = 1; x < MAX; x+=2) {
    int xx = (x+1)/2;
    if (isPrime[x] && isPrime[xx]) vec[x]++;
  }
  srep(i, 1, MAX) vec[i] += vec[i-1];
  int q; std::cin >> q;
  rep(i, q) {
    int l, r; std::cin >> l >> r;
    int x = vec[r];
    if (l > 0) x -= vec[l-1];
    std::cout << x << "\n";
  }
}


Measured memory_bytes: 1024
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <string>
#include <limits>
#include <algorithm>
#include <map>
#include <sstream>

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
static ull tenq = 1000000000;
static ull mod = tenq + 7;

using namespace std;

int main()
{
  ll N;
  cin >> N;
  vector<ll> as(N + 2);
  as[0] = 0;
  for(auto i = 1; i <= N; i++) cin >> as[i];
  as[N+1] = 0;

  ll total = 0;
  for (auto i = 1; i < as.size(); i++) total += abs(as[i] - as[i-1]);
  for (auto i = 1; i <= N; i++) {
    auto cost = total + abs(as[i-1] - as[i+1]) - abs(as[i] - as[i-1]) - abs(as[i+1] - as[i]);
    cout << cost << endl;
  }

  return 0;
}


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

#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define SP << " " <<

typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;

const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const int INF = (1LL << 60); // 1152921504606846976
const double EPS = (1 >> 30);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> inline T ceil(T a, T b) {return T((a + b - 1)/b);}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }

int nmax=200000; // 2*(10^5)
vvec g(nmax);

vector<int> divisor(const int n){
  vector<int> ret;
  for(int i=1;i*i<=n;i++){
    if(n % i == 0){
      ret.push_back(i);
      if(i*i!= n) ret.push_back(n/i);
    }
  }
  sort(ret.begin(),ret.end());
  return ret;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------

    int n;
    cin>>n;
    vec x=divisor(n);
    int ans=0;
    for(auto f:x){
        if(f==1) continue;
        int memo=n/(f-1);
        if(memo==n%(f-1)) ans+=f-1;
    }
    cout<<ans<<endl;
}

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

using namespace std;

const int MAXN = 1e5 + 10;

int n, m, ans, cnt[MAXN], cc[MAXN];
vector<int>	vec[MAXN];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m;
	for (int i = 0; i < n; i++){
		int x;	cin >> x;	cnt[x]++;
		vec[x % m].push_back(x);
	}
	for (int i = 0; i < m; i++)
		cc[i] = vec[i].size();
	for (int i = 0; i < MAXN; i++){
		sort(vec[i].begin(), vec[i].end());
		vec[i].resize(unique(vec[i].begin(), vec[i].end()) - vec[i].begin());
	}

	ans = cc[0]/2;
	
	for (int i = 1; i < m; i++){
		if (m-i < i)	continue;
		if (m-i == i){
			ans += cc[i]/2;
			continue;
		}

		ans += (cc[i] + cc[m-i])/2;

		int c1 = 0, c2 = 0;
		for (int u:vec[i])
			if (cnt[u]&1)	c1++;
		for (int u:vec[m-i])
			if (cnt[u]&1)	c2++;

		int mn = min(c1, c2);
		int t = 0;
		for (int u:vec[i])
			if (cnt[u]&1){
				cnt[u]--;
				t++;
				if (t == mn)	break;
			}
		t = 0;
		for (int u:vec[m-i])
			if (cnt[u]&1){
				cnt[u]--;
				t++;
				if (t == mn)	break;
			}

		c1 -= mn;
		c2 -= mn;
		cc[i] -= mn;
		cc[m - i] -= mn;

		if (c1 & 1)	c1--;
		if (c2 & 1)	c2--;

		if (c1){
			if (cc[m-i] < c1)
				ans -= (c1 - cc[m-i])/2;
		}
		else if (c2){
			if (cc[i] < c2)
				ans -= (c2 - cc[i])/2;
		}
	}

	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 6528
def count_two(n):
  count = 0
  while n % 2 == 0:
    count += 1
    n //= 2
  return count

def main():
  N = int(input())
  ans = 1
  maxv = 0
  for i in range(1, N + 1):
    tmp = count_two(i)
    if tmp > maxv:
      maxv = tmp
      ans = i
  print(str(ans))
    
if __name__ == '__main__':
  main()


Measured memory_bytes: 3060
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
b = b + [0]
res = 0
prev = 0

for ai, bi in zip(a, b):
    if (prev + bi) > ai:
        res += ai
        tmp = ai - prev
        if tmp < 0:
            prev = bi
        else:
            prev = max(0, bi - tmp)
    else:
        res += prev + bi
        prev = 0

print(res)


Measured memory_bytes: 18468
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
#define rall(a) (a).rbegin(),(a).rend()
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    int n, m; cin >> n >> m;

    vector<int> a(m);
    rep(i,m) a[i] = 0;

    rep(i,n){
        int k;  cin >> k;
        rep(j,k){
            int b; cin >> b; b--;
            a[b]++;
        }
    }

    int ans = 0;

    rep(i,m){
        if(a[i] == n) ans++;
    }

    dunk(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

typedef struct Point{
    double x, y;
} Point;


int main(){
    int n;
    cin >> n;
    vector<Point> p(n);
    rep(i,n) {
        double x, y;
        cin >> x >> y;
        p[i] = Point{x, y};
    }

    vector<int> s(n);
    rep(i,n) s[i] = i;
    double dis = 0;
    int cnt = 0;
    do{
        for(int i = 0; i < n-1; i++){
            int sp = s[i], ep = s[i+1];
            dis += sqrt((p[ep].x - p[sp].x)*(p[ep].x - p[sp].x) + (p[ep].y - p[sp].y)*(p[ep].y - p[sp].y));
        }
        cnt++;
    } while(next_permutation(all(s)));
    printf("%.7f\n", dis/cnt);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<int> VI;
const ll MOD = 1000000007;
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a - b >= c)
		cout << 0;
	else
		cout << c - (a - b);
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1003;
int n,a[MaxN];

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

Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long int a[200007];
int main(){
    int n;
    long long int i,j,k;
    long long int c,d,s;
    cin>>n;
    for(i=0,c=0;i<n;i++){
        cin>>a[i];
        c+=a[i];
    }
    s=-1;
    for(i=0,k=0;i<n-1;i++){
        k+=a[i];
        d=c-2*k;
        if(d<0)d=-d;
        if(d<s || s==-1)s=d;
    }
    cout<<s<<endl;
    return 0;
   }


Measured memory_bytes: 1792
#include<iostream>
#include<string>
using namespace std;
int main()
{
    long long k;
    string s;
    cin >> s >> k;
    for(unsigned int i = 0; i < s.size() && i < k; i++){
        if(s[i] != '1'){
            cout << s[i] << endl;
            return 0;
        }
    }
    cout << '1' << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*

const val MOD = 1000000007L
const val INF = Long.MAX_VALUE - 1

fun main(args: Array<String>) {
    val s = readList().first()

    var count = 0
    var prev = ""
    var now = ""
    s.forEach {
        now += it
        if (prev == now) {
        } else {
//            println(prev)
            prev = now
            now = ""
            count++
        }
    }
    println(count)
}

fun readList() = readLine()!!.split(' ')


inline fun Int.rep(start: Int = 0, shiftLast: Boolean = false, body: (Int) -> Unit) {
    for (i in start until if (shiftLast) this + start else this) {
        body(i)
    }
}

inline fun Long.rep(start: Long = 0, shiftLast: Boolean = false, body: (Long) -> Unit) {
    for (i in start until if (shiftLast) this + start else this) {
        body(i)
    }
}

fun <K, V> Map<K, V>.toMutableMap(): MutableMap<K, V> {
    return HashMap(this)
}

Measured memory_bytes: 45732
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    csf = [list(map(int, input().split())) for _ in range(n - 1)]

    for i in range(n):
        if i == n - 1:
            print(0)
        else:
            x = csf[i][1]
            for j in range(i + 1, n - 1):
                cj1, sj1, fj1 = csf[j - 1]
                cj, sj, fj = csf[j]
                # print(i, j, x, csf[j - 1], csf[j])
                if x + cj1 + (fj1 - x % fj1) % fj1 <= sj:
                    x = sj
                else:
                    x += cj1 + (fj1 - x % fj1) % fj1
            x += csf[-1][0] + (csf[-1][2] - x % csf[-1][2]) % csf[-1][2]
            print(x)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


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

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

int main() {
  long A,B,g,cnt=1;
  cin >> A >> B;
  g = gcd(A, B);

  for(long i=2;i*i<=g;i++){
    if(g%i==0){cnt++;}
    while(g%i==0){g /= i;}
  }
  if(g>1){cnt++;}
  cout << cnt << endl;
  
  return 0;
}

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

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

Node *root, *NIL;

void insert(int key) {
  Node *y = NIL;
  Node *x = root;
  Node *z = new Node();
  z->key = key;

  while (x != NIL) {
    y = x;
    if (z->key < x->key) {
      x = x->left;
    } else {
      x = x->right;
    }
  }
  z->parent = y;

  if (y == NIL) {
    root = z;
  } else if (z->key < y->key) {
    y->left = z;
  } else {
    y->right = z;
  }
}

void deleteNode(Node *node) {
  Node *target, *child;
  if (node->left == NIL || node->right == NIL) {
    target = node;
  } else {
    target = node->right;
    while (1) {
      if (target->left == NIL) {
        break;
      }
      target = target->left;
    }
  }

  if (target->left != NIL) {
    child = target->left;
  } else {
    child = target->right;
  }
  if (child != NIL) {
    child->parent = target->parent;
  }

  if (target->parent == NIL) {
    root = child;
  } else if (target == target->parent->left) {
    target->parent->left = child;
  } else {
    target->parent->right = child;
  }

  if (target != node) {
    node->key = target->key;
  }

  delete target;
}

Node* find(Node *node, int key) {
  while (node != NIL && key != node->key) {
    if (key < node->key) {
      node = node->left;
    } else {
      node = node->right;
    }
  }
  return node;
}

void printPreorder(Node *node) {
  cout << " " << node->key;
  if (node->left != NIL) printPreorder(node->left);
  if (node->right != NIL) printPreorder(node->right);
}

void printInorder(Node *node) {
  if (node->left != NIL) printInorder(node->left);
  cout << " " << node->key;
  if (node->right != NIL) printInorder(node->right);
}

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

  int n;
  cin >> n;

  string command;
  int v;
  for (int i = 0; i < n; i++) {
    cin >> command;
    if (command == "insert") {
      cin >> v;
      insert(v);
    } else if (command == "find") {
      cin >> v;
      if(find(root, v) == NIL) {
        cout << "no" << endl;
      } else {
        cout << "yes" << endl;
      }
    } else if (command == "delete") {
      cin >> v;
      deleteNode(find(root, v));
    } else if (command  == "print") {
      printInorder(root);
      cout << endl;
      printPreorder(root);
      cout << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 21908
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os << "[ "; 
	for(auto v:V)os << v << " "; return os << "]";
}
template<class T> ostream& operator<<(ostream &os, set<T> S){ os << "{ "; 
	for(auto s:S) os<<s<<" ";  return os<<"}"; 
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
	return os<<"("<<P.first<<","<< P.second << ")";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {
	os<<"{ ";for(auto m:M)os<<"("<<m.F<<":"<<m.S<<")";
	return os<<"}";
}
#define cerr cout
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
#define ll long long
#define ld long double
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define I insert 
#define pb push_back
#define F first
#define S second
#define endl "\n"
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define For(i,n) for(int i=0;i<(int)n;++i)
#define Rev(i,n) for(int i=(int)n-1;i>=0;--i)
#define Rep(i,n) for(int i=1;i<=(int)n;++i)
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpii;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int n , m , q;
const int N = 55;

int A[N];
int a[N] , b[N] , c[N] , d[N];
int mx;
int ans[N];

void upd(){
	int as = 0;
	for(int i = 1 ;i <=q ; ++i){
		if(A[b[i]]-A[a[i]] == c[i]){
			as += d[i];
		}
	}
	if(as > mx){
		mx = as;
		// for(int i = 1;i <= n ; ++i)
			// ans[i] = A[i];
	}
}

void recurse(int i ,int prev){
	// trace(i , prev);
	if(i == n+1){
		upd();
		return;
	}
	for(int j = prev ; j <= m ; ++j){
		A[i] = j;
		// trace(A[i]);
		recurse(i+1 , j);
	}
}

int main(){
	fio; cout<<fixed<<setprecision(25);	
	 cin >> n >> m >> q;
	 for(int i =1 ;i <= q ; ++i){
	 	cin >> a[i] >> b[i] >> c[i] >> d[i];
	 }
	 recurse(1 , 1);
	cout << mx << endl;






	return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
 using namespace std;
 int main() {
 int A, B, M;
 cin >> A >> B >> M;
 vector<int> a(A);
 vector<int> b(B);
 for (int i = 0; i < A; i++)cin >> a[i];
 for (int i = 0; i < B; i++)cin >> b[i];
 int minA = *min_element(a.begin(), a.end());
   int minB = *min_element(b.begin(), b.end());
 int ans = minA+minB;
 for (int i = 0; i < M; i++) {
 int x, y, c;
 cin >> x >> y >> c; x--; y--;
 ans = min(ans, a[x] + b[y] - c);
 }
 cout << ans << endl;

 }

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
const long long INF = 1e7+1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector < pair<ll, ll > > vp;
typedef vector <string> vs;
typedef vector <char> vc;
typedef list <ll> lst;

ll n, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

/*--------------------template--------------------*/


int main()
{
	cin >> n;
	vc v(n);
	REP(i, n) cin >> v[i];
	REP(i, n)
	{
		if (v[i] == '(') {
			cnt++;
		} else {
			if(cnt>0) {
				cnt--;
			}else {
				sum++;
			}
		}
	}
	if(sum>0) {
		REP(i,sum)
		{
			cout << '(';
		}
	}
	REP(i,n)
	{
		cout << v[i];
	}
	if(cnt>0) {
		REP(i,cnt)
		{
			cout << ')';
		}
	}
	cout << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		long n = in.nextLong();
		System.out.println(solve(n));
		in.close();
	}

	private static long solve(long n) {
		long r = 0;
		for (long i = 1; i < n; i++) {
			long m = n / i;
			if (m <= i + 1)
				break;
			if (n % i == 0)
				r += m - 1;
		}
		return r;
	}
}

Measured memory_bytes: 23892
import sys
input = sys.stdin.readline

N = int(input())

# 集合　listよりも 検索などが高速
# 重複なしの順序も無し
ans_set = set()

for i in range(N):
    A = int(input())
    if A in ans_set:
        ans_set.remove(A)
    else:
        ans_set.add(A)

print(len(ans_set))

Measured memory_bytes: 11884
N,M=[int(x) for x in raw_input().split()]
inr=[[] for i in range(N+1)]
our=[[] for i in range(N+1)]
parent=[-1 for i in range(N+1)]
for i in range(N+M-1):
    a,b=[int(x) for x in raw_input().split()]
    inr[b].append(a)
    our[a].append(b)
sizein = [len(inr[x]) for x in range(1,N+1)]
#+1
root= sizein.index(0)+1
parent[root]=0
candset=[ [our[root],root] ]
while(len(candset)>0):
    newcandset=[]
    for cands in candset:
        for c in cands[0]:
            if len(inr[c])==1:
                parent[c]=cands[1]
                newcandset.append( [our[c],c] )
            else:
                inr[c].remove(cands[1])
        candset=newcandset[:]
for i in range(1,N+1):
    print parent[i]


Measured memory_bytes: 135068
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	defer flush()

	N := readInt()
	M := readInt()
	Q := readInt()

	t := make([][]int, N+1)
	for i := 0; i < N+1; i++ {
		t[i] = make([]int, N+1)
	}

	for i := 0; i < M; i++ {
		L := readInt()
		R := readInt()
		t[L][R]++
	}

	for i := 0; i < N+1; i++ {
		for j := 0; j < N; j++ {
			t[i][j+1] += t[i][j]
		}
	}

	for i := 0; i < N; i++ {
		for j := 0; j < N+1; j++ {
			t[i+1][j] += t[i][j]
		}
	}

	for i := 0; i < Q; i++ {
		p := readInt()
		q := readInt()
		println(t[q][q] + t[p-1][p-1] - t[p-1][q] - t[q][p-1])
	}
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}

var stdoutWriter = bufio.NewWriter(os.Stdout)

func flush() {
	stdoutWriter.Flush()
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdoutWriter, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdoutWriter, args...)
}


Measured memory_bytes: 6400
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#define int long long

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define FOR(i,a,b) for(int i=(a), i##_len=(b);i< i##_len; ++i)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define INF (3e15)

using namespace std;

int A, B, C;
int K;

signed main()
{
    cin >> A >> B >> C;
    cin >> K;
    if ( A > B && A > C)
    {
        cout << A * pow(2, K) + B + C << endl;
    }
    else if ( B > A &&  B > C)
    {
        cout << B * pow(2, K) + A + C << endl;
    }
    else
    {
        cout << C * pow(2, K) + A + B << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
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 __shangu__
 */
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);
        CGrandGarden solver = new CGrandGarden();
        solver.solve(1, in, out);
        out.close();
    }

    static class CGrandGarden {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt(), a[] = new int[n];
            for (int i = 0; i < n; ++i) a[i] = in.nextInt();
            int ans = 0;
            for (int i = 1; i <= 100; ++i) {
                int pos = 0;
                while (pos < n) {
                    while (pos < n && a[pos] < i) ++pos;
                    if (pos == n) break;
                    while (pos < n && a[pos] >= i) ++pos;
                    ++ans;
                }
            }
            out.println(ans);
        }

    }

    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: 22356