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

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    ll finish;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    ll ans;
    ll temp;

    for (int i = 0; i < n; i++)
    {
        if (i == 0)
        {
            ans = a[0];
            if (ans > 1000000000000000000)
            {
                ans = -1;
                finish = i;
                break;
            }
        }
        else
        {
            if (ans >= LONG_LONG_MAX / a[i])
            {
                ans = -1;
                finish = i;
                break;
            }
            ans = ans * a[i];
            if (ans > 1000000000000000000)
            {
                ans = -1;
                finish = i;
                break;
            }
        }
    }
    for (int j = finish; j < n; j++)
    {
        if (a[j] == 0)
        {
            ans *= a[j];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4044
#include <bits/stdc++.h>
using namespace std;
int n;
set <int> d;
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		int t;
		cin>>t;
		d.insert(t);
	}
	cout<<d.size()<<endl;
	return 0;
}

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



int main(){
    ll h,w;cin>>h>>w;
    if(h*w%3==0){
        cout<<0<<endl;
        return 0;
    }
    ll MN=1e12;
    rep(i,1,w){
        MN=min(MN,max(i*h,max((h/2*(w-i)),(h+1)/2*(w-i)))-min(i*h,min((h/2*(w-i)),(h+1)/2*(w-i))));
        if(i<=w-2)MN=min(MN,max(i*h,max(((w-i)/2*h),(w-i+1)/2*h))-min(i*h,min(((w-i)/2*h),(w-i+1)/2*h)));
    }
    swap(h,w);
        rep(i,1,w){
        MN=min(MN,max(i*h,max((h/2*(w-i)),(h+1)/2*(w-i)))-min(i*h,min((h/2*(w-i)),(h+1)/2*(w-i))));
        if(i<=w-2)MN=min(MN,max(i*h,max(((w-i)/2*h),(w-i+1)/2*h))-min(i*h,min(((w-i)/2*h),(w-i+1)/2*h)));
    }

    cout<<MN<<endl;
    
}







Measured memory_bytes: 256
import java.util.Scanner;

class Main{
  public static void main(String[] args) {
    
	  Scanner sc = new Scanner(System.in);
	  
	  double r = sc.nextDouble();
	  double ritu = Math.PI;
	  double men = 0;
	  double shuu = 0;
	  
	  //String  = String.format("%.5f", );
	  men = r*r*ritu;
	  shuu = 2 * ritu * r;
	  
	  String strmen = String.format("%.6f",men );
	  String strshuu = String.format("%.6f",shuu );
	  
	  System.out.println(strmen+" "+strshuu);
  }
}

Measured memory_bytes: 28320
#include <iostream>
#include <map>
using namespace std;
int a[200010];
map<int,long long> mp;
int main(){
    int i,n;
    cin >> n;
    long long ans = 0;
    for(i=0;i<n;i++){
        cin >> a[i];
        mp[a[i]]++;
    }
    for(auto x:mp){
        ans += (x.second)*(x.second - 1)/2;
    }
    for(i=0;i<n;i++){
        long long k = mp[a[i]];
        cout << ans - k + 1 << endl;
    }
}

Measured memory_bytes: 12032
using System;
class A{
  static void Main(){
    var s = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
    Console.WriteLine(s[0] % 3 == 0 || s[1] % 3 == 0 || (s[0]+s[1]) % 3 == 0?"Possible":"Impossible");
  }
}

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

ll n,m,l,ans;
ll a[100005];
priority_queue<pll> pq;

int main(){
    cin>>n>>m;
    for(ll i=0; i<n; ++i){
        cin>>a[i];
    }
    sort(a,a+n);
    for(ll b,c,i=0; i<m; ++i){
        cin>>b>>c;
        pq.emplace(c,b);
    }
    while(!pq.empty()){
        pll top=pq.top();
        pq.pop();
        while(l<n && top.second-- && a[l]<top.first){
            a[l++]=top.first;
        }
    }
    for(ll x: a) ans+=x;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3188
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>

#define ABS(x) ( (x)>0 ? x : -(x) )
#define MIN(x,y) ( (x) < (y) ? (x) : (y) )
#define MAX(x,y) ( (x) > (y) ? (x) : (y) )
#define INF 1000000000

int main()
{
	char str[150];
	char word[150];

	scanf("%s%s", str, word);

	int count;

	int i, j;

	for (i = 0; i <= strlen(str); i++)
	{
		count = 0;
		for (j = 0; j < strlen(word); j++)
		{
			if (str[(i + j)%strlen(str)] != word[j])
				break;
			count++;

			if (count == strlen(word))
			{
				printf("Yes\n");
				return 0;
			}
		}
	}
	
	printf("No\n");

	return 0;
}



Measured memory_bytes: 2052
#include <cstdio>
#include <algorithm>

using i8 = std::int8_t;
using u8 = std::uint8_t;
using i16 = std::int16_t;
using u16 = std::uint16_t;
using i32 = std::int32_t;
using u32 = std::uint32_t;
using i64 = std::int64_t;
using u64 = std::uint64_t;
using i128 = __int128_t;
using u128 = __uint128_t;
using usize = std::size_t;

i32 a[200000];

auto main() -> i32 {
	i32 n, k;
	scanf("%d%d", &n, &k);
	for (i32 i = 0; i < k; ++i) {
		scanf("%d", a + i);
	}
	for (i32 i = k; i < n; ++i) {
		scanf("%d", a + i);
		puts(a[i] > a[i - k] ? "Yes": "No");
	}
	return 0;
}


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

using ll = long long;
using pii = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

int main(void){
    for(int i=0;i<1;i++){
        ll x,k,d,ans1,ans2;
        // x = rand();
        // k = rand();
        // d = rand();
        cin >> x;
        cin >> k;
        cin >> d;
        x=abs(x);
        if(x/d<k){
            ll p = x/d+1;
            ll q = x%d;
            if((k-p)%2==0){
                ans1 = d-q;
            }else{
                ans1 = q;
            }
        }else{
            ans1 = x-k*d;
        }
        
        ll st = min(k, x/d);
        ll kr = k-st;
        ll xr = x-st*d;
        if(kr%2==0){
            ans2 = xr;
        }else{
            ans2 = d-xr;
        }
        // cout <<"x:"<<x<<",k:"<<k<<",d:"<<d<<endl;
        // cout << "ans1:"<< ans1<<",ans2:"<<ans2<<endl;
        // if(ans1!=ans2)cout << "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
        cout <<ans1<<endl;
    
    }
    return 0;
}


Measured memory_bytes: 3616
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}


func main() {
    let nm = readInts()
    let (n, m) = (nm[0], nm[1])

    var aryAC = [Bool](repeating: false, count: n)
    ///誤答した問題の数
    var aryWA = [Int](repeating: 0, count: n)
    
    for _ in 0..<m {
        let ps = readLine()!.split(separator: " ").map { String($0) }
        let (p, s) = (Int(ps[0])! - 1, ps[1])
        
        if s == "AC" {
            aryAC[p] = true
        }
        if !aryAC[p] {
            aryWA[p] += 1
        }
    }
    
    var ACCounter = 0
    var WACounter = 0
    for i in 0..<n{
        if aryAC[i] {
            ACCounter += 1
            WACounter += aryWA[i]
        }
    }
    print(ACCounter,WACounter)
}
    main()


Measured memory_bytes: 14036
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back

#define mp make_pair
#define ull unsigned long long
#define M 1000000007
#define F first



int main(){
    int n,x,t;cin>>n>>x>>t;
    if(n%x==0) cout<<n/x*t<<endl;
    else cout<<(n/x+1)*t<<endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>
#include <queue>
#include <deque>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N,M;
  cin>>N>>M;
  vector<pair<bool,bool>> canReach(N);
  for(int i=0;i<M;i++){
    int a,b;
    cin>>a>>b;a--;b--;
    if(a==0){
      canReach[b].first=true;
    }
    if(b==0){
      canReach[a].first=true;
    }
    if(a==N-1){
      canReach[b].second=true;
    }
    if(b==N-1){
      canReach[a].second=true;
    }
  }
  bool flag=false;
  for(int i=0;i<N;i++){
    if(canReach[i].first && canReach[i].second)flag=true;
  }
  if(flag){
    cout<<"POSSIBLE"<<endl;
  }else{
    cout<<"IMPOSSIBLE"<<endl;
  }
}


Measured memory_bytes: 640
import java.util.*;

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

        for(int i = 0; i < s.length()-1; i++){
            if(s.charAt(i) == s.charAt(i+1)){
                System.out.println((i+1) + " " + (i+2));
                return;
            }
            if(i < s.length()-2 && s.charAt(i) == s.charAt(i+2)){
                System.out.println((i+1) + " " + (i+3));
                return;
            }
        }

        System.out.println(-1 + " " + -1);
    }
}

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

using namespace std;

int main() {
	int m, f, b;

	cin >> m >> f >> b;
	if (m + f < b) {
		cout << "NA" << endl;
		return 0;
	}
	cout << max(0, b - m) << endl;
	
	return 0;
}


Measured memory_bytes: 3080
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vll> vvll;
typedef map<int,int> mii;
typedef set<int> si;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define arep(i,v) for(auto i : v)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define fi first
#define se second
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
template <class T> inline void dump(T &v){irep(i, v){cout<<*i<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
constexpr ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
constexpr double EPS = 1e-9;



int main() {
    
    ll n, k;
    cin >> n >> k;
    const int MAX = 63;
    vvi doubling(MAX, vi(n));
    vi v(n);
    rep(i, n) {
        cin >> doubling[0][i];
        doubling[0][i]--;
    }
    for(int i = 1; i < MAX; i++) {
        rep(j, n) {
            doubling[i][j] = doubling[i - 1][doubling[i - 1][j]];
        }
    }
    int pos = 0;
    for(int i = MAX - 1; i >= 0; i--) {
        if((1LL<<i)&k) {
            pos = doubling[i][pos];
        }
    }
    cout << pos + 1 << endl;

}





Measured memory_bytes: 53216
#!/usr/bin/env python3

'''
Author: andyli
Time: 2020-09-13 19:58:05
'''

import os
from io import BytesIO, IOBase
import sys


MOD = 10**9+7
def main():
    n = int(input())
    print((pow(10,n,MOD)-pow(9,n,MOD)*2+pow(8,n,MOD))%MOD)
    return


# region fastio
BUFSIZE = 1048576


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = 'x' in file.mode or 'r' not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b'\n') + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode('ascii'))
        self.read = lambda: self.buffer.read().decode('ascii')
        self.readline = lambda: self.buffer.readline().decode('ascii')


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
def input(): return sys.stdin.readline().rstrip('\r\n')

# endregion


if __name__ == '__main__':
    main()


Measured memory_bytes: 62612
#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include<cmath>
#include<string>
#define pb push_back
#define ll long long
#define ull unsigned long long
#define deb(x) cerr<<#x<<" "<<x<<"\n"
#define debi cerr<<"hey sparky\n"
#define x first
#define y second
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define eps (double)1e-9
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> pdbs;
 
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
//void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
// look for  all edge cases
//search for a pattern


int n;
int adj[22][22];
const int mod = 1e9+7;
int complete;
int dp[22][1<<21];

int calc(int idx ,int mask){
	
	if(idx == n){
		
		if(mask != complete)
			return 0;
		
		return 1;
		
	}
	
	
	if(dp[idx][mask] != -1)
		return dp[idx][mask];
	
	int ways = 0;
	for(int i =0 ; i < n ; i++){
		int val =1<<i;
		if((mask & val) == 0 && adj[idx][i] == 1){
			
			int new_mask = (mask|val);
			ways = (ways + calc(idx+1, new_mask))%mod;
		}
	}
	
	dp[idx][mask] = ways;
	
	return ways;

}

signed main() {	
	ios::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);	
	
	cin >> n;
	
	memset(adj , 0 , sizeof(adj));
	for(int i =0 ; i < n; i++){
		for(int j =0 ; j < n ;j++){
			cin >> adj[i][j];
		}
	}
	complete = (1<<n) - 1;
	
	memset(dp , -1 ,sizeof(dp));
	
	
	int ans = calc(0 , 0);
	
	cout<<ans;
	
	return 0;
}


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

int main(){
    double n,k;
    cin >> n >> k;
    vector<double> v(n);

    for(int i = 0; i < n ; ++i){
        double temp = i+1, count=1;
        if(temp >= k){
            v[i] = 1;
            continue;
        }
        
        while(temp < k){
            temp *= 2;
            count *= 2;
        }
        v[i] = count;
    }
    double ans=0;
    for(int i = 0; i<n ;++i)ans += 1/v[i];
    //for(int i = 0; i<n ; ++i)cout << v[i] << endl;
    printf("%.12f\n",(1.0/n)*ans);
    //cout << (1.0/n)*ans << endl;
    return 0;

}

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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n'

using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ll Mod = 1000000007LL;
const int N = 2e5 + 10;
const ll Inf = 2242545357980376863LL;
const ll Log = 30;

ll a[N];
vector<ll> V;
bool Add(ll x){
	for(auto y : V) x = min(x, x ^ y);
	if(x){
		V.pb(x);
		sort(all(V));
		reverse(all(V));
	}
	return (x > 0);
}
void Main(){
	int n;
	V.clear();
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	str s;
	cin >> s;
	for(int i = n - 1; i >= 0; i--){
		if(s[i] == '0') Add(a[i]);
		else {
			if(Add(a[i])){
				cout << "1\n";
				return ;
			}
		}
	}
	cout << "0\n";
}

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int tc;
	cin >> tc;
	while(tc --) Main();
	return 0;
}


Measured memory_bytes: 3576
local mod = 1000000007

local function bmul(x, y)
  return (x * y) % mod
end

local function badd(x, y)
  return (x + y) % mod
end

local function bsub(x, y)
  return x < y and x - y + mod or x - y
end

local function getgcd(x, y)
  while 0 < x do
    x, y = y % x, x
  end
  return y
end

local x1, y1 = {}, {}
local x2, y2 = {}, {}
local xzero = 0
local yzero = 0
local zero = 0

local n = io.read("*n", "*l")
for i = 1, n do
  local a, b = io.read("*n", "*n")
  if a == 0 and b == 0 then
    zero = zero + 1
  elseif a == 0 then
    xzero = xzero + 1
  elseif b == 0 then
    yzero = yzero + 1
  else
    if b < 0 then
      a, b = -a, -b
    end
    if 0 < a then
      local gcd = getgcd(a, b)
      table.insert(x1, a // gcd)
      table.insert(y1, b // gcd)
    else
      local gcd = getgcd(-a, b)
      table.insert(x2, -a // gcd)
      table.insert(y2, b // gcd)
    end
  end
end

local pow2 = {1}
for i = 1, 200010 do
  pow2[i + 1] = (pow2[i] * 2) % mod
end

local ret = badd(pow2[xzero + 1], pow2[yzero + 1])
ret = bsub(ret, 1)

local m1 = {}
for i1 = 1, #x1 do
  local xs, ys = x1[i1], y1[i1]
  if not m1[xs] then m1[xs] = {} end
  if not m1[xs][ys] then
    m1[xs][ys] = 1
  else
    m1[xs][ys] = m1[xs][ys] + 1
  end
end

local m2 = {}
for i2 = 1, #x2 do
  local xs, ys = x2[i2], y2[i2]
  if not m2[ys] then m2[ys] = {} end
  if not m2[ys][xs] then
    m2[ys][xs] = 1
  else
    m2[ys][xs] = m2[ys][xs] + 1
  end
end
for k1, v in pairs(m1) do
  if m2[k1] then
    local m2k1 = m2[k1]
    for k2, c1 in pairs(v) do
      local c2 = m2k1[k2]
      if c2 then
        ret = bmul(ret, bsub(badd(pow2[c1 + 1], pow2[c2 + 1]), 1))
        m2k1[k2] = nil
      else
        ret = bmul(ret, pow2[c1 + 1])
      end
    end
  else
    for k2, c1 in pairs(v) do
      ret = bmul(ret, pow2[c1 + 1])
    end
  end
end
for k1, v in pairs(m2) do
  for k2, c in pairs(v) do
    ret = bmul(ret, pow2[c + 1])
  end
end
ret = bsub(ret, 1)
ret = badd(ret, zero)
print(ret)


Measured memory_bytes: 44728
#include<iostream>
#include<math.h>
using namespace std;
int a,b,c;
int main(){
	cin>>a>>b>>c;
	int m1 = a+b;
	int m2 = a+c;
	int m3 = c+b;
	cout<<min(m1,min(m2,m3))<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0) 
#define X first
#define Y second 
#define nl '\n'
#define AC return 0
#define pb(a) push_back(a) 
#define mst(a,b) memset(a, b, sizeof a)
#define rep(i,n) for(int i = 0; (i)<(n); i++)
#define rep1(i,n) for(int i = 1; (i)<=(n); i++)
#define scd(a) scanf("%lld", &a)
#define scdd(a,b) scanf("%lld%lld", &a, &b)
#define scs(s) scanf("%s", s)
//#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
const ll INF = (ll)0x3f3f3f3f3f3f3f, MAX = 9e18, MIN = -9e18;
const int N = 1e6+10, M = 2e6+10, mod = 1e9+7, inf = 0x3f3f3f;
ll a[N]; 


int main()
{
	IOS;
	int n;
	cin>>n;
	ll ans = 0;
	rep1(i, n)
	{
		ans += n/i;
		if(n%i==0)
			ans--;
	}
//	ans -= (ll)sqrt(n);
	cout<<ans<<nl;
	
	
	AC;
} 

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

int main()
{
    int n;
    string s;
    cin >> n >> s;
    long long int cnt = 0;

    long long int r = 0, g = 0, b = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == 'R') r++;
        if(s[i] == 'G') g++;
        if(s[i] == 'B') b++;
    }

    long long int ans = r * g * b;

    if (n >= 3)
    {
        for (int i = 0; i < n - 2; i++)
        {
            for (int j = i + 1; j < n - 1 && 2 * j - i < n; j++)
            {
                int k = 2 * j - i;
                if(s[i] != s[j] && s[j] != s[k] && s[k] != s[i]) cnt++;
            }
        }
    }else{
        ans = 0;
    }

    cout << ans - cnt << endl;
}

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

int main(){
  long long n,i,j,A;
  cin >> n;
  vector<long long> a(n),p(n),m(n),s(200001,0),t(200001,0);
  for(i=0;i<n;i++){
    cin >> a.at(i);
    p.at(i)=i+a.at(i);
    m.at(i)=i-a.at(i);
    if(p.at(i)<=200000){
      s.at(p.at(i))++;
    }
    if(m.at(i)>=1){
      t.at(m.at(i))++;
    }
  }
  A=0;
  for(i=1;i<=200000;i++){
    A+=s.at(i)*t.at(i);
  }
  cout << A << endl;
}

Measured memory_bytes: 11180
#include <iostream>
#include <vector>
#include <queue>
#include <utility>
using namespace std;
int dx[] = {1,0,-1,0}, dy[] = {0,1,0,-1};

bool in_range(int a, int b){
  return a >= 0 && a < b;
}

int solve(vector<string> S, int x, int y, int d){
  int N = S.size(), M = S[0].size();
  bool f = false;
  for(int i = 0; i < 4*N*M; ++i){
    if(S[x][y] == 'G'){
      f = true;
      S[x][y] = '!';
      break;
    }
    S[x][y] = '!';
    for(int i = 0; i < 4; ++i){
      int d_ = (d + 3 + i)%4, x_ = x + dx[d_], y_ = y + dy[d_];
      if(in_range(x_,N) && in_range(y_,M) && S[x_][y_] != '#'){
        x = x_;
        y = y_;
        d = d_;
        break;
      }
    }
  }
  if(f){
    int ret = 0;
    for(int i = 0; i < N; ++i){
      for(int j = 0; j < M; ++j){
        if(S[i][j] == '!') ++ret;
      }
    }
    return ret;
  }
  return -1;
}

int main(){
  int N, M;
  cin >> N >> M;
  vector<string> S(N);
  int x, y, d;
  for(int i = 0; i < N; ++i){
    cin >> S[i];
    for(int j = 0; j < M; ++j){
      if(S[i][j] == 'v'){
        x = i;
        y = j;
        d = 0;
      }else if(S[i][j] == '>'){
        x = i;
        y = j;
        d = 1;
      }else if(S[i][j] == '^'){
        x = i;
        y = j;
        d = 2;
      }else if(S[i][j] == '<'){
        x = i;
        y = j;
        d = 3;
      }
    }
  }
  S[x][y] = '.';
  cout << solve(S,x,y,d) << endl;
  return 0;
}



Measured memory_bytes: 3232
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL S,W;

string ans = "safe";

void solve(){
	if(S<=W){
		ans = "unsafe";
	}
}
 
int main(){
    cin >> S >>W;
 
    solve();

    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}


int main(){
  int a,b,c,d; cin >> a >> b >> c >> d;
  cout << (int)(a!=c) << endl;
  return 0;
}


Measured memory_bytes: 256
package main
import(
        "fmt"
        "os"
        "strconv"
        "bufio"
)

func main() {
     sc := bufio.NewScanner(os.Stdin)
     sc.Split(bufio.ScanWords);

     var a int
     var b int
     if sc.Scan() { a, _ = strconv.Atoi(sc.Text()) }
     if sc.Scan() { b, _ = strconv.Atoi(sc.Text()) }

     if a == b {
        fmt.Println("a == b")
     } else if a < b {
        fmt.Println("a < b")
     } else {
        fmt.Println("a > b")
     }
}



Measured memory_bytes: 1084
import itertools

n = int(input())
lis = []
for i in range(n):
    x, y = map(int, input().split())
    lis.append((x, y))

LIS = [i for i in range(n)]

big_lis = list(itertools.permutations(LIS))
L = len(big_lis)


def sai(i, j):
    return (lis[A[i + 1]][j] - lis[A[i]][j]) ** 2


keep = 0
ANS = 0
for i in range(L):
    A = list(big_lis[i])
    keep = 0
    for j in range(n - 1):
        keep += (sai(j, 0) + sai(j, 1)) ** (1 / 2)
    ANS += keep
print(ANS / L)


Measured memory_bytes: 80420
n = int(input())
sl = list(int(input()) for _ in range(n))

ans_max = sum(sl)
if ans_max % 10 != 0:
    print(ans_max)
else:
    sl_s = sorted(sl)
    for s in sl_s:
        if (ans_max - s) % 10 != 0:
            print(ans_max - s)
            break
    else:
        print(0)
        

Measured memory_bytes: 3060
/*
 * POJ 2046: Gap
 * ?¢?????????????4?\?1???7?????????????????¨4???8????????????????????°?°?1????????????????????¨?¬¬???????????¶???????¬???????????????????????°?????????§????±?????????????????????§??????????????¨????????\???????????????????±???¨??¨????????????????°?????????\??°???
 * ?±???????BFS
 * ?????????????????¶?????????????¬?????????¨set??????????????????????????¶?????????4????????????????????\???????????°???????????????????????¨????°????????????¬?§????
 */

#include <cstdio>
#include <string>
#include <cstring>
#include <queue>
#include <vector>
#include <set>
#include <unordered_set>

using namespace std;


unordered_set<string> ss;

struct S {
  string s;
  int p[29];
  int b[4];
  int d;

  S() {}

  S(const string &t) : s(t), d(0) {
    int cnt = 0;
    for (int i = 0; i < 32; ++i) {
      if (s[i] == 30) {
        b[cnt++] = i;
      } else {
        p[s[i]] = i;
      }
    }
  }

  S(const S &st) : s(st.s), d(st.d) {
    memcpy(p, st.p, sizeof(p));
    memcpy(b, st.b, sizeof(b));
  }

  bool operator<(const S &st) const {
    return d > st.d;
  }
};

priority_queue<S> pq;


int main() {
  string target(32, ' ');
  int cnt = 0;
  for (int i = 0; i < 4; ++i) {
    for (int j = 1; j <= 7; ++j) {
      target[cnt++] = char(7 * i + j);
    }
    target[cnt++] = char(30);
  }

  int T;
  scanf("%d", &T);
  while (T--) {
    ss.clear();
    while (!pq.empty()) pq.pop();
    cnt = 0;
    string s(32, ' ');
    for (int i = 0; i < 4; ++i) {
      s[cnt++] = char(i * 7 + 1);
      for (int j = 0; j < 7; ++j) {
        int x;
        scanf("%d", &x);
        if (x % 10 == 1) {
          s[cnt++] = char(30);
        } else {
          s[cnt++] = char((x / 10 - 1) * 7 + x % 10);
        }
      }
    }
//    for (int i = 0; i < 32; ++i) printf("%d ", s[i]);printf("\n");

    if (s == target) {
      printf("0\n");
      continue;
    }
    pq.push(S(s));
    int ans = -1;
    while (!pq.empty()) {
      S u(pq.top());
      pq.pop();
      for (int i = 0; i < 4; ++i) {
        int bp = u.b[i];
        char pre = u.s[bp - 1];
        if (pre == 30 || pre % 7 == 0) {
          continue;
        }
        int np = u.p[pre + 1];

        S v(u);
        v.s[bp] = char(pre + 1);
        v.s[np] = char(30);
        if (ss.find(v.s) == ss.end()) {
          ++v.d;
          if (v.s == target) {
//            for (int i = 0; i < 32; ++i) printf("%d ", u.s[i]);
//            printf("---d=%d\n", u.d);
            ans = v.d;
            goto L;
          }
          ss.insert(v.s);
          v.p[pre + 1] = bp;
          v.b[i] = np;
          pq.push(v);
        }
      }
    }
    L:
    printf("%d\n", ans);
  }
  return 0;
}

Measured memory_bytes: 11396
h, w = map(int, input().split())

if h == 1 and w >= 1:
    ans = 1
elif h >= 1 and w == 1:
    ans = 1
elif h * w % 2 == 0 :
    ans = h * w // 2
else:
    ans = h * w // 2 + 1

print(ans)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define local
//if you find any bug in my code, please tell me.
int main()
{
#ifdef local
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
#endif
    int k,s,i,j,ans=0;
    cin>>k>>s;
    for(i=0; i<=k; i++)
        for(j=0; j<=k; j++)
        if(s-i-j>=0&&s-i-j<=k) ans++;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 384
// 2011/05/04 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int n;
		cin >> n;
		if(n==0)
			break;

		char dat[1001][1001];
		for(int i=0; i<n; i++)
			for(int j=0; j<n; j++)
				cin >> dat[i][j];
		for(int i=0; i<n+1; i++)
			dat[i][n] = '*';
		for(int j=0; j<n+1; j++)
			dat[n][j] = '*';
/*
		for(int i=0; i<n+1; i++){
			for(int j=0; j<n+1; j++){
				cout << dat[i][j];
			}
			cout << endl;
		}
*/
		int mx = 0;
		for(int i=0; i<n; i++){
			for(int j=0; j<n; j++){
				int tmp = 0;
				while(true){
					bool brk = false;
					for(int k=0; k<tmp+1; k++){
						if(dat[i+k][j+tmp]=='*'||dat[i+tmp][j+k]=='*'){
							brk = true;
							break;
						}
					}
					if(brk)
						break;
					else
						tmp++;
				}
				if(tmp>mx)
					mx = tmp;
			}
		}

		cout << mx << endl;
	}

	return 0;
}

Measured memory_bytes: 1632
n, m = map(int, input().split())
a = [(1, int(i)) for i in input().split()]
for _ in range(m):
    b, c = map(int, input().split())
    a.append((b, c))
a = sorted(a, key=lambda x: x[1])
res = 0
idx = 0
while idx < n:
    b, c = a.pop()
    p = min(b, n-idx)
    res += p * c
    idx += p
print(res)


Measured memory_bytes: 85016
N = int(input())
List = list(map(int,input().split()))
color = [0,0,0,0,0,0,0,0,0]

for i in range(N):
  if List[i] < 400:
    color[0] += 1
  elif 400<= List[i] < 800:
    color[1] += 1
  elif 800<= List[i] < 1200:
    color[2] += 1
  elif 1200<= List[i] < 1600:
    color[3] += 1
  elif 1600<= List[i] < 2000:
    color[4] += 1
  elif 2000<= List[i] < 2400:
    color[5] += 1
  elif 2400<= List[i] < 2800:
    color[6] += 1
  elif 2800<= List[i] < 3200:
    color[7] += 1
  else:
    color[8] += 1
#print(color)
cmin = 0
for i in range(8):
    if color[i]>0:
        cmin += 1
        
cmax = cmin+color[8]
if cmin ==0:
    cmin = 1
print(cmin,cmax)

Measured memory_bytes: 38256
#include <iostream>
#include <unordered_set>

using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    unordered_set<int> px;
    px.insert(a);
    px.insert(b);
    px.insert(c);
    cout << px.size() << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char s[1000005];
int main(){
	scanf("%s",s+1);
	int cnt=0,l=strlen(s+1);
	for(int i=l;i>=1;i--){
		if(s[i]<'5'||(s[i]=='5'&&s[i-1]<'5'))cnt+=s[i]-'0';
		else{
			cnt+=10-(s[i]-'0');
			s[i-1]++;
		}
	}
	if(s[0])cnt++;
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 1280
<?php
$n = (int)trim(fgets(STDIN));
$s = trim(fgets(STDIN));

if ($n % 2 === 1) {
	echo 'No';
	exit();
}
$half = (int)($n/2);
for ($i=0; $i < $half; $i++) { 
	$mae = $s[$i];
	$ura = $s[$i+$half];
	if ($mae !== $ura) {
		echo 'No';
		exit();
	}
}
echo 'Yes';

Measured memory_bytes: 4728
#include <iostream>
#include <vector>

using namespace std;

int f(int n) {
    if (n % 2 == 0) {
        return n / 2;
    } else {
        return 3 * n + 1;
    }
}

int main() {
    int s;
    cin >> s;
    
    vector<int> a = {s};
    vector<int> b(1000001);
    b[s] = 1;
    
    for (int i = 1; ; i++) {
        a.push_back(f(a.back()));
        
        for (int j = 0; j < i; j++) {
            if (b[a.back()]) {
                cout << i + 1 << endl;
                return 0;
            }
        }
        
        b[a.back()] = 1;
    }
}

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

const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};
const int N = 405;
const int INF = 1e9;
char board[N][N];
int h,w;

bool is_in(int x, int y) {
  if(0 <= x && x < h && 0 <= y && y < w) return true;
  return false;
}

signed main() {
  cin >> h >> w;

  rep(i,h) rep(j,w) cin >> board[i][j];
  vector<vector<int>> d(h, vector<int> (w, INF));

  int ans = 0;
  rep(ii,h) rep(jj,w) {
    if(board[ii][jj] != '#' || d[ii][jj] != INF) continue;
    int sx = ii, sy = jj;

    queue<P> que;
    d[sx][sy] = 0;
    que.push({sx,sy});

    int cnt = 0;
    int black = 1;
    while(!que.empty()) {
      int cx = que.front().first;
      int cy = que.front().second;
      que.pop();

      for (int i = 0; i < 4; i++) {
        int nx = cx + dx[i];
        int ny = cy + dy[i];
        if(!is_in(nx, ny)) continue;
        if(board[nx][ny] == board[cx][cy] || d[nx][ny] != INF) continue;

        if(board[nx][ny] == '.') cnt++;
        else if(board[nx][ny] == '#') black++;

        d[nx][ny] = d[cx][cy] + 1;
        que.push({nx, ny});
      }
    }

    ans += cnt * black;
  }
  cout << ans << '\n';
}


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

int main() {
  int N, K;
  cin >> N >> K;
  int input = 1;
  
  for (int i = 0; i < N; i++) {
    int data1 = input * 2;
    int data2 = input + K;
    if (data1 > data2) {
      input = data2;
    }
    else {
      input = data1;
    }
  }
  cout << input << endl;
}
  


Measured memory_bytes: 3672
#include"bits/stdc++.h"
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define INF 1e+9


int main() {
	int n;
	cin >> n;
	if (n == 111) cout << "999" << endl;
	if (n == 119) cout << "991" << endl;
	if (n == 191) cout << "919" << endl;
	if (n == 911) cout << "199" << endl;
	if (n == 991) cout << "119" << endl;
	if (n == 199) cout << "911" << endl;
	if (n == 919) cout << "191" << endl;
	if (n == 999) cout << "111" << endl;

	return 0;
}

Measured memory_bytes: 256
S = input()
s = set(S)
count = [S.count(i) for i in s]
if len(S) == 2:
    if len(s) == 2:
        print('YES')
    else:
        print('NO')
elif (max(count)-min(count) <= 1 and len(s) == 3) or len(S) == 1:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 9172
#include <string>
#include <iostream>

using namespace std;

int main()
{
	string s;
	cin >> s;
	int sum = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '1') {
			sum++;
		}
	}
	cout << sum << endl;
	return 0;
}

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

struct P{
    double x, y, angle;
    P(double x, double y) : x(x), y(y){
        if(abs(x) + abs(y) < 0.001)angle = 0;
        else{
            angle = acos(x / sqrt(x*x + y*y));
            if(y < 0){
                angle = 2*acos(-1) - angle;
            }
        }
    }

    bool operator<(const P &p)const{
        return angle < p.angle;
    }
};

int main(void){
    int n;
    long long ans = 0;
    vector<P> p;
    cin >> n;
    for(int i=0;i<n;i++){
        int x, y;
        cin >> x >> y;
        p.push_back(P(x, y));
    }
    sort(p.begin(), p.end());

    for(int i=0;i<n;i++){
        long long x = 0, y = 0;
        for(int j=0;j<n;j++){
            x += p[(i+j)%n].x;
            y += p[(i+j)%n].y;
            ans = max(ans, x*x + y*y);
        }
    }
    cout << fixed << setprecision(16) << (double) sqrt((double)ans) << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main() {
    int A,B,C;
    cin>>A>>B>>C;
    if (A == B && A == C) {
        cout << "No" << endl;
    }
    else if (A != B && A != C && B != C) {
        cout << "No" << endl;
    }
    else cout << "Yes" << endl;
    
    return 0;
}

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

using namespace std;

int main(){
    string s;
    cin >> s;
    int zero=0, one=0;
    for(auto c: s){
        if(c == '0')
            zero++;
        else
            one++;
    }
    cout << 2 * min(one, zero) << endl;
    return 0;
}


Measured memory_bytes: 512
a, b = gets.chomp.split(" ").map(&:to_i)
ans = 0
def ispalind(string)
    n = string.length
    for i in 0..(n - 1)/2
        if string[i] != string[n - 1 - i]
            return false
        end
    end
    return true
end
for i in a..b
    if ispalind(i.to_s)
        ans += 1
    end
end
print(ans)

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

int main() {
  int N,T,A;
  cin>>N>>T>>A;
  vector<int> vec(N);
  for(int i=0;i<N;i++){
    cin>>vec.at(i);
  }
  vector<double> vec1(N);
  for(int i=0;i<N;i++){
    vec1.at(i)=T-vec.at(i)*0.006;
  }
  double ans=100000.0;
  int ans1;
  for(int i=0;i<N;i++){
    if(abs(vec1.at(i)-A)<ans){
      ans=abs(vec1.at(i)-A);
      ans1=i+1;
    }
  }
  cout<<ans1<<endl;
}

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

int main(){
	
	int a,b,c;
	cin >> a >> b >> c;
	
	if(a==b&&b==c){
		cout << "1";
	}
	else if(a==b||b==c||a==c){
		cout << "2";
	}
	else cout << "3";
}

Measured memory_bytes: 256
n, k = map(int, input().split())
cnt = 1
head = 0
head_total = 0
tail = n
tail_total = 0
mod = 10**9+7
for i in range(n + 1):
    if i >= k:
        cnt += tail_total - head_total + 1
        cnt %= mod
    head_total += head
    tail_total += tail
    head += 1
    tail -= 1
print(cnt % mod)


Measured memory_bytes: 9176
#include <iostream>
#include <limits.h>
#include <queue>
#include <algorithm>
#include <map>


using namespace std;

typedef pair<int,int> P;


const int N=10000;
int ball[10];
int n=0;

int A[10],B[10];

bool solve(int i,int a,int b,bool IS_A){

  //cout<<"a,b:"<<a<<","<<b<<endl;
  
  if(i==10) return true;

  if(IS_A){
    A[a]=ball[i];
    if(a>0 && A[a-1]>A[a]){
      //cout<<"hoge"<<endl;
      return false;
    }
    a++;
  }
  else{
    B[b]=ball[i];
    if(b>0 && B[b-1]>B[b]){
      //cout<<"huge"<<endl;
      return false;
    }
    b++;
  }
  
  bool t1,t2;
  
  //when ball[i] is pushed into A or B
  return (solve(i+1,a,b,true)||solve(i+1,a,b,false));
}





int main(){

  cin>>n;
  
  for(int i=0;i<n;i++){
    for(int j=0;j<10;j++){
      cin>>ball[j];
    }
    if(solve(0,0,0,true)||solve(0,0,0,false)) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
  }


  return 0;
}

Measured memory_bytes: 3044
#include<iostream>
using namespace std;
int main(){
  int n,l[10],work,s;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> l[i];
  }
  for(int i=0;i<n;i++){
    work=l[i];
    for(int j=i;j<n;j++){
      if(l[j]>work){
        work=l[j];l[j]=l[i];l[i]=work;
      }
    }
  }
  for(int i=1;i<n;i++){s=s+l[i];}
  if(l[0]<s)cout<<"Yes";
  else cout<<"No";
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int count[4][3][10];
  int n,b,f,r,v;
  cin >> n;
  for(int j=0;j<4;j++){
    for(int k=0;k<3;k++){
      for(int l=0;l<10;l++){
	count[j][k][l]=false;
      }}}
  for(int i=0;i<n;i++){
  cin >> b >> f >> r >> v ; 
  count[b-1][f-1][r-1]+=v;

  }
  for(int m=0;m<4;m++){
    for(int p=0;p<3;p++){
      for(int o=0;o<10;o++){
	cout <<" " << count[m][p][o];
	  
	  }
      cout << endl ;
    }
    if(m!=3)cout  << "####################" << endl ;

  }

}

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

string soroban[8] = {"*****     ", "     *****", "==========",
                     " **** ****", "* **** ***", "** **** **",
                     "*** **** *", "**** **** "};

int main() {
    string s;
    int count = 0;
    while (cin >> s) {
        int diff = 5 - s.size();
        string t;
        for (int i = 0; i < diff; i++) {
            t.push_back('0');
        }
        t += s;

        if (count) cout << endl;
        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 5; j++) {
                cout << soroban[i][t[j] - '0'];
            }
            cout << endl;
        }
        count++;
    }
}

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

int main(){
  int x,y ; cin >> x >> y;
  for(int i=0;i<=x;++i){
    //i = カメ x-i=つる
    if(i*4 + (x-i)*2 == y) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No";
  return 0;
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
using namespace std;
#define fast_io {cin.sync_with_stdio(0); cout.sync_with_stdio(0);}
#define out(x,y) {cout<<x<<y;}
using ll = long long int;

int main(){
	fast_io;
	ll n,m;
	cin>>n>>m;
	ll ans = 0;
	for(ll i=0;i<m;i++){
		ll x; cin>>x; ans+=x;
	}
	if(ans<=n){
		cout<<n-ans<<endl;
	}
	else{
		cout<<-1<<endl;
	}
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main(){
	char a[1005];
	int la=1;
	bool flag=0;
	a[la]=getchar();
	while(a[la]!='\n'){
		if(a[la]=='C')flag=1;
		else if(a[la]=='F'&&flag)return puts("Yes"),0;
		la++;
		a[la]=getchar();
	}
	puts("No");
}

Measured memory_bytes: 256
import java.util.*;

	public class Main
	{
		public static void main(String []args)
		{
			for(int i = 1; i < 10; i++)
			{
				for(int j = 1; j < 10; j++)
				{
					System.out.printf("%dx%d=%d\n",i,j,i*j);
				}
			}

		}


	}

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


def main():
    r, D, x2000 = map(int, input().split())
    currx = x2000
    for i in range(10):
        currx = r*currx - D
        print(currx)
    pass


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <map>
#include <string.h>
#define ll long long
#define mp(a, b) make_pair(a, b)

using namespace std;

int arr[10];

int main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	cin >> arr[1] >> arr[2] >> arr[3];
	sort(arr + 1, arr + 4);
	int num = arr[3] * 10 + arr[2] + arr[1];
	cout << num << endl;

	return 0;
}

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

#define cc(x) cout << (x) << endl
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef vector<long long> vll;

template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

const ll inf = 1LL<<58;
const int iinf = 1<<30;

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n){
        cin >> a[i];
    }
    ll count=0;
    rep(i,n){
        if(a[i]<0){
            count++;
        }
    }

    if(count%2==0){
        ll tmp=0;
        rep(i,n){
            tmp+=abs(a[i]);
        }
        cc(tmp);
        return 0;

    }else{
        rep(i,n){
            a[i]=abs(a[i]);
        }
        sort(all(a));

        ll tmp=-a[0];
        repi(i,1,n){
            tmp+=abs(a[i]);
        }
        cc(tmp);
        return 0;
    }
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int num=0;

void Merge(int A[],int left,int mid,int right);
void MergeSort(int A[],int left,int right);

int main()
{
    int A[500000],N;
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>A[i];
	}
	MergeSort(A,0,N);
	cout<<A[0];
	for(int i=1;i<N;i++){
		cout<<" "<<A[i];
	}
	cout<<endl<<num<<endl;
}

void Merge(int A[],int left,int mid,int right)
{
	int n1=mid-left;
	int n2=right-mid;
	int dL[n1+1],dR[n2+1];
	for(int i=0;i<n1;i++){
		dL[i]=A[left + i];
	}
	for(int i=0;i<n2;i++){
		dR[i]=A[mid + i];
	}
	dL[n1]=1000000001;
	dR[n2]=1000000001;
	int i,j;
	for(i=left,j=0;i<right;i++){
		if(dL[i-left-j]<dR[j]){
			A[i]=dL[i-left-j];
		}else{
			A[i]=dR[j];
			j++;
		}
		num++;
	}
	
}
void MergeSort(int A[],int left,int right)
{
	if(left+1<right){
		int mid=(left+right)/2;
		MergeSort(A,left,mid);
		MergeSort(A,mid,right);
		Merge(A,left,mid,right);
	}
}

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

void warshall_floyd(int n, vector<vector<int> > &g) {
    for(int k = 0; k < n; ++k)
        for(int i = 0; i < n; ++i)
            for(int j = 0; j < n; ++j) g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
}

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int n,m; cin >> n >> m;
    vector<vector<int> > g(n,vector<int>(n, 1e9));
    int a[1010], b[1010], c[1010];
    for(int i=0; i < m; ++i){
        cin >> a[i] >> b[i] >> c[i];
        --a[i]; --b[i];
        g[a[i]][b[i]] = c[i];
        g[b[i]][a[i]] = c[i];
    }
    for(int i=0;i<n;++i) g[i][i] = 0;
    warshall_floyd(n, g);

    int ans = 0;
    for(int i=0; i < m; ++i) {
        if(c[i] > g[a[i]][b[i]]) ++ans;
    }

    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 384
# ABC083-B
def get_wa(N):
    ans = 0
    while N > 0:
        ans += N % 10
        N = N //10
    return ans
N, A, B = map(int, input().split())
ans = 0
for i in range(N+1): 
    tmp = get_wa(i)
    if A <= tmp <= B:
        ans += i

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rf(x) (x)=0;while(*p<48)p++;while(47<*p)(x)=((x)<<3)+((x)<<1)+(*p++&15);
//#define rf(x) (x)=0;while(*p<48)im=*p=='-';while(47<*p)(x)=((x)<<3)+((x)<<1)+(*p++&15);if(im)(x)=-(x);
#define pb push_back
#define sz(V) ((int)(V).size())
#define allv(V) ((V).begin()),((V).end())
#define befv(V) ((V)[(sz(V)-2)])
#define sorv(V) sort(allv(V))
#define revv(V) reverse(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define clv(V) (V).clear()
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define rb(x) ((x)&(-(x)))
#define cb(x) (x)=(!(x))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
#define INFST (0x7f7f7f7f)
#define INFLLST (0x7f7f7f7f7f7f7f7fll)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ld, ld> pdd;
typedef complex<ld> base;
const ld EPS = (ld)1e-7;
const ld PI = acos(0) * 2;
bool isZero(const ld& x) { return abs(x) <= EPS; }
int sign(const ld& x) { return isZero(x) ? 0 : (0 < x ? 1 : -1); }
ll gcd(ll a, ll b) { for(;b;a%=b,swap(a,b)){} return abs(a); }
pll operator + (const pll& a, const pll& b) { return pll(a.first+b.first, a.second+b.second); }
pll operator - (const pll& a, const pll& b) { return pll(a.first-b.first, a.second-b.second); }
pll operator * (const pll& a, const ll& b) { return pll(a.first*b, a.second*b); }
ll operator * (const pll& a, const pll& b) { return a.first*b.second - b.first*a.second; }
ll ccw(const pll& a, const pll& b, const pll& c) { return a*b + b*c + c*a; }
void fg(vector<int> G[], int a, int b) { G[a].pb(b); G[b].pb(a); }
void fg(vector<pii> G[], int a, int b, int c) { G[a].pb({b, c}); G[b].pb({a, c}); }

ll a, b;

ll f(ll a, ll b) {
	ll q = a/b, r = a%b;
	return r ? (2ll * q * b + f(b, r)) : ((2ll * q - 1) * b);
}

int main() {
	cin >> a >> b;
	cout << f(a-b, b) + a << endl;
	return 0;
}

Measured memory_bytes: 256