akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }
 
int main()
{
  cin.tie( 0 );
  ios::sync_with_stdio( false );
  
  int n;cin>>n;
  vector<char> s(n);
  rep(i,n)cin>>s[i];
  
  int p,w,g,y;
  p=w=g=y=0;
  rep(i,n){
    if(s[i]=='P')p=1;
    else if(s[i]=='W')w=1;
    else if(s[i]=='G')g=1;
    else if(s[i]=='Y')y=1;
  }
  string ans="Three";
  if(p+w+g+y==4)ans="Four";
  cout(ans);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define ll long long
#define pb push_back
#define sz(x) (int)(x).size()
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(), x.end()

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>; ///find_by_order(),order_of_key()
template<class T1, class T2> ostream& operator<<(ostream& os, const pair<T1,T2>& a) { os << '{' << a.f << ", " << a.s << '}'; return os; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& a) {
	os << '{';
	for(int i=0;i<sz(a);i++)
	{
		if(i>0&&i<sz(a)-1)
			os << ", ";
		os << a[i];
	}
	os << '}';
    return os;
}
const int N=3005,mod=1e9+7;
int add(int x,int y)
{
    x+=y;
    if(x>=mod)
        x-=mod;
    return x;
}
int sub(int x,int y)
{
    x-=y;
    if(x<0)
        x+=mod;
    return x;
}
int mul(int a,int b)
{
    return ((ll)a*b)%mod;
}
int powmod(int x,int k) {int ans=1;for(;k;k>>=1,x=mul(x,x))if(k&1)ans=mul(ans,x);return ans;}
int inv(int i)
{
    return powmod(i,mod-2);
}
int dp[N];
const int l=2e5+5;
int fact[l];
int ways(int x,int y,int a,int b)
{
    x=abs(x-a);
    y=abs(y-b);
    int ans=mul(fact[x+y],inv(fact[x]));
    ans=mul(ans,inv(fact[y]));
    return ans;
}
vector<int> r[N];
vector<pair<int,int> > block;
int main()
{
    fact[0]=1;
    fact[1]=1;
    for(int i=2;i<l;i++)
        fact[i]=mul(fact[i-1],i);
    int n,m,k;
    scanf("%i %i %i",&n,&m,&k);
    block.pb({1,1});
    block.pb({n,m});
    for(int i=0;i<k;i++)
    {
        int x,y;
        scanf("%i %i",&x,&y);
        block.pb({x,y});
    }
    sort(all(block));
    n=block.size();
    dp[n-1]=1;
    //cout << block << endl;
    for(int i=1;i<n;i++)
    {
        dp[i]=ways(1,1,block[i].f,block[i].s);
    }
    for(int i=1;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            if(block[j].f>=block[i].f&&block[j].s>=block[i].s)
            {
                dp[j]=sub(dp[j],mul(dp[i],ways(block[i].f,block[i].s,block[j].f,block[j].s)));
            }
        }
    }
    printf("%i\n",dp[n-1]);
    return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;

int n;
int a[N][3];

int dp[N][3];

int main()
{
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        for (int j = 0; j < 3; ++j)
            cin >> a[i][j];
    }
    for (int i = 1; i <= n; ++i)
    {
        for (int j = 0; j < 3; ++j)
        {
            for (int k = 0; k < 3; ++k)
            {
                if (j == k)
                    continue;
                dp[i][j] = max(dp[i][j], dp[i - 1][k] + a[i][j]);
            }
        }
    }
    cout << max(dp[n][0], max(dp[n][1], dp[n][2])) << endl;
    return 0;
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;


//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
const ll MOD = 1e9 + 7;
int n;
ll x[201010];
ll dp[201010];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> n ;
    map<int,deque<ll>> mp;
    rep(i,n) {
      cin >> x[i];
    }
    VLL c;
    c.push_back(x[0]);
    rep(i,n){
      if(c.back() == x[i] ) continue;
      else c.push_back(x[i]);
    }

    rep(i,c.size()){
      mp[c[i]].push_back(i);
    }

    dp[0] = 1;
    rep(i,c.size()){
      if(mp[c[i]].size() >= 2){
        //cout << i << ':' <<c[i] << ',' << mp[c[i]].front() << "\n";
        mp[c[i]].pop_front();
        (dp[mp[c[i]].front()] += dp[i]) %= MOD;
      }
      (dp[i+1] += dp[i]) %= MOD;
    }

    cout << dp[c.size()] << endl;
    return 0;
}


Measured memory_bytes: 148720
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

using ll = long long;
using ld = long double;
using ull = unsigned long long;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cout.setf(ios::fixed), cout.precision(20);
	int k;
	cin >> k;
	cout << 360 / __gcd(k, 360) << "\n";
	return 0;
}




Measured memory_bytes: 3608
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
ll a[100010];

bool check(int k) {
    ll s = 0;
    for (int i = 0; i <= k; i++) s += a[i];
    for (int i = k+1; i < n; i++) {
        if (a[i] > 2 * s) return false;
        s += a[i];
    }
    return true;
}

int solve() {
    sort(a, a+n);
    int lb = -1, ub = n-1;
    while (ub - lb > 1) {
        int mid = (ub + lb) / 2;
        if (check(mid)) {
            ub = mid;
        } else {
            lb = mid;
        }
    }
    return n - ub;
}

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

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

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 1024
import java.util.*;
import java.lang.*;
public class Main{
public static void main(String [] args){
Scanner in = new Scanner(System.in);
  String s = in.next();
  
  for(int i =0;i<s.length()-2;i++){
  if(s.charAt(i)==s.charAt(i+1) && s.charAt(i+1)==s.charAt(i+2)){
  System.out.print("No");
  }
    else{
      System.out.print("Yes");
    }
  }
}
}

Measured memory_bytes: 21972
#include<stdio.h>

int main(void)
{
  int page, paper;
	
  scanf("%d",&page);
  
  if(page % 2){
    paper = (page / 2) + 1;
  } else{
    paper = page / 2;
  }
  
  printf("%d\n",paper);
  
  return 0;
}

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

int main() {

  double xa, ya, xb, yb, xc, yc, xd, yd;

  while( cin >> xa >> ya >> xb >> yb >> xc >> yc >> xd >> yd ) {

    double gx0 = ( xa + xb ) / 2;
    double gy0 = ( ya + yb ) / 2;
    double gx1 = ( xc + xd ) / 2;
    double gy1 = ( yc + yd ) / 2;
    double lx0 = abs( xa - xb ) / 2;
    double ly0 = abs( ya - yb ) / 2;
    double lx1 = abs( xc - xd ) / 2;
    double ly1 = abs( yc - yd ) / 2;

    if ( abs( gx1 - gx0 ) - ( lx0 + lx1 ) <= 0.00000001 && abs( gy1 - gy0 ) - ( ly0 + ly1 ) <= 0.00000001 ) {
      cout << "YES" << endl;
    }else {
      cout << "NO" << endl;
    }

  }

  return 0;

}

Measured memory_bytes: 1216
import heapq
n,m = map(int,input().split())

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

for i in range(n):
    t[i] = -t[i]

t.sort()

for i in range(m):
    x=heapq.heappop(t)
    x = -x
    x = int(x/2)
    heapq.heappush(t,-x)
    #print(t)
print(-sum(t))

Measured memory_bytes: 63856
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;
const int cnt=1e7+7; 

int main()
{
//	freopen("input.txt","r",stdin);//设置 cin scanf 这些输入流都从 test.in中读取
    
    int k;
    cin>>k;
    bool flag=0;//是否满足条件，满足条件为1
    ll sum=0;
    int ans;
	for(int i=0;i<cnt;i++)
	{
		sum=(sum*10+7)%k;
		if(sum%k==0) 
		{
			flag=1;
			ans=i+1;
//			cout<<sum;
			break;
		}
	} 
	if(flag) cout<<ans;
    else cout<<"-1";
    
	return 0;
}


Measured memory_bytes: 3124
#include "iostream"
#include "vector"
using namespace std;

int main()
{
	int n;
	long long int count = 0;
	cin >> n;
	vector<int>a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (i != 0) {
			if (a[i] - a[i - 1] > 1) {
				cout << -1 << endl;
				return 0;
			}
		}
	}
	if (a[0] != 0) {
		cout << -1 << endl;
		return 0;
	}
	for (int i = 0; i < n-1; i++) {
		if (a[i + 1] - a[i] == 1)count++;
		else if (a[i + 1] != 0)count += a[i + 1];
	}
	cout << count << endl;
	return 0;
}



Measured memory_bytes: 1024
import itertools
N = int(input())
P = map(int, input().split())
Q = map(int, input().split())

lis = [i for i in range(1, N+1)]
a = 0
b = 0
ans = list(itertools.permutations(lis))
TP=tuple(P)
TQ=tuple(Q)
for n, i in enumerate(ans):
    if(i == TP):
        a=n+1
        if(b!=0):
            break
    if(i==TQ):
        b=n+1
        if(a!=0):
            break

print(abs(a-b))

Measured memory_bytes: 8052
let n = read_int ()

let rec factors m a acc =
  if a * a > m then acc
  else if a * a = m then a :: acc
  else if m mod a = 0 then factors m (a + 1) (a :: (m / a) :: acc)
  else factors m (a + 1) acc

let fs = factors (n - 1) 1 [] |> List.length

let rec test m k =
  if m = 0 then false else if m mod k = 0 then test (m / k) k else m mod k = 1

let fn =
  factors n 1 []
  |> List.filter (fun x -> x <> 1)
  |> List.map (test n)
  |> List.fold_left (fun acc x -> if x then acc + 1 else acc) 0

;;
print_int (fs - 1 + fn);
print_newline ()


Measured memory_bytes: 1152
def solve(N, As):
    colors = set()
    allcount = 0
    for a in As:
        n = a // 400
        if n < 8:
            colors.add(n)
        else:
            allcount += 1
    return max(len(colors), 1), len(colors) + allcount


if __name__ == "__main__":
    N = int(input())
    As = map(int, input().split(" "))
    m1, m2 = solve(N, As)
    print(m1, m2)


Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <math.h>

typedef long long ll;
typedef long double ld;
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define PRECISION std::cout << std::fixed << std::setprecision(20);
  
using namespace std;
 
const ll inf = 1e18+1;
const int N = 4e5+1;
const ll mod = 1e9+7;
const int bits = 19;

void solve(){
    int h1,h2,m1,m2,k;
    cin>>h1>>m1>>h2>>m2>>k;

    int mi = 0;

    if(m1>m2){
        mi+=60+m2-m1;
        h2--;
    }else{
        mi+=m2-m1;
    }

    mi+=60*(h2-h1);
    cout<<mi-k<<"\n";
}

int main(){
    FASTIO;
    PRECISION;
    
    int t;
    // cin>>t;
    t = 1;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 3640
a,b=map(int,input().split())
s=[]*a
for i in range(a):
    s.append(input())
ans=[]
dx=[1, 0, -1, 0, 1, -1, -1, 1]
dy=[0, 1, 0, -1, 1, 1, -1, -1]
for i in range(a):
    anssss=[]
    for j in range(b):
        if s[i][j]=="#":
            anssss.append("#")
            continue
        count=0
        for k in range(8):
            if (dx[k]+j>=0 and dy[k]+i>=0 and dx[k]+j<b and dy[k]+i<a):
                if (s[dy[k]+i][dx[k]+j]=="#"):
                    count+=1
        anssss.append(str(count))
    ans.append(anssss)
for i in range(a):
    for j in range(b):
        print(ans[i][j],end="")
    print()



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

struct Card { char suit, value; };

void trace(struct Card a[], int N){
    for(int i = 0; i<N; i++){
        if(i>0) cout<<' ';
        cout << a[i].suit << a[i].value;
    }
    cout << endl;
}
void bubbleSort(struct Card a[], int n){
    for(int i = 0; i < n; i++){
        int j = n - 1;
            while(j>0){
                if(a[j].value < a[j-1].value){
                    swap(a[j],a[j-1]);
                }
                j--;
            }
    }
}
void selectionSort(struct Card a[], int n){
    for (int i = 0; i < n - 1; i++){
        int minj = i;
        for (int j = i; j < n; j++)
            if (a[j].value < a[minj].value){
                minj = j;
            }
        if (minj != i){
            swap(a[i],a[minj]);
        }
    }
}
/*
bool isStable(struct Card a[], struct Card C[], int n){
    for (int i = 0; i < n; i++){
        if((a[i].value == C[i].value) && (a[i].suit != C[i].suit)) return false;
    }
    return true;
}
*/
bool isStable(struct Card C1[], struct Card C2[], int n){
    for (int i = 0; i < n; i++){
        if( (C1[i].suit != C2[i].suit)) return false;
    }
    return true;
}

int main(){
    int n;
    cin >> n;
    struct Card C1[n];
    struct Card C2[n];
    for (int i = 0; i < n; i++) cin >> C1[i].suit >> C1[i].value;
    for (int i = 0; i < n; i++) C2[i] = C1[i];

    bubbleSort(C1,n);
    trace(C1,n);
    cout << "Stable" << endl;

    selectionSort(C2,n);
    trace(C2,n);
    if (isStable(C1, C2, n)){
        cout << "Stable" << endl;
    }else{
        cout << "Not stable" << endl;
    }
    return 0;
}


Measured memory_bytes: 3100
# -*- coding: utf-8 -*-
import sys
from collections import deque
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N,M=map(int,input().split())
    X,Y=set([0]),set([0])
    A,B,C=[0]*N,[0]*N,[0]*N
    for i in range(N):
        A[i],B[i],C[i]=map(int,input().split())
        X.add(A[i])
        X.add(B[i])
        Y.add(C[i])
    D,E,F=[0]*M,[0]*M,[0]*M
    for i in range(M):
        D[i],E[i],F[i]=map(int,input().split())
        X.add(D[i])
        Y.add(E[i])
        Y.add(F[i])
    UX=list(X)
    UY=list(Y)
    UX.sort()
    UY.sort()
    dictx,dicty={n:i*2 for i,n in enumerate(UX)},{n:i*2 for i,n in enumerate(UY)}
    LX=[UX[i//2+1]-UX[i//2] if i%2 else 0 for i in range(len(UX)*2-1)]
    LY=[UY[i//2+1]-UY[i//2] if i%2 else 0 for i in range(len(UY)*2-1)]
    c=[[0]*(len(UX)*2-1) for _ in range(len(UY)*2-1)]
    for i in range(N):
        y=dicty[C[i]]
        for x in range(dictx[A[i]],dictx[B[i]]+1):
            c[y][x]=1
    for i in range(M):
        x=dictx[D[i]]
        for y in range(dicty[E[i]],dicty[F[i]]+1):
            c[y][x]=1
    que=deque()
    used=[[0]*len(UX)*2 for _ in range(len(UY)*2)]
    dy=[1,1,-1,-1]
    dx=[1,-1,1,-1]
    for k in range(4):
        nny,nnx=dicty[0]+dy[k],dictx[0]+dx[k]
        if 1<=nny<len(UY)*2-1 and 1<=nnx<len(UX)*2-1:
            que.append((nny,nnx))
            used[nny][nnx]=1
    ans=0
    dy=[1,0,-1,0]
    dx=[0,1,0,-1]
    while que:
        y,x=que.popleft()
        if y%2 and x%2:
            ans+=LY[y]*LX[x]
        for k in range(4):
            ny,nx=y+dy[k],x+dx[k]
            nny,nnx=ny+dy[k],nx+dx[k]
            if c[ny][nx]==0:
                if nny<0 or nny>=len(UY)*2-1 or nnx<0 or nnx>=len(UX)*2-1:
                    print('INF')
                    exit()
                if not used[nny][nnx]:
                    que.append((nny,nnx))
                    used[nny][nnx]=1
    print(ans)

if __name__ == '__main__':
    main()


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

using namespace std;

typedef long long int ll;
typedef long long int lli;
typedef unsigned long long int ull;
typedef long double ld;
typedef string str;

typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = 1; i <= (n); ++i)
#define fin(ans) cout << (ans) << endl;
//３つ以上の値をセットに(3より多いときはカッコ内を増やす)\
sort -> p -> q -> r
#define mt(p, q, r) make_tuple(p, q, r)
#define all(a) a.begin(), a.end()

template <typename T>
void V(T &n)
{
  for (ll i = 0; i < n.size(); i++)
  {
    cin >> n[i];
  }
}

template <typename T, typename U>
void V2(T &n, U &m)
{
  for (ll i = 0; i < n.size(); i++)
  {
    cin >> n[i] >> m[i];
  }
}

template <typename T>
void Sort(T &n, ll a = 0, ll b = 0)
{
  if (b == 0)
  {
    return (sort(n.begin() + a, n.end()));
  }
  else
  {
    return (sort(n.begin() + a, n.begin() + b));
  }
}

template <typename T>
void Down(T &n, ll a = 0, ll b = 0)
{
  if (b == 0)
  {
    return (sort(n.begin() + a, n.end(), greater<ll>()));
  }
  else
  {
    return (sort(n.begin() + a, n.begin() + b, greater<ll>()));
  }
}

void Main()
{
  ll a, b, t; cin >> a >> b >> t;
  fin(t / a * b)
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  if(n == 1) {
    cout << "Hello World" << endl;
    return 0;
  }
  ll a, b;
  cin >> a >> b;
  cout << a + b << endl;
}

Measured memory_bytes: 3536
// Example program

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

typedef pair<int,int> ii;
typedef vector<ii> vii;

int main() {
    int n;
    cin >> n;
    vector<int> arr(n);
    for(int i = 0; i < n; i++) cin >> arr[i];
    int index = 0;
    int number = 0;
    for(int i = 0; i < n; i++) {
        if(abs(arr[i]) > number) {
            index = i;
            number = abs(arr[i]);
        }    
    }
    vii ans;
    
    for(int i = 0; i < n; i++) {
        ans.push_back(ii(index,i));
        arr[i] += arr[index];
    }
    if(arr[index] < 0) {
        for(int i = n-2; i >= 0; i--) {
            ans.push_back(ii(i+1,i));    
        }
    } else { 
        for(int i = 1; i < n; i++) {
            ans.push_back(ii(i-1,i));
        }    
    }
    cout << ans.size() << endl;
    for(int i = 0; i < ans.size(); i++ ){
        cout << ans[i].first+1 << " " << ans[i].second+1 << endl;
    }
}


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

int main() {
    int a, b, c, d, l, r;
    cin >> a >> b >> c >> d;
    l = a + b;
    r = c + d;
    if (l > r) {
        cout << "Left" << endl;
    } else if (l < r) {
        cout << "Right" << endl;
    } else {
        cout << "Balanced" << endl;
    }
}

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

#define dump(...) cout<<"# "<<#__VA_ARGS__<<'='<<(__VA_ARGS__)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

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

template<typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	print_tuple<Cdr...>(os,t);
	os<<(sizeof...(Cdr)?",":"")<<get<sizeof...(Cdr)>(t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

vi f(vl xs,vl ys,int a,ll d)
{
	map<ll,map<ll,int>> xy, yx;
	rep(i,xs.size()){
		ll x=xs[i],y=ys[i];
		xy[x][y]=i;
		yx[y][x]=i;
	}

	vi res(1,a);
	xy[xs[a]].erase(ys[a]);
	yx[ys[a]].erase(xs[a]);
	rep(k,res.size()){
		int u=res[k];
		ll x=xs[u],y=ys[u];
		for(ll x0:{x-d,x+d})
			if(xy.count(x0)){
				auto& c=xy[x0];
				for(auto i=c.lower_bound(y-d),j=c.upper_bound(y+d);i!=j;c.erase(i++)){
					int v=i->second;
					res.push_back(v);
					yx[ys[v]].erase(xs[v]);
				}
			}
		for(ll y0:{y-d,y+d})
			if(yx.count(y0)){
				auto& c=yx[y0];
				for(auto i=c.lower_bound(x-d),j=c.upper_bound(x+d);i!=j;c.erase(i++)){
					int v=i->second;
					res.push_back(v);
					xy[xs[v]].erase(ys[v]);
				}
			}
	}
	return res;
}

ll g(vl xs,vl ys,vi vs,ll d)
{
	vector<tuple<ll,ll>> xy,yx;
	rep(i,xs.size()){
		xy.emplace_back(xs[i],ys[i]);
		yx.emplace_back(ys[i],xs[i]);
	}
	sort(all(xy)); sort(all(yx));

	ll res=0;
	for(int v:vs){
		int x=xs[v],y=ys[v];
		for(ll x0:{x-d,x+d}){
			auto i=lower_bound(all(xy),mt(x0,y-d));
			auto j=upper_bound(all(xy),mt(x0,y+d));
			res+=j-i;
		}
		for(ll y0:{y-d,y+d}){
			auto i=upper_bound(all(yx),mt(y0,x-d));
			auto j=lower_bound(all(yx),mt(y0,x+d));
			res+=j-i;
		}
	}
	return res;
}

int main()
{
	for(int n,a,b;cin>>n>>a>>b&&n|a|b;){
		vl xs(n),ys(n);
		rep(i,n){
			int x,y; cin>>x>>y;
			tie(xs[i],ys[i])=mt(x+y,-x+y);
		}
		a--,b--;
		ll d=max(abs(xs[a]-xs[b]),abs(ys[a]-ys[b]));

		vi vs=f(xs,ys,a,d);
		cout<<g(xs,ys,vs,d)/2<<endl;
	}
}


Measured memory_bytes: 32760
MAP = {
 '1' => ['.', ',', '!', '?', ' '],
 '2' => ['a', 'b', 'c'],
 '3' => ['d', 'e', 'f'],
 '4' => ['g', 'h', 'i'],
 '5' => ['j', 'k', 'l'],
 '6' => ['m', 'n', 'o'],
 '7' => ['p', 'q', 'r', 's'],
 '8' => ['t', 'u', 'v'],
 '9' => ['w', 'x', 'y', 'z'],
}

def decode(str)
  msg = ''
  keymap_has = ->(i) { return MAP.key?(str[i]) ? true : false }
  finish = ->(i) { return str.length > i ? false : true }
  addcnt = ->(i, cnt) { return (cnt >= (MAP[str[i]]).length - 1) ? 0 : cnt + 1 }

  parser = ->(i, cnt, found) do
    unless finish[i]
      if keymap_has[i]
        cnt = addcnt[i, cnt]
        found ? parser[i + 1, cnt, true] : parser[i + 1, 0, true]
      else
        msg += MAP[str[i - 1]][cnt] if found
        parser[i + 1, -1, false]
      end
    end
  end

  parser[0, -1, false]

  return msg
end

tests_number = STDIN.gets.to_i
tests_number.times do
  puts decode(STDIN.gets.chomp)
end

Measured memory_bytes: 7916
#include <stdio.h>
#include <string.h>
#include <iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<unordered_set>
#include<unordered_map>
#define P pair<int,int>
#define int long long 
using namespace std;

int ans[10];
signed main() {
	int a, b, c; cin >> a >> b >> c;
	ans[0] += (a - 2)*(b - 2);
	unordered_map<int, unordered_map<int, bool>>U;
	for (int d = 0; d < c; d++) {
		int e, f; scanf("%lld%lld", &e, &f); e--; f--;
		for (int i = -1; i < 2; i++) {
			for (int j = -1; j < 2; j++) {
				int sum = 0;
				int n = e + i, m = f + j;
				for (int x = -1; x < 2; x++) {
					for (int y = -1; y < 2; y++) {
						if (n + x < 0 || n + x >= a || m + y < 0 || m + y >= b)goto l;
						if (U[n + x][ m + y])sum++;
					}
				}
				ans[sum]--;
				ans[sum + 1]++;
			l:;
			}
		}
		U[e][f] = true;
	}
	for (int i = 0; i < 10; i++) {
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 168436
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        double x1 = scan.nextDouble();
        double y1 = scan.nextDouble();
        double x2 = scan.nextDouble();
        double y2 = scan.nextDouble();

        System.out.println(Math.sqrt(Math.pow(x1 - x2 ,2) + Math.pow(y1 - y2, 2)));
    }
}

Measured memory_bytes: 18288
/* Generated by powerful Codeforces Tool
 * You can download the binary file in here https://github.com/xalanq/cf-tool (win, osx, linux)
 * Author: step_by_step
 * Time: 2020-03-19 17:35:03
**/

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
  
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <assert.h>
#include <memory.h>
#include <time.h>
#include <bitset>

#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = (l); i < (r); i++)
#define repb(i, r, l) for (int i = (r); i > (l); i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
#define rank qwertyuio
#define next dfghjk
#define prev fhsgfhjf
#define plus fsghsf
#define minus ytryr
  
using namespace std;
  
inline bool setmin(int &x, int y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(int &x, int y) { return (y > x) ? x = y, 1 : 0; }
inline bool setmin(ll &x, ll y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(ll &x, ll y) { return (y > x) ? x = y, 1 : 0; }
  
const int N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int P1 = 31;
const int P2 = 57;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const int MOD2 = 998244353;
const ld eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 26;

deque<int> next_good(deque<int> s) {
    int p = sz(s) - 1;
    while (p >= 0 && s[p] == 9) {
        s[p] = 0;
        p--;
    }
    if (p == -1) {
        s.push_front(1);
    } else {
        s[p]++;
    }
    while (true) {
        int b = -1;
        rep(i, 0, sz(s) - 1) {
            if (abs(s[i] - s[i + 1]) > 1) {
                b = i;
                break;
            }
        }
        if (b == -1) {
            break;
        }
        if (s[b + 1] > s[b]) {
            s[b]++;
        }
        int lll = max(s[b] - 1, 0);
        rep(i, b + 1, sz(s)) {
            s[i] = lll;
            lll = max(lll - 1, 0);
        }
    }
    return s;
}

int main()
{
    //freopen("circus.in", "r", stdin);
    //freopen("circus.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    cout << fixed;
    //ll TL = 10.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    int k;
    cin >> k;
    deque<int> ans = {0};
    rep(i, 0, k) {
        ans = next_good(ans);
    }
    for (int i : ans) {
        cout << i;
    }
    cout << "\n";
    return 0;
}



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

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


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

using namespace std;

using ll = long long;
using ull = unsigned long long;

template <typename T> inline void print(T val) { cout << val << '\n'; }

template <typename Iterator> inline void print(Iterator begin, Iterator end) {
  for (auto it = begin; it != end; it = next(it)) {
    cout << *it << ' ';
  }
  cout << '\n';
}

template <class T> inline T square(T x) {
  T result;
  result = x * x;
  return result;
};

#ifdef LOCAL
#define DBG_MACRO_NO_WARNING
#include <dbg.h>
#else
#define dbg(...) 0
#endif

const int MOD = 1e9 + 7;
const int INF = 1e9 + 5;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

#ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);

  auto start = chrono::steady_clock::now();
#endif

  ll a, b, c, k;
  cin >> a >> b >> c >> k;

  ll ans = 0;

  if (k >= a) {
    ans += a;
    k -= a;
  } else {
    ans = k;
    print(ans);
    return 0;
  }

  dbg(k);

  if (k >= b) {
    k -= b;
  } else {
    print(ans);
    return 0;
  }

  ans -= min(k, c);
  print(ans);

#ifdef LOCAL
  auto end = chrono::steady_clock::now();
  auto diff = end - start;

  cout << "Duration: " << chrono::duration<double, milli>(diff).count() << " ms"
       << '\n';
#endif

  return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std; 
int main()
{
int a;
int b;
int c;
int n;

cin>>n;
a=n/100;
c=n%10;
b=(n-100*a-c)/10;
if(a==1)
{
	a=9;

	
}
else
{
	a=1;
		
}
if(b==1)
{
	b=9;
	
}
else
{
	b=1;
	
}
if(c==1)
{
	c=9;
}
else
{
	c=1;

}
cout<<a*100+b*10+c;
    return 0;
}

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

int main(){
    int N, sum=0, quo;
    cin >> N;
    quo = N;
    while(quo!=0){
        sum += quo%10;
        quo = quo/10;
    }
    if(N%sum == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int X,Y,Z,A,B,C;

    scanf("%d%d%d",&A,&B,&C);

    X=A;
    A=B;
    B=X;

    Y=A;
    A=C;
    C=Y;

    printf("%d %d %d",A,B,C);

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long

using namespace std;
const int MAXN = 200005;
const int MOD = 1000000007;

ll s[MAXN],arr[MAXN],f[MAXN];

int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n; cin >> n;
	for(int i=1;i<=n;i++){
		cin >> arr[i];
	}
	sort(arr+1,arr+1+n);
	for(int i=1;i<=n;i++)
		s[i] = arr[i] + s[i-1];
	for(int i=1;i<n;i++){
		if(s[i] * 2 >= arr[i+1]) f[i] = 1;
		f[i] += f[i-1];
	}
	int ans = 1;
	for(int i=1;i<n;i++){
		if(f[n-1]-f[i-1] == n-i) ans++;
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3712
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input!{
        s: String,
    }
    let weather = ["Sunny", "Cloudy", "Rainy"];
    if let Some(i) = weather.iter().position(|&x| x == s) {
        println!("{}", weather[(i + 1) % 3]);
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
typedef pair<int,int>P;
#define fi first
#define se second

int n,m,c[1000];
int s;
signed main(){
    cin>>n;
    cin>>s;
    r(i,n-1){
        int p;
        cin>>p;
        s=__gcd(s,p);
    }
    cout<<s<<endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
typedef long long ll;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  char a;
  cin>>a;
  if('a' <= a && a <= 'z') cout << "a\n";
  else cout << "A\n";
  return 0;
}


Measured memory_bytes: 3028
#include <bits/stdc++.h>
using namespace std;
typedef long double ull;


int main()
{
    int a,b,c=0,sum=0;
    cin>>a>>b;

    while(b--)
    {
        int x;
        cin>>x;
        sum+=x;
    }

    if(sum>=a)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
from collections import deque
n,m = map(int, input().split())
G = [[]for i in range(n)]
for _ in range(m):
    a,b = map(lambda z: int(z)-1,input().split())
    G[a].append(b)
    G[b].append(a)

color = [-1 for _ in range(n)]
queue = deque([0])
color[0] = 1
two = True
while queue:
    now = queue.popleft()
    for to in G[now]:
        if color[to] == color[now]:
            two = False
            break
        if color[to] == -1:
            color[to] = 1 - color[now]
            queue.append(to)

if two:
    print(sum(color)*(n-sum(color)) - m)
else:
    print(n*(n-1)//2 - m)

Measured memory_bytes: 64288
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std ;

int pre[300005] , suf[300005] , len ;
char a[300005] ;

template< typename T >
void smin( T &x , T y ){ if( x > y ) x = y ; }

int main(){
	scanf( "%d" , &len ) , scanf( "%s" , a + 1 ) ;
	for( int i = 1 ; i <= len ; i ++ )
		pre[i] = pre[i-1] + ( a[i] == 'W' ) ;
	for( int i = len ; i ; i -- )
		suf[i] = suf[i+1] + ( a[i] == 'E' ) ;
	int ans = 1 << 20 ;
	for( int i = 1 ; i <= len ; i ++ )
		smin( ans , pre[i-1] + suf[i+1] ) ;
	printf( "%d" , ans ) ;
}


Measured memory_bytes: 2816
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

int main() {
  int n, m = 1e9;
  string s;
  cin >> n >> s;
  v1i v(n+2);
  v[0] = 0;
  rep(i, n){
    if(s[i] == 'E') v[i+1] = v[i] + 1;
    else v[i+1] = v[i];
  }
  v[n+1] = v[n];
  rep(i, n) m = min(m, i-v[i]+v[n+1]-v[i+1]);
  cout << m << endl;
  return 0;
}

Measured memory_bytes: 1796
n,m=map(int,input().split())
p=[-1]*(n+1)
a=list(map(int,input().split()))
e=[2,5,5,4,5,6,3,7,6]
p[0]=0
for i in range(n+1):
    for j in a:
        if i-e[j-1]>=0:
            p[i]=max(p[i],p[i-e[j-1]]*10+j)
print(p[-1])

Measured memory_bytes: 14388
#include <cstdio>
#include <cstring>
#include <string>
#include <string.h>
#include <cmath>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#define pi 3.1415926535
#define INF 0x3f3f3f3f
using namespace std;
typedef	long long ll;
ll n, m, i, j, k, h, t, maxn, ttt, t1, t2, sig = 0, l, d;

int main()
{
	cin >> n;
	string s;
	n = 0, m = 0;
	cin >> s;
	for (i = 0; i < s.length(); i++) {
		if (s[i] == 'R')n++;
		if (s[i] == 'B')m++;
	}
	if (n > m)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
S = int(input())
count = 0
s1 = int(S / 100)
S %= 100
s2 = int(S / 10)
S %= 10
s3 = S
if s1 == 1: count += 1
if s2 == 1: count += 1
if s3 == 1: count += 1
print(count)


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

#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

#define mygc(c) (c)=getchar_unlocked()
#define mypc(c) putchar_unlocked(c)

#define ll long long
#define ull unsigned ll

void reader(int *x){int k,m=0;*x=0;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){*x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||k>'9')break;*x=(*x)*10+k-'0';}if(m)(*x)=-(*x);}
void reader(ll *x){int k,m=0;*x=0;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){*x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||k>'9')break;*x=(*x)*10+k-'0';}if(m)(*x)=-(*x);}
void reader(double *x){scanf("%lf",x);}
int reader(char c[]){int i,s=0;for(;;){mygc(i);if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF) break;}c[s++]=i;for(;;){mygc(i);if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF) break;c[s++]=i;}c[s]='\0';return s;}
template <class T, class S> void reader(T *x, S *y){reader(x);reader(y);}
template <class T, class S, class U> void reader(T *x, S *y, U *z){reader(x);reader(y);reader(z);}
template <class T, class S, class U, class V> void reader(T *x, S *y, U *z, V *w){reader(x);reader(y);reader(z);reader(w);}

void writer(int x, char c){int s=0,m=0;char f[10];if(x<0)m=1,x=-x;while(x)f[s++]=x%10,x/=10;if(!s)f[s++]=0;if(m)mypc('-');while(s--)mypc(f[s]+'0');mypc(c);}
void writer(ll x, char c){int s=0,m=0;char f[20];if(x<0)m=1,x=-x;while(x)f[s++]=x%10,x/=10;if(!s)f[s++]=0;if(m)mypc('-');while(s--)mypc(f[s]+'0');mypc(c);}
void writer(double x, char c){printf("%.15f",x);mypc(c);}
void writer(const char c[]){int i;for(i=0;c[i]!='\0';i++)mypc(c[i]);}
void writer(const char x[], char c){int i;for(i=0;x[i]!='\0';i++)mypc(x[i]);mypc(c);}
template<class T> void writerLn(T x){writer(x,'\n');}
template<class T, class S> void writerLn(T x, S y){writer(x,' ');writer(y,'\n');}
template<class T, class S, class U> void writerLn(T x, S y, U z){writer(x,' ');writer(y,' ');writer(z,'\n');}
template<class T> void writerArr(T x[], int n){int i;if(!n){mypc('\n');return;}rep(i,n-1)writer(x[i],' ');writer(x[n-1],'\n');}

char memarr[17000000]; void *mem = memarr;
#define MD 1000000007

int N, A[100000], L;

int main(){
  int i, j, k;

  reader(&N,&L);
  rep(i,N) reader(A+i);

  REP(i,1,N) if(A[i-1]+A[i] >= L){
    writerLn("Possible");
    rep(j,i-1) writerLn(j+1);
    for(j=N-1;j>=i;j--) writerLn(j);
    return 0;
  }

  writerLn("Impossible");

  return 0;
}


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

bool check_location(int x, int y, int h, int w)
{
  	if(x<0 || y<0 || y>=h || x>=w)
    return false;
	return true;
}

int main()
{
  	int h,w;
  	cin>>h>>w;
  	vector<string> maps(h+4);
  	for(int i=0 ; i<h ; ++i)
    {
    	cin>>maps[i];
    }
  	for(int i=0 ; i<h ; ++i)
    {
    	for(int l=0 ; l<maps[i].length() ; ++l)
    	{
        	if(maps[i][l]!='#')
            {
              	int up=i-1;
              	int down=i+1;
              	int left=l-1;
              	int right=l+1;
              	
         		for(int j=up ; j<=down ; ++j)   	
                {
                	for(int k=left ; k<=right ; ++k)
                    {
                        if(!check_location(k,j,h,w))
                        continue;
                    	if(maps[j][k]=='#' && (maps[i][l]=='.' || maps[i][l]=='0'))
                        maps[i][l]='1';
                      	else if (maps[j][k]=='#' && maps[i][l]!='#')
                        maps[i][l]+=1;
                    }
                }
            }
            if(maps[i][l]=='.')
            maps[i][l]='0';
    	}
    	
    }
    for(int i=0 ; i<h ; ++i)
    cout<<maps[i]<<endl;
	return 0;
}

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

#define all(x) begin(x), end(x)

using i64 = int_fast64_t;
using f64 = double;
using p64 = pair<i64, i64>;

constexpr i64 INF = INT_FAST64_MAX / 2;
constexpr f64 EPS = DBL_EPSILON;

void solve() {
    i64 n, m;
    cin >> n >> m;
    vector<vector<i64>> path(n);
    for (i64 i = 0; i < m; i++) {
        i64 a, b;
        cin >> a >> b, a--, b--;
        path[a].emplace_back(b);
        path[b].emplace_back(a);
    }

    vector<i64> to(n, -1);
    queue<i64> from; // 1: node
    from.emplace(0);
    while (!from.empty()) {
        i64 node = from.front(); from.pop();

        for (auto& nxt : path[node]) {
            if (to[nxt] != -1) continue;
            to[nxt] = node;
            from.push(nxt);
        }
    }

    for (i64 i = 1; i < n; i++) {
        if (to[i] == -1) {
            cout << "No" << endl;
            return;
        }
    }

    cout << "Yes" << endl;
    for (i64 i = 1; i < n; i++) {
        cout << to[i] + 1 << endl;
    }
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 12820
mod = 10**9+7
l = input()
n = len(l)
dp1,dp2 = [0]*n,[0]*n
dp1[0] = 1
dp2[0] = 2
for i in range(1,n):
  if l[i] == "1":
    dp1[i] = (3*dp1[i-1] + dp2[i-1])%mod
    dp2[i] = (2*dp2[i-1])%mod
  else:
    dp1[i] = (3*dp1[i-1]) % mod
    dp2[i] = dp2[i-1]%mod
print((dp1[n-1]+dp2[n-1])%mod)

Measured memory_bytes: 11124
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <numeric>
#include <queue>
#include <numeric>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <map>
#include <functional>
#include <limits>
#include <set>
#include <stack>
#define rep(i,a,b) for((i)=a;i<(int)(b);i++)
#define max(a,b) ((a) < (b) ? (b) : (a))
#define min(a,b) ((a) > (b) ? (b) : (a))
#define AAA (1000000007)

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



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

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



int main() {

	int i, j, k;
	ll N, M, K;
	//int N, M, K;
	cin >> N >> K;
	ll a = N % K;
	ll b = (N / K + 1) * K-N;
	
	
	cout << (a>b ? b : a);

	return 0;
	
}

Measured memory_bytes: 256
n,k = map(int, input().split())
w = [int(input()) for i in range(n)]

def track_search(mid):
    count_track = 1
    cnt = 0
    for i in w:
        if i+cnt<=mid:
            cnt+=i
        else:
            count_track += 1
            cnt = i
    return count_track


def weight_search():
    global ans
    right = sum(w)+1
    left = max(w)
    while right>left:
        mid = (right+left)//2
        track = track_search(mid)
        if track>k:
            left = mid+1
        else:
            right = mid
            ans = mid
    return ans

print(weight_search())


Measured memory_bytes: 9564
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1<<29;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename T>void print(T t){for(auto &it:t)cout<<it<<" ";}
inline int powerexp(int a,int b,int m = MOD){int res=1;while(b){if(b&1)res=res*a%m;a=a*a%m,b>>=1;}return res%m;}
inline int modinv(int a){return powerexp(a,MOD-2,MOD);}
inline int lcm(int a,int b){int g=__gcd(a,b);return a/g*b;}

//-------------------< start here >-------------------------// 
void solve(){
    string s;
    int x;
    cin >> s;
    cin >> x;
    string ret = "";
    for(int i = 0; i<(int)s.length(); i+=x){
	   	ret+=s[i];
	}
	cout << ret << endl;	
}
//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr<<"time elapsed "<<(double)clock()/CLOCKS_PER_SEC<<endl;
   #endif
}


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

int main(void) {
	int A, B, K;
	cin >> A >> B >> K;
	for (int i = A;i <= B;i++) {
		if (i <A + K || i> B - K)
			cout << i << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <climits>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <complex>
#include <functional>
#include <utility>
#include <iterator>

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define dprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define dprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

//const double PI = 3.1415926535897932384626433832795;

int main() {
  string s;
  cin >> s;
  if(s[2] == s[3] && s[4] == s[5]) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
from collections import deque
s = input()
n = int(input())
q_list = [input().split() for _ in range(n)]
d = deque(list(s))
r_flag = False
for q in q_list:
    if q[0] == "1":
        r_flag = not r_flag
    elif q[0] == "2":
        if q[1] == "1":
            if r_flag:
                d.append(q[2])
            else:
                d.appendleft(q[2])
        elif q[1] == "2":
            if r_flag:
                d.appendleft(q[2])
            else:
                d.append(q[2])
if r_flag:
    d.reverse()
print("".join(d))

Measured memory_bytes: 47716
#include<iostream>
typedef long long ll;

using namespace std;

ll sum_of_divisors(ll n) {
  ll ans = 0;
  /*
  for(ll i = 1; i<=n;i++) {
    for(ll j=1;j<=n;j++) {
      if(i % j == 0) {
	ans += i;
      }
    }
  }
  */
  /*
  for(ll j = 1; j<=n;j++) {
    for(ll i=1;i<=n;i++) {
      if(i % j == 0) {
	ans += i;
      }
    }
  }
  */
  for(ll j = 1; j<=n;j++) {

    ll y = (ll) n / j;
    ans += (((y+1)*y)*j)/2;

  }
  return ans;

}

int main() {
  long long n;
  cin >> n;
  cout << sum_of_divisors(n);
}

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

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

    int fr[n+1]={0};
    int temp,sn,ans=0;
    for(int i=0;i<k;i++)
    {
        cin>>temp;

        while(temp--)
        {
            cin>>sn;
            fr[sn]=1;
        }
    }

    for(int i=1;i<n+1;i++)
        if(fr[i]==0)
        ++ans;

    cout<<ans<<endl;
}


Measured memory_bytes: 3640