akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {

	/**
	 * @param args
	 */
	static Scanner sc = new Scanner(System.in);
	
	public static void main(String[] args) {
		int rect = 0, rhom = 0;
		while(sc.hasNextLine()) {
			String[] parsed = sc.nextLine().split(",");
			int a = Integer.parseInt(parsed[0]), b = Integer.parseInt(parsed[1]), c = Integer.parseInt(parsed[2]);
			if((a*a + b*b) == (c*c)) rect++;
			if((a == b)) rhom++;
		}
		System.out.println(rect);
		System.out.println(rhom);
	}

}

Measured memory_bytes: 12000
/**
 * @File   : a.cpp
 * @Author : pasnger 
 * @Date   : 19/9/2020, 6:22:35 pm 
 */

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

#define INF 1e17
#define int long long
#define f(i, a, b) for(int i=(a); i<(b); (i)++)
#define fe(i, a, b) for(int i=(a); i<=(b); (i)++)
#define rf(i, a, b) for(int i=(a); i>(b); (i)--)
#define rfe(i, a, b) for(int i=(a); i>=(b); (i)--)
#define ff(ele, cont) for(auto (ele): (cont))
#define pb push_back;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef map<int, int> mii;

const int mxn = 1e6+4;
const int mod = 1e9+7;
const double pi = acos(-1);

#define deb(...) cerr << "[" << #__VA_ARGS__ << "] : [", DBG(__VA_ARGS__) 
void DBG() {
  cerr << "]\n";
}
template<typename T, typename ...Args> void DBG(T first, Args... args) {
  cerr << first; if (sizeof...(args))cerr<<", "; DBG(args...);
}


/////////////////////////// GLOBAL ///////////////////////////
const int N = 1e6+10;
int prime[N], sqp[N];
/////////////////////////// GLOBAL ///////////////////////////


void seive(){
  f(i, 2, N)prime[i]=1;
  f(i, 2, N){
    if(prime[i]){
      if(i*i<N)sqp[i*i]=1;
      f(j,2,N){
        if(i*j<N) prime[i*j]=0;
        else break;
      }
    }
  }
}
int factors(int x){
  int ans = 1;
  f(i,0, N){
    if(prime[i]){
      if(i*i*i > x)break;
      int count = 1;
      while(x%i==0){
        count++;
        x/=i;
      }
      ans *= count;
    }
  }
  if(prime[x])ans*=2;
  else if(sqp[x])ans*=3;
  else if(x!=1)ans*=4;
  return ans;
}

void solve() {
  int n, k;
  cin>>n;
  int ans = 0;
  seive();
  f(i, 1, n){
    ans += factors(n-i);
  }
  cout<<ans<<"\n";

}


int32_t main() {
  #ifndef ONLINE_JUDGE
  clock_t tStart = clock();
  freopen("in.txt", "r", stdin);
  //freopen("output.txt","w",stdout);
  #endif 
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  // cin >> t;
  for (int tt=1;tt<=t;tt++) {
    //cout << "Case #"<<tt<<": ";
    solve();
  }
  #ifndef ONLINE_JUDGE
    cerr << "\nRun Time -> "<<(double)(clock()-tStart)/CLOCKS_PER_SEC <<" sec\n";
  #endif
}


Measured memory_bytes: 12076
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt();
    
    int ac = 0;
    int wa = 0;
    int tle = 0;
    int re = 0;
    for (int i = 0; i < num; i++) {
      String val = sc.next();
      if (val.equals("AC")){
        ac++;
      } else if (val.equals("WA")){
        wa++;
      } else if (val.equals("TLE")){
        tle++;
      } else {
        re++;
      }
    }
    
    System.out.println("AC x " + ac);
    System.out.println("WA x " + wa);
    System.out.println("TLE x " + tle);
    System.out.println("RE x " + re);
  }
}


Measured memory_bytes: 58192
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		long h = sc.nextLong();

		System.out.println(calc(h));

	}

	public static long calc(long hp) {
		if(hp==1) return 1;
		return 2*calc(hp/2)+1;
	}

}


Measured memory_bytes: 23636
import sys
N=int(sys.stdin.readline())
H=list(map(int,sys.stdin.readline().split()))

dp=[0]*N

dp[1]=abs(H[0]-H[1])
for i in range(2,N):
    dp[i]=min(dp[i-1]+abs(H[i-1]-H[i]),dp[i-2]+abs(H[i-2]-H[i]))
print(dp[-1])


Measured memory_bytes: 13868
//Author : Sukarna Paul

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include<ext/pb_ds/detail/standard_policies.hpp>
#define pi acos(-1)
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define MAX 300005
#define INF 0x3f3f3f3f
template <class T> inline T bigmod(T p,T e,T M){ll ret = 1LL;for(; e > 0LL; e >>= 1LL){if(e & 1LL) ret = (ret * p) % M;p = (p * p) % M;}return (T)ret;}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}   // M is prime}

using namespace std;
using namespace __gnu_pbds;

typedef trie<string,null_type,trie_string_access_traits<>,pat_trie_tag,trie_prefix_search_node_update>pref_trie;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;




int main(){
    IOS
    //freopen("output.txt","w",stdout);
    string s;
    cin>>s;

    if(s=="ABC")cout<<"ARC\n";
    if(s=="ARC")cout<<"ABC\n";
}


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

int main() {
	// your code goes here
	ios::sync_with_stdio(false);
	cin.tie(0);
	int d, t, s;
	cin >> d >> t >> s;
	float time = (float) d / s;
	if (time <= t) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}
	return 0;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std; 
int main(){
  int n,m; cin >> n >> m;
  vector<string> str(n);
  for(int i=0; i<n; i++) cin >> str.at(i);
  
  for(int i=0; i<m+2; i++) cout << "#"; cout << endl;
  for(int i=0; i<n; i++) cout << "#" << str.at(i) << "#" << endl;
  for(int i=0; i<m+2; i++) cout << "#"; cout << endl;
 
}

Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
#include<bits/stdc++.h>
using namespace std;
long long n,m,x[1010],y[1010],z[1010],ans,now[1010],zf[2];
int main()
{
	cin>>n>>m;
	zf[0]=1;
	zf[1]=-1;
	for(int i=0;i<n;i++)
	{
		cin>>x[i]>>y[i]>>z[i];
	}
	for(int i=0;i<2;i++)
	{
		for(int j=0;j<2;j++)
		{
			for(int k=0;k<2;k++)
			{
				memset(now,0,sizeof(now));
				for(int l=0;l<n;l++)
				{
					now[l]=zf[i]*x[l]+zf[j]*y[l]+zf[k]*z[l];
				}
				sort(now,now+n);
				reverse(now,now+n);
				long long cnt=0;
				for(int l=0;l<m;l++)
				{
					cnt+=now[l];
				}
				ans=max(ans,cnt);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
n_list = []
sum_list = []

for i in range(1,n//2+1):
  n_list.append([i,n-i])
for i in range(len(n_list)):
  a_rank = 0
  b_rank = 0
  for j in range(len(str(n_list[i][0]))):
    a_rank += int(str(n_list[i][0])[j])
  for j in range(len(str(n_list[i][1]))):
    b_rank += int(str(n_list[i][1])[j])
  sum_list.append(a_rank + b_rank)
print(min(sum_list))

Measured memory_bytes: 11752
#include <iostream>
#include <string.h>
#define rep(i, n) for(int i=0;i<n;i++)
#define repr(i, n) for(int i=n;i>=0;i--)
#define FOR(i, j, n) for(int i=j;i<n;i++)
#define FORR(i, j, n) for(int i=j;i>=n;i--)
using namespace std;
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0097
//
int main() {
    int n, s;
    long long dp[11][1001];
    memset(dp, 0, sizeof(dp));

    dp[0][0] = 1;

    rep(k, 101) {
        FORR(i, 9, 0) {
            rep(j, 1001 - k) {
                dp[i + 1][j + k] += dp[i][j];
            }
        }
    }

    while (cin >> n >> s) {
        if (!n && !s) return 0;
        cout << dp[n][s] << endl;
    }
    return 0;
}

Measured memory_bytes: 3180
import Foundation
import CoreFoundation

#if swift(>=4.0)
#else
extension String {
    func split(separator separator: Character) -> [String] {
        return self.characters.split(separator).map{String($0)}
    }
    var count: Int {
        return self.characters.count
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
extension Array where Element: Comparable {
    func max() -> Element? {
        return self.maxElement()
    }
    func min() -> Element? {
        return self.minElement()
    }
    func sorted() -> Array {
        return self.sort()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    mutating func swapAt(i: Int, _ j: Int) {
        swap(&self[i], &self[j])
    }
    func joined(separator separator: String = " ") -> String {
        return self.map{String($0)}.joinWithSeparator(separator)
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func reverse() {
        self = self.reversed()
    }
    func enumerated() -> EnumerateSequence<[Element]> {
        return self.enumerate()
    }
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: Character = " ") -> [String] {
    return readLine()!.split(separator: separator)
}
func readIntSplit(by separator: Character = " ") -> [Int] {
    return readLine()!.split(separator: separator).map{Int($0)!}
}
prefix operator * { }
prefix func * <T> (a: [T]) -> (T, T)          { return (a[0], a[1]) }
prefix func * <T> (a: [T]) -> (T, T, T)       { return (a[0], a[1], a[2]) }
prefix func * <T> (a: [T]) -> (T, T, T, T)    { return (a[0], a[1], a[2], a[3]) }
prefix func * <T> (a: [T]) -> (T, T, T, T, T) { return (a[0], a[1], a[2], a[3], a[4]) }
infix operator ** { associativity right precedence 155 }    // 右結合，乗除算より強くビットシフトより弱い
func **(lhs: Int, rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
func **(lhs: Int, rhs: Double) -> Double {
    return pow(Double(lhs), rhs)
}
//func gcd(x: Int, _ y: Int) -> Int {
//    return y>0 ? gcd(y, x%y) : x
//}
//func lcm(x: Int, _ y: Int) -> Int {
//    return x * y / gcd(x, y)
//}
let MOD = 10**9+7

/*************** テストスペース ***************/

//arr.sort{$0.0==$1.0 ? $0.1<$1.1 : $0.0<$1.0}  // タプル配列のソート

/*************** メインプログラム ***************/

let N = readInt()!
var H = readIntSplit()
for i in (0..<N-1).reverse() {
    if H[i] > H[i+1] {
        H[i] -= 1
    }
}
var ans = "Yes"
for i in 0..<N-1 {
    if H[i] > H[i+1] {
        ans = "No"
        break
    }
}
print(ans)


Measured memory_bytes: 8848
s=input()
cnt=0
for i in range(len(s)):
    if s[-7:] == 'dreamer':
        s=s[:-7]
    elif s[-6:] == 'eraser':
        s=s[:-6]
    elif s[-5:] =='erase'or s[-5:]=='dream':
        s=s[:-5]
    elif s=='':
        break
    else:
        cnt+=1
        break
if cnt==0:
    print('YES')
else:
    print('NO')

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

int main()
{
  int n;
  while(1){
    int ans=1000000;
    cin>>n;
    if(n==0)break;
    for(int a=0; a<=50; a++){
      for(int b=0; b<=50; b++){
	for(int c=0; c<=50; c++){
	  int sum=(380*(5*(a/5)))*0.8+(a%5)*380;
	  sum+=(550*(4*(b/4)))*0.85+(b%4)*550;
	  sum+=(850*(3*(c/3)))*0.88+(c%3)*850;
	  if(a*200+b*300+c*500==n){
	    ans=min(ans, sum);
	  }
	}
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
while True:
    n,k = map(int,input().split())
    if n == 0and k == 0:
        break
    a = [int(input()) for _ in range(n)]
    s = sum(a[0:k])
    ss = [s]
    for i in range(k,n):
        s = s + a[i] - a[i-k]
        ss.append(s)
    print(max(ss))


Measured memory_bytes: 11708
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vv vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 1000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;

signed main(void) {
    int N; cin>>N;
    int ans=0;
    rep(i, N) {
        int l,r; cin>>l>>r;
        ans+=r-l+1;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int N=0,E=0,W=0,S=0;
	char ch;


	while((ch = getchar()) != '\n'){
		if(ch == 'N')	N=1;
		if(ch == 'E')	E=1;
		if(ch == 'W')	W=1;
		if(ch == 'S')	S=1;
	}

	if(N==S && E ==W)
		printf("Yes\n");
	else
		printf("No\n");

	return 0;

}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  string S,T; cin>>S>>T;
  int N=S.size(),M=T.size();
  vi A(N+1),B(N+1),C(M+1),D(M+1);
  rep(i,0,N){
    A[i+1]=A[i];
    B[i+1]=B[i];
    if(S[i]=='A') A[i+1]++;
    else B[i+1]++;
  }
  rep(i,0,M){
    C[i+1]=C[i];
    D[i+1]=D[i];
    if(T[i]=='A') C[i+1]++;
    else D[i+1]++;
  }
  int Q; cin>>Q;
  rep(i,0,Q){
    int p,q,r,s; cin>>p>>q>>r>>s;
    int E=A[q]-A[p-1],F=B[q]-B[p-1],G=C[s]-C[r-1],H=D[s]-D[r-1];
    E%=3;
    F%=3;
    G%=3;
    H%=3;
    if((E+3-G)%3==(F+3-H)%3) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }
  }



Measured memory_bytes: 4096
#include "bits/stdc++.h"
using namespace std;

int main() {
	int N, A, B;
	while (cin >> N >> A >> B) {
		if (N == 0) return 0;
		vector<int> P(N);
		for (int i = 0; i < N; i++) cin >> P[i];
		int MAX = -1, ANS = -1;
		for (int i = A; i <= B; i++) {
			if (P[i - 1] - P[i] >= MAX) MAX = P[i - 1] - P[i], ANS = i;
		}
		cout << ANS << endl;
	}
}


Measured memory_bytes: 3080
N, M, K = gets.chomp.split.map(&:to_i)

al = gets.chomp.split.map(&:to_i)
bl = gets.chomp.split.map(&:to_i)

# 両方のDPつくる
# index = 最大冊数
aldp = [0]
al.each do |a|
  aldp.push(a + aldp[-1])
end

bldp = [0]
bl.each do |b|
  bldp.push(b + bldp[-1])
end

bi = bldp.length - 1
max_cnt = 0
aldp.length.times do |ai|
  break if aldp[ai] > K
  while aldp[ai] + bldp[bi] > K
    bi -= 1
  end
  max_cnt = [max_cnt, ai+bi].max
end

p max_cnt

Measured memory_bytes: 49584
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
#define LL long long
#define mp make_pair
#define fr first
#define sc second
#define pb push_back
#define lc (x<<1)
#define rc ((x<<1)|1)
const int N=505;
int n,m;
char c[N][N],g[]={'R','Y','G','B'};
void wk(int x,int y,int col){
    if (x>=1&&x<=n&&y>=1&&y<=m) c[x][y]=g[col];
}
void paint(int x,int y,int k,int col){
    for (int i=0;i<k;i++)
     for (int j=0;i+j<k;j++){
        if ((k&1)^((i+j)&1)){
            wk(x-i,y-j,col);wk(x-i,y+j,col);
            wk(x+i,y-j,col);wk(x+i,y+j,col);
        }
     }
}
int main(){
     //freopen("in.txt","r",stdin);
     //freopen("out.txt","w",stdout);
    int i,j,k;
    scanf("%d%d%d",&n,&m,&k);
    if (k%2){
        for (i=1;i<=n;i++)
         for (j=1;j<=m;j++)
          if ((i+j)%2) c[i][j]='Y'; else c[i][j]='B';
    } else{
        int k2=k,f,g;k/=2;
        for (i=1,f=0;i-k+1<=n;i+=k2,f^=1){
            for (j=1,g=0;j-k+1<=m;j+=k2,g^=1) paint(i,j,k,f^g);
        }
        for (i=k+1,f=2;i-k+1<=n;i+=k2,f^=1){
            for (j=1+k,g=0;j-k+1<=m;j+=k2,g^=1) paint(i,j,k,f^g);
        }

        for (i=1,f=0;i-k+1<=n;i+=k2,f^=1){
            for (j=2,g=0;j-k+1<=m;j+=k2,g^=1) paint(i,j,k,f^g);
        }
        for (i=k+1,f=2;i-k+1<=n;i+=k2,f^=1){
            for (j=2-k,g=0;j-k+1<=m;j+=k2,g^=1) paint(i,j,k,f^g);
        }
    }
    for (i=1;i<=n;i++){
        for (j=1;j<=m;j++) putchar(c[i][j]);
        puts("");
    }

    return 0;
}


Measured memory_bytes: 768
def rle(t):
    tmp2, count, ans = t[0], 1, []
    for i in range(1, len(t)):
        if tmp2 == t[i]:
            count += 1
        else:
            ans.append([tmp2, count])
            tmp2 = t[i]
            count = 1
    ans.append([tmp2, count])
    return ans


S = list(input())
s = []
tmp = ''
for j in range(len(S) - 1):
    tmp += S[j]
    if S[j] == 'L' and S[j+1] == 'R':
        s.append(tmp)
        tmp = ''
    elif j == len(S) - 2:
        tmp += S[j+1]
        s.append(tmp)

stock = []
for k in s:
    stock.append(rle(k))

solve = []
for l in stock:  # 塊ごと
    R = l[0][1]
    L = l[1][1]
    for m in range(R + L):
        if m == R - 1:  # 'RL'のRの場合
            txt = (R-1)//2 + L//2 + 1
            solve.append(txt)
        elif m == R:  # 'RL'のLの場合
            txt = R//2 + (L-1)//2 + 1
            solve.append(txt)
        else:
            solve.append(0)
print(' '.join(map(str, solve)))


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

typedef long long ll;

int main(int argc, char const *argv[])
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    ll n, m;
    cin >> n >> m;
    ll a[n];
    for(ll i = 0; i < n; i++) cin >> a[i];
    sort(a, a+n);
    vector<pair<ll, ll>> cb;
    for(ll i = 0; i< m; i++){
        ll b, c;
        cin >> b >> c;
        cb.push_back(make_pair(c, b));
    }
    stable_sort(cb.begin(), cb.end(), [](pair<int, int> a, pair<int, int> b){return a.second > b.second;});
    stable_sort(cb.begin(), cb.end(), [](pair<int, int> a, pair<int, int> b){return a.first > b.first;});

    ll rep[n] = {0};
    ll last = -1;
    for(ll i = 0; i < m; i++){
        if(last == n-1) break;
        for(ll j = 0; j < cb[i].second; j++){
            if(last == n-1) break;
            if(a[last+1] < cb[i].first) {
                rep[last+1] = cb[i].first;
                last++;
            }
            else break;
        }
    }
    ll sum = 0;
    for(ll i = 0;i < n; i++){
        if(rep[i] != 0) sum += rep[i];
        else sum += a[i];
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 4948
import math
H , W = map(int,input().split())
S = set()

def half_cut(x,y):
    for i in range(1,x):
        S1 = (x-i)*y
        S2 = math.ceil(y/2)*i
        S3 = math.floor(y/2)*i
        S.add(max(S1,S2,S3)-min(S1,S2,S3))

def three_cut(x,y):
    for i in range(1,x):
        S1 = math.ceil(i/2)*y
        S2 = math.floor(i/2)*y
        S3 = (x-i)*y
        S.add(max(S1,S2,S3)-min(S1,S2,S3))

half_cut(H,W)
half_cut(W,H)
three_cut(H,W)
three_cut(W,H)

print(min(S))

Measured memory_bytes: 20840
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
//#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

//#include <cv.h>
//#include <highgui.h>
#include <stdlib.h>
#include <string>

const int MAX_N = 100;
int N;
int V[MAX_N], C[MAX_N];

int main(int argc, char **argv) {
    std::cin >> N;

    for (int i = 1; i <= N; i++) {
        std::cin >> V[i];
    }

    for (int i = 1; i <= N; i++) {
        std::cin >> C[i];
    }

    int ret = 0;

    for (int i = 1; i <= N; i++) {
        if (C[i] < V[i]) {
            ret += V[i] - C[i];
        }
    }
    
    std::cout << ret << std::endl;

    return 0;
}


Measured memory_bytes: 256
#!/usr/local/bin/ruby
a=0
sum=0
def f(x)
   return x*x
end
while line=gets
   d=line.to_i
   for i in 0..(600-2*d)/d
      a=a+d
      sum+=f(a)
   end
   ans=sum*d
   puts "#{ans}"
   a,ans,sum=0,0,0
end

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

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

	int ans = 0;
	rep(i, 0, n - 1) if (s[i] == s[i + 1]) ans++;
	ans += 2 * k;

	cout << min(ans, n - 1) << endl;

	return 0;
}

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

int main(){
  int N,M;
  bool s=false;
  cin>>N>>M;
  vector<int> a={1,0,0};
  vector<bool> b(3,false);
  for(int i=0;i<M;i++){
    int A,B;
    cin>>A>>B;
    if(!b[A-1]){a[A-1]=B;b[A-1]=true;}
    if(b[A-1]&&a[A-1]!=B){cout<<-1;s=true;break;}
    if(N!=1&&a[0]==0){cout<<-1;s=true;break;}
  }
  if(!s&&N==3){cout<<a[0]<<a[1]<<a[2];}
  else if(!s&&N==2){cout<<a[0]<<a[1];}
  else if(!s&&N==1&&M==0){cout<<0;}
  else if(!s&&N==1){cout<<a[0];}
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int a,b;
	scanf("%d", &a);
	if(a%1000==0){
		printf("0");
	}
	if(a%1000!=0){
		b=a%1000;
		printf("%d", 1000-b);
	}
	return 0;
}

Measured memory_bytes: 3172
def f(x) :
    while x % 10 != 0 :
        x += 1
    return x
def h(x) :
    return x % 10
l = []
n = []
sum = 0
for i in range(5) :
    a = int(input())
    if a % 10 == 0 :
        sum += a
    else :
        l.append(a)
for i in l :
    n.append(h(i))
if n :
    min = n.index(min(n))
    mo = l[min]
    sum -= f(l[min])
    sum += mo
for i in l :
    sum += f(i)
print(sum)


Measured memory_bytes: 3064
/*Infor {{{
 ******************************************************
 * > File Name: a.cpp
 * > Author: samcompu
 * > Mail: admin@samcompu.com
 * > Created Time: 2018年07月01日 星期日 19时30分41秒
 ******************************************************
}}}*/

#include <bits/stdc++.h>

using namespace std;

/*Abbreviation {{{ */
#define FOR(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define ROF(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define cini(a) scanf("%d", &(a))
#define cinc(a) scanf("%c", &(a))
#define cinl(a) scanf("%lld", &(a))
#define cins(a) scanf("%s", (a))
#define cind(a) scanf("%lf", &(a))
#define coui(a) printf("%d", (a))
#define couc(a) printf("%c", (a))
#define coul(a) printf("%lld", (a))
#define cous(a) printf("%s", (a))
#define coud(a) printf("%f", (a))
#define SPA printf(" ")
#define LIN printf("\n")
#define ull unsigned long long int
/*}}}*/

/*Constant {{{*/
const int MAXN = 100;
/*}}}*/

/*Class {{{*/
/*}}}*/

/*Variable {{{*/
int a[MAXN + 1];
/*}}}*/

/*Declare {{{*/
/*}}}*/

/*Main {{{*/
int main() {
  int n;
  cini(n);
  FOR(i, 1, n) cini(a[i]);
  int minNum = a[1];
  int maxNum = a[1];
  FOR(i, 1, n) {
    minNum = min(minNum, a[i]);
    maxNum = max(maxNum, a[i]);
  }
  coui(maxNum - minNum);
  return 0;
}
/*}}}*/

/*Define {{{*/
/*}}}*/


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

typedef long long ll;

ll R, C, K;
ll Dp[3001][3001][4], V[3001][3001];
#define maxupd(A, B) (A) = max((A), (B))
ll Res;
int main() {
  cin >> R >> C >> K;
  for (ll i = 0; i < K; ++i) {
    ll r, c, v;
    cin >> r >> c >> v;
    V[r][c] = v;
  }
  for (ll r = 1; r <= R; ++r) {
    for (ll c = 1; c <= C; ++c) {
      for (ll k = 0; k <= 3; ++k) {
        maxupd(Dp[r][c][0], Dp[r - 1][c][k]);
        maxupd(Dp[r][c][k], Dp[r][c - 1][k]);
      }
      for (ll k = 2; k >= 0; --k) {
        maxupd(Dp[r][c][k + 1], Dp[r][c][k] + V[r][c]);
      }
    }
  }
  for (ll k = 0; k <= 3; ++k) maxupd(Res, Dp[R][C][k]);
  cout << Res << endl;
  return 0;
}


Measured memory_bytes: 355192
N= int(input())
Data = [list(map(int,input().split())) for i in range(N)]
#Data = [list(map(int, input().split())) for _ in range(n)]

Data.sort(key=lambda x:(x[1]))


sumtime = 0
flg = 0
for i in range(N):
    if(sumtime + Data[i][0] <= Data[i][1]):
        sumtime += Data[i][0]
    else:
        flg += 1
        break

if flg:print("No")
else: print("Yes")

Measured memory_bytes: 88264
#include <bits/stdc++.h>
#define int long long int
#define mod(x) ((x % MOD) + MOD) % MOD
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define RFORE(i,a,b) for(int i=(b);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(c) (int)((c).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define LB(c,x) (int)(lower_bound(ALL(c),x)-(c).begin())
#define UB(c,x) (int)(upper_bound(ALL(c),x)-(c).begin())
#define COUNT(c,x) (UB(c,x)-LB(c,x))
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define EXIST(s,e) (bool)((s).find(e)!=(s).end())
#define PB push_back
#define MP make_pair
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
using namespace std;
template<typename T1, typename T2> using P = pair<T1,T2>;
template<typename T> using V = vector<T>;
struct edge { int from, to; int cost; };
bool operator< (const edge &edge1, const edge &edge2) { return edge1.cost < edge2.cost; };
const int INF = 1e18;
const int MOD = 1e9+7;

template<typename T> ostream& operator << (ostream& s, const V<T>& v) {
   s << "[";
   for (int i = 0; i < v.size(); i++) { s << v[i]; if (i < v.size() - 1) s << " "; }
   s << "]";
   return s;
}

signed main()
{
   int N; cin >> N;
   V<int> a(N);
   REP(i, N) {
      cin >> a[i];
   }

   bool all_neg = true;
   int MAX = -INF, MAX_i = -1;
   REP(i, N) {
      if (a[i] > 0) {
         all_neg = false; break;
      }
      if (MAX < a[i]) {
         MAX = a[i];
         MAX_i = i;
      }
   }
   if (all_neg) {
      cout << MAX << endl;
      cout << N-1 << endl;
      RFOR(i, MAX_i+1, N) {
         cout << i+1 << endl;
      }
      FOR(i, 0, MAX_i) {
         cout << 1 << endl;
      }
      return 0;
   }


   V<int> sum(2), num(2);
   REP(i, N) {
      if (a[i] > 0) {
         sum[i % 2] += a[i];
         num[i % 2]++;
      }
   }
   V<int> ans;
   int head = 1, tail = 1;
   if (sum[0] > sum[1]) {
      RFOR(i, 0, N) {
         if (i % 2 == 1) continue;
         if(a[i] < 0) {
            ans.PB(i);
         } else {
            if (i == 0) head = 0;
            if (i == N-1) tail = 0;
         }
      }
      RFOR(i, 0, num[0] - 1 + head + tail) {
         ans.PB(2*i + (head ? 0 : 1));
      }
   } else {
      RFOR(i, 0, N) {
         if (i % 2 == 0) continue;
         if(a[i] < 0) {
            ans.PB(i);
         } else {
            if (i == 0) head = 0;
            if (i == N-1) tail = 0;
         }
      }
      RFOR(i, 0, num[1] - 1 + head + tail) {
         ans.PB(2*i + (head ? 0 : 1));
      }
   }
   cout << max(sum[0], sum[1]) << endl;
   cout << SZ(ans) << endl;
   REP(i, SZ(ans)) {
      cout << ans[i]+1 << endl;
   }

   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<bool> vb;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);
const double eps=1e-8;

class Graph{
	private:
	int GV,GE;
	vvi List;
	void TSfunc(int v,vb& used){
		used[v]=1;
		for(int i=0;i<List[v].size();i++){
			int u=List[v][i];
			if(!used[u]) TSfunc(u,used);
		}
		ts.push_back(v);
	}
	public:
	vi ts;
	Graph(int v,int e){
		GV=v;
		GE=e;
		List=vvi(v);
	}
	void add_edge(int x,int y){
		List[x].push_back(y);
	}
	void TS(){
		vb used(GV);
		for(int i=0;i<GV;i++){
			if(!used[i]) TSfunc(i,used);
		}
	}
};

int V,E;

int main(){
	cin>>V>>E;
	Graph gra(V,E);
	int s,t;
	for(int i=0;i<E;i++){
		cin>>s>>t;
		gra.add_edge(s,t);
	}
	gra.TS();
	for(int i=V-1;i>=0;i--) cout<<gra.ts[i]<<endl;
}

Measured memory_bytes: 1884
#include <iostream>

using namespace std;

const int N = 1000001;
int p[N], f[N];
unsigned long long int ans[N];
void precalc() {
	for(int i = 0; i < N; ++i)
	{
		p[i] = 1, f[i] = i;
	}
	for (int i = 2; i < N; ++i)
	{
		if (p[i])
		{
			f[i] -= f[i] / i;
			for (int j = i+i; j < N; j+=i)
			{
			  p[j] = 0, f[j] -= f[j] / i;
			}
		}
	}
	ans[1]=2;
	for(int i=2;i<N;i++)ans[i]=ans[i-1]+f[i];
}

int main()
{
	precalc();
	int t; cin>>t;
	
	for(int i = 0; i < t; ++i)
	{
		int n; cin>>n;
		cout<<ans[n]<<endl;
	}
	return 0;
}

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

int main()
{
    int n, m;
    cin >> n >> m;
    int sum = 0;
    for (int i = 0; i < m; i++)
    {
        int temp;
        cin >> temp;
        sum += temp;
    }
    if (sum > n) cout << -1;
    else cout << n- sum;
    return 0;
}


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

int main() {
  int sx,sy,tx,ty;
  cin >> sx >> sy >> tx >> ty;
  
  for (int i=0;i<(tx-sx) ; i++) cout << "R";
  for (int i=0;i<(ty-sy) ; i++) cout << "U";
  for (int i=0;i<(tx-sx) ; i++) cout << "L";
  for (int i=0;i<(ty-sy) ; i++) cout << "D";
  cout << "D";
  for (int i=0;i<(tx-sx+1) ; i++) cout << "R";
  for (int i=0;i<(ty-sy+1) ; i++) cout << "U";
  cout << "LU";
  for (int i=0;i<(tx-sx+1) ; i++) cout << "L";
  for (int i=0;i<(ty-sy+1) ; i++) cout << "D";
  cout << "R"<<endl;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <map>
#include <fstream>
using namespace std;
queue<vector<int>> route;
void print_route(vector<int> p1, vector<int> p2)
{
	//xから合わせる
	while(p1[1] != p2[1])
	{
		route.push(p1);
		if(p1[1]>p2[1])
		{
			p1[1]--;
		}
		else
		{
			p1[1]++;
		}
		route.push(p1);
	}
	while(p1[0] != p2[0])
	{
		//from
		route.push(p1);
		if(p1[0]>p2[0])
		{
			p1[0]--;
		}
		else
		{
			p1[0]++;
		}
		//dest
		route.push(p1);
	}
	
}

int main()
{
	int H,W;
	cin>>H>>W;

	vector<vector<int>> a;
	a.resize(H);
	for(int i=0; i<H; i++)
	{
		a[i].resize(W);
		for(int j=0; j<W; j++)
		{
			cin>>a[i][j];
		}
	}
	queue<vector<int>> q;
	//奇数マスを走査
	for(int i=0; i<H; i++)
	{
		for(int j=0; j<W-1; j++)
		{
			if(a[i][j]%2==1)
			{
				a[i][j]--;
				a[i][j+1]++;
				route.push(vector<int>{i,j});
				route.push(vector<int>{i,j+1});
			}
		}
	}

	for(int i=0; i<H-1; i++)
	{
		if(a[i][W-1]%2==1)
		{
			a[i][W-1]--;
			a[i+1][W-1]++;
			route.push(vector<int>{i,W-1});
			route.push(vector<int>{i+1,W-1});
		}
	}



	cout<<route.size()/2<<endl;
	while(!route.empty())
	{
		vector<int> p1,p2;
		p1 = route.front();
		route.pop();
		p2 = route.front();
		route.pop();

		cout<<p1[0]+1<<" "<<p1[1]+1<<" "<<p2[0]+1<<" "<<p2[1]+1<<endl;
	}

	return 0;
}

Measured memory_bytes: 17024
mod = 10**9+7

x = int(input())

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


def bnp(bs, pw):
    res = 1
    while pw:
        if pw % 2:
            res = (res*bs) % mod
        bs = (bs*bs) % mod
        pw //= 2

    return res


sm = 0
for n in s:
    sm = (sm+n) % mod
sm %= mod

sm = (sm*sm) % mod

sqr = 0

for n in s:
    p = (n*n) % mod
    sqr = (sqr+p) % mod

res = (sm-sqr+mod) % mod
res = (res*bnp(2, mod-2)) % mod

print(res % mod)


Measured memory_bytes: 104224
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue> //C++
#include <string> //C++
#include <iostream> //C++
#include <vector> //C++
#include <algorithm> //C++
using namespace std; //C++
#define rep(i, a, n) for (i = (a); i < (n); i++)


int main()
{
	int a, b;
	cin >> a >> b;

	int x = a - b * 2;

	if (x >= 0) cout << x;
	else cout << 0;

	
}

Measured memory_bytes: 256
// ######      ###      #######    #######    ##     #     #####        ###     ##### //
// #     #    #   #          #        #       # #    #    #     #      #   #     ###  //
// #     #   #     #        #         #       #  #   #   #       #    #     #    ###  //
// ######   #########      #          #       #   #  #   #           #########    #   //
// #     #  #       #     #           #       #    # #   #    ####   #       #    #   //
// #     #  #       #    #            #       #     ##   #    #  #   #       #        //
// ######   #       #   #######    #######    #      #    #####  #   #       #    #   //

// #pragma GCC optimize(2)
// #pragma GCC optimize(3)
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
// #pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> ppl;
#define ain(a,n) for(ll i=0;i<(n);++i)	cin>>(a)[i];
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(ll i=0;i<(n);++i)
#define FOR(i,a,b) for(ll i=(a);i<=(b);++i)
#define FORD(i,a,b) for(ll i=(a);i>=(b);--i)
#define cases ll T=0;cin>>T;while(T--)
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define END "\n"
#define pb push_back
#define mp make_pair
#define go(c,itr) for(auto itr=(c).begin(); itr!=(c).end(); ++itr)
#define back(c,itr) for(auto itr=(c).rbegin(); itr!=(c).rend(); ++itr)
#define PI 3.14159265359
#define inf 9e18
#define MOD 1000000007
#define MODU 998244353
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define MAXN 1000005
const string alpha = "abcdefghijklmnopqrstuvwxyz";
const ll N = 1e8;
ll binexp(ll a, ll b, ll m) {
	a %= m;
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return res;
}
ll modinvfermat(ll a, ll m)
{
	return binexp(a, m - 2, m);
}
void task(bool flag)
{
	if (flag)
		cout << "YES\n";
	else
		cout << "NO\n";
}
ll lcm(ll a, ll b)
{
	return ((1LL * a * b) / (__gcd(a, b)));
}
vl dp(MAXN, -1);

signed main() {

	fast
	ll a, b, c, k;
	cin >> a >> b >> c >> k;
	ll ans = 0;
	ans += min(a, k);
	k -= min(a, k);
	k -= min(b, k);
	ans -= min(c, k);
	cout << ans << END;



// #ifndef ONLINE_JUDGE
// 	cout << "\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\n";
// #endif
	return 0;
}

Measured memory_bytes: 11016
h, n = map(int, input().split())
c = [set() for i in range(h + 1)]
for i in range(n):
    a, b = map(int, input().split())
    c[b].add(a)
c[h] = set([1, 2])
count = 0
for i in range(h - 1):
    l = c[i] | c[i + 1]
    p = None
    if l == set():
        count += 2
        c[i + 1].add(1)
        c[i + 1].add(2)
    elif 0 not in l and 1 not in l:
        p = 1
    elif 2 not in l and 3 not in l:
        p = 3
    elif 1 not in l and 2 not in l:
        p = 2
    if p:
        j = 0
        while True:
            if c[i + j + 1] | c[i + j + 1] == set():
                j += 1
            else:
                break
        if p != 2 and p - 1 not in c[i + j + 1] and p not in c[i + j + 1]:
            count += 1
            c[i + 1].add(p - 1)
            c[i + 1].add(p)
            continue
        if j % 2 or j < 2:
            count += 1
            c[i + 1].add(p - 1)
            c[i + 1].add(p)
print(count)


Measured memory_bytes: 7840
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

#define INF ((1LL<<62)-(1LL<<31))
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p) pom(a,p-2,p)

////////////////////////////////////////////////////////////////////////////////////////
int main(){
    ll n;cin>>n;
    ll tmp = (n*100+107) / 108;
  	//cout << (ll)(1.08*tmp) << " " << n;
    if(n == (ll)(1.08*tmp)) cout << tmp << ednl;
    else cout << ":(" << ednl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>

using namespace std;

inline int64_t num_layers(int64_t n) {
  return pow(2, n+2) - 3;
}

inline int64_t num_putties(int64_t n) {
  return pow(2, n+1) - 1;
}

int64_t countup_putties(int64_t n, int64_t x) {
  if (n == 0) return 1;
  int64_t child_nl = num_layers(n-1);
  int64_t child_np = num_putties(n-1);
  if (x == 1) {
    return 0;
  } else if (x <= child_nl + 1) {
    return countup_putties(n-1, x-1);
  } else if (x == child_nl + 2) {
    return child_np + 1;
  } else {
    return child_np + 1 + countup_putties(n-1, x-child_nl-2);
  }
}

int main() {
  int64_t n, x;
  cin >> n >> x;
  cout << countup_putties(n, x) << endl;
  return 0;
}


Measured memory_bytes: 256
from math import ceil

N, H = map(int, input().split())

A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
else:
    a = max(A)
    B.sort()
    B.reverse()

ans = 0
for b in B:
    if H <= 0:
        print(ans)
        break

    if a < b:
        H -= b
        ans += 1
else:
    print(ans + ceil(H / a))

Measured memory_bytes: 17048
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
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 ll = long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class CSqrtInequality {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      long double a, b, c; cin >> a >> b >> c;
      if (c > a + b + 2*sqrt(a*b)) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    }
};

signed main() {
  CSqrtInequality solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
long long a[123456];
int n;
map<long long,long long>Mp;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
	{
        scanf("%d",&a[i]);
        Mp[a[i]]++;
    }
    long long MMM=1;
    for(int i=0;i<=100010;i++)
		{
	 		MMM=max(MMM,Mp[i]);
	   		if(Mp[i]&&Mp[i+1]&&Mp[i+2])
		   	{
	     		long long ans=Mp[i]+Mp[i+1]+Mp[i+2];
	       		MMM=max(MMM,ans);
	       }
	       if(Mp[i]&&Mp[i+1])
		   	{
	     long long ans=Mp[i]+Mp[i+1];
	     MMM=max(MMM,ans);
	            }
	            if(Mp[i]&&Mp[i+2])
				{
	               long long ans=Mp[i]+Mp[i+2];
	               MMM=max(MMM,ans);
	            }
    }
    cout<<MMM<<endl;
    return 0;
}


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

typedef pair<int, int> ii;
const int N = 100005;

int n, sz[N];
long long res, f[N];
vector<ii> G[N];

void dfs(int u, int p) {
    sz[u] = 1;
    for (auto v : G[u]) {
        if (v.first == p) continue;
        dfs(v.first, u), sz[u] += sz[v.first];
    }
}

int find(int u, int p) {
    for (auto v : G[u]) {
        if (v.first == p) continue;
        if (sz[v.first] * 2 >= n) return find(v.first, u);
    }
    return u;
}

void reDfs(int u, int p) {
    res += f[u] * 2, sz[u] = 1;
    for (auto v : G[u]) {
        if (v.first == p) continue;
        f[v.first] = f[u] + v.second, sz[u] += sz[v.first];
        reDfs(v.first, u);
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin >> n;
    for (int i = 1; i < n; ++i) {
        int u, v, w; cin >> u >> v >> w;
        G[u].push_back(ii(v, w));
        G[v].push_back(ii(u, w));
    }
    dfs(1, 1);
    int r = find(1, 1);
    reDfs(r, r), dfs(r, r);
    long long mn = 1e18;
    for (auto i : G[r]) {
        if (sz[i.first] * 2 == n) {
            cout << res - f[i.first]; return 0;
        }
        mn = min(mn, f[i.first]);
    }
    cout << res - mn;
}


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

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

  int ans[2] = {};
  char c = '0';
  for(int i=0; i<s.size(); ++i){
    if(c == s[i]){
      ++ans[1];
    }else{
      ++ans[0];
    }
    c = (c == '0' ? '1' : '0');
  }

  cout << min(ans[0], ans[1]) << endl;
}


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

int main() {
	int r, g, b;
	cin >> r >> g >> b;
	if (((100 * r + 10 * g + b) % 4) == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 256
/* ＵＴＦ－８ */
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <array>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <numeric>
#include <type_traits>
#include <limits>

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>

#define USE_COLORED 1

#ifdef USE_COLORED
static const char stdout_pre[]  = "\033[1m"; // bold black
static const char stderr_pre[]  = "\033[31;1m"; // bold red
static const char stdxxx_post[] = "\033[m";

// 当然ながら GCC(g++)/libstdc++ 依存
#include <ext/stdio_filebuf.h>
using stdio_filebuf = __gnu_cxx::stdio_filebuf<char>;
class colored_stdio_filebuf : public stdio_filebuf {
private:
	const char* const pre_;
	const char* const post_;

public:
	colored_stdio_filebuf(FILE* fp, const char* pre, const char* post) : stdio_filebuf(fp, std::ios_base::out), pre_(pre), post_(post)
	{
	}

protected:
	std::streamsize xsputn(const char* s, std::streamsize count) override
	{
		stdio_filebuf::xsputn(pre_, strlen(pre_));
		auto ret = stdio_filebuf::xsputn(s, count);
		stdio_filebuf::xsputn(post_, strlen(post_));
		return ret;
	}
};
#endif

int main()
{
#ifdef USE_COLORED
	if (getenv("DEBUG")) {
		std::cout.rdbuf(new colored_stdio_filebuf(stdout, stdout_pre, stdxxx_post));
		std::cerr.rdbuf(new colored_stdio_filebuf(stderr, stderr_pre, stdxxx_post));
	} else
#endif
	{
		int fd = open("/dev/null", O_WRONLY);
		dup2(fd, 2);
		close(fd);
	}
	
	long N, D, A;
	std::vector<std::pair<long, long>> XH;
	std::cin >> N >> D >> A;
	XH.resize(N);
	for (auto& xh : XH)
		std::cin >> xh.first >> xh.second;
	
	std::sort(XH.begin(), XH.end());

	long result = 0;

	auto first = XH.begin();
	auto last = first;
	long total_dmg = 0;
	while (first != XH.end()) {
		while (last != XH.end() && last->first <= first->first + D * 2) {
			last->second += total_dmg;
			++last;
		}
		
		long num_bomb = (first->second - total_dmg + A - 1) / A;
		result += num_bomb;
		total_dmg += num_bomb * A;
		while (first != XH.end() && first != last && first->second <= total_dmg) {
			++first;
		}
	}
	
	std::cout << result << "\n";
}


Measured memory_bytes: 3328
import java.util.*;
import java.util.regex.*;

public class Main {
	
	public static void main(String... args) {
		System.out.println(toString(genPrimes(55555, scanInt())));
	}
	
	private static String toString(int... nums) {
		StringBuilder buff = new StringBuilder();
		for (int n : nums) {
			if (0 < buff.length()) buff.append(' ');
			buff.append(n);
		}
		return buff.toString();
	}
	
	private static int[] genPrimes(int max, int N) {
		int[] primes = new int[N];
		int p = 0;
		for (int i = 11; i <= max && p < N; i += 2) {
			if (i % 5 != 1) continue;
			if (isPrime(i)) {
				primes[p] = i;
				++p;
			}
		}
		return primes;
	}
	
	private static boolean isPrime(int n) {
		int m = n / 3;
		for (int i = 3; i < m; i += 2) {
			if (n % i == 0) {
				return false;
			}
		}
		return true;
	}

	private static final Scanner SC = new Scanner(System.in);

	private static int scanInt() {
		return SC.nextInt();
	}

	private static  String scanString() {
		return SC.next();
	}
}


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

using llong = long long;

int main() {

    int N;
    cin >> N;
    vector<int> L;
    for (int i = 0; i < N; i++) {
        int tmp;
        cin >> tmp;
        L.push_back(tmp);
    }

    sort(L.begin(), L.end());

    int sum = 0;
    for (int i = 0; i < N - 2; i++) {
        for (int j = i + 1; j < N - 1; j++) {
            // k < i+j の必要
            auto iter = lower_bound(L.begin(), L.end(), (L[i] + L[j])); // i+j以上の最初のiter
            int dis = distance(L.begin(), iter) - j - 1;
            if (dis > 0) {
                sum += dis;
            }
        }
    }
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    //ios_base::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    int n, k;
    cin >> n >> k;
    cout << ((n - 1) + (k - 1) - 1) / (k - 1);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <stdio.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>

//using namespace std;

#define Rep(i,a,b) for(int i = a; i < b; ++i)
#define rep(i,b) Rep(i,0,b)
#define allof(a) (a).begin(), (a).end()

typedef long long ll;
const int inf = 1e9 + 7;
const ll infll = 1ll << 60ll;
const ll mod = 1e9 + 7;
// 0~3までは右左下上 4~7までは斜め
constexpr int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
constexpr int dy[] = { 0, -1, 0, 1, 1, -1, -1, 1 };

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

namespace {  // 名前なし名前空間
	// gcd, lcm は C++17 でstdに標準入りしたので言語のバージョンに注意
	// 最大公約数
	ll gcd(ll a, ll b) {
		if (b == 0) return a;
		return gcd(b, a % b);
	}

	// 最小公倍数
	ll lcm(ll a, ll b) {
		return a / gcd(a, b) * b;
	}

}

int main() {

	std::string s;
	std::cin >> s;

	int n = (int)s.size();

	int ans = 0;

	if (n % 2 == 1) {
		int half = n / 2;

		std::vector<char> v(half);
		rep(i, half) {
			v[i] = s[i];
		}
		for (int i = 0; i < half; ++i) {
			if (v[i] != s[n - 1 - i]) ++ans;
		}
	}
	else {
		int half = n / 2;

		std::vector<char> v(half);
		rep(i, half) {
			v[i] = s[i];
		}
		for (int i = 0; i < half; ++i) {
			if (v[i] != s[n - 1 - i]) ++ans;
		}
	}

	std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 256