akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;

using ll = long long;
int INF = numeric_limits<int>::max() / 2;
ll LINF = numeric_limits<ll>::max() / 2;
int MOD = 1e9 + 7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x;
    cin >> x;
    ll ans = x / 11;
    ll rest = x % 11;
    ans *= 2;
    if(0 < rest && rest <= 6) ans++;
    else if(6 < rest)ans += 2;
    cout << ans << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

import collections
import functools
import math
import operator


P = 1000000007


def sieve_of_eratosthenes(end):
    assert end > 1
    is_prime = [True for _ in range(end)]
    is_prime[0] = False
    is_prime[1] = False
    primes = []
    for i in range(2, end):
        if is_prime[i]:
            primes.append(i)
            for j in range(2 * i, end, i):
                is_prime[j] = False
    return primes


def factorize_fact(n, primes):
    factors = collections.Counter()
    if n < 2:
        return factors
    for p in primes:
        if p * p > n:
            break
        while n % p == 0:
            factors[p] += 1
            n //= p
    if n > 1:
        factors[n] += 1
    return factors


def sum_ctrs(counters):
    return functools.reduce(operator.add, counters, collections.Counter())


def prod_mod(iterable, mod=P):
    def multi_mod(x, y):
        return (x % mod) * (y % mod) % mod
    return functools.reduce(multi_mod, iterable, 1)


def sum_of_divs_of_fact(n, mod=P):
    primes = sieve_of_eratosthenes(math.ceil(math.sqrt(n)) + 1)
    ctr = sum_ctrs(factorize_fact(x, primes) for x in range(1, n + 1))
    ans = prod_mod(v + 1 for v in ctr.values()) % mod
    return ans


def main():
    print(sum_of_divs_of_fact(int(input())))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3700
n=int(input())
mod=10**9+7
memo=[{} for i in range(n+1)]

def ok(last4):
  for i in range(4):
    t=list(last4)
    if i>=1:
      t[i-1],t[i]=t[i],t[i-1]
    if "".join(t).count("AGC")>=1:
      return False
  return True

def dfs(cur,last3):
  if last3 in memo[cur]:
    return memo[cur][last3]
  if cur==n:
    return 1
  res=0
  for c in "ACGT":
    if ok(last3+c):
      res=(res+dfs(cur+1,last3[1:]+c))%mod
  memo[cur][last3]=res
  return res

print(dfs(0,"TTT"))




Measured memory_bytes: 9444
#include <iostream>
#include <queue>
#include <map>
#include <algorithm>
#include <vector>
#include <string>
#include <tuple>
#include <functional>
using namespace std;

string S; int depth, minx;

int main() {
	cin >> S;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'S') depth++;
		if (S[i] == 'T') depth--;
		minx = min(minx, depth);
	}
	cout << -minx * 2 << endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define fin <<'\n'
int dx[]={1,0,-1,0};
int dy[]={0,-1,0,1};
int dxx[]={1,1,0,-1,-1,-1,0,1};
int dyy[]={0,-1,-1,-1,0,1,1,1};
bool inside(int x,int y,int w,int h){
  return (x>=0 && y>=0 && x<w && y<h);}
typedef long long ll;
typedef pair<int,int> pii;



int main(){
  cin.tie(0), ios::sync_with_stdio(false);
  int a,b;
  cin >>a>>b;
  cout <<a+b/2 fin;


  

  return 0;
}


Measured memory_bytes: 256
//  Copyright © 2020 Kavish Lodha. All rights reserved.
#include <bits/stdc++.h>
using namespace std;
#define vll vector<long long>
#define mll map<long long,long long>
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a>b)?b:a)
#define pb push_back
#define prll pair<long long,long long>
typedef long long ll;
typedef long double ld;
#define rep(i,a,n)   for(ll i=a; i<n; i++)
#define rrep(i,a,n)  for(ll i=n-1; i>=a; i--)
typedef map<string,ll> msl;
#define mx 100001
#define mod 1000000007
ll gcd(ll a, ll b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
ll extgcd(ll a,ll b,ll& x,ll& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll x1, y1;
    ll d = extgcd(b, a % b, x1, y1);
    x = y1;
    y = x1 - y1 * (a / b);
    return d;
}
ll revrsno(ll n){
    ll k=0;
    vll z;
    while(n>0){
        z.pb(n%10);
        n/=10;
    }
    rep(i,0,z.size()) k=k*10+z[i];
    return k;
}
bool isPrime(ll n){
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
    for (ll i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
    return true; 
}
bool isPowerOfTwo(ll n) { 
   if(n==0) 
   return false; 
   return (ceil(log2(n)) == floor(log2(n))); 
}
ll powm(ll a,ll b) {
	ll res = 1;
	while (b) {
		if (b & 1)
			res = (res * a) % mod;
		a = (a * a) % mod;
		b >>= 1;
	}
	return res;
}
ll divide(ll a,ll b) {
	return (a % mod) * powm(b, mod - 2) % mod;
}
ll mul(ll a,ll b) {
	return ((a % mod) * (b % mod)) % mod;
}
 
ll add(ll a,ll b) {
	return (a % mod + b % mod) % mod;
}
ll Totfun(ll n){
    ll z=n;
    if(n%2==0){
        while(n%2==0){
            n/=2;
        }
        z/=2;
    }
    for(ll i=3;i<=sqrt(n);i+=2){
        if(isPrime(i)&&n%i==0){
          while(n%i==0){
            n/=i;
          }
        z-=z/i;  
        }
    }
    if(n>1){
        z-=z/n;
    }
    return z;
}
ll maxPrimeFactor(ll n) { 
    ll maxPrime=-1; 
    while(n%2==0){
        maxPrime=2; 
        n>>=1; 
    } 
    for (ll i=3;i<=sqrt(n);i+=2) { 
        while(n%i==0){ 
            maxPrime=i; 
            n=n/i; 
        } 
    } 
    if (n>2) maxPrime=n; 
    return maxPrime; 
} 
ll nCr(ll n,ll r){
    if(r>n||r<0) return 0;
    ll z=1;
    for(ll i=n-r+1;i<=n;i++){
        z*=i;
        z/=(i+r-n);
    }
    return z;
}
/*
vll a[mx];
ll l[mx],d[mx];
void dfs(ll x,ll y){
   l[x]=1; d[x]=y;
   for(ll i:a[x])
   if(!l[i])
   dfs(i,y+1);
}
void bfs(ll x){
    queue<ll> q;
    q.push(x);
    l[x]=1;
    d[x]=0;
    while(!q.empty()){
        ll cur=q.front();
        q.pop();
        for(ll i : a[cur]){
            if(1-l[i]){
                q.push(i);
                d[i]=d[cur]+1;
                l[i]=1;
            }
        }
    }
}
*/
 /*sort(a,a+n);
    ll d=1;
    vll z;
    for(ll i=1;i<n;i++){
    if(a[i]==a[i-1]){
        d++;
    }
    else{
            z.pb(d);
            d=1;
    }
    }
    z.pb(d);*/
int main(){
   ios_base::sync_with_stdio(false); 
   cin.tie(NULL);
   cout.tie(NULL);
   ll n,m;
   cin>>n>>m;
   cout<<nCr(n,2)+nCr(m,2);
   return 0;
}

Measured memory_bytes: 256
void main()
{
    long n = rdElem;
    dchar[] s = rdDchar;

    s.uniq.array.length.writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

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

int main(){
	int a,b,c;
	cin >> a >> b >> c;
	if(a==b && b==c){
		if(a%2==0){
			cout << -1 << endl;
		}else{
			cout << 0 << endl;
		}
	}else{
		int ans=0;
		while(a%2==0 && b%2==0 && c%2==0){
			int na=b/2+c/2, nb=c/2+a/2, nc=a/2+b/2;
			a=na; b=nb; c=nc;
			ans++;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
<?php
// A
fscanf(STDIN, '%d', $k);
fscanf(STDIN, '%d %d', $a, $b);
$ans = 'NG';
for ($i = $a; $i <= $b; $i++) {
    if ($i % $k === 0) {
        $ans = 'OK';
        break;
    }
}
echo $ans;

Measured memory_bytes: 15992
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<ll> t(n+1), x(n+1), y(n+1);
  rep(i, n)
    cin >> t[i+1] >> x[i+1] >> y[i+1];
  for (int i = n; i > 0; i--)
    t[i] -= t[i-1];
  for (int i = 1; i <= n; i++) {
    ll d = abs(x[i]-x[i-1])+abs(y[i]-y[i-1]);
    if (t[i] < d || t[i]%2 != d%2) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

int main() {
    int x; cin >> x;
    if (x == 0) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
using ll = long long;

const ll mod = 1000000007;

ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1){
            res = res * a % mod;
        }
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
 
ll modinv(ll a, ll mod) {
    return modpow(a, mod - 2, mod);
}
 
ll nCr(ll n, ll r) {
    ll ans = 1;
    for (ll i = n; i > n - r; --i) {
        ans = ans * i % mod;
    }
    for (ll i = 1 ; i < r + 1; ++i) {
        ans = ans * modinv(i, mod) % mod;
    }
    return ans;
}

int main(){
    ll x, y;
    cin >> x >> y;
    if((x + y) % 3 != 0){
        cout << "0" << endl;
    } else {
        ll n = (2*y - x) / 3L;
        ll m = (2*x - y) / 3L;
        if(n < 0 || m < 0){
            cout << "0" << endl;
        } else {
            cout << nCr(n + m, m) << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var nm = Input.ar;
        var ct = Enumerable.Repeat(1, nm[0]).ToArray();
        var bo = new bool[nm[0]];
        bo[0] = true;
        for(var i = 0; i < nm[1]; i++)
        {
            var xy = Input.ar;
            ct[xy[0]-1]--;
            ct[xy[1]-1]++;
            bo[xy[1] - 1] = bo[xy[1] - 1] || bo[xy[0] - 1];
            bo[xy[0] - 1] = ct[xy[0] - 1] != 0 && bo[xy[0] - 1];
        }
        WriteLine(bo.Count(b => b));
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public  
static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static int[][] twodim(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] twodimL(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 18656
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(auto i = (N) - 1; i >= 0; i -= 1)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define vrep(v,it) for(auto it = v.begin(); it != v.end(); it++)
#define vrepr(v,it) for(auto it = v.rbegin(); it != v.rend(); it++)
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
#define rand mtrand
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cout << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cout << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
#endif
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = 0x1FFFFFFFFFFFFFFFLL;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(15);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}

using P = pair<int,int>;
//random_device seed_gen; mt19937_64 mtrand(seed_gen());
//////////////////////////////////////////

int p , a[3000] , ans[3000];
int inv(int i){
  return i == 1 ? 1 : p - inv(p % i) * (p / i) % p;
};

int main(){
  in(p);
  rep(i , p) in(a[i]);
  // k=0
  ans[0] = a[0];
  // k=1~p-2
  for(int l = 1; l <= p - 1; l++){
    if(a[l] == 0) continue;
    int cur = 1;
    for(int k = 1; k < p; k++){
      ans[k] += cur;
      cur = cur * l % p;
    }
  }
  for(int k = 1, x = inv(p-1); k <= p - 1; k++){
    ans[k] = (ans[k] % p) * x % p;
  }
  reverse(ans + 1 , ans + p);
  // k = p-1
  ans[p-1] = (ans[p-1] + p - a[0]) % p;

  rep(i,p) cout << (i?" ":"") << ans[i];
  cout << endl;
}

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

int main() {
  int n; cin >> n;
  vector<long long> a(n);
  for(int i=0; i<n; i++){
    cin >> a[i];
  }
  sort(a.begin(),a.end());
  bool b = true;
  for(int i=0; i<n-1; i++){
    if(a[i] == a[i+1]) b=false;
  }
  
  if(b) cout << "YES" << endl;
  else cout << "NO" << endl;
}

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

int main() {
    string n; cin >> n;
    if (n[0] == '9' || n[1] == '9') puts("Yes");
    else puts("No");
}

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define in(v) cin>>v;
#define out(v) cout<<v<<"\n"

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int A, B, C; in(A); in(B); in(C);

  int n = A % B;
  rep(i, B) {
    if (n == C) {
      out("YES");
      return 0;
    }
    n += A % B;
    n %= B;
  }
  out("NO");

  return 0;
}


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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acosl(-1);

#define rep(i,n) for(int i=0; i<(n); ++i)
#define all(n) n.begin(),n.end()

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//cout << fixed << setprecision(6);
	int n;
	cin >> n;
	string s;
	cin >> s;

	ll r = count(s.cbegin(), s.cend(),'R');
	ll g = count(s.cbegin(), s.cend(),'G');
	ll b = count(s.cbegin(), s.cend(),'B');
	ll ans = r * g * b;
	rep(j, n){
		rep(i, j){
			int k = 2*j - i;
			if(k < n){
				if(s[i] == s[j]) continue;
				if(s[i] == s[k]) continue;
				if(s[j] == s[k]) continue;
				ans--;
			}
		}
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3636
#include<vector>
#include<iostream>
#include<cstdlib>
#include<climits>
#include<algorithm>
using namespace std;

int main(){
  int n;cin>>n;
  vector<int> res(3,0);
  for(int i=0;i<3;++i)
    cin>>res[i];
    
    vector<int> tmp(res);
    for(int i=1;i<n;++i){
        for(int j=0;j<3;++j){
          cin>>tmp[j];
          tmp[j] += [=]()->int{
              int mx = INT_MIN;
              for(int k=0;k<3;++k){
                  if(k!=j)mx = max(mx,res[k]);
              }
            return mx;
          }();
        }
        res = tmp;
    }
  cout<<max({res[0],res[1],res[2]});
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(var,cnt) for(int (var)=0; (var)<(int)(cnt); ++(var))
#define REP(var,init,cnt) for(int (var)=(init); (var)<(cnt); ++(var))
#define ran(var,vec) for(auto &(var):(vec))
#define all(v) (v).begin(),(v).end()
#define TF(flag) (flag)?1:0
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pi = pair<int,int>;
using pl = pair<ll,ll>;

template<typename T>
using vec = vector<T>;
template<typename T>
using mat = vector<vec<T>>;
template<typename T>
using cub = vector<mat<T>>;
template<typename T>
using val = valarray<T>;

template<typename T>
using pq = priority_queue<T>;
template<typename T>
using rpq = priority_queue<T,vec<T>,greater<T>>;

template<typename T1,typename T2>
ostream &operator<<(ostream &os, const pair<T1,T2> &p){
  os<<"P("<<p.first<<", "<<p.second<<") ";
  return os;
}

template<typename T1,typename T2>
istream &operator>>(istream &is, pair<T1,T2> &p){
  is>>p.first>>p.second;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, vector<T> &v){
  for(T &in:v) is>>in;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const valarray<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

template<typename T>
istream &operator>>(istream &is, valarray<T> &v){
  for(T &in:v) is>>in;
  return is;
}

// Usual Template End ================================================

// Template End ======================================================

int main(void){
  string atcoder, x, contest; cin>>atcoder>>x>>contest;
  cout<<"A"<<x[0]<<"C";
}














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

int main(){
    string s;
    cin>>s;
    int counta=0;
    for(int i=0; i<3; i++){
        if(s[i]=='A'){
            counta++;
        }
    }
    if(counta != 0 && counta != 3){
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }
    return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
a = [0]*n
b = [0]*m
c = [0]*n
for i in range(n):
    a[i] = list(map(int, input().split()))
for j in range(m):
    b[j] = int(input())
for i in range(n):
    for j in range(m):
        c[i] += a[i][j] * b[j]
for i in range(n):
    print(c[i])


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

int mod = 1000000007;
int64_t large = 9223372036854775807;
double PI = 3.141592653589793;

int main()
{
    int N, M;
    cin >> N >> M;
    vector<vector<int>> list(N);
    vector<int> count(N); //各洞窟から何箇所行けるか
    for (int i = 0; i < M; i++)
    {
        int p, q;
        cin >> p >> q;
        p--, q--;
        list[p].push_back(q);
        list[q].push_back(p);
        count[p]++, count[q]++;
    }

    vector<bool> arrived(N, false); //訪問済みかどうか
    vector<int> from(N);
    vector<int> length(N);          //始点からの距離
    queue<int> que;                 //訪問予定

    que.push(0);
    arrived[0] = true;
    while (!que.empty())
    {
        int now = que.front();
        que.pop();
        for (int i = 0; i < count[now]; i++)
        {
            int search = list[now][i];
            if (!arrived[search]) //未訪問
            {
                arrived[search] = true;
                length[search] = length[now] + 1;
                from[search] = now;
                que.push(search);
            }
        }
    }
    cout << (length[N - 1] == 2 ? "POSSIBLE" : "IMPOSSIBLE");
}

Measured memory_bytes: 14704
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) obj.begin(),obj.end()
#define pb(obj) push_back(obj)
#define REP(i,N) for(int i=0;i<N;i++)
typedef long long ll;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M;
    cin>>N>>M;
    vector<int> A(N);
    ll sum=0;
    for(int i=0;i<N;i++){
        cin>>A[i];
        sum+=A[i];
    }
    int b,c;
    vector<pair<int,int>>P(M);//C,B
    for(int i=0;i<M;i++){
        cin>>b>>c;
        P[i]=make_pair(c,b);
    }
    sort(ALL(A));
    sort(ALL(P));
    ll sub=sum;
    int itr=M;
    int counter=0;
    int num;
    for(int i=0;i<N;i++){
        if (counter==0){
            itr--;
            if(itr<0){break;}
            counter=P[itr].second;
            num=P[itr].first;
        }
        sum=sum-A[i]+num;
        sub=max(sub,sum);

        counter--;
    }
    cout<<sub<<endl;
}

Measured memory_bytes: 1408
#include <string.h>
#include <iostream>
#include <math.h>
using namespace std;
int main() {

	int N;
	int x = 0;
	int ans = 0;
	char S[100];
	cin >> N >> S;

	for (int i = 0; i < N; i++) {
		if (S[i] == 'I') {
			x += 1;
		}
		if (S[i] == 'D') {
			x -= 1;
		}
		if (ans < x) {
			ans = x;
		}
	}
	cout << ans;
	return 0;
}

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

using namespace std;

const int MAX_N = 1e5 + 10;
char sim[MAX_N];
int x_cnt[MAX_N];

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

    int n = 0;
    for ( int i = 0; i < s.size(); i ++ ) {
        if ( s[i] == 'x' )
            x_cnt[n] ++;
        else
            sim[n ++] = s[i];
    }

    int i = 0;
    while ( i * 2 < n && sim[i] == sim[n - i - 1] )
        i ++;

    if ( i * 2 < n )
        cout << -1;
    else {
        int k = 0;
        for ( int i = 0; i * 2 < n; i ++ )
            k += abs( x_cnt[i] - x_cnt[n - i] );
        cout << k;
    }

    return 0;
}


Measured memory_bytes: 768
#include <iostream>
using namespace std;
typedef long long ll;

int a,b,q;
ll s[2][100004];

ll f(ll x){
    int l=0,r=a+1;
    ll y,z,v,w,u;
    for(int i=0;i<=1;i++){
        while(l+1<r){
            int m=(l+r)/2;
            if(s[i][m]>x)r=m;
            else l=m;
        }
        if(i==0){
            y=x-s[i][l];
            z=s[i][r]-x;
            l=0;
            r=b+1;   
        }else{
            v=x-s[i][l];
            w=s[i][r]-x;
        }
    }
    u=min(max(y, v), max(z, w));
    u=min(u, y+w+min(y, w));
    u=min(u, z+v+min(z, v));
    return u;
}

int main(void){
    cin>>a>>b>>q;
    for(int i=1;i<=a;i++){
        cin>>s[0][i];
    }
    for(int i=1;i<=b;i++){
        cin>>s[1][i];
    }
    s[0][0]=s[1][0]=-1e16;
    s[0][a+1]=s[1][b+1]=1e16;
    for(int i=0;i<q;i++){
        ll x;
        cin>>x;
        cout<<f(x)<<endl;
    }
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 9999999999;
const int INFI = 2147483647;
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
  T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }


int main() {
  int N,W; cin >>N >>W;
  vector<int> v(N), w(N);
  rep(i, N) cin >>v.at(i) >>w.at(i);
  vector<int> dp(W+1, 0);
  // dp[i]...重さiでの価値の最大値
  for (int bag=0; bag<N; bag++){
    for (int i=0; i<W; i++){
      chmax(dp[i+1], dp[i]);
      if (i+w.at(bag) <= W) chmax(dp[i+w.at(bag)], dp[i] + v.at(bag));
    }
  }
  cout <<dp[W] <<endl;
  
}



Measured memory_bytes: 3144
def main():
    n, *p = map(int, open(0).read().split())

    cnt = 0
    for i, cur_p in enumerate(p):
        if i + 1 != cur_p:
            cnt += 1
        if cnt > 2:
            print('NO')
            return()
    print('YES')
    return()

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
  string s;
  cin>>s;
  long long int str=0;
  long long int ans=0;
  for(long long int i=0; i<3;i++){
    if(s[i]=='R'){
      str++;
    }else{
      ans=max(str,ans);
      str=0;
    }
  }
  ans=max(str,ans);
  cout<<ans<<endl;
}

Measured memory_bytes: 3620
#!/usr/bin/env python3
import sys


YES = "YES"  # type: str
NO = "NO"  # type: str


def solve(X: int):
    print(YES if X in {3, 5, 7} else NO)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
		using namespace std;
		#define int long long int
		#define loop(i,a,b) for(int i=a;i<b;i++)
		#define scan(arr,n) for (int i = 0; i < n; ++i) cin >> arr[i]
		#define vi vector<int>
		#define si set<int>
		#define pii pair <int, int>
		#define sii set<pii>
		#define vii vector<pii>
		#define mii map <int, int>
		#define pb push_back
		#define faster ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
		//Constants
		const int MOD = 1000000007; /* 1e9 + 7*/
		const int MAXN = 1000005; /*1e6 +5 */
		 
		int spf[1000009]; // stores the smallest prime factor of a number
		 
		void sieve()
		{
		spf[1] = 1;
			for (int i=2; i<MAXN; i++)
				spf[i] = i;
			for (int i=4; i<MAXN; i+=2)
				spf[i] = 2;
		 
			for (int i=3; i*i<MAXN; i++)
				if (spf[i] == i)
				{
					for (int j=i*i; j<MAXN; j+=i)
						if (spf[j]==j)
							spf[j] = i;
				}
			}
		
		 
		/* Iterative Function to calculate (x^y)%p in O(log y) */
		int power(int x,  int y, int p)
		{
			int res = 1;     // Initialize result
			x = x % p; // Update x if it is more than or
						// equal to p 
			if (x == 0) return 0; // In case x is divisible by p;     
			while (y > 0)
			{
				// If y is odd, multiply x with result
				if (y & 1)
					res = (res*x) % p;     
				// y must be even now
				y = y>>1; // y = y/2
				x = (x*x) % p;
			}
			return res;
		}
		
		 
		void solve(int caseNumber)
		{
			// cout<<"Case "<<caseNumber<<": "endl;
			int x,k,d;
			cin>>x>>k>>d;
		//	int left,right;
			int req=abs(x);
			req=req/d;
			if(k<=req)
			{
				int ans=abs(x)-(k*d);
				cout<<abs(ans)<<endl;
			}
			else
			{
				k=k-req;
				if(k&1)
				{
					int ans=abs(x)-(req*d) - d;
					cout<<abs(ans)<<endl;
				}
				else
				{
					int ans=abs(x)-(req*d);
					cout<<abs(ans)<<endl;
				}
			}
		}

		 
		int32_t main()
		{
			faster;
			/*sieve();*/
		   // compute();
		  // int t;cin>>t;
		 int t=1;
			for(int ii=1;ii<=t;ii++)
			{
				solve(ii);
			}
		 
		 
			return 0;
		}


Measured memory_bytes: 3652
#include <iostream>
using namespace std;
int h[] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
int l[] = { 0,31,29,31,30,31,30,31,31,30,31,30,31 };
bool isLeap(int y)
{
  if(y % 400 == 0) return true;
  else if(y % 100 == 0) return false;
  else if(y % 4 == 0) return true;
  else return false;
}
int daysfrom(int y,int m,int d)
{
  int *p = isLeap(y) ? l : h;
  int s = p[m] - d + 1;
  int i;
  for(i=m+1; i<13; i++){
    s += p[i];
  }
  return s;
}
int daysto(int y,int m,int d)
{
  int *p = isLeap(y) ? l : h;
  int s = d - 1;
  int i;
  for(i=m-1; i>0; i--){
    s += p[i];
  }
  return s;
}
int main()
{
  int y1,m1,d1,y2,m2,d2;
  for(;;){
    cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2;
    if(y1<0 || m1<0 || d1<0 || y2<0 || m2<0 || d2<0) break;
    if(y1==y2){
      int s1 = daysto(y1,m1,d1);
      int s2 = daysto(y2,m2,d2);
      cout << s2 - s1 << endl;
    }else{
      int s = daysfrom(y1,m1,d1);
      int i;
      for(i=y1+1; i<y2; i++){
	s += daysfrom(i,1,1);
      }
      s += daysto(y2,m2,d2);
      cout << s << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <cstring>
#include <vector>

#define MAX_N (100)
#define INF (100000000)

using namespace std;

typedef struct {
	int to;
	int cost;
} Edge;

vector<Edge> G[MAX_N];
int W[MAX_N][MAX_N];

int ans;
int n, m;

void getMin(int V, int cost, int left, bool used[][MAX_N])
{
	if (cost >= ans){
		return;
	}
	
	if (V == n - 1){
		if ((left == 2 || left == 0) && ans > cost){
			ans = cost;
		}
	}
	
	if (left == 2){
		for (int i = 0; i < G[V].size(); i++){
			if (used[V][G[V][i].to] == false){
				used[V][G[V][i].to] = true;
				getMin(G[V][i].to, cost + G[V][i].cost, left, used);
				getMin(G[V][i].to, cost, left - 1, used);
				used[V][G[V][i].to] = false;
			}
		}
	}
	if (left == 1){
		for (int i = 0; i < G[V].size(); i++){
			if (used[V][G[V][i].to] == false){
				used[V][G[V][i].to] = true;
				getMin(G[V][i].to, cost, left - 1, used);
				used[V][G[V][i].to] = false;
			}
		}
	}
	if (left == 0){
		getMin(n - 1, cost + W[V][n - 1], 0, used);
	}
	
	return;
}

int main()
{
	int a, b, c;
	Edge in;
	
	while (1){
		scanf("%d %d", &n, &m);
		
		if (n + m == 0){
			break;
		}
		
		for (int i = 0; i < n; i++){
			G[i].clear();
		}
		
		for (int i = 0; i < n; i++){
			fill(W[i], W[i] + n, INF);
			W[i][i] = 0;
		}
		
		for (int i = 0; i < m; i++){
			scanf("%d %d %d", &a, &b, &c);
			
			in.to = --a;
			in.cost = c;
			G[--b].push_back(in);
			in.to = b;
			G[a].push_back(in);
			
			W[a][b] = W[b][a] = c;
		}
		
		for (int k = 0; k < n; k++){
			for (int i = 0; i < n; i++){
				for (int j = 0; j < n; j++){
					W[i][j] = min(W[i][j], W[i][k] + W[k][j]);
				}
			}
		}
		
		bool used[MAX_N][MAX_N];
		
		for (int i = 0; i < n; i++){
			fill(used[i], used[i] + n, false);
		}
		
		ans = INF;
		getMin(0, 0, 2, used);
		
		printf("%d\n", ans);
	}
	
	return (0);
}

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

int main(void) {
    int N;
    int64_t a;
    int64_t mod4 = 0;
    int64_t odd = 0;
    int64_t even = 0;

    cin >> N;

    for(int i=0;i<N;i++) {
        cin >> a;
        if(a % 2) {
            odd++;
        } else {
            if(a % 4) {
                even++;
            } else {
                mod4++;
            }
        }
    }

    if(mod4 == 0) {
        if((even > 1) && (odd == 0)) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    } else {
        if(((even == 0) && (odd  == (mod4+1)))
            || (odd <= mod4)) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }

    return 0;
}


Measured memory_bytes: 256
H, W = map(int, input().split())
A = []
c = 0
for i in range(H):
  As = input()
  A.append(As)
  c += As.count("#")
if c != H+W-1:
  print("Impossible")
  exit()
ok = True
i, j = (0, 0)
for k in range(H+W-2):
  fR = j+1 < W and A[i][j+1] == "#"
  fD = i+1 < H and A[i+1][j] == "#"
  if not fR ^ fD:
    ok = False
    break
  if fR:
    j += 1
  if fD:
    i += 1
if ok:
  print("Possible")
else:
  print("Impossible")


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

int n;
vector <int> a;

int main()
{
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		int x; scanf("%d", &x);
		a.push_back(x);
	}
	sort(a.rbegin(), a.rend());
	int res = 0;
	for (int i = 0; i < a.size(); i++)
		if (i % 2 == 0) res += a[i];
		else res -= a[i];
	printf("%d\n", res);
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	seen := make(map[int]bool, n)
	var ans string = "YES"
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		if !seen[a] {
			seen[a] = true
		} else {
			ans = "NO"
			break
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 7296
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>

using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}


void solve(long long N, long long K, std::vector<long long> p){
  vector<double> v;
  for(ll i=0; i<N; i++) {
    v.push_back((double)(p[i]+1)/(double)2);
  }
  vector<double> s(N+1, 0);
  for(ll i=1; i<=N; i++) {
    s[i]=s[i-1]+v[i-1];
  }
  double m = -1;
  for(ll i=K; i<=N; i++) {
    m = max(m, s[i]-s[i-K]);
  }
  std::cout << setprecision(10) << m << std::endl;
}

int main(){
  long long N;
  scanf("%lld",&N);
  long long K;
  scanf("%lld",&K);
  std::vector<long long> p(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&p[i]);
  }
  solve(N, K, std::move(p));
  return 0;
}



Measured memory_bytes: 5104
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

struct Item {
  int v;
  int w;
};

int solve(int w, vector<Item> &items, vector<int> &memo) {
  if (memo[w] != -1) {
    return memo[w];
  }

  int max_v = 0;
  for (auto &item : items) {
    if (w < item.w) {
      continue;
    }

    max_v = max(max_v, item.v + solve(w - item.w, items, memo));
  }

  return memo[w] = max_v;
}

int main(int argc, const char *argv[])
{
  int n, w;
  cin >> n >> w;

  vector<Item> items(n);
  vector<int> memo(w + 1, -1);
  for (int i = 0; i < n; i++) {
    cin >> items[i].v;
    cin >> items[i].w;
  }

  cout << solve(w, items, memo) << "\n";
  return 0;
}


Measured memory_bytes: 3904
def prime(N):
    first=[True for i in range(N+1)]
    first[0],first[1]=False,False
    for i in range(2,int((N+1)**0.5)):
        if not first[i]:continue
        for j in range(i*2,N+1,i):first[j]=False
    return [i for i in range(N+1) if first[i]]

prime_number=prime(10000)
while 1:
    n=int(input())
    if n==0:break
    box=0
    for i,j in enumerate(prime_number):
        if j>n:break
        if prime_number[i]-prime_number[i-1]==2:
            box=max(box,prime_number[i])
    print(box-2,box)


Measured memory_bytes: 5712
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace B
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var n = int.Parse(Console.ReadLine());
            var s = Console.ReadLine();
            Console.WriteLine(CountOf(s, "ABC"));
        }

        static int CountOf(string target, string value)
        {
            var editStr = target;
            var count = 0;
            var index = 0;
            while (true)
            {
                index = editStr.IndexOf(value);
                if (index < 0) break;
                count++;
                if (editStr.Length > 1) editStr = editStr.Substring(index + 1);
            }
            return count;
        }
    }
}


Measured memory_bytes: 13280
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <map>
#include <stack>
using namespace std;

#define mod 1000000007
#define ten5 100005
#define ten52 200005
#define ten6 1000005
#define PI 3.1415926
#define pb(x) push_back(x)

typedef long long int ll;

ll general,total;
//ll chk[55];
//ll num[55];
//ll num2[55];
//ll num[ten5];
//ll num2[ten5];
//char cmap[10][10];
//priority_queue<long long int> pq;   //big at front
//stack<int> stk;
//vector<pair<ll,ll>> vpll;
vector<ll> vll[9];
//deque<ll> deq[55];
//list<int> li;
//set<int> sint;
set<ll> sll;
map<ll,ll> mp;

ll dfs(ll);

int main()
{
    //double ans=0.0,half;
    //float f,g,h;
    long long int sum,sum2,n1,n2,n3;
    long long int m,n,o,i,j,k=1;
    long long int a,a1,a2,a3,a4,a5,a6;
    sum=sum2=n1=n2=n3=0;
    a=a1=a2=a3=a4=a5=a6=0;
    //string s,s1;
    //char now,pre,c;
    cin>>n>>m;general=n;total=0;
    for(i=0;i<m;i++)
    {
        cin>>a1>>a2;
        vll[a1].pb(a2);
        vll[a2].pb(a1);
    }
    dfs(1);
    cout<<total;
    return 0;
}

ll dfs(ll n)
{
    if(sll.find(n)!=sll.end()) return 0;
    sll.insert(n);
    if(sll.size()==general)
    {
        sll.erase(n);
        return 1;
    }
    for(int i=0;i<vll[n].size();i++)
        total+=dfs(vll[n][i]);
    sll.erase(n);
    return 0;
}




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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pii;

template<typename T>
using pq_gt = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using pq_lt = priority_queue<T, vector<T>, less<T>>;

#define se second
#define fi first
#define pb push_back

long long int a[100100], b[100100],c[100100];
long long int visited[100100];
vector<long long int> connected[100100];

int main() {
    ios::sync_with_stdio(false);
    long long int n,m;
    cin>>n>>m;
    for(long long int i = 0; i < m; ++i) {
    	long long int x,y;
    	cin>>x>>y;
    	connected[x].pb(y);
    	connected[y].pb(x);
    }
    queue<long long int> q;
    q.push(1);
    visited[1] = true;
    a[1] = 1;
    while(!q.empty()) {
    	long long int x = q.front();
    	q.pop();
    	for(long long int i : connected[x]) {
    		if(a[i]==a[x]) {
    			cout<<(n)*(n-1)/2-m<<endl;
    			return 0;
    		}
    		if(!visited[i]) {
    			visited[i] = true;
    			if(a[x] == 1) {
    				a[i] = 2;
    			} else if(a[x] == 2) {
    				a[i] = 1;
    			}
    			q.push(i);
    		}
    	}
    }
    long long int x=0,y=0;
    for(long long int i = 1; i <=n; ++i) {
    	if(a[i]==1) {
    		x++;
    	} else {
    		y++;
    	}
    }
    //cout<<"end"<<endl;
    cout<<x*y-m<<endl;
}

Measured memory_bytes: 9216
#include <iostream>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cmath>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
using namespace std;


int main(){
   int a,b;cin>>a>>b;
   if(a>=13) cout<<b<<endl;
   else if(a>=6 and a<=12) cout<<b/2<<endl;
   else cout<<0<<endl;
 //  //return 0;
    return 0;
}

Measured memory_bytes: 764
N = int(input())
A = list(map(int, input().split()))

numbers = [0, 0, 0]

for i in A:
    if (i % 4) == 0:
        numbers[0] += 1
    elif (i % 2) == 0:
        numbers[1] += 1
    else:
        numbers[2] += 1

if (numbers[1] == 0) and (numbers[2] - numbers[0] <= 1):
    print('Yes')
elif (numbers[1] != 0) and (numbers[0] >= numbers[2]):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 62832
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(x)    (x).begin(),(x).end()
typedef long long ll;
const int MOD = (int)1e9 + 7;

int main(){
  int n,q;
  cin >> n >> q;
  string s;
  cin >> s;

  vector<int> a(n);
  a[0] = 0;
  rep(i,n){
    if (i==0) continue;
    a[i] = (s[i-1]=='A'&& s[i]=='C') ? a[i-1] + 1 : a[i-1];
  }

  rep(i,q){
    int l,r;
    cin>>l>>r;
    cout<<a[r-1] - a[l-1]<<endl;
  }
}



Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>
#define len length()
#define sz size()
#define rng(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) rng(i, 0, n)
#define srt(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define vi(a, n) vector<int> a(n)
#define vs(a, n) vector<string> a(n)
#define vc(a, n) vector<char> a(n)
#define psb(a) push_back(a)
#define ppb pop_back()
#define erc(S, i) S.erase(S.begin() + i)
#define ers(S, i, j) S.erase(S.begin() + i, S.begin() + j)
#define sp(n) cout << setprecision(n) << fixed
#define fst(s) s.at(0)
#define lst(s) s.at(s.len - 1)
typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(){
    string S;
    cin >> S;
    if(S.at(0) == S.at(1) || S.at(1) == S.at(2) || S.at(2) == S.at(3)) cout << "Bad" << endl;
    else cout << "Good" << endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python

def main():
    n, k = map(int, input().split())

    cnt = 0
    min_ = 0
    max_ = 0

    for i in range(1, n+2):
        min_ += i - 1
        max_ += n - i + 1

        if i >= k:
            cnt += max_ - min_ + 1
            cnt %= 10 ** 9 + 7

    print(cnt)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9188
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define MAX(a,b) a=a>b?a:b
#define MIN(a,b) a=a>b?a:b
#define REP(i,x,n) for(int i=x;i<n;i++)
#define REPR(i,x,n) for(int i=n-1;i>=x;i--)
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD =1000000007;//1e9 + 7;





int main(){
	
	ll n,a,b;
    cin>>n>>a>>b;
    ll o=0;
    if((b-a)%2){
        
        if(n-a>b-1){
            b-=a;
             o+=a;
            a=0;
           
        }else{
            
            a+=(n-b)+1;
            o+=(n-b)+1;
            b=n;
        }
    }
    cout<<((b-a)/2)+o;
    
    cout<<endl;
	
}

Measured memory_bytes: 256
//
#include<map>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
string a[200009];
 
map<string,int>rr;
string b[200009];
int main(){
	int n;
	cin>>n;
	int maxn=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		rr[a[i]]++;
		if(rr[a[i]]>maxn){
			maxn=rr[a[i]];
		}
	}
	int ans=0;
	for(int i=0;i<n;i++){
		if(rr[a[i]]==maxn){
			b[ans]=a[i];
			rr[a[i]]=0;
			ans++;
		} 
	}
	sort(b,b+ans);
	for(int i=0;i<ans;i++){
		cout<<b[i]<<endl;
	}
}


Measured memory_bytes: 28288
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX
#define INFL LLONG_MAX
typedef long long ll;
using namespace std;
int main(){
  string s;
  cin >> s;
  int ans = 0;

  rep(i,3){
    if(s.at(i)=='R') ans = 1;
  }

  if(s.at(0)=='R'&&s.at(1)=='R') ans=2;
  else if(s.at(1)=='R'&&s.at(2)=='R') ans = 2;

  if(s.at(0)=='R'&&s.at(1)=='R'&&s.at(2)=='R') ans = 3;

  cout << ans << endl;
}


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

int main() {
	char c;
	cin >> c;
	if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') cout << "vowel";
	else cout << "consonant";
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり

問題文通りに判定して終わり
*/

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

int a;
int b;
int c;

int main(){
	a=0;
	while (a<9) {
		a++;
		c=a;
		b=0;
		while (b<9) {
			b++;
		    cout << a << "x" << b << "=" << c << endl;
			c += a;
		}
	}
    return 0;
}

Measured memory_bytes: 1116
// ABC061_C
#include <iostream>
#include <vector>
#include <algorithm>  // std::copy()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
using namespace std;
typedef long long ll;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり

int main() {
    // input
    ll N, K, a, b;
    cin >> N >> K;
    vector<ll> num(100000+1, 0);
    REP(i, N) {
        cin >> a >> b;
        num[a] += b;
    }
    
    // 各数が何個あるかの累積和を計算
    vector<ll> partial;
    COPY(num, partial);  // copy vec to partial
    partial_sum(num.begin(), num.end(), partial.begin());
    
    // K 個以上となる最小のインデックスを求める
    auto iter = lower_bound(partial.begin(), partial.end(), K);
    cout << IDX(partial, iter) << "\n";
    
    return 0;
}


Measured memory_bytes: 2168
import java.util.Scanner;

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

        int n  =sc.nextInt();

        int hoge = n / 100;
        int reNum = hoge + hoge * 10 + hoge * 100;
        if (reNum < n) {
            reNum += 111;
        }

        System.out.println(reNum);
    }
}


Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

int main() {
    string S; cin >> S;
    int count1 = 0;
    int count2 = 0;
    //　白黒
    for (int i = 0; i < S.size(); i++) {
        if (i%2) {
            if (S[i] == '1') ++count1;
        } else {
            if (S[i] == '0') ++count1; 
        }
    }
    //　黒白
    for (int i = 0; i < S.size(); i++) {
        if (i%2) {
            if (S[i] == '0') ++count2;
        } else {
            if (S[i] == '1') ++count2; 
        }
    }
    if (count1 < count2) cout << count1 << endl;
    else cout << count2 << endl;
}


Measured memory_bytes: 512