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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

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

    int a, b;
    a = 0;
    b = 0;
    for(int in=0;in<s.size();in++) {
        a *= 10;
        a += s.at(in) - '0';
        b += s.at(in) - '0';
    }

    if(a%b==0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std ;
const int N = 4e5 + 5 , Mod = 2019 ;
int bs[ N ] , a[ N ] ;
string s ;
signed main() {
	cin >> s ;
	bs[ 0 ] = 1 ;
	for( int i = 1 ; i < N ; ++i ) 
		bs[ i ] = bs[ i - 1 ] * 10 % Mod ;
	int x , y = 0 , ans = 0 ;
	a[ 0 ] = 1 ;
	for( int i = s.size() - 1 ; i >= 0 ; --i ) {
		x = ( s[ i ] - '0' ) * bs[ s.size() - i - 1 ] % Mod ;
		ans += a[ ( x + y ) % Mod  ] ;
		++ a[ ( x + y ) % Mod ] ;
		y = ( x + y ) % Mod ;
	}
	printf( "%d\n" , ans ) ;
	return 0 ;
}

Measured memory_bytes: 5452
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
typedef vector<vector<P>> vvP;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll k, x;
    cin >> k >> x;

    if(500*k >= x) {
        out("Yes");
    }
    else {
        out("No");
    }

    re0;
}

Measured memory_bytes: 256
N, K = map(int,input().split())
li = []
count = 0
for i in range(N):
    a,b = map(int,input().split())
    li.append([a,b])
li.sort()
for j in range(N):
    count += li[j][1]
    if count >= K:
        print(li[j][0])
        break


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




ll f(ll k,ll a, ll b, ll c, ll d = 0){
    if(k == d){
        if(b > a and c > b){
            return 1;
        }else{
            return 0;
        }
    }
    return f(k,a*2,b,c,d+1) or f(k,a,b*2,c,d+1) or f(k,a,b,c*2,d+1);
}

int main(){
    ll a, b, c; cin >> a >> b >> c;
    ll k; cin >> k;

    cout << (f(k,a,b,c) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3616
#include<stdio.h>
int main(){
    int n,m,x[201],a[201];
    scanf("%d",&n);
    for(int i=1;i<=n;i++)scanf("%d",&x[i]);
    scanf("%d",&m);
    for(int i=1;i<=m;i++)scanf("%d",&a[i]);
    for(int i=1;i<=m;i++){
        for(int j=1;j<=n;j++){
            if(j==a[i]){
                if(x[j+1]!=x[j]+1&&x[j]!=2019)x[j]++;
            }
        }
    }
    for(int i=1;i<=n;i++)printf("%d\n",x[i]);
    return 0;
}


Measured memory_bytes: 2092
// AOJ ALDS1_14_B String Search
// 2018.4.27 bal4u

#include <stdio.h>
#include <stdlib.h>

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif

char text[1000005];
char pattern[10005];
int  next[10005], skip[258];

char *bmMatch(char *text, int len, char *pattern, int patlen,
              int *skip, int *next)
{
    int i, j;

    i = patlen - 1;
    while (i < len) {
        j = patlen - 1;
        while (j >= 0 && text[i] == pattern[j]) {
            i--;
            j--;
        }
        if (j < 0) return text + i + 1;
        if (skip[text[i]] >= next[j]) i += skip[text[i]];
        else i += next[j];
    }
    return NULL;
}

int bmSkip(int *skip, int slen, char *pattern, int patlen)
{
    int j;

    if (slen < 256) return -1;
    for (j = 0; j < 256; j++) skip[j] = patlen;
    for (j = 0; j < patlen - 1; j++)
        skip[pattern[j]] = patlen-1-j;
    return 0;
}

int bmNext(int *next, int nlen, char *pattern, int patlen)
{
    int  j, k, s;
    int  *g;

    g = malloc(sizeof(int)*patlen);
    for (j = 0; j < patlen; j++) next[j] = 2*patlen - 1 - j;
    j = patlen;
    for (k = patlen - 1; k >= 0; k--) {
        g[k] = j;
        while (j != patlen && pattern[j] != pattern[k]) {
            next[j] = (next[j] <= patlen-1-k) ? next[j] : patlen-1-k;
            j = g[j];
        }
        j--;
    }
    s = j;
    for (j = 0; j < patlen; j++) {
        next[j] = (next[j] <= s+patlen-j) ? next[j] : s+patlen-j;
        if (j >= s) s = g[s];
    }
    free(g);
    return 0;
}

char buf[20];
void mypr(int n)
{
	int w = 0;
	while (n) buf[w++] = n%10 + '0', n/=10;
	while (w--) pc(buf[w]);
	pc('\n');
}

void corner(int len)
{
	int i;
	if (len < 0) return;
	pc('0'), pc('\n');
	i = 0; while (len--) mypr(++i);
}

int main()
{
	int c, tlen, plen, len;
	int a, fa, b, fb;
	char *pos;

	fa = 1, pos = text;
	*pos++ = a = gc();
	while ((c = gc()) > ' ') {
		*pos++ = c;
		if (a != c) fa = 0;
	}
	*pos = 0; tlen = pos-text;

	fb = 1, pos = pattern;
	*pos++ = b = gc();
	while ((c = gc()) > ' ') {
		*pos++ = c;
		if (b != c) fb = 0;
	}
	*pos = 0; plen = pos-pattern;

	if (fa && fb && a == b) { corner(tlen-plen); return 0; }

    bmSkip(skip, 256, pattern, plen);
    bmNext(next, plen, pattern, plen);
	pos = text, len = tlen;
	while (1) {
	    pos = bmMatch(pos, len-(pos-text), pattern, plen, skip, next);
		if (pos == NULL) break;
		printf("%d\n", pos-text);
		pos++;
	}
	return 0;
}


Measured memory_bytes: 2796
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,A,B;
    cin >> N >> A >> B;
    cout << A*(N/(A+B))+min(N%(A+B),A) << "\n";
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		String s = scan.next();
		scan.close();
		int check=0;
		if(s.length()!=a+b+1)check=1;
		else {
			for(int i=0;i<a+b+1;i++) {
				if(s.charAt(i)=='-' &&i!=a  || i==a && s.charAt(i)!='-') {
					check=1;
					break;
				}
			}
		}
		System.out.println((check==1)? "No":"Yes");
	}
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
 
#define ll long long
#define loop(a) loopi(i,a)
#define loopi(i,a) for(int i=0; i<a; i++)
#define pll pair<ll,ll>
 
using namespace std;

const int mod=1e9+7;
const int maxn=500005;

int main(){
	ios_base::sync_with_stdio(0),cin.tie(0);
	string s;
	cin >> s;
	ll ans=0;
	bool boo=false;
	if(s[0]=='<') boo=true;
	vector<ll> vec;
	int cnt=0;
	s+=' ';
	loop(s.size()-1){
		cnt++;
		if(s[i]!=s[i+1]){
			vec.push_back(cnt);
			cnt=0;
		}
	}
	vec.push_back(0);
	loop(vec.size()){
		if(boo){
			ans+=(vec[i]-1)*vec[i]/2;
			boo=false;
		}
		else{
			ans+=(vec[i]+1)*vec[i]/2;
			if(i>0) if(vec[i-1]>vec[i]) ans+=vec[i-1]-vec[i];
			boo=true;
		}
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 3352
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] lines = Console.ReadLine().Split(' ');
            long x = long.Parse(lines[0]);
            long y = long.Parse(lines[1]);
            string[] ans = { "Alice", "Brown" };

            Console.WriteLine(ans[Math.Abs(x - y) <= 1 ? 1 : 0]);
        }
    }
}


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

using namespace std;

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

    vector<int> x(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i];
    }

    int res = 1000000000;
    for (int i = 1; i <= 100; i++) {
        int r = 0;
        for (int j = 0; j < n; j++) {
            r += (x[j] - i) * (x[j] - i);
        }

        res = min(res, r);
    }

    cout << res << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
std::vector<int> v;
int INF= 0x3f3f3f3f;
int mina=INF;
void solve(){
     int N;
     cin >> N;
     for(int i=0;i<N;i+=1){
          int x;
          cin >> x; 
          v.push_back(x);
     }
     int pointer = floor(0);
     int left = v[0];
     int right = 0;
     for(int i=1;i<N;i+=1){
          right+=v[i];
     }
     if(abs(right-left)<mina){
          mina = abs(right-left);
     }
     for(int i=1;i<(N-1);i+=1){
          left+=v[i];
          right-=v[i];
          // cout << left << " " << right << endl;
          if(abs(right-left)<mina){
               mina = abs(right-left);
          }
     }
}
int main() {
     solve();
	cout << mina;
}


Measured memory_bytes: 3580
#include<stdio.h>
#define MAX 100000
typedef struct{
  int p,r,l;
}Node;
Node T[MAX];
int a,d[MAX],h[MAX];

int sibling(int);
void depth(int,int);
int height(int);
void print(int);

int main(){
  int n,id,r,l,x=0;
  int i;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    T[i].p=-1;
  }
  for(i=0;i<n;i++){
    scanf("%d%d%d",&id,&l,&r);
    T[id].l=l;
    T[id].r=r;
    if(r!=-1) T[r].p=id;
    if(l!=-1) T[l].p=id;
  }
  for(i=0;i<n;i++){
    if(T[i].p==-1) x=i;
  }
  depth(x,0);
  height(x);
  for(i=0;i<n;i++){
    print(i);
  }
  return 0;
}

void depth(int a, int b){
  if(a==-1) return;
  d[a]=b;
  depth(T[a].l,b+1);
  depth(T[a].r,b+1);
}
int height(int a){
  int r=0,l=0;
  if(T[a].r!=-1) r=height(T[a].r)+1;
  if(T[a].l!=-1) l=height(T[a].l)+1;
  if(T[a].r==-1 && T[a].l==-1) return 0;
  if(l>r) return h[a]=l;
  else return h[a]=r;
}int sibling(int a){
  if(T[a].p==-1) return -1;
  if(T[T[a].p].l!=a && T[T[a].p].l!=-1) return T[T[a].p].l;
  if(T[T[a].p].r!=a && T[T[a].p].r!=-1) return T[T[a].p].r;
  return -1;
}
void print(int a){
  int dg=0;
  printf("node %d: parent = %d,",a,T[a].p);
  printf(" sibling = %d,",sibling(a));
  if(T[a].l!=-1) dg++;
  if(T[a].r!=-1) dg++;
  printf(" degree = %d,",dg);
  printf(" depth = %d, height = %d, ",d[a],h[a]);
  if(T[a].p==-1) printf("root\n");
  else if(T[a].l==-1 && T[a].r==-1) printf("leaf\n");
  else printf("internal node\n");
}



Measured memory_bytes: 2052
n, m, x, y = gets.chomp.split(' ').map(&:to_i)
mx = gets.chomp.split(' ').map(&:to_i).max
my = gets.chomp.split(' ').map(&:to_i).min

result = false
(x + 1).upto(y).each do |z|
  if mx < z && my >= z
    result = true
    break
  end
end

puts result ? 'No War' : 'War'



Measured memory_bytes: 1788
main = do
 [n,a,b] <- map (read::String->Int) .words <$> getLine
 s <-  getLine
 mapM_ putStrLn .pre_1 (f s) a $b  
 

f ::String->[String]
f s = [[c] | c <- s] 

{-
pre_1 ::[String] -> Int -> Int -> [String]
pre_1 ("a":xs) a b | (a + b > 0) = "Yes" : (pre_1 xs (a-1) b)
pre_1 ("b":xs) a b | (a + b > 0) && (b > 0) = "Yes": (pre_1 xs a (b-1))
pre_1 (_:xs) _ _ = "No" :   (pre_1 xs a b)
-}

pre_1 ::[String] -> Int -> Int -> [String]
pre_1 (x:[]) a b 
 | (x=="a")&&(a + b > 0) = "Yes" : []
 | (x=="b")&&(a + b > 0) && (b > 0) = "Yes": []
 | otherwise = "No" :  []
pre_1 (x:xs) a b 
 | (x=="a")&&(a + b > 0) = "Yes" : (pre_1 xs (a-1) b)
 | (x=="b")&&(a + b > 0) && (b > 0) = "Yes": (pre_1 xs a (b-1))
 | otherwise = "No" :   (pre_1 xs a b)


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

int main(){
  int n;
  cin >> n;
  vector<int> p(n);
  for(int i = 0;i < n;i++){
    cin >> p.at(i);
  }
  int result = 0;
  for(int i = 1;i < n-1;i++){
    if( (p.at(i+1) < p.at(i) && p.at(i) < p.at(i-1)) || (p.at(i+1) > p.at(i) && p.at(i) > p.at(i-1)) ){
      result++;
    }
  }
  cout << result << endl;
}

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

bool is_valid(int num) {
    while(num % 2 == 0) num /= 2;
    while(num % 3 == 0) num /= 3;
    while(num % 5 == 0) num /= 5;
    return num == 1;
}

int solve_testcase() {
    int L; scanf("%d", &L);
    if(L == 0) return 1;
    int R; scanf("%d", &R);

    int ans = 0;
    for(int i=L; i<=R; i++) ans += is_valid(i);
    printf("%d\n", ans);
    
    return 0;
}

int main() {
    while(!solve_testcase());
}



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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;
const ll INF = 1LL<<60;
//int INF = numeric_limits<int>::max();

int main(int, char**) {
	int n; cin >> n;
	int ret = 0;
	int target = 1;
	for (int i=0; i<n; i++) {
		int a; cin >> a;
		if (a==target) target++;
		else ret++;
	}
	if (target==1) ret = -1;
	cout << ret << endl;
	return 0;
}

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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

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

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    vector<int> a(n);
    double sum = 0;
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        sum += 1.0/a[i];
    }
    cout << 1.0/sum << "\n";
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)

def input(): return sys.stdin.readline()[:-1]
mod = 10**9 + 7
def readInt():return int(input())
def readIntList():return list(map(int,input().split()))
def readStringList():return list(input())
def readStringListWithSpace():return list(input().split())
def readString():return input()
import math
n,d = readIntList()
count = 0
for _ in range(n):
    x,y = readIntList()
    count += 1 if (x*x)+(y*y) <= d*d else 0
print(count)
        

Measured memory_bytes: 9220
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define forn(i,a,b) for(int i =a;i<b;i++)
#define fi first
#define se second
#define fast ios_base::sync_with_stdio(false);
using namespace std;


typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;


void solve(){
	int n;
	cin >> n;

	int a[n];
	map<int,vi> there;

	
	forn(i,0,n) {
		cin >> a[i];
		there[a[i]].pb(i);
	}

	int cnt = 0;
	for(int i =0;i<n;i++){
		int pos = 1;
		for(int j =1;j*j<=a[i];j++){
			if(a[i]%j==0){
				int check1 = j;
				int check2 = a[i]/j;
				if(there.find(check1)==there.end() && there.find(check2)==there.end())
					continue;

				if(there[check1].size()==1 && there[check1][0] != i)
				{
					pos = 0;
					break;
				}

				if(there[check1].size()>1){
					pos = 0;
					break;
				}

				if(there[check2].size()==1 && there[check2][0] !=i )
				{
					pos = 0;
					break;
				}
				if(there[check2].size()>1){
					pos = 0;
					break;
				}
			}		

		}
		if(pos)
			cnt++;
	}
	cout << cnt << endl;
}

int main(){
	fast;
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif

	// int t;cin >> t;while(t--)
		solve();
}


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

void Main()
{
  string Sdash, T; cin >> Sdash; cin >> T;
  int N = Sdash.size(); int M = T.size();
  vector<string> candidates;
  for (int s = 0; s < N-M+1; s++) {
    bool matched = true;
    for (int t = 0; t < M; t++) {
      //cout << s << "," << t << endl;
      if (Sdash[s+t] == T[t] or Sdash[s+t] == '?') ;
      else {matched = false; break;}
    }
    if (matched) {
      string candidate = Sdash;
      for(int t = s; t < s+M; t++) candidate[t] = T[t-s];
      int i = 0;
      for (char c : candidate) {
        if (c == '?') candidate[i] = 'a';
        i++;
      }
      candidates.push_back(candidate);
    }
  }
  sort(candidates.begin(), candidates.end());
  if (candidates.size() == 0) cout << "UNRESTORABLE" << endl;
  else cout << candidates[0] << endl;
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 3672
// 2019/11/20 Tazoe

#include <iostream>
#include <algorithm>
using namespace std;

const int INF = 1000000001;		// ありえない大きい値

int main()
{
	int N, M;
	cin >> N >> M;

	int D[1001];
	for(int i=1; i<=N; i++){
		cin >> D[i];
	}

	int C[1001];
	for(int j=1; j<=M; j++){
		cin >> C[j];
	}

	int DP[1001][1001];
	for(int i=1; i<=N; i++){
		DP[0][i] = INF;
	}
	for(int j=0; j<=M; j++){
		DP[j][0] = 0;
	}

	for(int j=1; j<=M; j++){
		for(int i=1; i<=N; i++){
			DP[j][i] = min(DP[j-1][i], DP[j-1][i-1]+D[i]*C[j]);
		}
	}

	cout << DP[M][N] << endl;

	return 0;
}



Measured memory_bytes: 6988
import sys
from collections import Counter
from collections import deque
import heapq
import math
import fractions
import bisect
import itertools
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))


n=10
h,w=mp()
d=[lmp() for i in range(n)]
for k in range(n):
    for i in range(n):
        for j in range(n):
            d[i][j] = min(d[i][j],d[i][k] + d[k][j])
ans=0
for i in range(h):
    l=lmp()
    for k in range(w):
        if l[k]!=-1:
            ans+=d[l[k]][1]
print(ans)

Measured memory_bytes: 5088
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pp pair<ll,ll>
typedef tree<pp,null_type,less<pp>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define ld long double
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin() , (x).end()
#define rep(i,a,b) for( ll i = a ; i < b ; i+=1 )
#define sz(v) (ll)(v.size())
#define hell (ll)1000000007
#define slld(x) scanf("%lld",&x)
ll t = 1;
const ll inf = hell, N=20005;
inline ll mult(ll x,ll y){return (x*y)%hell;}
inline ll add(ll x,ll y){x+=y;return x%hell;}
vector<ll> adj[N], revg[N], dist(N,inf);
void solve(){
	ll n, m, a, b, c, x, ans=0;
	cin>>n>>m>>a>>b>>c;
	vector<ll> aa, bb, cc, v;
	rep(i,0,a){
		cin>>x;
		aa.pb(x);
	}
	rep(i,0,b){
		cin>>x;
		bb.pb(x);
	}
	rep(i,0,c){
		cin>>x;
		cc.pb(x);
	}
	sort(all(aa),greater<ll>());
	sort(all(bb),greater<ll>());
	sort(all(cc),greater<ll>());
	rep(i,0,n)v.pb(aa[i]);
	rep(i,0,m)v.pb(bb[i]);
	rep(i,0,min(n+m,c))v.pb(cc[i]);
	sort(all(v),greater<ll>());
	rep(i,0,n+m)ans+=v[i];
	cout<<ans;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
//    cin >> t ;
    while(t--){
        solve();
    }
    return 0 ;
}


Measured memory_bytes: 9712
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int W = sc.nextInt();
		int H = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int r = sc.nextInt();
		if(y >= r && y <= H-r && x >=r && x <= W-r){
			System.out.printf("Yes\n");
		}else{
			System.out.printf("No\n");
		}
	}
}


Measured memory_bytes: 26436
a, b, c = map(int, raw_input().split())
big = a
go = b
if big < b:
    big = b
if big < c:
    big = c

if big == b:
    go = a + c
elif big == c:
    go = b + a
else:
    go = b + c
print big * 10 + go

Measured memory_bytes: 2568
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;
template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
// long long mod = 998244353;
#define REP(i, n) for (long long i = 0; i < (n); i++)
#define rep(i, a, n) for (long long i = a; i < (n); i++)
typedef long long ll;
typedef pair<ll, ll> P;
long long mod = 1000000007;
long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t % mod;
    } else {
        return modpow(m, n - 1) * m % mod;
    }
}
long long power(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}

long long moddiv(long long a, long long b) { return (a * modpow(b, mod - 2)) % mod; }

const ll INF = 1LL << 60;

void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}

ll nCkmod(ll n, ll k) {
    ll denomi = 1;
    for (int i = n; i > n - k; i--) {
        denomi *= i;
        denomi %= mod;
    }
    ll numera = 1;
    REP(i, k) {
        numera *= (i + 1);
        numera %= mod;
    }
    return moddiv(denomi, numera);
}
vector<vector<ll>> graph;
vector<ll> as;
map<P, ll> number;
ll n;
ll memo[3001][3001];
ll func(ll first, ll length) {
    if (length == 0) {
        return 0;
    }
    if (memo[first][length] != INF) {
        return memo[first][length];
    }
    ll a, b;
    a = func(first, length - 1);
    b = func(first + 1, length - 1);
    memo[first][length] = max(-a + as[length - 1 + first], -b + as[first]);
    return memo[first][length];
}
int main() {
    ll n, m, k;
    cin >> n >> m >> k;
    vector<ll> as(n);
    vector<ll> bs(m);
    vector<ll> las(n + 1);
    vector<ll> lbs(m + 1);
    REP(i, n) {
        cin >> as[i];
        las[i + 1] += las[i] + as[i];
    }
    REP(i, m) {
        cin >> bs[i];
        lbs[i + 1] += lbs[i] + bs[i];
    }
    ll maxsum = 0;
    REP(i, n + 1) {
        ll tl = k - las[i];
        ll sum = i;
        ll ok = 0;
        ll ng = m + 1;
        if (tl < 0) {
            continue;
        }
        while (abs(ok - ng) > 1) {
            ll mid = (ok + ng) / 2;
            if (lbs[mid] > tl) {
                ng = mid;
            } else {
                ok = mid;
            }
        }
        sum += ok;
        maxsum = max(maxsum, sum);
    }
    cout << maxsum << endl;
}

Measured memory_bytes: 9436
#include <iostream>
using namespace std;
typedef long long ll;
ll n,k;
main(){
	cin>>n;
	ll x=n;
	while(x){
		k+=(x%10);
		x/=10;
	}
	if(n%k==0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
//O(k)愚直,nは大きいがkがそうでもないときに思い出す
long long modpow(long long x,long long n,long long mod){
    long long res = 1;
    while(n > 0) {
        if(n & 1) (res *= x) %= mod;
        (x *= x) %= mod;
        n >>= 1;
    }
    return res;
}
long long modinv(long long x, long long mod){
     return modpow(x, mod - 2, mod); }
long long modcomb(long long n,long long r,long long mod){
    long long numerator = 1;
    for(long long i = 0; i < r; i++) {
        (numerator *= (n - i)) %= mod;
    }
    long long denominator = 1;
    for(long long i = 1; i <= r; i++) {
        (denominator *= i) %= mod;
    }
    denominator = modinv(denominator, mod);
    return numerator * denominator % mod;
}
int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n), b(2 * n,0);
    for (ll i = 0; i < n; i++) {
        cin >> a[i];
        b[i] = a[i];
    }
    for (ll i = 0; i < n;i++){
        b[i+n] = a[i];
    }
    ll inv1 = 0;
    for (ll i = 0; i < n;i++){
        for (ll j = i + 1; j < n;j++){
            if (a[i] > a[j]) inv1++;
        }
    }
    ll inv2 = 0;
    for (ll i = 0; i < n; i++) {
        for (ll j = n; j < 2 * n; j++) {
            if (b[i] > b[j]) inv2++;
        }
    }
    ll ans = 0;
    ans += inv1 * k;
    ans %= MOD;
    ll t = inv2 * modcomb(k, 2, MOD);
    ans += t;
    ans %= MOD;
    cout << ans << endl;
}

Measured memory_bytes: 3656
import java.util.*;

public class Main {
  public static void main(String[] args) {
          Scanner sc = new Scanner(System.in);
          int hp1 = sc.nextInt();
          int attack1 = sc.nextInt();
          int hp2 = sc.nextInt();
          int attack2 = sc.nextInt();
          while(hp1 > 0 && hp2 > 0){
            hp2 -= attack1;
          if(hp2 <= 0) {
            System.out.println("Yes");
            continue;
          }
            hp1 -= attack2;
          if(hp1 <= 0) {
            System.out.println("No");
            continue;
          }
          }
          }
        }

Measured memory_bytes: 35760
#include<stdio.h>
#define N 100000

struct Node{
  int p;
  int l;
  int r;
};
  
struct Node A[N];
int n,B[N];

  
  int rec(int x,int y){
    B[x] = y;
    if(A[x].r != -1) rec(A[x].r,y);
    if(A[x].l != -1) rec(A[x].l,y + 1);
  }
  

int main(){
  int i,j,d,v,c,l,r,n,op;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    A[i].p = A[i].l = A[i].r = -1;
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&v,&d);
    for(j=0;j<d;j++){
      scanf("%d",&c);
      if(j==0) A[v].l=c;
      else A[l].r = c;
      l=c;
      A[c].p = v;
    }
  }
  for(i=0;i<n;i++){
    if(A[i].p == -1) r=i;
  }

  rec(r,0);

  for(i=0;i<n;i++){
   
    printf("node %d: parent = %d, depth = %d,",i,A[i].p,B[i]);
    if(A[i].p == -1) printf(" root,");
    else if(A[i].l == -1 ) printf(" leaf,");
    else printf(" internal node,");
    printf(" [");
    for(j=0,op=A[i].l;op != -1;j++,op = A[op].r){
      if(j != 0) printf(", ");
      printf("%d",op);
    }
    printf("]\n");  
  }

  return 0;
}

Measured memory_bytes: 5296
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const ll INF=1e18;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll n,cx,cy,H;
    cin>>n;
    V<ll> x(n),y(n),h(n);
    rep(i,n) cin>>x[i]>>y[i]>>h[i];
    bool ok=0;
    for(ll i=0;i<=100;i++){//X
        for(ll j=0;j<=100;j++){//Y
            ll tmp=0;
            bool flag=1;
            rep(k,n){
                if(h[k]>0){
                    tmp=abs(x[k]-i)+abs(y[k]-j)+h[k];
                    break;
                }
            }
            rep(k,n){
                if(h[k]>0){
                    if(tmp!=abs(x[k]-i)+abs(y[k]-j)+h[k]){
                        flag=0;
                    }
                }else{
                    if(tmp-abs(x[k]-i)-abs(y[k]-j)>0){
                        flag=0;
                    }
                }
            }
            if(flag&&tmp>0){
                cx=i;
                cy=j;
                H=tmp;
                ok=1;
                break;
            }
        }
        if(ok) break;
    }
    cout<<cx<<' '<<cy<<' '<<H<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  ll N;
  cin >> N;
  vector<ll> a(3*N), plus(N+3), minus(N+3);
  priority_queue<ll> pq_bwd;
  priority_queue<ll, vector<ll>, greater<ll> > pq_fwd;
  ll tot_p = 0 , tot_m = 0;

  for(int i=0;i<3*N;i++) {
    cin >> a[i];
    if(i < N) {
      pq_fwd.push(a[i]);
      tot_p += a[i];
    }
    else if(i >= 2*N) {
      pq_bwd.push(a[i]);
      tot_m += a[i];
    }
  }
  plus[0] = tot_p;
  minus[N+1] = tot_m;

  for(int i=N;i<2*N;i++) {
    ll x = pq_fwd.top();
    if(a[i] > pq_fwd.top()) {
      pq_fwd.pop();
      tot_p -= x;
      tot_p += a[i];
      pq_fwd.push(a[i]);
    }
    plus[i-N+1] = tot_p;
  }

  for(int i=2*N-1;i>=N;i--) {
    ll x = pq_bwd.top();
    if(a[i] < pq_bwd.top()) {
      pq_bwd.pop();
      tot_m -= x;
      tot_m += a[i];
      pq_bwd.push(a[i]);
    }
    minus[i-N+1] = tot_m;
  }
  ll ans = -1e15;
  for(int i=0;i<=N;i++) {
    if(ans < plus[i] - minus[i+1])
      ans = plus[i] - minus[i+1];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6516
#include <iostream>
#include <math.h>
//#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <tuple>

using namespace std;
#define n_max 100000

#define rep(i,n) for(int i = 0; i < n; i++)
#define rep2(i,a,n) for(int i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
typedef long long ll;
typedef pair<ll, ll> PI;

int main() {
    string s, t;
    cin >> s >> t;
    vector<int> S(26,0), T(26,0);
    
    rep(i,s.size()) {
        S[s[i] - 97]++;
        T[t[i] - 97]++;
    }

    bool ans = true;
    sort(S.begin(), S.end());
    sort(T.begin(), T.end());

    for(int i = 0; i < 26; i++) {
        if(S[i] != T[i]) { ans = false; }
    }
    if(ans) { cout << "Yes" <<endl; }
    else    { cout << "No" <<endl; }

    return 0;
}


Measured memory_bytes: 776
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <istream>
#include <ostream>

#include <cstdlib>
#include <cmath>
#include <cstdio>

using namespace std;

#define fi first
#define se second
#define mkp make_pair
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define rep(i,n) for(ll i=0; i < (n); ++i)
#define rrep(i,n) for(ll i=((n)-1); i >= 0; --i)

#define OPLT(T) bool operator<(const T & lop_, const T & rop_)
#define OPEQ(T) bool operator==(const T & lop_, const T & rop_)

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

istream& operator>>(istream& istr, __float128& obj) { double d; istr >> d; obj = d; return istr; };
ostream& operator<<(ostream& ostr, __float128& obj) { ostr << static_cast<double>(obj); return ostr; };

int main() {
	int N, x;
	cin >> N >> x;
	vector<int> a(N);
	rep(i,N) cin >> a[i];
	vector<vector<int> > b;
	vector<int> tmp;
	for(int i = 1; i < N; i++) {
		if(a[i] + a[i-1] <= x) {
			if(tmp.size()) {
				tmp.push_back(a[i-1]);
				b.push_back(tmp);
			}
			tmp.clear();
		}
		else {
			tmp.push_back(a[i-1]);
		}
	}
	if(tmp.size()) {
		tmp.push_back(a[N-1]);
		b.push_back(tmp);
		tmp.clear();
	}
	ll res = 0;
	rep(i,b.size()) {
		tmp = b[i];
		rep(j,tmp.size()) {
			if(j) {
				res += max(0,tmp[j]+tmp[j-1]-x);
				tmp[j] = max(0, tmp[j] - max(0,tmp[j]+tmp[j-1]-x));
			}
		}
	}
	cout << res << endl;
	return 0;
}


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

using ll = long long;

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

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

  ll x, y; std::cin >> x >> y;
  ll ans = 1;
  while (x*2 <= y) {
    x *= 2, ans++;
  }
  std::cout << ans << "\n";
}


Measured memory_bytes: 256
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
  a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max,k,min:Integer;
  l:array of Integer;
  s,s123,s1,s2,s3:string;
  al:string = 'abcdefghijklmnopqrstuvwxyz';
  tf,tfl,tfr:Boolean;
begin
  try
    { TODO -oUser -cConsole メイン : ここにコードを記述してください }
    Readln(a);
    count:=0;
    max  :=0;
    min  :=100;

    Writeln((a div 2)*((a+1)div 2));
    Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<cmath>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};

int done[1000005] = {};

int main()
{

    int n,k,r,s,p;
    string t;
    cin >> n >> k;
    cin >> r >> s >> p;
    cin >> t;

    bool can[3] = {true,true,true};
    // int done[100] = {};
    ll ans = 0;
    for(int i=0; i<t.size(); ++i)
    {
        can[0] = can[1] = can[2] = true;
        for (int j=i; j<t.size(); j += k)
        {   
            if(done[j]==1) break;

            if(t[j] == 'r' && can[0])
            {
                ans += p;
                can[0] = false;
                can[1] = can[2] = true;
            } 
            else if(t[j] == 's' && can[1])
            {
                ans += r;
                can[1] = false;
                can[0] = can[2] = true;
            }  
            else if(t[j] == 'p' && can[2])
            {
                ans += s;
                can[2] = false;
                can[0] = can[1] = true;
            }  
            else
            {
                can[0] = can[1] = can[2] = true;
            }

            done[j] = 1;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <tuple>
#include <functional>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define rep(i,n) for(long long  i = 0; i < n; i++)
#define rep2(i,a,n) for(long long  i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
typedef long long ll;

using namespace std;
int ans = 0;

void solve(int i, int j, vector<vector<int> > v, int candy, int n)
{
    if(i == 1 && j == n-1) { ans = max(ans, candy); return; }
    //cout << "i," << i << ",j," << j << endl; 
    if(i+1<2) { solve(i+1, j  , v, candy+v[i+1][j],n); }
    if(j+1<n) { solve(i  , j+1, v, candy+v[i][j+1],n); }
}

int main() 
{
    int n; cin >> n;
    vector<vector<int> > a(2, vector<int>(n,0));
    rep(i,2) { rep(j,n) { cin >> a[i][j]; } }

    solve(0,0,a,0,n);

    ans += a[0][0];    

    cout << ans << endl;

    return 0;
}
    



Measured memory_bytes: 384
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;
 
#define int long long int
#define ld long double
#define pi pair<int, int>
#define pb push_back
#define fi first
#define se second
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
 
const int N = 3e3 + 5;
const int mod = 998244353;
const int inf = 1e9 + 9;

int a[N], dp[N][N];

signed main() {
	IOS;
	int n, s;
	cin >> n >> s;
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	dp[0][0] = 1;	
	for(int i = 1; i <= n; i++){
		for(int j = 0; j <= s; j++){
			dp[i][j] = (dp[i][j] + 2*dp[i-1][j]) % mod;
			if(j >= a[i])
				dp[i][j] = (dp[i][j] + dp[i-1][j-a[i]]) % mod;
		}
	}
	cout << dp[n][s];
	return 0;
}

Measured memory_bytes: 74072
import sys
import math
from collections import deque
import copy

N = int(input())
p = list(map(float, input().split()))
if N == 1:
    print(p[0])
    sys.exit()
dp = [[0 for _ in range(N + 10)] for _ in range(N + 10)]
dp[2][0] = (1.0 - p[0]) * (1.0 - p[1])
dp[2][2] = p[0] * p[1]
dp[2][1] = 1.0 - dp[2][0] - dp[2][2]
for i in range(2, N):
    for l in range(0, N + 1):
        dp[i + 1][l + 1] += dp[i][l] * p[i]
        dp[i + 1][l] += dp[i][l] * (1.0 - p[i])
ans = 0.0
for i in range(N // 2 + 1, N + 1):
    ans += dp[N][i]
print(ans)


Measured memory_bytes: 258184
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		
		for(int i=0; i<n; i++)
		{
			int[] a = new int[3];
			for(int j=0; j<3; j++)
			{
				a[j] = scanner.nextInt();
			}
			
			for(int j=1; j<3; j++)
			{
				if(a[0] < a[j])
				{
					int buf = a[0];
					a[0] = a[j];
					a[j] = buf;
				}
			}
			System.out.println( (a[0]*a[0]==a[1]*a[1]+a[2]*a[2]) ? "YES" : "NO");
		}
	}
}

Measured memory_bytes: 33436
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int i;
    cin >> i;
    vector<int> weight(i);
    //1~T
    vector<int> sum1(i);
    //T+1~end
    vector<int> sum2(i);
    vector<int> distance(i-1);
    for (int j = 0; j < i ;j++) {
        cin >> weight.at(j);
    }
    for (int j = 0; j < i ;j++) {
      //  cout << j << ":" << weight.at(j) << endl;
    }
    for (int j = 0; j < i-1; j++) {
       // cout << j+1 << ":" ;
        for (int k = 0; k < j+1; k++){
            sum1.at(j) = sum1.at(j) + weight.at(k);
           // cout << sum1.at(j);
        }
       // cout << endl;
    }
    for (int j = 0; j < i-1; j++) {
       // cout << j+1 << ":" ;
        for (int k = j+1; k < i; k++){
            sum2.at(j) = sum2.at(j) + weight.at(k);
           // cout << sum2.at(j);
        }
       // cout << endl;
    }
    for (int j = 0; j < i-1 ;j++) {
        distance.at(j) = sum2.at(j) - sum1.at(j);
        if(distance.at(j) < 0) {
            distance.at(j) =  -distance.at(j);
        }
       // cout << j+1 << ":" << sum2.at(j) << "-" << sum1.at(j) << "=" << distance.at(j) << endl;
    }
    cout << *std::min_element(distance.begin(), distance.end()) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
   	int N;
    cin >> N;
  	int sum = 0;
  	int num = N;
      while(num > 0){
        sum += num % 10;
        num /= 10;
      }
     if(N % sum == 0) cout << "Yes" << endl;
   else cout << "No" << endl;
}

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


void funcC2() {
  int n;
  std::cin >> n;
  std::vector<std::string> s(n,"");
  bool isOrigin;
  for (int i = 0; i < n;i++) {
    std::cin >> s[i];
  }
  std::sort(s.begin(), s.end());
  int cnt = 1;
  for (int i = 1; i < n; i++) {
    if(s[i - 1] != s[i])cnt++;
  }
  std::cout << cnt;

}


int main(void) {
  funcC2();
  return 0;
}

Measured memory_bytes: 9504
namespace I_am_the_brown_coder{
    class ABC10000000{
        static void Main(){
            string[] a_p = System.Console.ReadLine().Split();
            int a = int.Parse(a_p[0]);
            int p = int.Parse(a_p[1]);
            System.Console.WriteLine((3*a+p)/2);
        }
    }
}

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

int main() {
    ll k;
    std::cin >> k;
    vector<ll> a(k);
    
    for (int i = 0; i < k; i++) {
        std::cin >> a[i];
    }
    
    if(a[k-1]!=2){
        std::cout << -1 << std::endl;
        return 0;
    }
    
    ll minv = a[k-1];

    for (int i = k-2; i >= 0; i--) {
        ll l = 0;
        ll r = 1e18/a[i];
        
        while( r-l>1 ){
            ll m = (r+l)/2;
            // std::cout << m << std::endl;
            if( m*a[i] >= minv ){
                r = m;
            }else{
                l = m;
            }
        }
        
        minv = r*a[i];
    }
    ll maxv = 4;
    for (int i = k-2; i >=0; i--) {
        if(a[i]<maxv){
            ll l = 0;
            ll r = 1e18/a[i];
            
            while( r-l>1 ){
                ll m = (r+l)/2;
                if( m*a[i] >= maxv ){
                    r = m;
                }else{
                    l = m;
                }
            }
            maxv = r*a[i];
        }else{
            std::cout << -1 << std::endl;
            return 0;
        }
    }
    
    if(minv>maxv-1){
        std::cout << -1 << std::endl;
        return 0;
    }
    
    std::cout << minv<<" "<<maxv-1 << std::endl;
}


Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define reps(i, n) for (int i = 1; i <= (n); ++i)
#define repd(i, n) for (int i = (n)-1; i >= 0; --i)
#define repds(i, n) for (int i = (n); i > 0; --i)
#define loop(i, x, n) for (int i = (x); i < (n); ++i)
#define loops(i, x, n) for (int i = (x); i <= (n); ++i)
#define loopd(i, x, n) for (int i = (x); i > (n); --i)
#define loopds(i, x, n) for (int i = (x); i >= (n); --i)
#define itrep(i, a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i, a) for (auto i = rbegin(a); i != rend(a); ++i)
#define each(i, x) for (auto &&i : x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(a) ((int)a.size())
#define pow2(n) (n * n)
#define int ll
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
template <class T>
using p_queue = priority_queue<T, vector<T>, greater<T>>;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
constexpr double eps = 1e-8;
ll mod = static_cast<ll>(1e9 + 7);
template <class T, class... Args>
constexpr void mins(T &a, Args... args) { a = min<T>({a, args...}); }
template <class T, class... Args>
constexpr void maxs(T &a, Args... args) { a = max<T>({a, args...}); }
template <class F>
class FixPoint : private F {
public:
    explicit constexpr FixPoint(F &&f) : F(std::forward<F>(f)) {}
    template <class... Args>
    constexpr decltype(auto) operator()(Args &&... args) const { return F::operator()(*this, std::forward<Args>(args)...); }
};
template <class F>
constexpr decltype(auto) funcs(F &&f) { return FixPoint<F>{std::forward<F>(f)}; }
template <class T>
std::vector<T> vecs(int n, T &&val) { return std::vector<T>(std::forward<int>(n), std::forward<T>(val)); }
template <class... Args>
decltype(auto) vecs(int n, Args &&... args) { return std::vector<decltype(vecs(std::forward<Args>(args)...))>(std::forward<int>(n), vecs(std::forward<Args>(args)...)); }
template <class V, class T>
void fill(V &x, const T &val) { x = val; }
template <class V, class T>
void fill(vector<V> &vec, const T &val) {
    for (auto &&v : vec)
        fill(v, val);
}

void solve() {
    string s, t;
    cin >> s >> t;

    int ans = inf;
    rep(i, sz(s) - sz(t) + 1) {
        int cnt = 0;
        rep(j, sz(t)) cnt += s[i + j] != t[j];
        mins(ans, cnt);
    }
    cout << ans << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout.flush();
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(void){
    int a,b; cin >> a >> b;
    int h[4]={0}; h[a]=1;h[b]=1;
    for(int i=0;i<3;i++){
        if(h[i+1]==0){
            cout << i+1 << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
  int X,A,B;
  cin >> X >> A >> B;
  if(A>=B) printf("delicious\n");
  else if(A+X>=B) printf("safe\n");
  else printf("dangerous\n");
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    char a[5]={'*'};
    int count=0;
    scanf("%s",a);
    
    for(int i=0;i<4;i++)
    {
        if(a[i]==a[i+1])
        {
            count++;
            if(count>=2)
            {
                i=4;
            }
        }
        else
        {
            count=0;
        }
    }
    
    if(count>=2)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;

//定数
//円周率
const double pi = 3.141592653589793238462643383279;
//天井
const int INF = 1000000000; // = 10^9
const ll LINF = 1000000000000000; // = 10^15
//ABC文字列
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZABC";
const string abc = "abcdefghijklmnopqrstuvwxyzabc";
//よくあるmodくん
const ll MOD = 1000000007; // = 10^9 + 7

//データ構造
//隣接リスト用構造体（有向グラフ向け）
struct edge {
  ll to; // E.toでその辺の終点へアクセスできる
  ll cost; // e.costでその辺の重みにアクセスできる
};
//Union_Find木
struct UnionFind {
  vector<int> UF; // UF.at(i) : iの親の番号
  vector<int> SIZE; // SIZE.at(root(i)) : iと連結されてる要素の数
  UnionFind(int N) : UF(N), SIZE(N, 1) { // 最初は全てが根であるとして初期化
    for(int i = 0; i < N; i++) {
      UF.at(i) = i;
    }
  }
  int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
    if (UF.at(x) == x) {
      return x;
    }
    return UF.at(x) = root(UF.at(x));
  }
  void unite(int x, int y) { // xとyの木を併合
    int rx = root(x); // xの根をrx
    int ry = root(y); // yの根をry
    if (rx == ry) {
      return; // xとyの根が同じ(=同じ木にある)時はそのまま
    }
    // xとyの根が同じでない(=同じ木にない)時：小さい方の根を大きい方の根につける
    if (SIZE.at(rx) < SIZE.at(ry)) {
      UF.at(rx) = ry;
      SIZE.at(ry) += SIZE.at(rx);
      SIZE.at(rx) = 0;
    }
    else {
      UF.at(ry) = rx;
      SIZE.at(rx) += SIZE.at(ry);
      SIZE.at(ry) = 0;
    }
  }
  bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
  int size(int x) { // xと連結されてる要素の数を返す
    return SIZE.at(root(x));
  }
};

//関数 (計算量)
//ctoi (O(1))
int ctoi(char c){
  if (c == '0') return 0;
  if (c == '1') return 1;
  if (c == '2') return 2;
  if (c == '3') return 3;
  if (c == '4') return 4;
  if (c == '5') return 5; 
  if (c == '6') return 6;
  if (c == '7') return 7;
  if (c == '8') return 8;
  if (c == '9') return 9;
  return -1;  
}
//to_char (O(1))
char to_char(int i){
  if (i == 0) return '0';
  if (i == 1) return '1';
  if (i == 2) return '2';
  if (i == 3) return '3';
  if (i == 4) return '4';
  if (i == 5) return '5';
  if (i == 6) return '6';
  if (i == 7) return '7';
  if (i == 8) return '8'; 
  if (i == 9) return '9';
  return ' ';  
}
//素数判定 
//一つ一つの判定ではこっちの方が速い(一つ当たりO(√N))
//一方100までに何個あるかなどはEratosthenesの篩の方が良い（O(NlogN))
bool PN(int x) {
  if (x <= 1) return false; // 1や0,-1は素数ではない
  if (x == 2) return true; // √2 + 1 > 2 なので下でやると 2 ％ 2 = 0 となり判定できない
  for (int i = 2; i < sqrt(x) + 1; i++) {
    if (x % i == 0) return false; // 割れたら素数じゃない
  }
  return true;
}
// A^N mod M を計算する。modしたくなかったらM = LINFとかにすればよい。(O(√N))
ll modpow(ll A, ll N, ll M) {
  ll ans = 1;
  while (N > 0) {
    if (N & 1) ans = ans * A % M;
      A = A * A % M;
      N >>= 1;
   }
  return ans;
}
  
//メイン処理
int main() {
  cout << fixed << setprecision(16); //精度向上
  //ここまでテンプレ
  int N;
  cin >> N;
  int ans = 0;
  if (N % 10 == 9) {
    ans++;
  }
  if (N / 10 == 9) {
    ans++;
  }
  if (ans != 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3612