akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<iomanip>
#define mins(a,b) a=min(a,b)
#define maxs(a,b) a=max(a,b)
template < typename T > std::string to_string( const T& n )
  {
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
  }
using namespace std;

const long long INF=9000000000000000;
typedef long long ll;

int main(){
string s;
cin>>s;
if(s[0]!=s[1] and s[1]!=s[2] and s[2]!=s[3])
cout<<"Good"<<endl;
else
cout<<"Bad"<<endl;
}


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

int main() {
    ll N, K, R, S, P, ans;
    cin >> N >> K >> R >> S >> P;
    string T; cin >> T;
    for (int i = 0; i < K; i++){
        if (T[i] == 'r') {
            ans += P;
        }
        else if (T[i] == 's') {
            ans += R;
        }
        else{
            ans += S;
        }
    }
    for (int i = K; i < N; i++){
        if (T[i] == 'r') {
            if (T[i-K] != 'r') ans += P;
            else T[i] = 'n';
        }
        else if (T[i] == 's') {
            if (T[i-K] != 's') ans += R;
            else T[i] = 'n';
        }
        else if (T[i] == 'p'){
            if (T[i-K] != 'p') ans += S;
            else T[i] = 'n';
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
  ll W, H, x, y;
  cin >> W >> H >> x >> y;
  cout << W*H/2.0 << " ";
  if (W/2.0 == x && H/2.0 == y) cout << 1 << endl;
  else cout << 0 << endl;
}


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

MOD = 1000000007  # type: int

def solve(N: int, M: int, a: "List[int]"):
    dp = [0] * (N + 1)
    dp[0] = 1
    j = 0
    for i in range(N):
        if j < M and i == a[j]:
            dp[i] = 0
            j += 1
        if i + 1 <= N:
            dp[i + 1] += dp[i]
        if i + 2 <= N:
            #print(i + 2)
            dp[i + 2] += dp[i]
    ret = dp[N] % MOD
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    a = [ int(next(tokens)) for _ in range(M) ]  # type: "List[int]"
    solve(N, M, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 462708
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

int main(){
    int a, b;
    cin >> a >> b;
    string s;
    cin >> s;
    
    if(s[a] != '-'){
        cout << "No";
        return 0;
    }
    s.erase(s.begin()+a);
    rep(i, s.size()){
        if(s[i] > '9' || s[i] < '0'){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
}

Measured memory_bytes: 384
import re

s = input()
t = input()

def check(s, t):
    p = re.compile('[a-z]+')
    if not p.match(s) or not p.match(t):
        return 'No'
    if len(s) < 1 or len(s) > 10:
        return 'No'
    if len(s) + 1 != len(t):
        return 'No'
    if t[0:len(s)] != s:
        return 'No'
    return 'Yes'

print(check(s, t))


Measured memory_bytes: 9872
import math
n = int(input())
nc = n
result = []
i = 2
while i <= math.sqrt(n):
    if n%i == 0:
        n //= i
        result.append(str(i))
    else:
        i += 1
if n != 1:
    result.append(str(n))
print(str(nc) + ": " + " ".join(result))


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

int main() {
  string s;
  cin>>s;
  int a=(s[0]-'0')*10+(s[1]-'0');
  int b=(s[2]-'0')*10+(s[3]-'0');
  bool MMYY=1<=a&&a<=12;
  bool YYMM=1<=b&&b<=12;
  if(MMYY&&YYMM)cout<<"AMBIGUOUS"<<endl;
  else if(MMYY)cout<<"MMYY"<<endl;
  else if(YYMM)cout<<"YYMM"<<endl;
  else cout<<"NA"<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    char s[101] = { 0 }, p[101] = { 0 };
    int i;
    int start = 0, num;
    
    scanf("%s\n%s\n", s, p);
    
    while(s[start] != 0){
        if(s[start] == p[0]){
            i = 0;
            num = start;
            while(s[num+i] == p[i]){
                i++;
                if(s[num+i] == 0){
                    num = -i;
                }
            }
            if(p[i] == 0){
                printf("Yes\n");
                return 0;
            }
        }
        start++;
    }
    printf("No\n");
    
    return 0;
}



Measured memory_bytes: 2100
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
	int n, a, b;
	string s;

	int an = 0;
	int bn = 0;
	int cn = 0;
	int f = 0;

	cin >> n >> a >> b;
	cin >> s;
	
	for (int i = 0; i < n; ++i) {
		f = 0;
		if (s[i] == 'a' && an+bn+cn < a+b) {
			++an;
			f = 1;
			cout << "Yes" << endl;
		}
		else if (s[i] == 'b' && an + bn + cn < a + b && bn < b) {
			++bn;
			f = 1;
			cout << "Yes" << endl;
		}
		else if (s[i] == 'c') {
			f = 1;
			cout << "No" << endl;
		}
		if (!f) {
			cout << "No" << endl;
		}
		
	}

}

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

int main() {
	int N;
	cin >> N;
	long *A = new long[N];
	for (int i = 0; i < N; i++)
		A[i] = 0;
	int count = 0;
	for (int i = 0; i < N; i++) {
		scanf("%ld", &A[i]);
	}
	sort(A, A+N);
	for (int i = 0; i < N-1; i++)
		if (A[i] == A[i + 1]) {
			A[i] = 0;
			A[i + 1] = 0;
			i++;
		}

	long result = 0;
	for (int i = 0; i < N; i++)
		if (A[i])
			result++;
	cout << result << endl;
	delete[] A;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll e=1000000007;
long long int me(long long int x,long long int n,long long int M)
{
 long long int result=1;
    while(n>0)
    {
        if(n%2==1)
            result=(__int128)(result*x)%M;
        x=(__int128)(x*x)%M;
        n=n/2;
    }
    return result;
}
ll modInverse(ll A,ll B,ll M)
{
    ll k=B*(M-2);
    return me(A,k,M);
}
int main()
{
    ll c=0;
    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll i=0;
    while(i<=n-1)
    {
        
        if(s[i]=='R')
        {ll j;
        ll a1=0;
        ll b1=0;
        j=i+1;
        while(j<=n-1)
        {
            if(s[j]=='G')
            {
                a1++;
            }
            if(s[j]=='B')
            {
                b1++;
            }
            
            j++;
        }c=c+a1*b1;
            
        }
        if(s[i]=='G')
        {
            ll j;
        ll a1=0;
        ll b1=0;
        j=i+1;
        while(j<=n-1)
        {
            if(s[j]=='R')
            {
                a1++;
            }
            if(s[j]=='B')
            {
                b1++;
            }
            
            j++;
        }c=c+a1*b1;
        
          
        }
        if(s[i]=='B')
        {
            ll j;
        ll a1=0;
        ll b1=0;
        j=i+1;
        while(j<=n-1)
        {
            if(s[j]=='R')
            {
                a1++;
            }
            if(s[j]=='G')
            {
                b1++;
            }
            
            j++;
        }c=c+a1*b1;
          
        }
        
        i++;
    }
    ll ram=c;
    ll seeta = 0;
  //  cout<<c;
    i=0;ll j;
    while(i<=n-1)
    {
        j=i+1;
        while(j<=n-1)
        {
            ll k1 = abs(i-j);
            ll k = j + k1 ; 
            if(s[i]!=s[j] && s[j]!=s[k] && k<=n-1 && s[k]!=s[i])
            {
              //  cout<<s[i]<<" "<<s[j]<<" "<<s[k];
               // cout<<"\n";
                seeta++;
            }
            
            j++;
        }
        
        
        
        
        i++;
    }
    
    cout<<ram-seeta;
 
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <iterator>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(v) begin(v), end(v)
#define reps(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) reps(i, 0, n)
#define each(i, n) for (auto&& i : n)
#define fill(x, y) memset(x,y,sizeof(x))
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
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; }
template <typename T> inline void print(const T& x) {cout << x << '\n';}

int n, W;
vi v,w;
int memo[101][10001];
int dfs(int i, int res)
{
  if(memo[i][res]!=-1) return memo[i][res];
  int ret;
  if(i>=n) ret=0; 
  else if(w[i]>res) ret=dfs(i+1,res);
  else ret = max(dfs(i+1, res), dfs(i+1,res-w[i])+v[i]);
  return memo[i][res]=ret;
}

signed main()
{
  cin>>n>>W;
  fill(memo,-1);
  rep(i,n)
  {
    int vi, wi; cin>>vi>>wi;
    v.pb(vi); w.pb(wi);
  }
  cout<<dfs(0,W)<<endl;

  return 0;
}


Measured memory_bytes: 7160
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define all(a) a.begin(),a.end()
typedef complex<double> Point;
typedef vector<Point> VP;
const double EPS = 1e-9;
#define X real()
#define Y imag()
#define EQ(n,m) (abs((n)-(m)) < EPS)

VP crosspointCC(Point a, double ar, Point b, double br) {
  VP ps;
  Point ab = b-a;
  double d = abs(ab);
  double crL = (norm(ab) + ar*ar - br*br) / (2*d);
  if (EQ(d, 0) || ar < abs(crL)) assert(false);

  Point abN = ab * Point(0, sqrt(ar*ar - crL*crL) / d);
  Point cp = a + crL/d * ab;
  ps.push_back(cp + abN);
  //if (!EQ(norm(abN), 0))
  ps.push_back(cp - abN);
  return ps;
}

namespace std {
  bool operator<(const Point a, const Point b) {
    return a.X != b.X ? a.X < b.X : a.Y < b.Y;
  }
}


int main(void){
    double c1x,c1y,c1r,c2x,c2y,c2r;
    cin>>c1x>>c1y>>c1r>>c2x>>c2y>>c2r;
    VP ps = crosspointCC(Point(c1x,c1y),c1r,Point(c2x,c2y),c2r);
    sort(all(ps));
    printf("%.9f %.9f ", ps[0].X,ps[0].Y);
    printf("%.9f %.9f\n",ps[1].X,ps[1].Y);
    return 0;
}

Measured memory_bytes: 3360
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
/*--Output/////////////////////////////////////////////////*/
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))
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; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.second < b.second; }

const int MOD = 1000000007;

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

signed main() {
    map<char,ll>abc;
    SS(string,s)
    abc['a']=0;abc['b']=0;abc['c']=0;
    rep(i,s.size())abc[s[i]]++;
    ll ma=-MOD,mi=MOD;
    for(auto it=abc.begin();it!=abc.end();it++){
        chmin(mi,it->second);
        chmax(ma,it->second);
    }
    YES(ma-mi<=1);
}

Measured memory_bytes: 512
#include <vector>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <ctime>
#include <map>
#include <set>
#include <chrono>
#include <queue>
#include <string>
#include <cassert>
#include <bitset>
#include <stack> 

#define INFLL 2000000000000000000
#define INF 2000000000
#define MOD 998244353
#define BASE 77747
#define PI acos(-1.0)
#define MAXLEN 29

using namespace std;

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



int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	
	ll a, b, c;
	cin >> a >> b >> c;
	if (c < a + b + 1) {
		cout << c + b << endl;
	} else {
		cout << b + a + b + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int t = sc.nextInt();
		if (t>=x)
			System.out.println("0");
		else 
			System.out.println(x-t);

	}

}
	

Measured memory_bytes: 35784
INF=float('inf')
s=input()
t=input()
ls=len(s)
lt=len(t)
S=[]
T=[]
for i in range(ls):
  S.append(s[i])
for j in range(lt):
  T.append(t[j])
ans=INF
for k in range(ls-lt+1):
  cnt=0
  for j in range(lt):
    if S[k+j]!=T[j]:
      cnt+=1
  ans=min(ans,cnt)
  
print(ans)
      

Measured memory_bytes: 9068
#include<iostream>
#include<math.h>
#include <algorithm>
#include<float.h>
#include <limits>
#include <vector> 
#include <numeric>

#define rep(i,a,n) for(ll int (i) = (a);(i) < (n);(i)++)
#define urep(i,a,n) for(ll int (i) = (a);(i) > (n);(i)--)
#define MOD 1000000007
#define ll long long

using namespace::std;

int jo(ll int jxo, ll int jyo){
	ll int jhogeo = 1;
	rep(jinto,0,jyo) jhogeo=jhogeo*jxo;
	return jhogeo;
}
char tobig(char toxbig){
  return (toxbig-0x20);
}
char tolow(char toxlow){
  return (toxlow+0x20);
}
  


int main(){
  char C[2][3];
  rep(i,0,2){
    rep(j,0,3) cin>>C[i][j];
  }
  if((C[0][0]==C[1][2])&&(C[0][1]==C[1][1])&&(C[0][2]==C[1][0])) cout<<"YES";
  else cout<<"NO";
  
}
// int *p = new int[N];

//  vector<int> 変数名(要素数);
//  sort(変数名.begin(),変数名.end());//昇順ソート

// vector<vector<int>> 変数名(左の個数, vector<int>(右の個数));

//


Measured memory_bytes: 256
#include <string>
#include <assert.h>
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main(int argc, char const *argv[])
{
    int n,d;
    cin >> n >> d;
    vector<vector<int>> x(n, vector<int>(d));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < d; j++){
            cin >> x.at(i).at(j);
        }
    }
    int count = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = i+1; j < n; j++) {
            double result=0;
            for (int k = 0; k < d ; k ++) {
                if (x.at(i).at(k) - x.at(j).at(k) != 0) {
                    result += pow(x.at(i).at(k) - x.at(j).at(k), 2.0);
                }
            }
            result = sqrt(result);
            if (ceil(result) == result) count++;
        }
    }
    cout << count;

    return 0;
}

Measured memory_bytes: 256
#
#　　　　　　　　　　　　　　,. -─────────‐- .、
#　　　　　　　　　　　　 ／／￣￣＼　　　　　　／￣￣＼＼
#　　　　　　　　　　　／　　　　　　　　　　　　　　　　　　　　 ＼
#　　　　　　　　　 ／　　　　　　　　::::::::::::::::::::::::::::::::　　　　　　　＼
#　　　　　　　　／ 　　／ ／￣＼＼::::;;;;;;;;;;;;;;;;;:::::／／￣＼＼　　＼
#　　　　　　 ／　　　　|　 |.　┃　.|　| ::::;;;;;;;;;;;;;::::｜ |.　┃　.|　|　　　 ＼　　　　　　　　　　　　　　　　　　　　　
#　　　　　／ 　　　　　＼ ＼＿／／　::::::::::::::::::　＼＼＿／／　　　　　 ＼　　　　
#　　　 ／　　　　　..／￣￣＼　／　　　::｜::　　　＼　／￣￣＼..　　　　　＼
#　　 / 　 　 　 　 :::::　　　　　　|　　　　　 |　　　　　 |　　　　　　 :::::　　　　　 ヽ.　　　
#　　| 　　　　　　　　　　　　　　|　　　　　 |　　　　　 |　　　　　　　　　　　　　　|.
#　　| 　　　　　　　　　　　　　　＼＿＿／＼＿＿／ 　　　　　　　　　　　　　　|　　　　　　　　　　　　　　　　　
#　　| 　　　　　　　　　　　　　　　｜　　　　　　　｜　　　　　　　　　　　　　　　|
#　　| 　　　　　　　　　　　　　　　｜r─‐┬──､|　　　　　　　　　　　　　　　 |
#　　ヽ　　　　　　　　　　　　　　　 |/　　　|　　 　｜　　　　　　　　　　　　　　/
#　　　 ＼　　　　　　　　　　　　　 ＼　　　　　　／　　　　　　　　　　　　　／
#　　　　　＼ 　　　　　　　　　　　　　￣￣￣￣　　　　　　　　　　　　　／
#
#
import sys
input=sys.stdin.readline
inf=float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [input() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    s = ST().replace("BC", "X")
    ans = 0
    a_cnt=0
    for st in s:
        if st == "A":
            a_cnt += 1
        elif st == "X":
            ans += a_cnt
        else:
            a_cnt=0
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 42736
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <ll> vl;

#define F           first
#define S           second
#define pb          push_back
#define P           push


int main() {
    #ifdef LU_Serious
        freopen("in.txt", "r", stdin);
    #endif /// LU_Serious
    
    char ch;
    
    while(cin >> ch) {
        if(ch == 'a' or ch == 'e' or ch == 'i' or ch == 'o' or ch == 'u') printf("vowel\n");
        else printf("consonant\n");
    }
    
    return 0;
}


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

int main() {
    int n,k;

    scanf("%d%d",&n,&k);

    int num;
    for(int i=0; i<n; i++){
        if(i==0){
            num = k;
        }
        else{
            num *= k-1;
        }
    }

    cout<<num<<endl;


}

Measured memory_bytes: 256
#include <iostream> // includes cin to read from stdin and cout to write to stdout
#include <math.h>
using namespace std; // since cin and cout are both in namespace std, this saves some text

int main()
{
    long long A, B, C, K;
    cin >> A >> B >> C >> K;
    
    long long diff = A - B;
    
    if (abs(diff) > pow(10, 18)) cout << "Unfair" << endl;
    else if (K % 2 == 0) cout << diff << endl;
    else cout << -diff << endl;
    
    return 0;
}


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

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
	cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
	cout << head;
	if (sizeof...(tail) != 0) cout << " ";
	print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
	for (auto& a : vec) {
		cout << a;
		if (&a != &vec.back()) cout << " ";
	}
	cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
	for (auto& vec : df) {
		print(vec);
	}
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	int n;
	cin >> n;
	int v = n;
	int div = 0;
	while (v > 0)
	{
		div += v % 10;
		v /= 10;
	}
	double d = (double)n / (double)div;
	if (d == floor(d))
		print("Yes");
	else
		print("No");
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


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

void fnInput(vector<int> &rvnTrg, vector<int> &rvnSch)
{
  int nTrgCnt;
  cin >> nTrgCnt;

  rvnTrg.resize(nTrgCnt + 1);
  for (int i = 0; i < nTrgCnt; i++)
    cin >> rvnTrg[i];

  int nSchCnt;
  cin >> nSchCnt;

  rvnSch.resize(nSchCnt);
  for (int i = 0; i < nSchCnt; i++)
    cin >> rvnSch[i];
}

void fnLinSch(vector<int> &rvnTrg, const vector<int> &cnrvnSch, int &rnFnd)
{
  size_t nMaxSiz = rvnTrg.size() - 1;
  for (size_t ni = 0; ni < cnrvnSch.size(); ni++)
  {
    rvnTrg[nMaxSiz] = cnrvnSch[ni];
    size_t nj = 0;
    while (rvnTrg[nj] != cnrvnSch[ni])
      nj++;
    if (nj != nMaxSiz)
      rnFnd++;
  }
}

void fnResult(int nFnd)
{
  cout << nFnd << endl;
}

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

  vector<int> vnTrg, vnSch;
  int nFnd = 0;

  fnInput(vnTrg, vnSch);
  fnLinSch(vnTrg, vnSch, nFnd);
  fnResult(nFnd);

  return 0;
}

Measured memory_bytes: 1244
using System;
using System.Linq;
using System.Collections.Generic;

public class Hello
{
    public static void Main()
    {
        int kosu=int.Parse(Console.ReadLine());
        int [] target=Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        int kaisu=0;
        int min;
        bool sita=false;
        
        for(int i=0;i<kosu;i++)
        {
            min=i;
            for(int j=i;j<kosu;j++)
            {
                if(target[j]<target[min])
                {
                    min=j;
                    sita=true;
                }
            }
            if(sita==true)
            {
                int a=target[i];
            target[i]=target[min];
            target[min]=a;
            kaisu++;
            sita=false;
            }
            
        }
        Console.WriteLine(string.Join(" ",target));
        Console.WriteLine(kaisu);
    }
}



Measured memory_bytes: 18316
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")
 
#define int  long long
#define rep(i,begin,end) for(__typeof(end)i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define F first
#define S second
#define sz(x) ((int)x.size())
#define pb push_back
#define pf push_front
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
#define what_is(x) cerr << #x << " is " << x <<"\n";
#define sortA(v) sort(v.begin(), v.end())
#define sortD(v) sort(v.rbegin(), v.rend())
#define PI 3.14159265358979323846
#define vout(a) for(auto x:a) cout<<x<<" ";
#define INF 10000000000000000 //1e16
 
// #define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
 
 
// using namespace __gnu_pbds;
using namespace std;
 
using ll  = long long;
using vi  = vector<int>;
using pii = pair<int,int>;
using vii = vector<pii>;
using mi  = multiset<int>;
using mii = multiset<pii>;
 
int lcm(int a,int b) {return (a*(b/__gcd(a,b)));}



void solve()
{
    int t,n,m,i,k,r,l,u,v,w,j,s,sum=0,pos,flag=0,count=0;
    string S,T,U; 
    // int x,y;
    cin>>S;
if(S[2]==S[3]&&S[4]==S[5]) cout<<"Yes";
  else cout<<"No";
}
 
 
signed main()
{

    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
        // if(t)cout<<"\n";
    }
    return 0;
}


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

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ld long double
#define forn(low,high,i) for(i = low; i < high; i++)
#define forrev(high,low,i) for(i = high; i >= low; i--)
#define all(v) v.begin(),v.end()
#define decimal_digits cout << fixed << setprecision(15);

string to_string(string s) { return '"' + s + '"';}
string to_string(char s) { return string(1, s);}
string to_string(const char* s) { return to_string((string) s);}
string to_string(bool b) { return (b ? "true" : "false");}
template <typename A> string to_string(A);
template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}
template <typename A> string to_string(A v) {bool f = 1; string r = "{"; for (const auto &x : v) {if (!f)r += ", "; f = 0; r += to_string(x);} return r + "}";}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {cerr << " " << to_string(H); debug_out(T...);}
#define pr(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

#define GOOGLE 0
#define MULTIPLE_TC 0

const int inf = 1e9;
const long long INF = 1e18;
const int mod = 1e9 + 7;
const int bit32 = log2(inf) + 3;
const int bit64 = log2(INF) + 3;

inline int add(long long a, long long b){a += b; if(a >= mod) a -= mod; return a;}
inline int sub(long long a, long long b){a -= b; if(a < 0) a += mod; return a;}
inline int mul(long long a, long long b){a %= mod; b %= mod; return (int)((long long) a * b % mod);}
inline int modexpo(long long a, long long b){int res = 1; while(b > 0){ if(b & 1) res = mul(res, a); a = mul(a, a); b /= 2;} return res;}
inline int divide(long long a, long long b){return mul(a, modexpo(b, mod - 2));}
inline int inv(long long a){return modexpo(a, mod - 2);}

clock_t time_p = clock();

void ktj(){
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (float)(time_p)/CLOCKS_PER_SEC << "\n";
}

void pre(){ // Reset each global variable (esp. for graphs)
  
}

void solve(){
  int s, w;
  cin >> s >> w;
  cout << (w >= s ? "unsafe\n" : "safe\n");  
}

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

  pre();

  int t = 1, T;

  if(MULTIPLE_TC)
    cin >> t;

  for(T = 1; T <= t; T++){
    if(GOOGLE)
      cout << "Case #" << T << ": ";
    solve();
  }

  ktj();
}


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

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

#define MOD 1000000007

int main(void) {
    ll A, B, C;
    ll o = 0;
    cin >> A >> B >> C;
    if((A % 2 == 0 && B % 2 == 0 && C % 2 == 0) && (A == B && B == C)) {
        cout << -1 << endl;
    } else {
        while(A % 2 == 0 && B % 2 == 0 && C % 2 == 0) {
            ll a = A / 2;
            ll b = B / 2;
            ll c = C / 2;
            A = b + c;
            B = a + c;
            C = a + b;
            o++;
        }
        cout << o << endl;
    }
    return 0;
}


Measured memory_bytes: 256
n = input()
if len(n)==1:
  print(n)
else:
  nines = 1
  for i in range(1,len(n)):
    if n[i]!="9":
      nines = 0
  if nines == 1:
    print((len(n)-1)*9+int(n[0]))
  else:
    print((len(n)-1)*9+(int(n[0])-1))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    int cnt = 0;
    if(s.at(0) == '1'){
        cnt++;
    }
    if(s.at(1) == '1'){
        cnt++;
    }
    if(s.at(2) == '1'){
        cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256
while true
	n,m,a = gets.split(" ").map{|e|e.to_i}
	break if n==0 && m==0 && a==0
	array=Array.new 1001
	(1001).times{|e|array[e]=[]}
	
	m.times{
		h,p,q = gets.split(" ").map{|e|e.to_i}
		array[h-1].push [p,q]
	}

	1001.times{|h|
		array[1000-h].each{|e|
			if e[1]==a
				a=e[0]
			elsif e[0]==a
				a=e[1]
			end
		}
	}
	p a
end

Measured memory_bytes: 6124
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int a, b, c;
		int parts[];
		int m;
		int p[], q[], r[], s[];

		a = sc.nextInt();
		b = sc.nextInt();
		c = sc.nextInt();
		while (a + b + c != 0) {
			m = sc.nextInt();
			parts = new int[a + b + c];
			p = new int[m];
			q = new int[m];
			r = new int[m];
			s = new int[m];
			for (int i = 0; i < a + b + c; i++) {
				parts[i] = 2;
			}
			for (int i = 0; i < m; i++) {
				p[i] = sc.nextInt();
				q[i] = sc.nextInt();
				r[i] = sc.nextInt();
				s[i] = sc.nextInt();
				if (s[i] == 1) {
					parts[p[i] - 1] = 1;
					parts[q[i] - 1] = 1;
					parts[r[i] - 1] = 1;
				}
			}
			for (int i = 0; i < m; i++) {
				if (s[i] == 0) {
					if (parts[p[i] - 1] * parts[q[i] - 1] * parts[r[i] - 1] == 2) {
						if (parts[p[i] - 1] == 2) {
							parts[p[i] - 1] = 0;
						} else if (parts[q[i] - 1] == 2) {
							parts[q[i] - 1] = 0;
						} else if (parts[r[i] - 1] == 2) {
							parts[r[i] - 1] = 0;
						}
					}
				}
			}

			for (int i = 0; i < a + b + c; i++) {
				System.out.println(parts[i]);
			}

			a = sc.nextInt();
			b = sc.nextInt();
			c = sc.nextInt();
		}
	}
}

Measured memory_bytes: 12000
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef unsigned long ll;

int main()
{
	string str;
	int n;
	cin>>n;
	cin>>str;
	if(str.size() % 2 != 0){
		cout<<"No"<<endl;
	}else{
		if(str.substr(0,str.size()/2) == str.substr(str.size()/2,str.size()/2)){
			cout<<"Yes"<<endl;
		}else{
			cout<<"No"<<endl;
		}
	}
	return 0;
}



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

int main() {
	int N;
	cin >> N;
	vector<int> H(N);
	for (int i = 0; i < N; ++i) cin >> H[i];
	H.push_back(2000000000);
	int ans = 0;
	int cnt = 0;
	for (int i = 0; i < N; i++) {
		if (H[i + 1] <= H[i]) cnt++;
		else {
			ans = max(ans, cnt);
			cnt = 0;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4024
#define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_map>

using namespace std;

int main()
{
    int N;
    cin >> N;
    int ac = 0, wa = 0, tle = 0, re = 0;
    for (int i = 0; i < N; ++i) {
        string S;
        cin >> S;
        if (S == "AC") ++ac;
        else if (S == "WA") ++wa;
        else if (S == "TLE") ++tle;
        else if (S == "RE") ++re;
    }
    cout
        << "AC x " << ac << "\n"
        << "WA x " << wa << "\n"
        << "TLE x " << tle << "\n"
        << "RE x " << re << endl;
    return 0;
}


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

#define for_(i,a,b) for(int i=(a);i<(b);++i)

int main() {
	int H, W, N;
	cin >> H >> W >> N;
	
	int cx, cy, ans = 0;
	cin >> cx >> cy;
	
	for_(i,1,N) {
		int x, y;
		cin >> x >> y;
		
		if ((cy > y && x > cx) || (y > cy && x < cx)) {
			ans += abs(cx - x) + abs(cy - y);
		} else {		
			ans += max(abs(cx - x), abs(cy - y));
		}
		
		cx = x; cy = y;
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 1164
import java.util.*;
public class Main {
   public static void main(String[] args){
	   Scanner sc = new Scanner(System.in);
	   int n,m;
	   char c;
	   for(;;){
	       n= sc.nextInt();
	       if(n==0){
		       return;
	       }
	       char[][] ch=new char[n][2];
	       for(int i=0;i<n;i++){
		       ch[i][0]=sc.next().charAt(0);
		       ch[i][1]=sc.next().charAt(0);
	       }
	       m=sc.nextInt();
	       for(int i=0;i<m;i++){
		       c=sc.next().charAt(0);
		       for(int j=0;j<n;j++){
			       if(c==ch[j][0]){
				       System.out.print(ch[j][1]);
				       break;
			       }else if(j==n-1){
				       System.out.print(c);
			       }
		       }
	       }
	       System.out.println();
	   }
   }
}


Measured memory_bytes: 76524
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;

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

    string S;
    cin>>S;

    int n = S.size();
    rep(i, n) cout<<'x';
    cout<<endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define print(n) cout<<n<<endl
const int M=100111;
const int mod=1000000007;
const int inf=1000000007;
const long long INF=1000000000000000007;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};


int main(){
	int n;string S;
	cin>>n>>S;
	int ans=0;

	rep(i,1,n){
		int cnt=0,now=0;
		rep(j,0,n-i){
			if(S[j]==S[i+j])cnt++;
			else{now=max(now,cnt),cnt=0;}
		}
		now=max(now,cnt);
		if(now>i){now=i;}
		ans=max(ans,now);
	}
	print(ans);
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; 
#define arrlen(arr) (sizeof(arr)/sizeof(arr[0]))
#define Sort(arr) sort(arr, arr+arrlen(arr))
#define For(i,s,n) for(int i=s;i<n;i++)

	
int main(){
	int N;
	cin >> N;
	int a[N-1],b[N-1],c[N],d[N]={};
	For(i,0,N-1) cin >> a[i] >> b[i];
	For(i,0,N) cin >> c[i];
	
	Sort(c);
	int M=0;
	For(i,0,N-1) M+=c[i];
	
	d[0]=c[N-1];
	int count=1;
	while(1){
		For(i,0,N-1){
			if(d[a[i]-1]!=0&&d[b[i]-1]==0){
				count++;
				d[b[i]-1]=c[N-count];
			}
			else if(d[a[i]-1]==0&&d[b[i]-1]!=0){
				count++;
				d[a[i]-1]=c[N-count];
			}
		}
		if(count==N){
			cout << M << endl;
			For(i,0,N) cout << d[i] << " ";
			return 0;
		}
	}
}

Measured memory_bytes: 512
#include <iostream>
#include <map>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;

int main() {
	int n;
	cin>>n;
	string s;
	cin>>s; 
	map<char, int> mp;
	int cnt = 0;
	string al = "";
	for (char ch = 'A'; ch<='Z'; ch++) {
		mp[ch] = cnt++;
		al+=ch; 
	}
	for (int i=0; i<s.size(); i++) {
		s[i] = al[(mp[s[i]]+n)%26];
	}
	cout << s;	  
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int sum = 0 , count = 0;
		double ave = 0;
		while ( sc.hasNext() ) {
			String[] line = sc.next().split(",");
			int a = Integer.parseInt(line[0]);
			int b = Integer.parseInt(line[1]);
			sum += a * b;
			ave += b;
			count++;
		}
		System.out.println(sum+"\n"+(int)Math.floor(0.5+ave/(double)count));
	}
}

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

int main(){
  int n;
  cin >> n;
  for (int i=1;i<=n;++i){
    if (i*(i+1)/2>=n){
      for (int j=i;j>=1;--j){
	    if (j<=n){
          n-=j;
	      cout<<j<<"\n";
	    }
      }
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(0,-1),(1,0),(0,1),(-1,0)]
ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []

    while True:
        n,m = LI()
        if m == 0:
            rr.append(n+1)
            break
        a = [LI() for _ in range(m)]
        s = set()
        for c,d in a:
            s |= set(list(range(c,d)))

        rr.append(n+1+len(s)*2)
        break

    return '\n'.join(map(str,rr))


print(main())




Measured memory_bytes: 9204
# -*- coding: utf-8 -*-

count = 0
def dfs(i, j, island):
    global count
    #print i, j
    dxy = [(1, 0), (0, 1), (-1, 0), (0, -1)]
    
    if i < 0 or i >= len(island) or j < 0 or j >= len(island[0]):
        return

    if island[i][j] == '#' or island[i][j] == 'x':
        return

    island[i][j] = 'x'
    count += 1
    
    for d in dxy:
        dfs(i+d[0], j+d[1], island)

def solve(w, h, island):
    s_i = 0
    s_j = 0
    for i, row in enumerate(island):
        for j, s in enumerate(row):
            if s == '@':
                s_i = i
                s_j = j
                break

    dfs(s_i, s_j, island)
    print count

def func():
    '''

    '''
    while True:
        global count
        wh = map(int, raw_input().split())
        w = wh[0]
        h = wh[1]
        if w == 0 and h == 0:
            break
        island = []
        count = 0
        for i in range(h):
            row = []
            line = raw_input()
            for j in line:
                row.append(j)
            island.append(row)
        
        # for row in island:
        #     for j in row:
        #         print j
        #     print ''

        solve(w, h, island)


func()
    

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

int main() {
  int64_t n, c;
  std::cin >> n >> c;
  std::vector<std::pair<int64_t, int64_t>> xv(n);

  for (auto &i : xv) {
    std::cin >> i.first >> i.second;
  }
  std::vector<int64_t> cl(n), cl_max(n), ul(n), ul_max(n);

  cl[0] = xv[0].second - xv[0].first;
  cl_max[0] = std::max(static_cast<int64_t>(0), cl[0]);
  for (int64_t i = 1; i < n; i++) {
    cl[i] = xv[i].second - (xv[i].first - xv[i - 1].first) + cl[i - 1];
    cl_max[i] = std::max(cl[i], cl_max[i - 1]);
  }

  ul[n - 1] = xv[n - 1].second - (c - xv[n - 1].first);
  ul_max[n - 1] = std::max(static_cast<int64_t>(0), ul[n - 1]);
  for (int64_t i = n - 2; 0 <= i; i--) {
    ul[i] = xv[i].second - (xv[i + 1].first - xv[i].first) + ul[i + 1];
    ul_max[i] = std::max(ul[i], ul_max[i + 1]);
  }

  int64_t cal = std::max(cl_max[n - 1], ul_max[0]);

  for (int64_t i = 0; i < n - 1; i++) {
    int64_t now_cal = cl[i] - xv[i].first + ul_max[i + 1];
    cal = std::max(cal, now_cal);
  }

  for (int64_t i = n - 1; 0 < i; i--) {
    int64_t now_cal = ul[i] - (c - xv[i].first) + cl_max[i - 1];
    cal = std::max(cal, now_cal);
  }
  std::cout << cal << std::endl;
  return 0;
}


Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a;cin>>a;
  cout<<a*a<<endl;
  return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort()
F.sort(reverse=True)

start = -1
end = A[-1] * F[0]

def check(now):
    cnt = 0
    for a, f in zip(A, F):
        # cnt += max(0, a-now//f)
        eatable = now//f
        if eatable < a:
            cnt += a - eatable
    # return cnt <= K
    if cnt > K:
        return False
    return True

while end > start + 1:
    now = (start + end) // 2
    if check(now):
        end = now
    else:
        start = now

print(end)


Measured memory_bytes: 33940
#coding:utf-8
h = 1
w = 1

while h+w != 0:
    h, w=input().rstrip().split(" ")
    h = int(h)
    w = int(w)
    if h == 0:
        if w==0:
            break
    for i in range(h):
        print("#"*w)
    print("")

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

int main() {
  int h, n;
  cin >> h >> n;
  vector<int> a(n);
  rep (i, n) cin >> a.at(i);
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());

  string ans = "No";
  rep (i, n) {
    h -= a.at(i);
    if (h <= 0) {
      ans = "Yes";
      break;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main()
{
  string s;
  cin >> s;
  if(s=="A")
    cout << "T" << endl;
  else if(s=="C")
    cout << "G" << endl;
  else if(s=="G")
    cout << "C" << endl;
  else
    cout << "A" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <tuple>
#include <stack>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
typedef long long ll;
using namespace std;

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}
char upper(char c){
	return c-0x20;
}
char lower(char c){
	return c+0x20;
}
int main() {
	int a,b; cin >> a >> b;
	cout << (a+b)%24 << endl;
}

Measured memory_bytes: 256
def resolve():
    n, w = map(int, input().split())
    goods = [list(map(int, input().split())) for _ in range(n)]

    dp = [[0] * (w + 1) for _ in range(n + 1)]

    for i in range(1, n + 1):
        for j in reversed(range(w + 1)):
            # もしi番目の品物が入るのであれば
            if goods[i - 1][0] <= j:
                dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - goods[i - 1][0]] + goods[i - 1][1])
            else:
                dp[i][j] = dp[i - 1][j]

    print(dp[n][w])
    
resolve()

Measured memory_bytes: 120172
import java.util.Scanner;

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

		long x = sc.nextLong();
		long y = sc.nextLong();

		long sub = Math.abs(x - y);

		if(sub < 2){
			System.out.println("Brown");
		}else{
			System.out.println("Alice");
		}


		sc.close();
	}
}


Measured memory_bytes: 23380
fn read1<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn readn<T: std::str::FromStr>(delimiter: &str) -> Vec<T> {
    let s = read1::<String>();
    s.split(delimiter).map(|e| e.parse().ok().unwrap()).collect::<Vec<T>>()
}

fn inspect(a: &Vec<char>) -> (bool, usize, usize) {
    let mut l = 0;
    let mut r = 0;
    let mut flg = false;
    let mut cont = false;
    let w = a.len();
    for i in 0..w {
        if a[i] == '#' && !cont {
            if flg { return (false, 0, 0); }
            cont = true;
            l = i;
        }
        if a[i] == '.' && cont {
            cont = false;
            r = i - 1;
            flg = true;
        }   
    }
    if r == 0 && cont {
        r = w - 1;
        flg = true;
    }

    (flg, l, r)
}

fn main() {
    let hw = readn::<usize>(" ");
    let h = hw[0];
    let _w = hw[1];

    let mut rr = 0;
    for _ in 0..h {
        let a = read1::<String>().chars().collect::<Vec<char>>();
        let (f, l, r) = inspect(&a);
        if !f || rr != l {
            println!("Impossible");
            return;
        } else {
            rr = r;
        }
    }

    println!("Possible");
}

Measured memory_bytes: 4352
H, W = map(int, input().split())
d = [list(map(int, input().split())) for _ in range(10)]
for k in range(10):
    for i in range(10):
        for j in range(10):
            d[i][j] = min(d[i][j], d[i][k] + d[k][j])

wall = [list(map(int, input().split())) for _ in range(H)]
ans = 0
for i in range(H):
    for j in range(W):
        if wall[i][j] >= 0:
            num = wall[i][j]
            ans += d[num][1]

print(ans)

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

int main(){
  
  int a, b, k; cin >> a >> b >> k;
  for(int i = 0; i < k; i++){
    if(i % 2 == 0){
      if(a % 2 == 1) a--;
      b += a / 2;
      a /= 2;
    }else{
      if(b % 2 == 1) b--;
      a += b / 2;
      b /= 2;
    }
    
    
  }
  
  cout << a << " " << b << endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
typedef long double ld;
typedef unsigned long long int ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<pair<ll, ll>> vpll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vll> vvll;
typedef map<int, int> mii;
typedef set<int> si;
//---------------------------------------------------------------------------------------------------

int main(void){
    // Your code here!
    int n; cin >> n;
    vector<string> s(n);
    rep(i,n) cin >> s[i];
    int c1 = 0;
    int c2 = 0;
    int c3 = 0;
    rep(i,n) {
        int l = s[i].size();
        if (s[i][0] == 'B' && s[i][l - 1] == 'A') c1++;
        else if (s[i][0] == 'B') c2++;
        else if (s[i][l-1] == 'A') c3++;
    }
    int ans = 0;
    rep(i,n) {
        int l = s[i].size();
        rep(j,l-1) {
            if (s[i][j] == 'A' && s[i][j+1] == 'B') ans++;
        }
    }
    if (c1 > 0 && c2 == 0 &&  c3 == 0) {
        cout << max(0,ans + c1 - 1) << endl;
        return 0;
    }
    cout << ans + c1 + min(c2,c3) << endl;
}


Measured memory_bytes: 3664