akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <climits>
#include <set>
using namespace std;
#define repn(i,s,n) for (int i=int(s); i < int(n); i++)
#define rep(i,n) repn(i,0,n)
#define repd(i,n) for (int i=int(n)-1; i >= 0; i--)

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef VVI Graph;
typedef long long ll;


ll doIt(ll a, ll b) {
  if (a == 0 || b == 0) return -max(a, b);  // we walked too much
  ll ret;
  if (a < b) {
    ret = b / a * a * 2;
    ret += doIt(a, b % a);

  }
  else {
    ret = a / b * b * 2;
    ret += doIt(a % b, b);
  }
  return ret;
}

int main() {
  ios::sync_with_stdio(false);

  ll n, x;
  cin >> n >> x;
  ll ans = 0;
  // step 1
  ans += x;
  // step 2
  ans += n - x;
  // now we got a parallelogram

  ans += doIt(n - x, x);
  cout << ans << endl;

  return 0;
}


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

int main() {
  int R;
  cin >> R;
  if(R < 1200) {
    cout << "ABC" << endl;
  } else if(R < 2800) {
    cout << "ARC" << endl;
  } else {
    cout << "AGC" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
{-# LANGUAGE ViewPatterns #-}

import           Control.Monad.Trans.State.Strict
import           Data.Foldable
import           Data.Sequence

main :: IO ()
main = interact $ toList . flip execState empty . mapM_ pressKey

pressKey :: Char -> State (Seq Char) ()
pressKey 'B' = modify delete
pressKey key = modify (|> key)

delete :: Seq Char -> Seq Char
delete (viewr -> EmptyR) = empty
delete (viewr -> s :> c) = s

Measured memory_bytes: 380
/* C++14 (Clang 3.8.0) for AtCoder */

#include <iostream>
#include <vector>
#include <string>
// #include <cmath>
// #include <math.h>
// #include <algorithm>
// #include "./Debug.h"

namespace AtCoder {
	using Input = std::vector<std::string>;
	using Num = std::vector<int>;

	Input input(void) {
		Input result;
		{
			std::string buf = "", row = "";
			std::getline(std::cin, buf);
			for (unsigned int i = 0; i < buf.size(); i++) {
				if (' ' == buf[i]) {
					result.push_back(row);
					row = "";
				} else {
					row += buf[i];
				}
			}
			result.push_back(row);
		}
		return result;
	}

	Num replaceToInteger(Input original = { "" }) {
		Num result;
		for (unsigned int i = 0; i < original.size(); i++) {
			result.push_back(atoi(original[i].c_str()));
		}
		return result;
	}
}

int main(void) {

	AtCoder::Num s = AtCoder::replaceToInteger(AtCoder::input());

	int n = 0;
	n = s[0];
	
	int a1 = n * s[1];
	int a2 = s[2];

	if (a1 < a2) {
		printf("%d\n", a1);
	} else {
		printf("%d\n", a2);
	}

	return 0;
}


Measured memory_bytes: 888
n = int(input())
t = list(map(int,input().split()))
m = int(input())
px = [ list(map(int,input().split())) for _ in range(m) ]
import copy as c
for i in range(m):
    tmp = c.copy(t)
    tmp[px[i][0]-1] = px[i][1]
    print(sum(tmp))

Measured memory_bytes: 3540
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

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

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
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 ctoi(char c){return c-'0';}


// TODO: write
int main() {
  int n;cin>>n;
  vector<int> h(n);rep(i,n)cin>>h[i];
  
  int ans = 0;
  int cnt = 0;
  rep(i,n){
    if(i){
      if(h[i-1] < h[i]){
        chmax(ans,cnt);
        cnt = 0;
      }else cnt++;
    }
  }
  chmax(ans,cnt);
  print(ans);
  return 0;
}



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

using namespace std;

inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}

typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,n-1)

const double EPS = 1e-10;
const double PI = acos(-1.0);

int main() {
	int n, m;
	string str;

	while(cin >> n, n) {
		cin >> m >> str;
		str += "  ";
		int pos = 0, count = 0, sum = 0;
		
		while(pos < m) {
			if(str[pos] == 'I') {
				count = 0;
				while(str[pos+1] == 'O' && str[pos+2] == 'I') {
					count++;
					pos += 2;
				}
				sum += count>=n ? count-n+1 : 0;
			}
			pos++;
		}

		cout << sum << endl;
	}

	return 0;
}

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

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

const long long INF =1LL << 60;

int N;
long long h[1000010];

long long dp[1000010];

int main() {
  int N, K; cin >> N >> K;
  for (int i = 0; i < N; i++) cin >> h[i];
  
  for (int i = 0; i < N; i++) dp[i] = INF;
  
  dp[0] = 0;
  
  for (int i = 0; i < N; i++) {
    for (int j = 1; j <= K; j++) {
      chmin(dp[i + j], dp[i] + abs(h[i + j] - h[i]));
    }
  }
  
  cout << dp[N - 1] << endl;
}
    


Measured memory_bytes: 5120
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_set>
#include <bitset>
#include <time.h>
#include <limits.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define Fi first
#define Se second
#define pb push_back
#define szz(x) (int)x.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
typedef tuple<int, int, int> t3;

int N, M;
vector <int> E[100010];
vector <pii> ans;
int cnt[100010], color[100010];
void add_ans(int x, int y) { ans.pb(pii(x, y)); cnt[x] ^= 1;}

void dfs(int x, int fa) {
	color[x] = 1;
	for(int e : E[x]) if(e != fa) {
		if(color[e] == 0) {
			dfs(e, x);
			if(cnt[e]) add_ans(e, x);
			else add_ans(x, e);
		}
		else if(color[e] == 1) {
			add_ans(x, e);
		}
	}
	color[x] = 2;
}

int main() {
	scanf("%d%d", &N, &M);
	if(M % 2) { puts("-1"); return 0; }
	rep(i, M) {
		int x, y;
		scanf("%d%d", &x, &y);
		E[x].pb(y);
		E[y].pb(x);
	}
	dfs(1, -1);
	for(pii e : ans) printf("%d %d\n", e.Fi, e.Se);
	return 0;
}

Measured memory_bytes: 17908
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    ll N, K, Q;
    // N 参加者
    // Q 正解
    // K point
    cin >> N >> K >> Q;
    vector<ll> score(N, K - Q);
    vector<ll> A(Q);
    REP(i, Q) {
        cin >> A[i];
        A[i]--;
    }
    REP(i, Q) { score[A[i]] += 1; }
    REP(i, N) {
        if(score[i] <= 0) {
            cout << "No" << endl;
        } else {
            // cout << score[i] << endl;
            cout << "Yes" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 2176
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
using namespace std;

int main (void) {
  int N, L;
  cin >> N >> L;
  vector<string> strlist;
  for (int i=0; i<=N-1; i++) {
    string a;
    cin >> a;
    strlist.push_back(a);
  }
  sort( strlist.begin(), strlist.end() );
  for (int i=0; i<=N-1; i++) {
    cout << strlist[i];
  }
}

Measured memory_bytes: 256
def print_tmp(a_li):
    s = [str(a) for a in a_li]
    t = ' '.join(s)
    print(t)


n = int(input())
a = input()
A = [int(i) for i in a.split(' ')]
print_tmp(A)
for i in range(1, n):
    v = A[i]
    j = i -1
    while j >= 0 and A[j] > v:
        A[j+1] = A[j]
        j -= 1
    A[j+1] = v
    print_tmp(A)



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

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define fr(i,k) for(i=0;i<k;i++)
#define ALL(c) (c).begin(),(c).end()
#define deb(x) cerr<<#x<<"  = "<<x<<endl;
#define SZ(x) (x).size();
#define ll long long
#define MOD 1000000007
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define em emplace_back
#define ulli unsigned long long int
#define INF 1e18
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> ii;
void solve();

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

int main() {
	fastio;
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/

	int t;
	t=1;

    //cin>>t;
	while (t--)
	{
		solve();
	}
	return 0;
}


void solve()
{
    ll n, k, i, j, ans;
	cin >> n>>k;

	ll a[n];

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

	vector<ll> dp(k + 1, 0);

	for (i = 1; i <= k; i++)
	{
		for (j = 0; j < n; j++)
		{
			if (i - a[j] >= 0 && dp[i - a[j]] == 0)
			{
				dp[i] = 1;
				break;
			}
		}
	}

	if (dp[k] == 0)
		cout << "Second" << endl;
	else
		cout << "First" << endl;
}



Measured memory_bytes: 3996
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1.0)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    int x, y, g[12] = {1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
    cin >> x >> y;
    x--; y--;
    cout << (g[x] == g[y] ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int num1 = sc.nextInt();
      int num2 = sc.nextInt();
      int total = num1;
      int count = 1;
      if(num2 > 1){
      while(total < num2){
        total = (num1 - 1) + total;
        count++;
      } 
      } else {
        count = 0;
      }

      System.out.print(count);
    }
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
#include <string>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) (a)=max(a, b)
#define chmin(a, b) (a)=min(a, b)
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;

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

ll N, M, Q;
ll a[55], b[55], c[55], d[55];

ll dfs(ll x[], ll n) {
  ll i;
  
  if(n==N) {
    ll t=0;
    for(i=0; i<Q; i++) if(x[b[i]]-x[a[i]]==c[i]) t+=d[i];
    return t;
  }
  
  ll res=0;
  for(i=(n==0) ? 1:x[n-1]; i<=M; i++) {;
    x[n]=i;
    chmax(res, dfs(x, n+1));
  }
  
  return res;
}

int main(void) {
  ll i, j, k;
  
  cin >> N >> M >> Q;
  for(i=0; i<Q; i++) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
    a[i]--; b[i]--;
  }
  
  ll x[11];
  pt(dfs(x, 0));
}
 
 


Measured memory_bytes: 3584
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ENDL '\n'
#define print1(i) std::cout << (i) << '\n'
#define print(i,j) std::cout << (i) << ' ' << (j) << '\n'

#define int long long // at least int64 > 9*10^18
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int n;
	std::cin >> n;
	std::vector<int> a(n);
	rep(i,n) std::cin >> a[i];
	int maxi = 0;
	int max = 0;
	rep(i,n) {
		if(std::abs(a[i])>max) {
			max = std::abs(a[i]);
			maxi = i;
		}
	}
	print1(2*n);
	if(a[maxi]>=0) {
		print(maxi+1,n);
		print(maxi+1,n);
		rep(i,n-1) {
			print(n,i+1);
			print(i+1,n);
		}
	} else {
		print(maxi+1,1);
		print(maxi+1,1);
		rep(i,n-1) {
			print(1,n-i);
			print(n-i,1);
		}
	}

	return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
    public static void main (String[] args)
    {
        // your code goes here
        Scanner s = new Scanner(System.in);
        String str = s.next();
        int max = 0;
        int c = 0;
        for(int j=0; j<str.length(); j++)
        {
            if(str.charAt(j)=='R')
                c++;
            else
            {
                if(c>max)
                    max = c;
                c = 0;
            }
        }
        if(c>max)
            max = c;
        c = 0;
        System.out.println(max);
    }
}

Measured memory_bytes: 35624
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("Ofast")
// #pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>

using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <typename T>
// using o_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// #define sfind(i) find_by_order(i)
// #define ord(i) order_of_key(i)
typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
using cd = complex<double>;
const double pi = acos(-1);
#define mod 1000000007
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i, a, b, c) for (ll i = a; (c > 0 ? i < b : i > b) and c != 0; i += c)
#define vi vector<int>
#define vl vector<ll>
#define _max(vec) (*max_element(all(vec)))
#define _min(vec) (*min_element(all(vec)))
#define fi first
#define si second
#define pb push_back
#define all(name) name.begin(), name.end()
#define ral(name) name.rbegin(), name.rend()
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod)
#define mod_in(a) power(a, mod - 2)
#define ncr(n, r) (n>=r?((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod):0LL)
#define deb(x) cerr << "[" << #x << " " << x << "]" << endl;
#define endl '\n'  //....????
#define int ll
vector<ll> ft(1, 1LL);


/*======================================================================*/
void solve(){
    int n;
    cin >> n;
    n -= 400;
    cout << 8 - n/200;
}
signed main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
}

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

Measured memory_bytes: 596
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
#include<stack>
using namespace std;
#define int long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dup(x,y) (((x)+(y)-1)/(y))
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;
const long double PI = (acos(-1));


signed main() {
	int N, M, K;
	cin >> N >> M >> K;
	vector<int>A(N), B(M);
	rep(i, N)cin >> A[i];
	rep(i, M)cin >> B[i];
	vector<int>v(M + 1);
	v[0] = 0;
	rep(i, M)v[i + 1] = v[i] + B[i];
	int sum_a = 0;
	int ans = 0;
	rep(i, N)sum_a += A[i];
	for (int i = N - 1; i >= -1; i--) {
		if (sum_a > K) {
			if (i >= 0)sum_a -= A[i];
			continue;
		}
		if (sum_a == K) {
			ans = max(ans, i + 1);
			if (i >= 0)sum_a -= A[i];
			continue;
		}
		int sa = K - sum_a;
		int num = lower_bound(v.begin(), v.end(), sa + 1) - v.begin();
		int s = i + num;
		ans = max(ans, s);
		if (i >= 0)sum_a -= A[i];
	}
	cout << ans;
}

Measured memory_bytes: 7984
M, D = map(int,input().split())
c = 0
for d in range(20,D+1):
    s = str(d)
    if (1<int(s[0])*int(s[1])<=M and int(s[0]) > 1 and int(s[1]) > 1):
        c += 1
print(c)


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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
#define int ll

int d[1010];
signed main(void)
{
  int n;
  cin >> n;
  REP(i, n) cin >> d[i];

  bool b[10000] = {false};
  FOR(i, 1, min((ll)4, n)) {
    REP(j, n-i+1) {
      int tmp = 0;
      REP(k, i) {
        tmp += d[j+k] * pow(10, i-k-1);
      }
      //cout << i << " " << j << " " << tmp << endl;
      b[tmp] = true;
    }
  }

  REP(i, 10000) {
    if(!b[i]) {
      cout << i << endl;
      break;
    }
  }

  return 0;
}

Measured memory_bytes: 3256
N,C,K = map(int, raw_input().split())
T = sorted(input() for _ in range(N))
p = N-1
ans = 0
while 0<=p:
    ans += 1
    c = 0
    t = T[p]
    while c<C and 0<=p and t-K<=T[p]:
        c += 1
        p -= 1
print ans


Measured memory_bytes: 8964
#include <iostream>
#include <stack>

int main ()
{
    std::stack<u_int> cars;
    u_int number;

    while(std::cin >> number){
        if(number != 0)
            cars.push(number);
        else{
            std::cout << cars.top() << std::endl;
            cars.pop();
        }
    }
    
    return 0;
}

Measured memory_bytes: 1192
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
// 昇順sort
#define sorti(x) sort(x.begin(), x.end())
// 降順sort
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

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

  if (k % 2 == 0) {
    cout << a - b << endl;
  } else {
    cout << -(a - b) << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define int long long
#define inf (int)(1e18)

int min(int a, int b){
	return a <= b ? a : b;
}

int max(int a, int b){
	return a >= b ? a : b;
}

signed main(){
	int N, W, i, j, vsum = 0;
	scanf("%lld%lld", &N, &W);
	int *w = (int *)malloc(sizeof(int) * N);
	int *v = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		scanf("%lld%lld", &w[i], &v[i]);
		vsum += v[i];
	}
	int *dp = (int *)malloc(sizeof(int) * (vsum + 1));
	dp[0] = 0;
	for(i = 1; i <= vsum; i++){
		dp[i] = inf;
	}
	for(i = 0; i < N; i++){
		for(j = vsum; j >= 0; j--){
			dp[j] = min(dp[j], dp[max(0, j - v[i])] + w[i]);
		}
	}
	int ans = 0;
	for(i = 0; i <= vsum; i++){
		if(dp[i] <= W){
			ans = max(ans, i);
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cassert>
using namespace std;

#define REP(i,n) for (int i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long ll;

int L;

int main ()
{
    cin >> L;
    L--;

    int Lt = L;
    int tt = 1;
    int vcnt = 1;
    while (Lt - tt >= 0) {
        Lt -= tt;
        tt <<= 1;
        vcnt++;
    }

    vector < vector < int > > edge;
    REP(i,vcnt - 1) {
        edge.push_back({i + 1, i + 2, 0});
        edge.push_back({i + 1, i + 2, 1 << i});
    }

    L -= (tt - 1);
    int pos = vcnt;
    int acc = tt;

    while (L > 0) {
        if (L - tt >= 0) {
            L -= tt;
            edge.push_back({pos, vcnt, acc});
            acc += tt;
        }
        tt >>= 1;
        pos--;
    }

    cout << vcnt << " " << edge.size() << endl;
    REP(i,edge.size()) {
        REP(j,edge[i].size()) {
            cout << edge[i][j];
            cout << ((j < edge[i].size() - 1) ? " " : "\n");
        }
    }


    return 0;
}

Measured memory_bytes: 256
n = int(input())
XY = []
for i in range(n):
    x, y = map(int, input().split())
    XY.append((x, y))

if n == 1:
    print(1)
    exit()
    
D = {}
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        a = XY[i][0]
        b = XY[i][1]
        c = XY[j][0]
        d = XY[j][1]
        p = c-a
        q = d-b
        if (p, q) in D:
            D[(p, q)] += 1
        else:
            D[(p,q)] = 1

D = list(D.items())
D.sort(key = lambda x: -x[1])
print(n-D[0][1])


Measured memory_bytes: 3572
import sys
# import math
# import decimal
# import queue
# import bisect
# import heapq
# import time
# import itertools

mod = int(1e9+7)
INF = 1<<29

def main():
    n,r = map(int,input().split())
    if n >=10:
        print(r)
    else:
        print(r+100*(10-n))
    return

if __name__=='__main__':
    main()


Measured memory_bytes: 38384
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<array>
#include<vector>
#include<functional>
#include<unordered_map>
#include<map>
#include<numeric>
#include<limits>
#include<utility>
#include<queue>
#include<random>
using namespace std;

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

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

	cout << a[0] << b[1] << c[2] << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

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

        Set<Integer> s = new HashSet<>();
        for (int i = 0; i < n; i++) {
            s.add(sc.nextInt());
        }

        System.out.println(s.size());
    }
}


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

#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define pii pair<int,int>
#define vi vector<int>
#define vit vector<int>::iterator it
#define mii map<int,int>
#define mis map<int,string>
#define msi map<string,int>
#define X first
#define Y second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define sz(v) (int)(v.size())
#define si set<int>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const int inf=0x7f7f7f7f;
const int N=1e5+10;

int main() {
	double L;
	cin>>L;
	L/=3;
	L*=L*L;
	printf("%.12f",L);    
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
constexpr int MOD = 1000000007;
constexpr int INF = numeric_limits<int>::max() / 2;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;

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


signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int H, W;
	cin >> H >> W;
	char c[H][W];
	int ans = 0;
	rep(i,H){
		rep(j,W){
			cin >> c[i][j];
			if(c[i][j] == '#') ++ans;
		}
	}
	if(ans == H+W-1) cout << "Possible" << endl;
	else cout << "Impossible" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
using namespace std;
#define FOR(i, a, b) for(int i=(a); i<(b);  i++)
#define REP(i, n)    for(int i=0;   i<(n);  i++)
#define REP1(i, n)   for(int i=1;   i<=(n); i++)
#define pb push_back
#define mp make_pair
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define EPS 1e-7
#define ALL(obj) (obj).begin(), (obj).end()
using ul    = unsigned long;
using ll    = long long;
using ld    = long double;
using vint  = vector<int>;
using vll   = vector<ll>;
using pint  = pair<int, int>;
using pll   = pair<ll, ll>;
using vpint = vector<pint>;
using vpll  = vector<pll>;
const int INF = (int)1e9 + 1;
const int MOD = (int)1e9 + 7;

int n;

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

  scan(n);
  vint w(n);
  REP(i, n) scan(w[i]);

  double sum = 0;
  REP(i, n){
    sum += w[i];
  }
  sum /= 2.0;

  double delta = 0.000001;
  int sum2=0;

  REP(i, n){
    sum2 += w[i];
    if(sum2>sum){
      cout << (int)(2*min(sum2-sum, sum-sum2+w[i])+delta) << endl;
      break;
    }
  }


//  cout <<  << endl;

  return 0;
}


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

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }	//最大公約数(Greatest Common Divisor)
ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }			//最小公倍数(Least Common Multiple)

long long comb(long long m) {
	return (m * (m - 1)) / 2;
}


int main() {
	int n;
	cin >> n;
	vector<string> s(n);
	rep(i, n)	cin >> s[i];

	int ac = 0, wa = 0, tle = 0, re = 0;
	rep(i, n) {
		if (s[i] == "AC")	ac++;
		else if (s[i] == "WA")	wa++;
		else if (s[i] == "TLE")	tle++;
		else if (s[i] == "RE")	re++;
	}

	printf("AC x %d\n", ac);
	printf("WA x %d\n", wa);
	printf("TLE x %d\n", tle);
	printf("RE x %d\n", re);



}

Measured memory_bytes: 6428
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_range(i, s, e) for (int i = (s); i < (int)(e); i++)
#define rep_rev(i, s, e) for (int i = (s)-1; i >= (int)(e); i--)
#define sort_vec(v) sort((v).begin(),(v).end())
typedef int64_t lint;
// lint mod = 998244353;
template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void app() {
  int n,m;
  cin>>n>>m;

  vector<vector<int>> g(n);
  rep(i,m){
    int a,b;
    cin>>a>>b;
    a--;b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  vector<int> ans(n,-1);
  queue<int> q;
  q.push(0);
  ans[0]=0;
  while(!q.empty()){
    int u=q.front();
    q.pop();
    for(auto v:g[u]){
      if(ans[v]!=-1) continue;
      ans[v]=u;
      q.push(v);
    }
  }

  cout<<"Yes"<<endl;
  rep_range(i,1,n){
    cout<<(ans[i]+1)<<endl;
  }

}

int main(){app();return 0;}


Measured memory_bytes: 10232
def check(x, y)
  2.times do |z|
    4.times do
      return 'Yes' if x == y
      a, b, c, d, e, f  = x
      x = z.zero? ? [e, a, c, d, f, b] : [d, b, a, f, e, c]
      h = x
      4.times do
        i, j, k, l, m, n = h
        h = [i, k, m, j, l, n]
        return 'Yes' if h == y
      end
    end
  end
  'No'
end
  
puts check(*$<.map(&:chomp).map(&:split))

Measured memory_bytes: 8664
from collections import deque

N = int(input())

G = {k: [] for k in range(N+1)}
for n in range(N-1):
    a, b = map(int, input().split())
    # 無向グラフ
    G[a].append((b, n))
    G[b].append((a, n))

ans = 1
ans_l = [-1]*(N-1)
que = deque([(1, -1, -1)])

while que:
    ci, pi, ec = que.popleft()
    c = 0

    for ni, n in G[ci]:
        if ni != pi:
            c += 1
            if c == ec:
                c += 1
            ans = max(ans, c)
            que.append((ni, ci, c))
            ans_l[n] = c

print(ans)
print(*ans_l, sep='\n')


Measured memory_bytes: 78900
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val a = List.fill(n+1)(sc.nextInt())
  val List(idx1, idx2) = a.zipWithIndex.groupBy(_._1).values.find(_.length == 2).get.map(_._2)
  val x = idx1
  val y = n - idx2

  val mod = 1000000007

  def plus(a: Long, b: Long): Long = (a + b) % mod
  def minus(a: Long, b: Long): Long = (a - b + mod) % mod
  def times(a: Long, b: Long): Long = (a * b) % mod

  def pow(a: Long, n: Int, res: Long = 1): Long = {
    if (n == 0) {
      res
    } else if ((n&1) == 0) {
      pow(times(a,a), n >> 1, res)
    } else {
      pow(times(a,a), n >> 1, times(res,a))
    }
  }

  def inv(a: Long): Long = pow(a, mod-2)

  def initFactTable(n: Int): Array[Long] = {
    (1 to n).scanLeft(1L)(times(_,_)).toArray
  }

  val fact = initFactTable(n-1)

  def initInvFactTable(n: Int): Array[Long] = {
    (1 to n).scanRight(inv(fact(n)))(times(_,_)).toArray
  }

  val invFact = initInvFactTable(n-1)

  def comb(n: Int, k: Int): Long = {
    if (k < 0 || n < k) {
      0
    } else {
      times(times(fact(n), invFact(k)), invFact(n-k))
    }
  }

  val pw = new java.io.PrintWriter(Console.out)
  for (i <- 1 to n+1) {
    val p0 = comb(n-1, i)
    val p1 = minus(times(2, comb(n-1, i-1)), comb(x+y, i-1))
    val p2 = comb(n-1, i-2)
    pw.println(plus(plus(p0, p1), p2))
  }

  pw.flush()
}


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

int main() {
ios_base :: sync_with_stdio(false);
cin.tie(NULL);
int n, k;
cin >> n >> k;
int arr[n];
unsigned long long dp[n];
for(int i = 0; i < n; i++)
cin >> arr[i];
memset(dp, LONG_MAX, sizeof dp);
dp[0] = 0;
for(int i = 1; i < n; i++){
for(int j = max(0, i - k); j < i; j++)
	dp[i] = min(abs(arr[i] - arr[j]) + dp[j], dp[i]);
}
cout << dp[n - 1];
return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <math.h>
#include <numeric>
using namespace std;
typedef long long ll;

int main(){
    int a,b,c;cin>>a>>b>>c;
    int ab=abs(a-b),ac=abs(a-c),bc=abs(b-c);
    vector<int> v;
    v.push_back(ab);
    v.push_back(ac);
    v.push_back(bc);
    sort(v.begin(),v.end());
    cout<<v[0]+v[1];
}

Measured memory_bytes: 256
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int N;
    cin >> N;
    double ret = 0;
    double rate = 380000.0;

    for (int i = 0; i < N; i++) {
        double x;
        string u;
        cin >> x >> u;
        if (u == "JPY") {
            ret += x;
        } else {
            ret += x * rate;
        }
    }

    cout << fixed << setprecision(10) << ret << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> v(n+2);
    for (int i = 0; i < m; ++i) {
        int c, d;
        cin >> c >> d;
        v[c]++; v[d]--;
    }
    int dep = 0, cur = 0;
    int ans = 0;
    for (int i = 1; i <= n+1; ++i) {
        ans++;
        if(dep != 0 && dep+v[i] == 0){
            ans += (i-cur-1)*2;
        }
        dep += v[i];
        if(dep == 0) cur = i;
    }

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


Measured memory_bytes: 3096
package main

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

func Solve(stdin io.Reader, stdout io.Writer) {
  sc := bufio.NewScanner(stdin)
  sc.Split(bufio.ScanWords)

  sc.Scan()
  k, _ := strconv.Atoi(sc.Text())

  sc.Scan()
  x, _ := strconv.Atoi(sc.Text())

  for i := x - k + 1; i < x + k; i++ {
    _, _ = fmt.Fprintf(stdout, "%d ", i)
  }
  _, _ = fmt.Fprintf(stdout, "\n")

}

func main() {
  Solve(os.Stdin, os.Stdout)
  return
}


Measured memory_bytes: 640
#include<iostream> 
#include<algorithm> 
#include<cassert> 
#include<vector> 
#include<fstream> 
#include<string> 
#include<stdio.h> 
#include<stdlib.h> 
#include<time.h> 
#include<queue> 
#include<map> 
#include<set> 
#include<bitset> 
#include<cmath> 

using namespace std; 
#define REP(i,m,n) for(int i=m;i<n;++i) 
#define REPll(i,m,n) for(long long i=m;i<n;++i) 
#define INF 10000000000000000 
#define MOD 1000000007 
#define ll long long 
#define mp make_pair 
#define all(v) v.begin(),v.end() 

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


Measured memory_bytes: 256
#B - Can you solve this?
N,M,C= map(int, input().split())
B =list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(N)]
Ans = 0
for i in range(N):
    ans = 0
    for j in range(M):
        ans += A[i][j]*B[j]
    ans += C
    if ans > 0 :
        Ans += 1
    else:
        pass
if Ans >= 0:
    print(Ans)
else:
    print(0)

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

int main()
{
	long long int x, cnt = 1;
	cin >> x;
	double a = 100.0;
	double ans = a;
	
	while(1)
	{
		ans += floor(ans * (1.0/100.0));
		
		if (ans >= x)
		{
			break;
		}
		
		cnt++;
	}
	
	cout << cnt << endl;
	
	return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
using ll = long long;
template <class T> using vec = vector<T>;
using vi   = vector<int>;
using vvi  = vector<vi>;
using vvvi = vector<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval>newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!
// 約数の列挙 O(sqrt(n))
template <class INT_T>
vector<INT_T> divisor(INT_T n){
  vector<INT_T> ret;
  for(INT_T i=1;i*i<=n;++i){
    if(n%i==0){
      ret.push_back(i);
      if(n/i != i) ret.push_back(n/i);
    }
  }
  return ret;
}
// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  ll N = IN();
  if(N==1) { cout << 0 << endl; return 0; }
  ll sum = 0;
  auto divs = divisor(N);
  for(auto m1 : divs){
    auto m = m1-1;
    if(m>0 && N/m == N%m) sum += m;
  }
  cout << sum << endl;

  // ll sum = N-1;  // q==1 のケース

  // //ll Nsq = (ll)(sqrt((double)(N)));

  // //dump(sum);
  // //for(ll q=2; q<Nsq+2; ++q){
  // for(ll q=2; q*q<N; ++q){
  //   ll a=N/(q+1)+1;
  //   ll b=N/q+1;
  //   //dump(q,a,b);
  //   if(a==b) continue;

  //   while(a<=b){
  //     ll mid = (a+b)/2;
  //     ll p = N/mid; ll r = N%mid;
  //     if(p==r){ sum+=mid; break; }
  //     if(p>r) b = mid-1;
  //     else a = mid+1;
  //   }
  // }
  // cout << sum << endl;
  return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
#include <cctype>

using namespace std;

#define REP(i,n) for(int i = 0; i < (int)n; ++i)

int main()
{
	int n;
	int c;

	while(cin >> n) {
		c = 0;

		vector<int> P(n);
		REP(i, n) P[i] = 1;

		P[0] = 0;

		for(int i = 1; i * i < n; ++i) {
			if(P[i] == 1) {
				for(int j = i + 1; j * (i + 1) - 1 < n; ++j) {
					P[j * (i + 1) - 1] = 0;
				}
			}
		}

		REP(i, n) {
			if(P[i] == 1)
				++c;
		}

		cout << c << endl;
	}
	return 0;
}

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

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

# max absolute value
_,mi = max((abs(v),i) for i,v in enumerate(A))
mi += 1

print(2*N-2)
for i in range(1,N+1):
  if i != mi:
    print(mi,i)

if A[mi-1] > 0:
  for i in range(1,N):
    print(i,i+1)
else:
  for i in reversed(range(1,N)):
    print(i+1,i)


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

using namespace std;

int main() {
	int long long N,Fizz,Buzz,FizzBuzz,suma,sumb,sumc,sumd,sumsum;
	cin >> N;
	Fizz = N / 3;
	Buzz = N / 5;
	FizzBuzz = N / 15;
	suma = (N * (N + 1) / 2);
	sumb = Fizz * (3 + 3 * Fizz) / 2;
	sumc = Buzz * (5 + 5 * Buzz) / 2;
	sumd = FizzBuzz * (15 + 15 * FizzBuzz) / 2;
	sumsum = suma - sumb - sumc + sumd;

	cout << sumsum << endl;
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<string.h>

int main(){
	int a,b,dou[20][20],m,x,y,i,j;
	
	while(~scanf("%d%d",&a,&b)){
		if(a==0 && b==0)break;
		
		scanf("%d",&m);
		memset(dou,0,sizeof(dou));
		for(i=0;i<m;i++){
			scanf("%d%d",&x,&y);
			dou[x][y]=-1;
		}
		dou[1][1]=1;
		for(i=1;i<=a;i++){
			for(j=1;j<=b;j++){
				if(dou[i][j]==-1)continue;
				if(dou[i-1][j]!=-1)dou[i][j]+=dou[i-1][j];
				if(dou[i][j-1]!=-1)dou[i][j]+=dou[i][j-1];
			}
		}
		
		printf("%d\n",dou[a][b]);
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<n;i++)
int main(){
ll a;
cin>>a;
if(a%2==0)
  cout<<a;
  else
    cout<<a*2;

return 0;
}

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

int main(){
	int x,y,size;
	int map[10][10] = {};
	char a,b;
	while(cin >> x >> a >> y >> b >> size){
		map[x][y] += 1;
		if(size == 1){
			for(int i=-1;i<=1;i++){
				if(i==0) continue;
				else{
					if(x+i > -1 && x+i < 10) map[x+i][y]++;
					else if(y+i > -1 && y+i < 10) map[x][y+i]++;
				}
			}
		}
		else if(size == 2){
			for(int i=-1;i<=1;i++){
				for(int j=-1;j<=1;j++){
					if(i==0&&j==0) continue;
					else {
						if(x+i > -1 && x+i < 10 && y+i > -1 && y+i < 10) map[x+i][y+j]++;
					}
				}
			}
		}
		else if(size == 3){
			for(int i=-1;i<=1;i++){
				for(int j=-1;j<=1;j++){
					if(i==0&&j==0) continue;
					else if(x+i < 0 && x+i > 10 && y+j < 0 && y+j > 10) continue;
					else {
						map[x+i][y+j] += 1;
						if(i == -1 && j == 0){
							if(x+i+i > -1 && y+j+j > -1){
								map[x+i+i][y+j+j]++;
							}
						}
						else if(i == 0 && j == -1){
							if(y+j+j > -1){
								map[x][y+j+j]++;
							}
						}
						else if(i==0 && j == 1){
							if(y+j+j < 10){
								map[x][y+j+j]++;
							}
						}
						else if(i==1 && j==0){
							if(x+i+i < 10 && y+j+j < 10){
								map[x+i+i][y+j+j]++;
							}
						}

					}
				}
			}
		}
	}
	int ecount = 0,tmp = 0;
	for(int i=0;i<10;i++){
		for(int j=0;j<10;j++){
			if(map[i][j] == 0) ecount++;
			else if(map[i][j] > 0){
				if(map[i][j] > tmp){
					tmp = map[i][j];
				}
			}
		}
	}
	cout << ecount << endl;
	cout << tmp << endl;
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

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

constexpr ll INF = 1'000'000'000'000'000'000;
namespace utils{
#define ALL(x) begin(x), end(x)
#define rALL(x) rbegin(x), rend(x)
    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool min_update(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool max_update(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }
    using V_Set = unordered_set<int>;
    using E_Set = unordered_map<int, V_Set>;

    ll operator"" _64(unsigned long long x){ return ll(x); }
    ull operator"" _64u(unsigned long long x){ return ull(x); }

    template<class T>
    vector<T> make_vector(int n, T t){
        return vector<T>(n, t);
    }
    template<class ...Ts>
    auto make_vector(int n, Ts ... ts){
        return vector<decltype(make_vector(ts...))>(n, make_vector(ts...));
    }

    template<class T>
    ostream& operator<<(ostream& os, const vector<T>& v){
        for (auto &&x : v) { os << x << ' '; } cout << endl; return os ;
    }
}
using namespace utils;

class solver{
    istream& is;
    ostream& os;

public:
    solver(istream& I, ostream& O) :is(I), os(O) {}
    void run(){
        string S, T;
        is >> S >> T;
        if(!is) return;
        int count = 0;
        for (int i = 0; i < S.size(); ++i) {
            count += S[i] == T[i];
        } // end i
        cout << count << endl;

    }
};

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef DEBUG
    string test_cases = "test_A.txt";
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int loop = 0;
    while(fs) {
        loop++;
        cout << '#' << loop << "#------\n";
        solver(fs, cout).run();
    }
    if(loop <= 1) {
        cout << "===" << endl;
        while(cin) solver(cin, cout).run();
    }
#else
    solver(cin, cout).run();
#endif
    return 0;
}


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

public class Main {

	public static void main(String args[]) throws IOException{
		Scanner sc = new Scanner(System.in);
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		
		StringBuilder sb = new StringBuilder();
		
		int H = Integer.parseInt(st.nextToken()), W = Integer.parseInt(st.nextToken()), D = Integer.parseInt(st.nextToken());
		int r[] = new int[H*W+1];
		int c[] = new int[H*W+1];
		
		for(int i=1;i<=H;i++){
			st = new StringTokenizer(br.readLine());
			for(int j=1;j<=W;j++){
				int A = Integer.parseInt(st.nextToken());
				r[A] = i;
				c[A] = j;
			}
		}
		
		int dp[][] = new int[D+1][H*W/D+10];
		
		for(int i=1;i<=D && i+D <= H*W;i++){
			for(int j = 1;i+D*j<=H*W;j++){
				dp[i][j] = dp[i][j-1] + Math.abs(r[i+D*(j-1)]-r[i+D*j]) + Math.abs(c[i+D*(j-1)]-c[i+D*j]); 
			}
		}
		st = new StringTokenizer(br.readLine());
		int Q = Integer.parseInt(st.nextToken());
		
		while(Q-->0){
			st = new StringTokenizer(br.readLine());
			int L = Integer.parseInt(st.nextToken()), R = Integer.parseInt(st.nextToken());
			
			int i = (L-1)%D + 1;
			
			sb.append(dp[i][(R-i)/D] - dp[i][(L-i)/D]+"\n");
		}
		System.out.print(sb);
	}
}

Measured memory_bytes: 51200
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = (ll)1e5;  
using  p = pair<int,int>;

int main(){
   int n;
   cin >> n;
   string s;
   cin >> s;
   ll _max = 0;
   for (int r = 1; r < n; r++)
   {
      auto x = vector<ll>('z'-'a'+1,0);
      auto y = vector<ll>('z'-'a'+1,0);
      for (int l = 0; l <r; l++)
      {
         x[s[l]-'a']++;
      }
     
      for (int rr = r; rr <n; rr++)
      {
         y[s[rr]-'a']++;
      }

      ll c =0;
      for (int j = 0; j <= 'z'-'a'; j++)
      {
         if(x[j] >0 && y[j]>0) c++; 
      }
      _max=max(_max,c);
   }
  
   cout << _max;

}
  
  

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using namespace std;

int main(){
	fastIO
  int n,x;
  cin>>n>>x;
  if(x%2==1){
  cout<<"No"<<endl;
  }
  else{
    if((x>=(n*2))&&(x<=(n*4)))
    {
      cout<<"Yes"<<endl;
    }
    else
      cout<<"No"<<endl;
    
  }
  
  
  return 0;
}
    
  
  


Measured memory_bytes: 3608
#include<cstdio>
int main()
{
	int a=0,b=0,c=0;
	scanf("%d %d %d",&a,&b,&c);
	if((a==5&&b==5&&c==7)||(a==5&&b==7&&c==5)||(a==7&&b==5&&c==5))printf("YES\n");
	else printf("NO\n");
	return 0;
	}

Measured memory_bytes: 128