akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include<cstdio>
#include <vector>
#include<queue>
#include<limits.h>
#include<string.h>
#include<functional>
using namespace std;

signed main() {
	double a; cin >> a;
	double PI = 3.14159265358979;
	printf("%.10lf %.10lf\n", a*a*PI, a * 2 * PI);
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
 
int main() {
   string S;
   cin>>S;
   if(S.at(6)=='1'||S.at(6)=='2'||S.at(6)=='3'||S.at(6)=='4'){
   if(S.at(5)=='0'){
     cout<<"Heisei"<<endl;}
       else
   {
       cout<<"TBD"<<endl;
   }
   
   }
   else
   {
       cout<<"TBD"<<endl;
   }
   
}
   

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int A[100001],n,count=0,count2=0,count3=0;
char B[100001];
int A2[100001];
char B2[100001];
//char C[100001][100001];
int Partition(int A[], int p, int r);
void Quicksort(int A[], int p ,int r);

int main(){
  int i,j,m;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    getchar();
    scanf("%c %d", &B[i], &A[i]);
  }
  for(i=0;i<n;i++){
     A2[i]=A[i];
     B2[i]=B[i];
   }



  m= Partition(A,0,n-1);
  Quicksort(A,0,n-1);

  

  
  for(i=0;i<n;i++){
    if(A[i] == A[i+1]){
      for(j=0;j<n;j++){
     
	if(A[i] == A2[j] && B[i] == B2[j]){
	  count=j;
	}

	if(A[i+1] == A2[j] && B[i+1] == B2[j]){
	  count2=j;
	}
      }
	//printf("count = %d count2 = %d \n ",count,count2);    
	if(count > count2){
	 count3++ ;
	 break;
	}

	// }
      
      
    }
  }
  
 
  if(count3==0)printf("Stable\n");
  else printf("Not stable\n");
  
  for(i=0;i<n;i++){
    printf("%c %d\n",B[i],A[i]);
    //printf("%c %d %c %d\n",B[i],A[i],B2[i],A2[i]);



 }
 
 

  return 0;
}


int Partition(int A[], int p,int r){
  int x,i,j,temp,temp2,t,t2;

  x = A[r];
  i = p-1;

  // printf("x = %d\n",x);

  for(j=p;j<=r-1;j++){
    if(A[j] <= x){
      
      i += 1;
      temp = A[i];
      A[i]=A[j];
      A[j]= temp;

      t = B[i];
      B[i]=B[j];
      B[j]= t;

    }
  }

  temp2 = A[i+1];
  A[i+1] = A[r]; 
  A[r]= temp2;  

  t2 = B[i+1];
  B[i+1] = B[r]; 
  B[r]= t2;  
  
  return i+1;
}

void Quicksort(int A[], int p, int r){
  int q;

  if (p < r){

    q = Partition(A,p,r);
    Quicksort(A, p, q-1);
    Quicksort(A, q+1, r);
  }
  
}

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

using namespace std;
using ll = long long;
using vs = vector<string>;
using pll = pair<ll,ll>;
using vpl = vector<pll>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vvb = vector<vb>;

#define R(a,i) for(ll a=0; a < (i); (a)++)
#define FOR(a,i,j) for(ll a=(i); a < (j); (a)++)
#define RD(a,i) for(ll a=(i)-1; (a) >= 0; (a)--)
#define FORD(a,i,j) for(ll a=(j)-1; (a) >= (i); (a)--)

#define xx first
#define yy second
#define pb push_back

#define all(X) begin(X),end(X)
#define sz(X) size(X)

#define DBG 1
#define TR(X) {if(DBG) cerr << (#X) << " = " << (X) << "\n";}
#define hline {if(DBG) cerr << "----------------------------------------------------------------------" << "\n";}
#define PK(X) {if(DBG) cerr << (X) << "\n";}

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

	ll N, K, Q;
	cin >> N >> K >> Q;

	vl points(N, 0);

	FOR(i,0,Q) {
		ll ith;
		cin >> ith;
		ith--;
		points[ith]++;
	}

	FOR(i,0,N) {
		if(K - Q + points[i] > 0)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
}


Measured memory_bytes: 1408
use std::io;

fn read_line() -> String {
    let mut line = String::new();
    io::stdin().read_line(&mut line).unwrap();
    return String::from(line.trim());
}

fn digit_total(n: i64) -> i64 {
    return if n == 0 {
        0
    } else {
        digit_total(n / 10) + n % 10
    }
}


fn main() {
    let n = read_line().parse::<i64>().unwrap();
    println!("{}", if n % digit_total(n) == 0 { "Yes" } else { "No" });
}

Measured memory_bytes: 4352
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(S: str):
    N = len(S)
    zeros = [0]*N
    nodes = zeros[:]
    for i in range(N):
        if S[i] == "R":
            nodes[i] = i+1
        else:
            nodes[i] = i-1
    buf = zeros[:]
    for _ in range(100):
        buf[:] = zeros
        for i in range(N):
            buf[i] = nodes[nodes[i]]
        nodes[:] = buf

    ans = zeros[:]
    for i in range(N):
        ans[nodes[i]] += 1

    print(*ans, sep=" ")

    return


def main():

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


if __name__ == '__main__':
    main()


Measured memory_bytes: 11880
#include<stdio.h>
int main()
{
    int a,b,c,sum;
    scanf("%d%d%d",&a,&b,&c);
    sum=a+b+c;
    if(sum>=22)
    {
        printf("bust\n");
    }
    else
    {
        printf("win\n");
    }
}


Measured memory_bytes: 128
N,C=[int(x) for x in str(input()).split()]
A=[]
for i in range(N):
  a,b,d=[int(x) for x in str(input()).split()]
  A.append([d,a,b])


br=200002

count=[0 for i in range(br)]

A.sort()
for i in range(1,C+1):
  ind=[0 for i in range(br)]
  end=0
  for j in range(N):
    if A[j][0]==i:
      if end!=A[j][1]:
        end=A[j][2]
        ind[2*A[j][1]-1]=1
        ind[2*end]=-1
      else:
        end=A[j][2]
        ind[2*A[j][1]]=0
        ind[2*end]=-1
  temp=0
  for j in range(br):
    temp+=ind[j]
    if temp>0:
      count[j]+=1

print(max(count))












Measured memory_bytes: 120632
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;
bool l[30000][10], r[30000][10];
bool ok[10][10][10];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int N;
    string S;
    cin >> N;
    cin >> S;
    l[0][S[0]-'0'] = true;
    for(int i = 1; i < N; i++){
        for(int j = 0; j < 10; j++){
            l[i][j] = l[i-1][j];
        }
        l[i][S[i]-'0'] = true;
    }
    r[N-1][S[N-1]-'0'] = true;
    for(int i = N-2; i >= 0; i--){
        for(int j = 0; j < 10; j++){
            r[i][j] = r[i+1][j];
        }
        r[i][S[i]-'0'] = true;
    }
    for(int i = 1; i <= N-2; i++){
        int t = S[i]-'0';
        for(int j = 0; j < 10; j++){
            for(int k = 0; k < 10; k++){
                if(l[i-1][j] && r[i+1][k]) ok[j][t][k] = true;
            }
        }
    }
    int ans = 0;
    for(int i = 0; i < 10; i++){
        for(int j = 0; j < 10; j++){
            for(int k = 0; k < 10; k++){
                if(ok[i][j][k]) ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 896
#include <stdio.h>
int main(void){
    int x, y;
    
    scanf("%d%d",&x,&y);
    
    if((y>(x*4))||(y<(x*2))){
        printf("No\n");
    }
    else{
        if(y%2==0) printf("Yes\n");
        else           printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 1620
#include <bits/stdc++.h>
#ifdef _WIN32
#include "debug.hpp"
#endif
using namespace std;

#define rep(i, N)  for(int i = 0; i < (N); i++)
#define reps(i, N) for(int i = 1; i <= (N); i++)
#define repr(i, N) for(int i = (N) - 1; i >= 0; i--)
#define pub push_back

template<typename T> 
void chmax(T &a, T b){ a = max(a, b); };
template<typename T> 
void chmin(T &a, T b){ a = min(a, b); };

typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;
const ll LINF = 10000000000000000;
const int MOD = 1000000007;
const int dx[9] = { 0, 1,  0, -1, 1,  1, -1, -1, 0};
const int dy[9] = { 1, 0, -1,  0, 1, -1, -1,  1, 0};
//--------------------------------------//
int n;
ll a[100000];

void solve(){
	rep(i, n)
		a[i] *= 2;
	sort(a, a + n, greater<ll>());
	ll mi = LINF;
	ll ans;
	reps(i, n - 1){
		if(abs(a[0] / 2 - a[i]) < mi){
			mi = abs(a[0] / 2 - a[i]);
			ans = i;
		}
	}
	cout << a[0] / 2 << " " << a[ans] / 2 << endl;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n;
	rep(i, n) {
		cin >> a[i];
	}
		solve();
	return 0;
}


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

int read(){
    int x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+(c^48);c=getchar();}
    return x*f;
}

int gcd(int a,int b){
    return b?gcd(b,a%b):a;
}

#define MAXN 100000
int N,Ans;

int main(){
    N=read();
    for(int i=1;i<=N;i++)
        Ans=gcd(Ans,read());
        printf("%d",Ans);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define pb push_back
typedef pair<ll,ll> ipair;
#define F first
#define S second
 
/*
//functions from gfg
 
long long int power(long long int x,long long int y,long long  int p)
{
    long long int res = 1;     // Initialize result
 
    x = x % p;  // Update x if it is more than or 
                // equal to p
 
    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            {//d=(long double)x/p;
            res = (res*x) % p;
            }
 
        // y must be even now
        y = y>>1; // y = y/2
        x=(x*x)%p;
        
    }
    return res%p;
}
 
long long int gcd(long long int a,long long int b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
}
 
long long int binomialCoeff(long long int n, ll k) 
{ 
    ll res = 1; 
  
    // Since C(n, k) = C(n, n-k) 
    if (k > n - k) 
        k = n - k; 
  
    // Calculate value of [n*(n-1)*---*(n-k+1)] / [k*(k-1)*---*1] 
    for (ll i = 0; i < k; ++i) 
    { 
        res *= (n - i); 
        res /= (i + 1); 
    } 
  
    return res; 
} 
 

void sieve(int n, vector<ll> &primes) 
{ 
    vector<int> prime(n,1);
    ll p;
    for ( p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == 1) 
        { 
            
            for (int i=p*p; i<=n; i += p) 
                prime[i] = 0; 
        } 
    } 
  
    for(p=2;p<=n;p++)
    {
        if(prime[p])
        primes.pb(p);
    }
   
} 


void dfs(vector<ll> adj[] ,ll src,vector<ll> &vis)
{
    vis[src]=1;
    for(ll i=0;i<adj[src].size();i++)
    {
        if(vis[adj[src][i]]==0)
        dfs(adj,adj[src][i],vis)
    }
}
 
*/

int main() {
	ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cout.tie(NULL);
    
    
	ll n,i,j,p,a,b,k,m,ans=0;
    cin>>n>>a>>b;
    if(a%2==b%2)
    {
        cout<<abs(a-b)/2<<endl;
    }
    else
    {
        ans+=(abs(a-b)-1)/2;
        ans+=min(min(a,b),n+1-max(a,b));
        cout<<ans<<endl;
    }
    
    
    
    
    
    
    // for(i=0;i<n;i++)
    // {
    //     cout<<a[i]<<" ";
    // }
    // cout<<endl;
    
	return 0;
}

Measured memory_bytes: 3588
n = int(input())
s = input()

res = 0
for i in range(1000):
    one = str(i//100)
    two = str(i%100//10)
    three = str(i%10)
    
    flg1 = False
    flg2 = False
    flg3 = False
    
    ptr = 0
    for j in range(ptr, n-2):
        if(s[j] == one):
            flg1 = True
            ptr = j+1
            break
    
    for j in range(ptr, n-1):
        if(s[j] == two):
            flg2 = True
            ptr = j+1
            break
    
    for j in range(ptr, n):
        if(s[j] == three):
            flg3 = True
            break
    
    if(flg1 and flg2 and flg3): res += 1

print(res)

Measured memory_bytes: 44380
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using stkll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
#ifndef ONLINE_JUDGE
    #define debug(x) cerr << #x << ": " << x << endl;
#else
    #define debug(x)
#endif

ll dp[110][110000];

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

    ll N, W; cin >> N >> W;
    vll w(N+1), v(N+1);
    rep(i,N) cin >> w[i+1] >> v[i+1];

    rep(i, 110) rep(j, 110000) dp[i][j] = INF;
    dp[0][0] = 0;
    for(ll i = 1; i <= N; i++) {
        for(ll j = 0; j <= 110000; j++) {
            dp[i][j] = dp[i-1][j];
            if(j-v[i] >= 0) chmin(dp[i][j], dp[i-1][j-v[i]] + w[i]);
        }
    }
    ll ans = 0;
    rep(j, 110000) if(dp[N][j] <= W) chmax(ans, j);
    cout << ans << endl;
}


Measured memory_bytes: 94848
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>

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

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

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

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

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

  ll A, B;
  cin >> A >> B;

  ll p = B - A;
  ll answer {};
  for (ll i = 1;i != p;++i) {
    answer += i;
  }
  cout << answer-A << '\n';
}


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

vector<int> binary(int keta, int N) {
  vector<int> vec(keta,0);
  for (int i=keta-1;i>=0;i--) {
    if (N>=pow(2,i)) {
      vec[i]=1;
      N-=pow(2,i);
    }
  }
  return vec;
}

int main() {
  int H,W,K;
  cin >> H>>W>>K;
  vector<string> vec(H);
  vector<string> vec2(H);
  for (int i=0;i<H;i++) {
    cin >> vec[i];
  }
  vector<int> hh(H);
  vector<int> ww(W);
  int unicount=0;
  int black;
  for (int i=0;i<pow(2,H);i++) {
    hh=binary(H,i);
    for (int j=0; j<pow(2,W);j++) {
      vec2=vec;
      black=0;
      ww=binary(W,j);
      for (int k=0;k<H;k++) {
        if (hh[k]==0) {continue;}
        for (int l=0;l<W;l++) {
          vec2[k][l]='r';
        }
      }
      for (int l=0;l<W;l++) {
        if (ww[l]==0) {continue;}
        for (int k=0; k<H;k++) {
          vec2[k][l]='r';
        }
      
      }
      for (int x=0;x<H;x++) {
        for (int y=0;y<W;y++) {
          if (vec2[x][y]=='#') {
            black++;
          }
        }
      }
      if (black==K) {
        unicount++;
      }
    }
    
    

  }
  cout << unicount << endl;

  

}

Measured memory_bytes: 4100
n,d=map(int,input().split())
arr=[]
ans=0
for i in range(n):
    li=list(map(int,input().split()))
    arr.append(li)
arr.append(arr[0])

for i in range(n):
  for ii in range(i+1,n):
    a=0
    for j in range(d):
      a+=(arr[ii][j]-arr[i][j])**2
    if a**0.5==int(a**0.5):
      ans+=1
print(ans)

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

#define ll long long
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

//const int MOD = 1e9 + 7;
//typedef unsigned long long u64;
//const double pi = 3.141592653589793238460;

const int MAX = 1e6 + 1;

int arr[200001];
int freq[MAX];

int main()
{
	//IOS
	int t = 1;
	//cin >> t;
	while(t--)
	{
		int n;
		cin >> n;
		for(int i = 1; i <= n; i++)
		{
			cin >> arr[i];
			freq[arr[i]]++;
		}

		vector<int> adj[n + 1];

		for(int i = 1; i <= n; i++)
		{
			int num = arr[i];
			for (int ii = 1; ii <= sqrt(num); ii++)
			{
				if (num % ii == 0)
				{
					if (num / ii == ii)
						adj[i].push_back(ii);
					else
					{
						adj[i].push_back(ii);
						adj[i].push_back(num / ii);
					}
				}
			}
		}

		ll ct = 0;
		bool fl;
		for(int i = 1; i <= n; i++)
		{
			fl = true;
			for(int j : adj[i])
			{
				if(j == arr[i] && freq[j] > 1)
				{
					fl = false;
					break;
				}
				if(j != arr[i] && freq[j] > 0)
				{
					fl = false;
					break;
				}
			}
			if(fl) ct += 1;
		}
		cout << ct << endl;
	}
	return 0;
}


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

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

    bool flg = false;

    int num = X / 100;
    for(int i=1; i<= num; ++i){
        if(X >= 100*i && X <= 105*i){
            flg = true;
            break;
        }
    }
    if(flg) cout << 1 << endl;
    else cout << 0 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int A, B;
    cin >> A >> B;
    bool a = true;
    for (int i = 1; i < 21; i++){
        if (B == A * i){
            a = false;
        }
    }
    if (a == true){
        cout << B - A << endl;
    }
    else {
        cout << A + B << endl;
    }
}

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

int main(){
    string a, b, c;
    cin >> a >> b >> c;
    cout << a[0] << b[0] << c[0] << endl;
    return 0;
}


Measured memory_bytes: 256
# AOJ 0042 A Thief
# Python3 2018.6.22 bal4u
 
MAX = 1003
 
for cno in range(1, 100):
    lim = int(input())
    if lim == 0: break
    print("Case ", cno, ":", sep='')
    N = int(input())
    V = [[0 for j in range(MAX)] for i in range(2)]
    W = [[0 for j in range(MAX)] for i in range(2)]     
    k1, k2 = 0, 1
    for i in range(1, N+1):
        v, w = map(int, input().split(','))
        for j in range(1, w):
            V[k2][j] = V[k1][j]
            W[k2][j] = W[k1][j]
        for j in range(w, lim+1):
            d = j - w
            if V[k1][d] + v >= V[k1][j]:
                V[k2][j] = V[k1][d] + v
                W[k2][j] = W[k1][d] + w
            else:
                V[k2][j] = V[k1][j]
                W[k2][j] = W[k1][j]
        k1, k2 = k2, k1
    print(V[k1][lim], W[k1][lim], sep='\n')



Measured memory_bytes: 5732
#F - Tree and constraints
#メモリテスト
import itertools
from collections import defaultdict
N = int(input())
G = [[] for i in range(N+1)]
edge = defaultdict(int)
for i in range(N-1):
    a, b = map(int, input().split())
    edge[(min(a, b), max(a, b))] = i+1
    G[a].append(b)
    G[b].append(a)
M = int(input())
que = [tuple(map(int, input().split())) for i in range(M)]
Data = [set([]) for i in range(M)]


def dfs(node):
    visited[node] = True
    for child in G[node]:
        if visited[child] == False:
            parent[child] = node
            dfs(child)


for i in range(M):
    s, g = que[i]
    visited = [False for i in range(N+1)]
    parent = [-1 for i in range(N+1)]
    dfs(s)
    now = g
    while parent[now] > 0:
        number = edge[(min(now, parent[now]), max(now, parent[now]))]
        Data[i].add(number)
        now = parent[now]
ans = 2**(N-1)
seq = [i for i in range(M)]
for i in range(1, M+1):
    # Mこからi+1こを選ぶ
    S = 0

    for v in itertools.combinations(seq, i):
        subset = set([])
        for x in v:
            subset = subset | Data[x]
        S += 2**(N-1-len(subset))
    ans -= (-1)**((i-1) % 2)*S
print(ans)



Measured memory_bytes: 75668
package main

import (
	"fmt"
)

func main() {
	var n, a, b, ans int
	fmt.Scan(&n, &a, &b)

	if a == 0 {
		ans = 0
	} else {
		if n < a+b {
			if n < a {
				ans = n
			} else {
				ans = a
			}
		} else {
			syou := n / (a + b)
			amari := n % (a + b)
			if amari < a {
				ans = amari + syou*a
			} else {
				ans = a + syou*a
			}
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 512
// B.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <map>

using namespace std;

typedef long long LL;

int main(int argc, char *argv[]) {
	LL n, d, x, y, ans = 0;
	cin >> n >> d;
	LL dd = d * d;
	for (int i = 0; i < n; ++i) {
		cin >> x >> y;
		ans += (x * x + y * y) <= dd;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3616
/*input
1
*/

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

// from atcoder live
// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1e9+7;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
 
    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main() {
    int n;
    cin >> n;
    mint a9 = 1, a8 = 1, a7 = 1;
    rep(i, n) {
        a9 *= 10;
        a8 *= 9;
        a7 *= 8;
    }
    mint ans = a9-a8*2+a7;
    cout << ans << endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define pb(a) push_back(a)
using namespace std;
typedef long long LL;
const LL INF = 999999999999;

int main(){
    int q;
    cin >> q;
    rep(i, q){
        int a,b,c,d;
        cin >> a >> b >> c >> d;
        a--;b--;c--;d--;
        int ans = 0;
        for(int i=a; i<=c; i++){
            for(int j=b; j<=d; j++){
                if(i%2==0 && j%2==1) continue;
                else ans++;
            }
        }
        cout << ans << endl;
    }

}



Measured memory_bytes: 3072
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
using namespace std;
typedef long long ll;
ll MOD = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << a * b / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
public class Main{
    public static void main(String[] args){
        
        int a, b, c;
        
        for(a = 1; a < 10; a++){
            for(b = 1; b < 10; b++){
                System.out.println(a + "x" + b + "=" + (a * b));
            }
        }
    }
}



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

const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int x;
    cin >> x;
    set<int> st;
    for (int i=2; i*i<=x; ++i) {
        for (int j=i*i; j<=x; j*=i) {
            st.insert(j);
        }
    }
    st.insert(1);
    auto itr = st.end();
    --itr;
    cout << *itr << endl;
    return 0;
}


Measured memory_bytes: 3628
have_n = int(input())

have_dict = {"S": [], "H": [], "C": [], "D": []}

for _ in range(have_n):
    suit, rank = input().split()
    rank = int(rank)
    
    have_dict[suit].append(rank)

for suit in have_dict.keys():
    for rank in range(1, 14):
        if not rank in have_dict[suit]:
            print(suit, rank)


Measured memory_bytes: 5600
#include<iostream>
	using namespace std;
	#define fo(i,n) for(int i=0;i<n;i++)
	#define pb push_back
	#define mp map<int,int>
	#define ump unordered_map<int,int>
	#define vi vector<int>
	#define M INT_MAX
	#define MI INT_MIN
	#define ll long long int
	#define pii pair<int,int>
	#define F first
	#define S second
	#define fall(i,a,b) for(int i=a;i<b;i++)
	#define pi 3.1415926535
	void solve()
	{
			int r;
			cin>>r;
			cout<<(double)(2*pi*r)<<endl;
	}
	int main()
	{
		ios_base::sync_with_stdio(false);
	    cin.tie(NULL);
		solve();
	}

Measured memory_bytes: 3792
N = int(input())
li = []
pre_t = 0
pre_x = 0
pre_y = 0
ans = "Yes"
for _ in range(N):
    t, x, y = map(int, input().split())
    dist = abs(x - pre_x) + abs(y - pre_y)
    d_t = abs(t - pre_t)
    if dist > d_t or (dist - d_t) % 2 == 1:
        ans = "No"

    pre_t, pre_x, pre_y = t, x, y

print(ans)


Measured memory_bytes: 46312
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int H, N, A[1010], B[1010];
int dp[1010][10101];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> H >> N;
	rep(i, 0, N) cin >> A[i] >> B[i];

	rep(i, 0, N + 1) rep(h, 0, H + 1) dp[i][h] = inf;
	dp[0][H] = 0;

	rep(i, 0, N) rrep(h, H, 0) {
		chmin(dp[i + 1][h], dp[i][h]);
		chmin(dp[i][max(0, h - A[i])], dp[i][h] + B[i]);
	}

	cout << dp[N][0] << endl;
}







Measured memory_bytes: 39936
n = int(input())
k = [[int(i)] for i in input().split()]
for i in range(n):
    k[i].append(i)
k.sort()
a = k[n//2-1][0]
b = k[n//2][0]
ans = [0]*200010
for i in range(n//2):
    ans[k[i][1]] = b
for i in range(n//2,n):
    ans[k[i][1]] = a
for i in range(n):
    print(ans[i])
 

Measured memory_bytes: 44992
#include<bits/stdc++.h>
using namespace std;
#define F(i,s,e) for(int i=s;i<e;++i)

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

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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

const int INF = 1e9;
int n;
int acts[100000][3];
int memo[100000][3];

int dp(int day = 0, int prev = -1)
{
	if (day == n)
		return 0;
	if (prev != -1 && memo[day][prev] > -1)
		return memo[day][prev];

	int res = -INF;
	for (int i = 0; i < 3; i++)
	{
		if (i == prev)
			continue;
		res = max(res, dp(day + 1, i) + acts[day][i]);
	}
	if (prev != -1)
		memo[day][prev] = res;
	return res;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> acts[i][0] >> acts[i][1] >> acts[i][2];
	}
	memset(memo, -1, sizeof(memo));
	cout << dp();
}

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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int64_t n;
  std::cin >> n;
  std::vector<int64_t> a(n);
  std::cin >> a;

  int64_t s = 0;
  for (int64_t i = 1; i < n; i++) {
    if (i % 2 == 1) {
      s += 2 * a[i];
    } else {
      s -= 2 * a[i];
    }
  }
  s *= -1;
  s += a[0] * 2;
  s /= 2;

  std::cout << s << " ";
  for (int64_t i = 1; i < n; i++) {
    std::cout << 2 * (a[i - 1] - s / 2);
    s = 2 * (a[i - 1] - s / 2);
    if (i != n - 1) {
      std::cout << " ";
    }
  }
  std::cout << std::endl;
  return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long u_ll;
typedef pair<int, int> pair_;
 
const int INF = 1001001001;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
int k;
 
int gcd(int a, int b){
    if(b == 0) return a;
 
    return gcd(b, a%b);
}
 
int main(){
    int n;
    cin>>n;
    vector<int> a_(n);
    a_[0]=0;

    for(int i = 1;i<n;i++) cin>>a_[i];

    vector<int> cnt(n, 0);

    for(int i =1;i<n;i++) {
        cnt[a_[i]-1]++;
    }

    rep(i,n) cout<<cnt[i]<<endl;

    return 0;
}

Measured memory_bytes: 4840
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <utility>
#include <typeinfo>
#include <tuple>
using namespace std;

#define MOD 1000000007
#define INF 1e9+7
#define INF_LONG 1e18
#define rep(i, n) for(int i=0; i<n; ++i)
#define rep1(i, n) for(int i=1; i<=n; ++i)
#define rrep(i, m, n) for(int i=m; i<n; ++i)
#define countof(array) (sizeof(array) / sizeof(array[0]))
typedef long long ll;

#define MAX_N 200000
#define MAX_M 100000
#define MAX_V 100
#define MAX_E 100
#define MAX_Q 100000

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

int ddx[] = {-1, 0, 1, 0, -1, 1, -1, 1};
int ddy[] = {0, -1, 0, 1, 1, 1, -1, -1};

string ab = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
string as = {"abcdefghijklmnopqrstuvwxyz"};

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

ll lcm(ll x, ll y) {
  return (x*y)/gcd(x, y);
}

void yes() {
  cout << "Yes" << endl;
}

void no() {
  cout << "No" << endl;
}

void print_array(int array[], int len) {

  for(int i=0; i<len; ++i) {
    cout << array[i] << endl;
  }

}

ll absolute(ll x) {
  return (x<0)? (-1)*x : x;
}

//g++ AtCoder.cpp -o AtCoder
//AtCoder

//--------------------------
int main() {

  int k, x;
  cin >> k >> x;

  if(500*k>=x) yes();
  else no();

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;
public class Hello
{
    private const long INF = 1000000007;
    private struct Pair { public long x, y; public Pair(long xx, long yy) { x = xx; y = yy; } }
    public static void Main()
    {
        int N = NextInt();
        int M = NextInt();
        int K = NextInt();
        //2点間さえわかればおｋ
        long ans = 0;
        long C = PCH.nCr(N * M - 2, K - 2);
        long[] X = new long[M + 1];
        for (int i = 0; i <= M; i++) { X[i] = i; X[i] %= INF; }
        for (int i = 1; i <= M; i++) { X[i] += X[i - 1]; X[i] %= INF; }

        long[] Y = new long[N + 1];
        for (int i = 0; i <= N; i++) { Y[i] = i * M; Y[i] %= INF; }
        for (int i = 1; i <= N; i++) { Y[i] += Y[i - 1]; Y[i] %= INF; }

        for (int x = 1; x <= M; x++)
        {
            for (int y = 1; y <= N; y++)
            {
                //Y座標は上にしか存在しない(同じ列のY座標はなので)
                ans += (((Y[N - y] + INF) % INF) * C) % INF;

                //X座標は絶えず変動するので自身より右、左側(領域高さ-1)を足す
                ans += (((X[M - x] + INF) % INF) * (N - y + 1) + ((X[x - 1] + INF) % INF) * (N - y)) * C % INF;
            }
        }
        Console.WriteLine(ans % INF);
    }
}
public static class PCH
{
    public static long nPr(long n, long r, long m = 1000000007)
    {
        for (long i = 0; i < r; r++) { n *= (n - i); n %= m; }
        return n;
    }
    public static long nCr(long n, long r, long m = 1000000007)
    {
        long a = 1;
        for (long i = 0; i < r; i++) { a *= (n - i); a %= m; }
        long b = 1;
        for (long x = 2; x <= r; x++) { b *= x; b %= m; }
        b = RepPow(b, m - 2) % m;
        return (a * b) % m;
    }
    public static long nHr(long n, long r, long m = 1000000007)
    {
        return nCr(n + r - 1, r, m);
    }
    public static long RepPow(long x, long p, long m = 1000000007)
    {
        if (p == 1) return x % m;
        long b = RepPow(x, p / 2, m) % m;
        if (p % 2 == 0) { return (b * b) % m; }
        else { return (x * ((b * b) % m)) % m; }
    }
}
public class Input
{
    private static Queue<string> queue = new Queue<string>();
    private static void Confirm() { if (queue.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) queue.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(queue.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(queue.Dequeue()); }
    public static string NextString() { Confirm(); return queue.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(queue.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 13268
import java.util.Scanner;

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

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

        int x = b;
        if (b >= 100)
            x += a * 1000;
        else if (b >= 10)
            x += a * 100;
        else
            x += a * 10;

        boolean isRe = false;
        int cnt = 1;
        int total = cnt * cnt;
        while (total <= x) {
            if (x == total) {
                isRe = true;
                break;
            }
            cnt++;
            total = cnt * cnt;
        }
      	
        System.out.println(isRe ? "Yes" : "No");
    }
}


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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
const long long INF = 1LL << 60;

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

  ll n, k;
  cin >> n >> k;

  ll mx = (n - 1) * (n - 2) / 2;

  if (k > mx) {
    cout << -1 << endl;
  } else {
    vector<P> edges;
    for (ll i = 2; i <= n; i++) {
      edges.emplace_back(1, i);
    }

    FOR(i, 2, n + 1) {
      FOR(j, i + 1, n + 1) {
        if (mx <= k) {
          goto end;
        }
        edges.emplace_back(i, j);
        mx--;
      }
    end:;
    }

    cout << edges.size() << endl;
    for (const auto& e : edges) {
      cout << e.first << " " << e.second << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 512
eval"D,G,*A="+`dd`.split*?,
p (0..1023).map{|b|n=e=0;s=G;A.each_slice(2){|q,c|e+=100;b&1>0?(n+=q;s-=q*e+c):Q=q*E=e;b/=2};s>0?s>Q ? 1e4:n--s/E: n}.min

Measured memory_bytes: 2308
#include <algorithm>
#include <iostream>
#include <vector>
 
using namespace std;
 
int main() {
  int n;
  cin >> n;
  
  // vector<int> p;
  int ans = 0;
  int m = 200000000;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    // p.push_back(x);
	m = min(m, x);
    if (m < x) {
      continue;
    }
    ++ans;
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
 
#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )

const double PI = acosl(-1.0);


int main() {

	int k;
	string s;

	cin >> k >> s;

	if ( (int) s.size() <= k ) {
		cout << s << endl;
	} else {
		cout << s.substr(0, k) << "...\n";
	}

	return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;

int n, m, q, ans;
int a[50], b[50], c[50], d[50];


void makenum(int x, vector<int> &vec){
	if (x == n){
		int temp = 0;
		for (int i = 0; i < q; i++){
			if (vec[b[i]-1] - vec[a[i]-1] == c[i]) temp += d[i];
		}
		ans = max(ans, temp);
		return;
	}
	if (x == 0){
		vec.push_back(1);
		makenum(x+1, vec);
	}else{
		for (int i = vec[x-1]; i <= m; i++){
			vec.push_back(i);
			makenum(x+1, vec);
			vec.pop_back();
		}
	}
	return;
}


int main(){
	cin >> n >> m >> q;
	for (int i = 0; i < q; i++){
		cin >> a[i] >> b[i] >> c[i] >> d[i];
	}
	vector<int> vec;
	makenum(0, vec);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3636
require 'pp'

M,D = $stdin.readline.chomp.split.map(&:to_i)

ans = 0
(1..D).each do |d|
  d1 = d % 10
  d10 = d / 10
  next if d1 == 1 or d10 == 1
  (1..M).each do |m|
    if d1 * d10 == m
      ans += 1
    end
  end
end
puts ans



Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
int R,C,r,c;
int main(){
    cin>>R>>C>>r>>c;
    int ans = R*C-r*C-c*R+r*c;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int M=1e5+3;
int a[M];
priority_queue<ll>q;
int main(){
	ll n,m;
	scanf("%lld%lld",&n,&m);
	ll k;
	for(ll i=0;i<n;i++){
		scanf("%lld",&k);
		q.push(k);
	}
	while(m--){
		ll maxn=q.top();
		q.pop();
		maxn>>=1;
		q.push(maxn);
	}
	ll sum=0;
	while(!q.empty()){
		sum+=q.top();
		q.pop();
	}
	printf("%lld",sum);
}

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

#define ll long long
#define Fi first
#define Se second
#define Pb push_back
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvp vector<vector<pair<int,int>>>

const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<int>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define all(v) v.begin(),v.end()
#define output_s(a) printf("%s\n",(a).c_str())

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m) for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x) for(auto &item:(x))

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template<typename TypeInt> //最大公約数
TypeInt GCD(TypeInt a,TypeInt b){
    if(a%b==0) return b;
    else return GCD(b,a%b);
}
template<typename TypeInt> //最小公倍数
TypeInt LCM(TypeInt a,TypeInt b){
    return a*b/GCD(a,b);
}

int IN_int(){
    int x;
    scanf("%d",&x);
    return x;
}

//library----------------------------------------------

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

const int NMAX = 100;
bool flag;

bool comp(int x,int y){
    return abs(0-x)<abs(0-y);
}

signed main(){
    CIN(a,b);
    SCIN(s);
    flag=true;
    RepS(i,0,a+b){
        if(i<a&&s[i]=='-'){flag=false;break;}
        else if(i==a&&s[i]!='-'){flag=false;break;}
        else if(a<i&&i<=a+b&&s[i]=='-'){flag=false;break;}
    }
    printf(flag?"Yes":"No");
    
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>

#define MAX_N (2*100000)

using namespace std;

int a[MAX_N + 10];

int main() {
  int n;
  scanf("%d", &n);

  for(int i=0;i<n;++i){
    scanf("%d", &a[i]);
  }

  int it = n - 1;
  for(int i=0;i<n;++i){
    if ( it < 0 ) {
      printf("%d ", a[-it-1]);
    } else {
      printf("%d ", a[it]);
    }
    it -= 2;
  }

  return 0;
}

Measured memory_bytes: 2816
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N, D[50];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;
	rep(i, 0, N) cin >> D[i];

	int ans = 0;
	rep(a, 0, N) rep(b, a + 1, N) ans += D[a] * D[b];
	cout << ans << endl;
}







Measured memory_bytes: 256
N,M,L = map(int,input().split())
INF = 10**13
D = [[INF]*N for _ in range(N)]
for i in range(N):
    D[i][i] = 0

for _ in range(M):
    A,B,C = map(int,input().split())
    D[A-1][B-1] = C
    D[B-1][A-1] = C

for k in range(N):
    for i in range(N-1):
        for j in range(i+1,N):
            D[i][j] = min(D[i][j],D[i][k]+D[j][k])
            D[j][i] = D[i][j]

F = [[INF]*N for _ in range(N)]
for i in range(N):
    for j in range(N):
        if i==j:
            F[i][j] = 0
        elif D[i][j] <= L:
            F[i][j] = 1

for k in range(N):
    for i in range(N-1):
        for j in range(i+1,N):
            F[i][j] = min(F[i][j],F[i][k]+F[j][k])
            F[j][i] = F[i][j]

for i in range(N):
    for j in range(N):
        if F[i][j] == INF:
            F[i][j] = -1
        elif i != j:
            F[i][j] -= 1

Q = int(input())
for i in range(Q):
    s,t = map(int,input().split())
    print(F[s-1][t-1])



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

using namespace std;
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll long long
ll sum(ll n){

return ((n*(n+1))/2);

}
int main(){

fast();

int x;
cin>>x;

int hour =  x/3600;

int minite = abs(hour*3600-x)/60;
int sec = (x-hour*3600)-minite*60;

cout<<hour<<":"<<minite<<":"<<sec<<endl;

return 0;
}



Measured memory_bytes: 3220
n=input()
length = len(n)
a = n[length-1]

if a=="3":
    print("bon")
if a == "2":
    print("hon")
if a == "4":
    print("hon")
if a == "5":
    print("hon")
if a == "7":
    print("hon")
if a == "9": 
    print("hon")
if a == "0":
    print("pon")
if a == "1":
    print("pon")
if a == "6":
    print("pon")
if a == "8":
    print("pon")

Measured memory_bytes: 9140
def Base_10_to_n(X, n):
    X_dumy = X-1
    alpha=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
    out = []
    while X_dumy>=0:
      out.insert(0,alpha[(X_dumy%n)])
      X_dumy = int(X_dumy/n)-1
    return out

N=int(input())
c=Base_10_to_n(N,26)
c=''.join(c)
print(c)





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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  string ans = "No";

  if ((a + b) == c || (a + c) == b || (b + c) == a) {
    ans = "Yes";
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <string.h>
#include <string>
#include <cmath>
#include <cstdio>
#include <functional>
#include <map>
#include <typeinfo>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;

bool ac[100001];
int penalty[100001];

int main()
{
  int n, m;
  scanf("%d %d", &n, &m);
  
  while(m--)
  {
    int p;
    char s[5];
    scanf("%d %s", &p, s);
    
    if(ac[p] == false)
    {
      if (s[0] == 'A')
        ac[p] = true;
      else
        penalty[p]++;
    }
  }
  
  int acs = 0;
  int penalties=0;
  
  for(int i = 1; i<= n; i++)
  {
    if(ac[i])
    {
      acs++;
      penalties += penalty[i];
    }
  }
  
  printf("%d %d\n", acs, penalties);
  return 0;
}


Measured memory_bytes: 768
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define MAX_V 400010
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
ll MOD=924844033;
#define N 1055050

ll n,m,k;
ll a[N];

main(){
    rep(i,3){
        int c=in(),d=in();
        a[c]++;
        a[d]++;
    }
    rep2(i,1,4){
        if(a[i]==3){
            cout<<"NO";return 0;
        }
    }
    cout<<"YES";
}   

Measured memory_bytes: 256