akhauriyash/Code-Regression huggingface dataset:
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, X, Y = il()
    ret = [0] * (N - 1)
    X -= 1
    Y -= 1
    for i in range(N - 1):
        for j in range(i + 1, N):
            k = min(abs(i - j), abs(X - i) + abs(Y - j) + 1, abs(Y - i) + abs(X - j) + 1)
            ret[k - 1] += 1

    for r in ret:
        print(r)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3444
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;

void solve(){
  int a, b; cin >> a >> b;
  int i;
  for(i = 1; i <= 3; i++){
    if(a * b * i % 2 == 1) break;
  }
  if(i == 4) cout << "No\n";
  else cout << "Yes\n";
  return;
}
int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int N, K;
    cin >> N >> K;
    if(K <= N / 2 + N % 2)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 3632
function main(input) {
    const args = input.split('\n');
    const N = parseInt(args[0],10);
    const nums = args.slice(1,N + 1);
    const isValid = nums.every((n) => {
	var ns = n.split(' ');
	var t = parseInt(ns[0],10),
	    x = parseInt(ns[1],10),
	    y = parseInt(ns[2],10);
	var sum = x + y;

	return (t >= sum) && ((t % 2) === (sum % 2));
    });

    if(isValid){
	console.log('Yes');
    }else{
	console.log('No');
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 29932
from collections import Counter


def main():
    N = int(input())
    S = input()
    answer = 0
    for i in range(1, N):
        first_half = Counter(S[:i])
        second_hald = Counter(S[i:])
        answer = max(answer, len(first_half & second_hald))
    print(answer)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
import java.util.*;
public class Main {
	public static void main(String args[]){
		Scanner in=new Scanner(System.in);
		int n=in.nextInt();
		while(n!=0){
			int sum=in.nextInt();
			int ans=sum;
			for(int i=1;i<n;i++){
				int x=in.nextInt();
				if(sum>0)sum+=x;
				else	sum=x;
				if(ans<sum)
					ans=sum;
			}
			n=in.nextInt();
			System.out.println(ans);
		}
		in.close();
	}
}

Measured memory_bytes: 34812
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ss second
#define ff first
#define mk make_pair
#define vec vector<int> 
#define pb push_back
#define finput ifstream cin;cin.open("in.txt")
#define foutput ofstream cout;cout.open("out.txt")
void div(int n,vector<int> &d){ 
    for (int i=1; i<=sqrt(n); i++){ 
        if (n%i == 0){
        	if (n/i == i) 
                d.pb(i); 
            else{ 
            	d.pb(i);
            	d.pb(n/i);
            } 
        } 
    }
} 
int main(){
//	finput;foutput;
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin>>n;
    int x[n],y[n],h[n];
    for(int i=0;i<n;i++){
    	cin>>x[i]>>y[i]>>h[i];
    }
    for(int i=0;i<=100;i++){
    	for(int j=0;j<=100;j++){
       		int check=1;
    		int lambda=0;
    		for(int k=0;k<n;k++){
    			if(h[k]!=0){
    				lambda=k;
    				break;
    			}
    		}
    		int h_val=(int)(abs(i-x[lambda]) + abs(j-y[lambda])) + h[lambda];
    		for(int k=0;k<n;k++){
    			if(k==lambda) continue;
    			int h_pred = max(h_val - (int)(abs(i-x[k]) + abs(j-y[k])),0);
    			if(h_pred == h[k]){
    				continue;
    			}
    			else{
    				check=0;
    				break;
    			}
    		}
    		if(check==1){
    			cout<<i<<" "<<j<<" "<<h_val<<endl;
    			return 0;
    		}
    	}
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
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<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (ll i = (n)-1; i >= 0; --i)
#define mes(a) cout << (a) << endl
#define dmes(a, b) cout << (a) << " " << (b) << endl
#define re0 return 0
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define rSort(a) sort(a.rbegin(), a.rend())
#define Rev(a) reverse(a.begin(), a.end())
#define MATHPI acos(-1)
#define itn int
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-19;


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

signed main() {
    ll s, c; 
    cin >> s >> c;
    
    ll r = 0;
    r += min(s, c/2);
    s -= r;
    c -= r*2;
    
    r += c/4;
    
    mes(r);
    
    
    
}

Measured memory_bytes: 3508
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
const int N = 1e5 + 10, OO = 0x3f3f3f3f, mod = 1e9 + 7;

#define PI acos(-1)
#define clr(arr, val) memset(arr, val, sizeof(arr))
#define loop(i, n) for (int i = 0; i < int(n); i++)
#define rloop(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define xloop(i, a, b) for (int i = int(a); i <= int(b); i++)
#define ALL(v) ((v).begin()), ((v).end())
#define SZ(v) ((int)((v).size()))
//int dx[] = {1, 0, -1, 0};
//int dy[] = {0, 1, 0, -1}; //4 Direction
//int dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
//int dy[] = {0, 1, 1, 1, 0, -1, -1, -1}; //8 direction
int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

//-- "كلٌّ من يسعى لابد يصل .. كلٌّ من يسعى مضمون له الوصول" --//

ll n , x , t;

int main()
{
    //ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	
	
	scanf("%lld %lld %lld", &n , &x , &t);
	ll mul = (n+(x-1))/x;
	printf("%lld\n" , mul*t);
	
	
	
	
    return 0;
}




Measured memory_bytes: 3820
#include<bits/stdc++.h>
#include<tr1/unordered_map>
#define pb push_back
#define pii pair<int,int>
#define SZ(x) (int)x.size()
#ifdef __linux__
#define getchar getchar_unlocked
#endif
#define mem(a,b) memset(a,b,sizeof(a))
#define  For(i,a,b) for(int i=a,i##E=b;i<=i##E;++i)
#define rFor(i,a,b) for(int i=a,i##E=b;i>=i##E;--i)
typedef long long LL;
using namespace std;
const int N=2010;
const int S=3000010;
const int mid=1500000;
const int inf=0x3f3f3f3f;
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
template<typename T>inline void read(T &x)
{
	x=0;int _f(0);char ch=getchar();
	while(!isdigit(ch))_f|=(ch=='-'),ch=getchar();
	while( isdigit(ch))x=x*10+ch-'0',ch=getchar();
	x=_f?-x:x;
}
inline void file()
{
	freopen("will.in","r",stdin);
	freopen("will.out","w",stdout);
}
int n,sum,ans,a[N];
bitset<S>A;
int main()
{
	//file();
	read(n);
	For(i,1,n)read(a[i]),sum+=a[i];
	A[mid]=1;
	For(i,1,n)A=(A<<a[i])|(A>>a[i]);
	For(i,mid,S-1)if(A[i]){ans=((i-mid)+sum)>>1;break;}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 2048
def main
  n = gets.chomp.to_i
  array = gets.chomp.split(' ').map(&:to_i)
  count = 0

  (0...n - 2).each do |i|
    count += 1 if ((array[i] < array[i + 1]) && (array[i + 1] < array[i + 2])) || ((array[i] > array[i + 1]) && array[i + 1] > array[i + 2])
  end
  print count
end

main


Measured memory_bytes: 1788
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;




namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine();

            int hour = int.Parse(input) / 60 / 60;
            int minute = (int.Parse(input) - (hour * 60 * 60)) / 60;
            int second = int.Parse(input) - (hour * 60 * 60) - (minute * 60);

            Console.WriteLine("{0}:{1}:{2}", hour, minute,second);
            Console.ReadLine();
        }  
    }
}

Measured memory_bytes: 5620
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.*;


public class Main{
	static final long MOD = 1000000007;
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		long h = sc.nextLong();
		long w = sc.nextLong();
		if (h == 1 || w == 1) {
			System.out.println(1);
			return;
		}
		System.out.println(((w + 1) / 2) * ((h + 1) / 2) + (w / 2) * (h / 2));
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
		return hasNextByte();
	}
	public String next() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || Integer.MAX_VALUE < nl) {
			throw new NumberFormatException();
		}
		return (int) nl;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 21204
s = str(input())

cnt = 0
new = s[0]
for idx in range(len(s[1:])):
    idx += 1
    if new[idx-1]==s[idx]:
        if s[idx] == '0':
            new+='1'
        else:
            new+='0'
        cnt += 1
    else:
        new+=s[idx]
print(cnt)

Measured memory_bytes: 3188
n, m = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
bc = [list(map(int,input().split())) for _ in range(m)]
bc.sort(key=lambda x:x[1], reverse=True)

ad = 0
idx = 0
for b, c in bc:
    for i in range(min(b, n-idx)):
        if a[idx+i] < c:
            continue
        else:
            ad += c*i
            idx += i
            print(ad + sum(a[idx:]))
            exit()
    ad += c*min(b, n-idx)
    idx += min(b, n-idx)
print(ad + sum(a[idx:]))

Measured memory_bytes: 32964
#include<iostream>
//#include<algorithm>
using namespace std;
int main(void)
{
	int n;
	cin >> n;
	int min = 0;
	cin >> min;
	int total = -2000000000;
	for (int i = 1; i < n; i++) {
		int k; cin >> k;
		if (k - min > total) {
			total = k - min;
		}
		if (k < min) {
			min = k;
		}
	}
	cout << total << endl;
	return 0;
}


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

//template
#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 ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
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 end

template<unsigned mod>struct mint {
   static int get_mod(){return mod;}
   int val;
   int inv() const{
      int tmp,a=val,b=mod,x=1,y=0;
      while(b)tmp=a/b,a-=tmp*b,swap(a,b),x-=tmp*y,swap(x,y);
      if(x<0)x+=mod; return x;
   }
   mint():val(0){}
   mint(ll x):val(x>=0?x%mod:mod+(x%mod)){}
   mint pow(ll t){mint res=1,b=*this; while(t){if(t&1)res*=b;b*=b;t>>=1;}return res;}
   mint& operator+=(const mint& x){if((val+=x.val)>=mod)val-=mod;return *this;}
   mint& operator-=(const mint& x){if((val+=mod-x.val)>=mod)val-=mod; return *this;}
   mint& operator*=(const mint& x){val=(ll)val*x.val%mod; return *this;}
   mint& operator/=(const mint& x){val=(ll)val*x.inv()%mod; return *this;}
   mint operator+(const mint& x)const{return mint(*this)+=x;}
   mint operator-(const mint& x)const{return mint(*this)-=x;}
   mint operator*(const mint& x)const{return mint(*this)*=x;}
   mint operator/(const mint& x)const{return mint(*this)/=x;}
   bool operator==(const mint& x)const{return val==x.val;}
   bool operator!=(const mint& x)const{return val!=x.val;}
};
using Mint=mint<1000000007>;
struct factorial {
   vector<Mint> Fact, Finv;
public:
   factorial(int maxx){
      Fact.resize(maxx+1),Finv.resize(maxx+1); Fact[0]=Mint(1); rep(i,0,maxx)Fact[i+1]=Fact[i]*(i+1);
      Finv[maxx]=Mint(1)/Fact[maxx]; rrep(i,maxx,0)Finv[i-1]=Finv[i]*i;
   }
   Mint fact(int n,bool inv=0){if(inv)return Finv[n];else return Fact[n];}
   Mint nPr(int n,int r){if(n<0||n<r||r<0)return Mint(0);else return Fact[n]*Finv[n-r];}
   Mint nCr(int n,int r){if(n<0||n<r||r<0)return Mint(0);else return Fact[n]*Finv[r]*Finv[n-r];}
};

int main(){
   int n; scanf("%d",&n);
   vector<int> a(n); rep(i,0,n)scanf("%d",&a[i]);
   if(n==1){
      Mint res=Mint(2)*a[0];
      printf("%d\n",res.val);
      return 0;
   }
   sort(ALL(a)); reverse(ALL(a));
   Mint coeff=Mint(2).pow(n-1),add=Mint(2).pow(n-2),res;
   rep(i,0,n){
      res+=coeff*a[i];
      coeff+=add;
   }
   res*=Mint(2).pow(n); printf("%d\n",res.val);
   return 0;
}

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

#define ll long long
#define ull unsigned long long
#define LL long long
#define sl(n) scanf("%lld", &n)
#define sf(n) scanf("%lf", &n)
#define si(n) scanf("%d", &n)
#define sch(n) scanf(" %c", &n)
#define ss(n) scanf("%s", n)
#define pii pair <int, int>
#define pll pair <ll, ll>
#define plp pair <int, pll >
#define pb push_back
#define fr first
#define sc second
#define all(a)  a.begin(),a.end()
#define Unique(a)  sort(all(a)),a.erase(unique(all(a)),a.end())

#define inf (1LL<<50)
#define eps 1e-9

ll Set(ll n, ll pos)
{
    return n|(1LL<<pos);
}

bool Check(ll n, ll pos)
{
    return (bool) (n&(1LL<<pos));
}

ll v[100010];
ll w[100010];
ll dp[101][100010];

int main ()
{
    //  freopen("input.txt", "r", stdin);
    //  freopen("output.txt", "w", stdout);
    //  ios_base::sync_with_stdio(0); // no printf/scanf must be present
    ll cs, ts, i, j, k, x, y, z, q, m, n, cap;

    while(sl(n) != EOF)
    {
        sl(cap);
        for (i = 1; i <= n; i++)
        {
            sl(w[i]);
            sl(v[i]);
        }

        ll ans = 0;

        for (i = 1; i <= n; i++)
        {
            for (j = 0; j <= cap; j++)
            {
                 dp[i][j] = dp[i-1][j];
                 if (j-w[i] >= 0)
                 dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i]]+v[i]);

                 if (i == n)
                    ans = max(ans, dp[i][j]);
            }
        }

        printf("%lld\n", ans);
    }
    return 0;
}


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

int main(){
  int n,a[110],sum=0;
  cin>>n;
  for(int i=0;i<n;i++) cin>>a[i];
  sort(a,a+n,greater<int>());
  for(int i=0;i<n;i++){
    if(i%2==0) sum+=a[i];
    else sum-=a[i];
  }
  cout<<sum;
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
	int a[4][3][10];
	int i,j,k,l,n;
	int b,f,r,v;

    for(i=0;i<4;i++){
        for(j=0;j<3;j++){
            for(k=0;k<10;k++){
                a[i][j][k]=0;
            }
        }
    }
    
    scanf("%d",&n);
    for(l=0;l<n;l++){
        scanf("%d %d %d %d",&b,&f,&r,&v);
        for(i=0;i<b;i++){
            for(j=0;j<f;j++){
                for(k=0;k<r;k++){
                    if(i==(b-1) && j==(f-1) && k==(r-1)) a[i][j][k] = a[i][j][k]+v;
                    
                }
            }
        }
    }
    
        for(i=0;i<4;i++){
            for(j=0;j<3;j++){
                for(k=0;k<10;k++){
                    printf(" %d",a[i][j][k]);
                    
                }
                printf("\n");
            }
            if(i != 3)
            printf("####################\n");
        }
	return 0;
}


Measured memory_bytes: 2092
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
ll a, b, q, s[100010], t[100010], x[100010];

int main()
{
	cin >> a >> b >> q;
	for (int i = 0; i < a; i++) cin >> s[i];
	for (int i = 0; i < b; i++) cin >> t[i];
	for (int i = 0; i < q; i++) cin >> x[i];
	for (int i = 0; i < q; i++)
	{
		int alb = -1, aub = a, blb = -1, bub = b;
		ll res = 1000000000000;
		while (alb + 1 < aub)
		{
			int mid = (alb + aub) / 2;
			if (s[mid] < x[i]) alb = mid;
			else aub = mid;
		}
		while (blb + 1 < bub)
		{
			int mid = (blb + bub) / 2;
			if (t[mid] < x[i]) blb = mid;
			else bub = mid;
		}
		if (alb != -1 && blb != -1)
		{
			res = min(res, x[i] - s[alb] + abs(s[alb] - t[blb]));
			res = min(res, x[i] - t[blb] + abs(s[alb] - t[blb]));
		}
		if (alb != -1 && bub != b)
		{
			res = min(res, x[i] - s[alb] + t[bub] - s[alb]);
			res = min(res, t[bub] - x[i] + t[bub] - s[alb]);
		}
		if (aub != a && blb != -1)
		{
			res = min(res, s[aub] - x[i] + s[aub] - t[blb]);
			res = min(res, x[i] - t[blb] + s[aub] - t[blb]);
		}
		if (aub != a && bub != b)
		{
			res = min(res, s[aub] - x[i] + abs(s[aub] - t[bub]));
			res = min(res, t[bub] - x[i] + abs(s[aub] - t[bub]));
		}
		cout << res << endl;
	}
}

Measured memory_bytes: 3712
import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    
    int digitSum = 0;
    int num = N;
    while( num > 0){
      digitSum += num%10;
      num /= 10;
    }
    if( N % digitSum == 0){
      System.out.println("Yes");
    }else{
      System.out.println("No");
  }
  }
}

    

Measured memory_bytes: 23764
#include <iostream>
#include <string>
#include <cassert>
using namespace std;
int main(){
	string s;
	int i,n,a,b,c,d;
	cin >> n >> a >> b >> c >> d >> s;
	a--; b--; c--; d--;
	for(i=a;i<c;i++){
		if(s[i]=='#' && s[i+1]=='#'){
			cout << "No" << endl;
			return 0;
		}
	}
	for(i=b;i<d;i++){
		if(s[i]=='#' && s[i+1]=='#'){
			cout << "No" << endl;
			return 0;
		}
	}
	if(c<d){
		cout << "Yes" << endl;
		return 0;
	}
	for(i=b;i<=d;i++){
		if(s[i-1]=='.' && s[i]=='.' && s[i+1]=='.'){
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
#include<queue>
#include<vector>

using namespace std;

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

int main(){
    int n;
    cin >> n;
    int d, x;
    cin >> d >> x;
    int a[n];
    rep(i, n) cin >> a[i];
    int ans = x;
    for (int i = 0; i < n; i++){
        for (int j = 1; j <= d; j += a[i]){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
strings = input().split('/')
s = list(map(int, strings))
flag = 1
if s[0] > 2019:
    flag = 0
elif s[0] == 2019:
    if s[1] > 4:
        flag = 0

ans_list = ['TBD', 'Heisei']
print(ans_list[flag])


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long N,T;
  cin>>N>>T;
  long long j=0,k=0;
  for(long long i=0;i<N;i++){
    long long t;
    cin>>t;
    j+=T-max(k-t,0LL);
    k=t+T;
  }
  cout<<j<<endl;
}

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

int getValue( int l, int w ){
    int L[6] = {60, 80, 100, 120, 140, 160};
    int W[6] = {2, 5, 10, 15, 20, 25};
    int V[6] = {600, 800, 1000, 1200, 1400, 1600};
    for ( int i = 0; i < 6; i++ ){
	if ( l <= L[i] && w <= W[i] ) return V[i];
    }
    return 0;
}

main(){
    int n, x, y, h, w; 
    while( cin >> n && n ){
	int sum = 0;
	for ( int i = 0; i < n; i++ ){
	    cin >> x >> y >> h >> w;
	    sum += getValue(x + y + h, w);
	}
	cout << sum << endl;
    }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 99999999999 //10^12-1
#define dev 998244353 //tenka1
#define P pair<int,int>
#define Fi first
#define Se second

signed main(){
    int n;
    cin>>n;
    int ans=180*(n-2);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
// types
typedef long long ll; 
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
// IO
#define fo(i, n) for (int i = 0; i < n; i++)
#define fo1(i, n) for (int i = 1; i <= n; i++)
#define sc(n) scanf("%d", &n) 
#define sca(a, n) fo(i, n) sc(a[i])
#define pd(a) printf("%d ", a)
#define pld(a) printf("%d\n", a)
#define pda(a, n) fo(i, n) pd(a[i])
#define pl printf("\n")
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b) 
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
// math
const ll mod = 1e9+7;
template<typename T> T gcf(T a, T b) {return (b == 0) ? a : gcf(b, a%b);} 
template<typename T> T lcm(T a, T b) {return (a*b)/gcf(a, b);}
template<typename T> T sumTo(T x) {return x * (x+1) / 2;}
template<typename T> T sumSquaresTo(T x) {return x * (x+1) * (2*x+1) / 6;}
template<typename T> T ceilDiv(T n, T d) {return (n+d-1)/d;}

void solve() {
    int n; string s; cin >>  n >> s;
    if (n % 2) {
        No();
    }
    else {
        fo(i, n/2) {
            if (s[i] != s[i+n/2]) {
                 No();
                 return;
            } 
        }
        Yes();
    }
}

int main() {
    int t = 1;
    //scanf("%d", &t);
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxk=(int)1e5+5;
ll a[maxk];
int n;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
	ll L=2,R=2,tmp1=0,tmp2=0;
	for(int i=n;i>=1;i--) {
		tmp1=a[i]*((L-1)/a[i]+1),tmp2=R/a[i]*a[i];
		if(tmp1>R || tmp2<L) {printf("-1\n");exit(0);}
		else {
			L=tmp1,R=tmp2+a[i]-1;
		}
	}
	printf("%lld %lld\n",L,R);
	return 0;
}
/*
4
3 4 3 2
*/
/*
5
3 4 100 3 2
*/
/*
10
2 2 2 2 2 2 2 2 2 2
*/

Measured memory_bytes: 1024
package main

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

const mod = 1000000007

// 1MB
const ioBufferSize = 1 * 1024 * 1024

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	n := nextInt()
	a := make([]int, n)

	for i := 0; i < n; i++ {
		a[nextInt()-1] = i + 1
	}

	fmt.Println(strings.Trim(fmt.Sprint(a), "[]"))
}


Measured memory_bytes: 6528
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <stack>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long int ll;

void printBit(ll num){
	if( num == 0){
		cout<<0<<endl;
		return ;
	}
	stack<int> ans;
	while(num > 0){
		if( num % 2 == 1){
			ans.push(1);
		}else{
			ans.push(0);
		}
		num /= 2;
	}
	while(!ans.empty()){
		cout<<ans.top();
		ans.pop();
	}
	cout<<endl;
	return;
}

int main()
{
	int n;
	cin>>n;
	if( n == 0){
		cout<<0<<endl;
		return 0;
	}
	stack<int> ans;
	while( n != 0){
		if( abs(n - 1) % 2 == 0){
			ans.push(1);
			n = (n-1)/(-2);
		}else{
			ans.push(0);
			n = n / (-2);
		}
	}
	while( ! ans.empty()){
		cout<<ans.top();
		ans.pop();
	}
	cout<<endl;
	return 0;
}


Measured memory_bytes: 3188
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        for(int i = 0; i < str.length(); i++){
            System.out.print("x");
        }
    }
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

constexpr ll INF = 1'001'001'001'001'001'001;
int N, M, L;
int t[310][310];
int Q;
ll d[310][310];
std::queue<int> que;
std::vector<int> ve;

void f(int v0){
    memset(t[v0], -1, sizeof(t[v0]));
    t[v0][v0] = 0;

    que.emplace(v0);

    ve.clear();
    for(int i=1;i<=N;++i){
        if(i != v0){
            ve.emplace_back(i);
        }
    }

    for(int u=0;;++u){
        int n = que.size();

        for(int _=0;_<n;++_){
            int v = que.front();
            que.pop();

            auto it = ve.begin();

            for(;it!=ve.end();){
                int w = *it;

                if(d[v][w] <= L){
                    t[v0][w] = u;
                    que.emplace(w);
                    it = ve.erase(it);
                }else{
                    it += 1;
                }
            }
        }

        if(que.empty()){
            break;
        }
    }
}

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

  std::cin >> N >> M >> L;

  for(int i=1;i<=N;++i){
      for(int j=1;j<=N;++j){
          if(i != j){
              d[i][j] = INF;
          }
      }
  }

  for(int i=0;i<M;++i){
      int A, B, C;
      std::cin >> A >> B >> C;

      d[A][B] = C;
      d[B][A] = C;
  }

  for(int k=1;k<=N;++k){
      for(int i=1;i<=N;++i){
          for(int j=1;j<=N;++j){
              d[i][j] = std::min(d[i][j], d[i][k] + d[k][j]);
          }
      }
  }

  for(int i=1;i<=N;++i){
      f(i);
  }

  std::cin >> Q;

  for(int i=0;i<Q;++i){
      int S, U;
      std::cin >> S >> U;

      std::cout << t[S][U] << std::endl;
  }
}


Measured memory_bytes: 1664
#include <iostream>

using namespace std;

int N;
int C[500];
int S[500];
int F[500];

int main(int argc, char *argv[]) {
	cin >> N;

	for (int i = 0; i < N - 1; i++)
		cin >> C[i] >> S[i] >> F[i];

	for (int i = 0; i < N; i++) {
		int x = 0;
		int idx = i;
		while (idx != N - 1) {
			if (x < S[idx])
				x = S[idx];
			else if (x % F[idx] != 0)
				x = (x / F[idx] + 1) * F[idx];

			x += C[idx];
			idx++;
		}
		cout << x << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define lp(i,a,n) for(int i=(a);i<=(int)(n);++i)
#define lpd(i,a,n) for(int i=(a);i>=(int)(n);--i)
#define mem(a,b) memset(a,b,sizeof a)
#define all(v) v.begin(),v.end()
#define println(a) cout <<(a) <<endl
#define sz(x) ((int)(x).size())
#define readi(x) scanf("%d",&x)
#define read2i(x,y) scanf("%d%d",&x,&y)
#define read3i(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define mod 1000000007
#define eps 1e-8
#define infi 1000000000
#define infll 1000000000000000000ll
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef set<int> si;
typedef map<int,int> mii;

const int N = 100002;
int n;

int main(){
    readi(n);
    ll ans = 0;
    lp(i,1,n){
        int l,r;
        read2i(l,r);
        ans += r-l+1;
    }
    cout <<ans;
}

/*
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
*/


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>
#include<bitset>
#include<cassert>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define chmax(x,y) x = max(x,y)
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll h, w, a, b;
map<ll, ll> m;
multiset<ll> vals;

int main() {
	cin >> h >> w;
	rep(i, w) {
		m[i] = i;
		vals.insert(0);
	}
	rep(i, h) {
		cin >> a >> b;
		a--;
		auto it = m.lower_bound(a);
		ll mr = -1;
		while (it != m.end() && it->first <= b) {
			mr = it->second;
			vals.erase(vals.find(it->first - it->second));
			it = m.erase(it);
		}
		if (b == w)mr = -1;
		if (mr != -1) {
			m[b] = mr;
			vals.insert(b - mr);
		}
		if (vals.size()) {
			cout << *vals.begin() + i + 1 << endl;
		}
		else {
			cout << -1 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 25428
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <queue>
#include <iomanip>
#include <set>
//#include <bits/stdc++.h>

template<typename T> bool chmax(T &a,T b){
    if(a<b){
        a=b;
        return true;
    }
    return false;
}

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

using namespace std;
#define ALL(X) X.begin(),X.end()
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
const int MOD=1000000007;
//const int MOD=998244353;
const int INTMAX=1001001000;
const ll LLMAX=1010010010010010000;

void warshall_floyd(vvll &cost){
    for(int k=0;k<cost.size();k++){
        for(int i=0;i<cost.size();i++){
            for(int j=0;j<cost.size();j++){
                cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j]);
            }
        }
    }
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll H,W;
    cin>>H>>W;
    vvll c(10,vll(10));
    for(ll i=0;i<10;i++)for(ll j=0;j<10;j++)cin>>c[i][j];
    vvll A(H,vll(W));
    for(ll i=0;i<H;i++)for(ll j=0;j<W;j++)cin>>A[i][j];
    
    warshall_floyd(c);
    
    vll count(10,0);
    for(ll i=0;i<H;i++){
        for(ll j=0;j<W;j++){
            if(A[i][j]>=0 && A[i][j]<10)count[A[i][j]]++;
        }
    }
    
    ll ans=0;
    for(ll i=0;i<10;i++){
        ans+=c[i][1]*count[i];
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 640
/*
 * Author:  heyuhhh
 * Created Time:  2020/6/21 20:38:35
 */
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <assert.h>
#include <functional>
#include <numeric>
#define MP make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define INF 0x3f3f3f3f
#define Local
#ifdef Local
  #define dbg(args...) do { cout << #args << " -> "; err(args); } while (0)
  void err() { std::cout << std::endl; }
  template<typename T, typename...Args>
  void err(T a, Args...args) { std::cout << a << ' '; err(args...); }
  template <template<typename...> class T, typename t, typename... A> 
  void err(const T <t> &arg, const A&... args) {
  for (auto &v : arg) std::cout << v << ' '; err(args...); }
#else
  #define dbg(...)
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//head
const int N = 2e6 + 5, MOD = 1e9 + 7;
int qpow(ll a, ll b) {
    ll res = 1;
    while(b) {
        if(b & 1) res = res * a % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return res;   
}
int fac[N], inv[N];
void init() {
    fac[0] = 1;
    for(int i = 1; i < N; i++) fac[i] = 1ll * fac[i - 1] * i % MOD;
    inv[N - 1] = qpow(fac[N - 1], MOD - 2);
    for(int i = N - 2; i >= 0; i--) inv[i] = 1ll * inv[i + 1] * (i + 1) % MOD;
}

int C(int n, int m) {
    return 1ll * fac[n] * inv[m] % MOD * inv[n - m] % MOD;
}

void run() {
    int k; cin >> k;
    string s; cin >> s;
    int n = s.length();
    int ans = 0;
    for (int i = 0; i <= k; i++) {
        ans = (ans + 1ll * qpow(25, i) * qpow(26, k - i) % MOD * C(i + n - 1, n - 1) % MOD) % MOD;
    }
    cout << ans << '\n';
}

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

Measured memory_bytes: 19868
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define pi acos(-1.0)

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main(){
    char c;
    cin >> c;
    if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
        cout << "vowel" << endl;
    }else{
        cout << "consonant" << endl;
    }
    return 0;
}










Measured memory_bytes: 764
/*---------------Go Code GO---------------*/

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

#define     PI              acos(-1.0)
#define     O_O             ios_base::sync_with_stdio(false); cin.tie(NULL)
#define     precision(a)    fixed<<setprecision(a)
#define     endl            '\n'
#define     Flush           cout<<flush
#define     LLMX            0x3fffffffffffffff
#define     PW2(a)          (long long)1<<a


int main()
{
    long long i,j,k,l,m,n,o,p,q,tst,csin=0;
    cin>>n>>q>>p;



    if(p==q)
        cout<<0<<endl;
    else
    {
        if((p+q)%2==0)
        {
            k=(p+q)/2;
            k-=q;
            cout<<k<<endl;
        }
        else
        {
            m=q+n-p+1;
            l=p-q-1;
            m=(m+n)/2-m+n-p+1;
            l=(l+1)/2-1+q+1;
            if(m>l) cout<<l<<endl;
            else cout<<m<<endl;

        }
    }



    return 0;
}




Measured memory_bytes: 256
/* Be strong, be fearless, be beautiful :D
And believe that anything is possible :))
when you have the right people there
to support you :) */
//RTn_E
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define _Sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define _file freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define ll long long
#define ld long double
#define sp setprecision
#define pb push_back
#define F first
#define S second
#define mk make_pair
#define pii pair < int , int >
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const ll mod = 1e9 + 7;
const int maxn = 100 + 100;
const ll inf = 1e18;

//Main CODE :/\

int mp[maxn] , num[maxn];
int main() {
    _Sync
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++)
        mp[s[i] - 'a']++;
    if (s.size() < 26){
        cout << s;
        for (int i = 0; i < 26; i++)
            if (!mp[i])
                return cout << char(i + 'a') << "\n" , 0;
    }
    if (s == "zyxwvutsrqponmlkjihgfedcba")
        return cout << "-1\n" , 0;
    for (int i = 0; i <= 25; i++){
        num[s[25 - i] - 'a'] = 1;
        if (s[24 - i] < s[25 - i])
            for (int j = 0; j <= 26; j++)
                if (num[j] == 1 && j > s[24 - i] - 'a')
                    return cout << s.substr(0, 24 - i) << char('a' + j) << "\n" , 0;
    }
    return 0;
}
//The_End
//Game Over :D


Measured memory_bytes: 256
N = 10**5
Q = int(input())
lr = [list(map(int, input().split())) for _ in range(Q)]
ans = [0 for _ in range(N+10)]

def is_prime(x):
    if x < 2:
        return False
    if x == 2:
        return True
    if x%2 == 0:
        return False
    for i in range(3, min(int(x**0.5)+5, x), 2):
        if x%i == 0:
            return False
    return True

for i in range(1, len(ans)):
    if is_prime(i) and is_prime((i+1)//2):
        ans[i] += 1
    ans[i] += ans[i-1]

for l, r in lr:
    print(ans[r]-ans[l-1])

Measured memory_bytes: 71512
#include <stdio.h>
int main()
{
    int a, b;
    int cnt = 0;
    int num = 0;
    int renum;
    int temp;
    int retemp;

    scanf("%d%d", &a, &b);

    while (a <= b)
    {
        renum = a;
        while (a != 0)
        {
            temp = a % 10;
            num = 10 * retemp + temp;
            a /= 10;
            retemp = num;
        }
        if (renum == num)
            cnt++;
        num = 0;
        retemp = 0;
        a = renum;
        a++;
    }
    printf("%d\n", cnt);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
vector<int>g[100005];
int dis[100005][3];
int main(){
	int n,m,s,t,u,v;
	memset(dis,-1,sizeof(dis));
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		scanf("%d%d",&u,&v);
		g[u].push_back(v);
	}
	scanf("%d%d",&s,&t);
	queue<pair<int,int> >q;
	q.push({s,0});
	dis[s][0]=0;
	while(!q.empty()){
		int v=q.front().first;
		int l=q.front().second;
		q.pop();
		for(int i=0;i<g[v].size();i++){
			int ll=(l+1)%3;
			if(dis[g[v][i]][ll]>=0)
				continue;
			dis[g[v][i]][ll]=dis[v][l]+1;
			q.push({g[v][i],ll});
		}
	}
	if(dis[t][0]>=0)
		dis[t][0]/=3;
	printf("%d\n",dis[t][0]);
} 

Measured memory_bytes: 6912
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,p;
  cin>>s>>p;
  s=s+s;
  bool flag = false;
  for(int i=0;i<(int)s.size()-(int)p.size()+1;i++){
    string t=s.substr(i,p.size() );

    if(t==p){
      flag=true;
      break;
    }
  }
  if(flag){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}



Measured memory_bytes: 3224
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
using static AtCoderTemplate.MyLibrary;

namespace AtCoderTemplate
{
    class Program
    {
        static void Main (string[] args)
        {
            string[] str;
            str = Console.ReadLine ().Split (' ');

            int x = int.Parse (str[0]);

            Console.WriteLine (x * x * x);
        }
    }

    class MyLibrary
    {

        // 自作の関数
        public static int MyFunction (int n)
        {
            return 0;
        }
    }
}


Measured memory_bytes: 18008
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int sum = 0;
  int max = 0;
  int p;
  for(int i = 0;i < n;i++) {
    cin >> p;
    sum += p;
    if(max < p) {
      max = p;
    }
  }
  cout << sum - max * 0.5 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<set>
#include<vector>
#include<string>
#include<iterator>
#include<iomanip>
#include<cmath>
#include<map>
#include<string.h>
#include<algorithm>

using namespace std;
void ll(){
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(0);
}

int main() {

	ll();
	
	int a, b, sum = 0;
	cin >> a >> b;
	sum = a + b;
	if (sum >= 24)
		cout << (a + b) - 24 << endl;
	else
		cout << (a + b)<<endl;
}

Measured memory_bytes: 3592
strs = gets.strip.split('')

_slice = strs.each_slice(2)
odd_strs = _slice.map(&:first)
even_strs = _slice.map(&:last)
even_strs.pop if strs.size % 2 == 1

odd_strs_one_count = odd_strs.count('1')
odd_strs_zero_count = odd_strs.size - odd_strs_one_count

even_strs_one_count = even_strs.count('1')
even_strs_zero_count = even_strs.size - even_strs_one_count

change_count_pattern1 = odd_strs_one_count + even_strs_zero_count
change_count_pattern2 = odd_strs_zero_count + even_strs_one_count

if change_count_pattern1 <= change_count_pattern2
  puts change_count_pattern1
else
  puts change_count_pattern2
end


Measured memory_bytes: 10364
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


int main(){
    FIN;
    ll n; cin >> n;
    vector<ll> a(n),b(n);
    ll num;
    rep(i,0,n){
        cin >> num;
        a[i] = b[i] = num;
    }
    sort(ALL(b),greater<ll>());

    for(ll i=0;i<n;i++){
        if(a[i] == b[0]) cout << b[1] << endl;
        else cout << b[0] << endl;
    }

    return 0;
}


Measured memory_bytes: 4736
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount
           
#define rep(i, n) for (int i = 0; i < n; ++i)

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
    string s;
    while (getline(cin, s), s != "END OF INPUT")
    {
	s += " ";
	int c = 0;
	for (int i = 0; i < s.size(); ++i)
	{
	    if (s[i] == ' ')
	    {
		if (c)
		    cout << c;

		if (i && s[i - 1] == ' ')
		    cout << '0';
		c = 0;
	    }
	    else
		++c;
	}
	cout << endl;
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,l,i;
  cin>>n>>l;
  vector<string> s(n);
  for(i=0;i<n;i++)
    cin>>s[i];
  sort(s.begin(),s.end());
  string ans="";
  for(i=0;i<n;i++)
    ans+=s[i];
  cout<<ans<<endl;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
static const int MAX = 200000;

int main(){
    int N;
    cin >> N;
    vector<int> R(N);
    for(int i ; i < N; i++){
        cin >> R.at(i);
    }
    int max_v = -2000000000;
    int min_v = R.at(0);

    for(int i = 1 ; i < N; i++){
        max_v = max(max_v, R.at(i) - min_v);
        min_v = min(min_v, R.at(i));
    }

    cout << max_v << endl ;

    return 0;

}


Measured memory_bytes: 3536
use std::io;
use std::cmp::min;

fn main() { 
    // 1行目の読み込み
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).expect("Failed to read line");
    let vec_1: Vec<&str> = buf.split_whitespace().collect();
    let n: i32 = vec_1[0].parse().unwrap_or(0);
    
    // 2行目の読み込み
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).expect("Failed to read line");
    let vec_x: Vec<&str> = buf.split_whitespace().collect();
    
    // pの候補を求める
    let mut sum_x:i32 = 0;
    for i in &vec_x {
        let t:i32 = i.parse().unwrap();
        sum_x += t;
    };
    let mut p:i32 = sum_x/n;

    // 答えの候補を二つとも求める
    let mut ans_1:i32 = 0;
    for i in &vec_x {
        let t:i32 = i.parse().unwrap();
        ans_1 += (t-p)*(t-p);
    };

    p += 1;
    let mut ans_2:i32 = 0;
    for i in &vec_x {
        let t:i32 = i.parse().unwrap();
        ans_2 += (t-p)*(t-p);
    };
 
    println!("{}", min(ans_1, ans_2));
}

Measured memory_bytes: 4352
#include<stdio.h>

int main(void)
{

	int a, b, c, d;
	scanf("%d %d %d %d", &a,&b, &c, &d);

	if (a + b > c + d) {

		printf("Left\n");
	}
	else if (a + b == c + d) {
		printf("Balanced\n");
	}
	else if (a + b < c + d) {
		printf("Right\n");
	}
	return 0;
		
}

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

int main(){
  string S;
  cin >> S;
  for(int i=0; i<3; i++){
    if(S[i]==S[i+1]){
      cout << "Bad" << endl;
      return 0;
    }
  }
  cout << "Good" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;


const int INF = 10000000;
const long long INFL = (1LL<<40);
const int MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}

template< typename T >
struct edge{
    int src, to;T cost;
    edge(int to,T cost) :src(-1),to(to),cost(cost){}
    edge(int src, int to, T cost) :src(src),to(to),cost(cost){}edge
    &operator=(const int &x){
        to =x;
        return *this;
    }
    operator int() const{ return to;}
};

double dist (double a, double b,  double c, double d){
    
    return sqrt((a-c)*(a-c) + (b-d)*(b-d));
    
}

bool check(int x,int y,vector<string> a,vector<string> b ){
    for(auto i = 0; i<b.size();i++){
        for(auto j =0; j<b.size();j++){
            if(a[x+i][y+j]!= b[i][j]) return false;
        }
    }
    return true;
}

int main() {
    string s,t;cin>>s>>t;
    sort(all(s));sort(all(t),greater<char>());
    
    if(s<t)cout<<"Yes"<<endl;
    if(s>=t)cout<<"No"<<endl;
    
    return 0;
}







Measured memory_bytes: 256