akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdint.h>
#include<tgmath.h>
#include<stdbool.h>
#include<sys/queue.h>
#include<time.h>
#define ll long long
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))

int a, b;

main(){
    scanf("%d%d", &a, &b);
    printf("%d\n", a*b);
    return 0;
}

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

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    double n;
    cin >> n;
    int a = (n / 2);
    if((int)n % 2 == 1)
        a++;
    double x = a;
    cout << x / n << endl;
    return 0;
}


Measured memory_bytes: 256
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from heapq import heapify, heappop, heappush

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
S = [input() for i in range(N)]

memo = defaultdict(int)
L = []
for i in range(N):
    l = list(S[i])
    l.sort()
    l = "".join(l)
    memo[str(l)] += 1
# print(memo)
ans = 0
for m in memo.values():
    ans += m * (m - 1)//2
print(ans)


Measured memory_bytes: 25716
#include <stdio.h>
int main()
{
    int a, b, ans;
    char op;
    do
    {
        scanf("%d %c %d", &a, &op, &b);
        switch (op)
        {
        case '+':
            ans = a + b;
            printf("%d\n", ans);
            break;
        case '-':
            ans = a - b;
            printf("%d\n", ans);
            break;
        case '*':
            ans = a * b;
            printf("%d\n", ans);
            break;
        case '/':
            ans = a / b;
            printf("%d\n", ans);
            break;
        default:
            break;
        }

    } while (op != '?');

    return 0;
}


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

int main(){
  int M1,D1,M2,D2;
  cin >> M1 >> D1 >> M2 >> D2;
  if(M1!=M2){
    cout << 1 << endl;
  }else{
    cout << 0 << endl;
  }
  return 0;
}


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

using namespace std;

int main(void)
{
    int a[6];

    for(int i=0;i<5;i++)
        cin >> a[i];

    int k;
    cin >> k;

    for(int i=0;i<=3;i++)
    {
        for(int j=i+1;j<=3;j++){

        if(abs(a[i]-a[j+1])>k){
            cout << ":(";
            return 0;
        }

        }
    }

    cout << "Yay!";

    return 0;
}


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

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


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

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


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

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

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

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

int dist(pii a, pii b){
    return abs(a.first-b.first) + abs(a.second-b.second);
}

int main() {
    int n,m;cin>>n>>m;
    vector<string> a(n);
    string box(m+2,'#');
    for(auto i=0;i<n;i++){
        cin>>a[i];
    }
    cout<<box<<endl;
    for(auto i=0;i<n;i++){
        cout<<"#"<<a[i]<<"#"<<endl;
    }
    cout<<box<<endl;
    
    
    
    return 0;
}







Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for(int (i)=0;(i)<(n);(i)++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  int total = 0;
  for(int i=0;i<n;i++) {
    cin >> a[i];
    total += a[i];
  }
  sort(a.rbegin(), a.rend());
  long double lim = (long double)total / (4 * m);
  if(a[m-1] < lim) cout << "No" << endl;
  else cout << "Yes" << endl;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        d: usize,
    }
    let num_per_one = 2 * d + 1;
    let ans = n / num_per_one + if n % num_per_one == 0 { 0 } else { 1 };
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;
int main() {
  ll N = 0;
  cin >> N;
  map<string,ll> mp;
  rep(i,N){
    string s;
    cin >> s;
    mp[s]++;
  }
  cout << mp.size();
}

Measured memory_bytes: 19208
#include <bits/stdc++.h>
using namespace std;
int n;
int x[107], y[107], h[107];
int X, Y, H;

int main() {
	scanf("%d", &n);
	int dd;
	for(int i = 1; i <= n; i++) {
		scanf("%d %d %d", &x[i], &y[i], &h[i]);
		if(h[i]) dd = i;
	}
	for(int i = 0; i <= 100; i++) {
		for(int j = 0; j <= 100; j++) {
			X = i, Y = j;
			H = h[dd] + abs(x[dd] - X) + abs(y[dd] - Y);
			for(int k = 1; k <= n; k++) {
				int t1 = abs(x[k] - X), t2 = abs(y[k] - Y);
				if(h[k] != max(H - t1 - t2, 0)) break;
				if(k == n) {
					printf("%d %d %d\n", X, Y, H);
					return 0;
				}
			}
		}
	}
}

Measured memory_bytes: 256
import time
startTimeProblem=time.time()

import fileinput, sys, itertools, functools
from math import *
from bisect import *
from heapq import *
from collections import *

def lcm(a, b):  
    return (a*b)/gcd(a, b)

class InputHelper:
    def __init__(self):
        self.myinput = fileinput.input()

    def isLocal(self):
        return not fileinput.isstdin()

    def int(self):
        return int(self.myinput.readline().rstrip())

    def ints(self):
        return [int(_) for _ in self.myinput.readline().rstrip().split()]

    def str(self):
        return self.myinput.readline().rstrip()

    def strs(self):
        return [_ for _ in self.myinput.readline().rstrip().split()]

class OutputHelper:
    def int(self, a):
        print(a)    

    def ints(self, a):  
        print(" ".join([str(_) for _ in a]))
    
    def intsNL(self, a):
        for _ in a:
            print(_)
    
    def str(self, s):
        print(s)

    def strs(self, s):
        print(" ".join([_ for _ in s]))

    def strsNL(self, s):
        for st in s:
            print(st)

class ListNode:
    def __init__(self, val):
        self.val = val
        self.next = None
        self.prev = None

In = InputHelper()
Out = OutputHelper()

######################################

N, K = In.ints()
V = In.ints()

class Solution():
    def __init__(self, K, V):
        self.ans = 0
        self.k = K
        self.posSum = 0
        self.negPreSum = [0]
        self.V = V

    @functools.lru_cache(None)
    def rec(self, fromIncl, toIncl):
        self.k -= 1
        canCallNext = self.k>0 and fromIncl!=toIncl

        #taketh left part
        leftVal = self.V[fromIncl]
        if leftVal>=0:
            self.posSum+=leftVal
        else:
            bipos = bisect_left(self.negPreSum, -leftVal)
            self.negPreSum.insert(bipos, -leftVal)

        negIdx = max(len(self.negPreSum)-1-self.k, 0)
        self.ans = max(self.ans, self.posSum-sum(self.negPreSum[0:negIdx+1]))

        if canCallNext:
            self.rec(fromIncl+1, toIncl)
        
        if leftVal>=0:
            self.posSum-=leftVal
        else:
            self.negPreSum.pop(bipos)
        
        #taketh right
        rightVal = self.V[toIncl]
        if rightVal>=0:
            self.posSum+=rightVal
        else:
            bipos = bisect_left(self.negPreSum, -rightVal)
            self.negPreSum.insert(bipos, -rightVal)

        negIdx = max(len(self.negPreSum)-1-self.k, 0)
        self.ans = max(self.ans, self.posSum-sum(self.negPreSum[0:negIdx+1]))

        if canCallNext:
            self.rec(fromIncl, toIncl-1)

        if rightVal>=0:
            self.posSum-=rightVal
        else:
            self.negPreSum.pop(bipos)

        self.k += 1


sol = Solution(K, V)
sol.rec(0, N-1)
Out.int(sol.ans)

######################################

if len(sys.argv)>2 and sys.argv[2]=="TIMEIT":
    fin = (time.time()-startTimeProblem)*1000
    print("{:.2f}".format(fin) + "ms")

Measured memory_bytes: 46188
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define ld long double
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 P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define onBoard(y,x) (y>=0 && y<h && x>=0 && x<w)
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define vp vector<pair<int,int>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<"Yes"<<endl
#define coutn cout<<"No"<<endl
#define coutY cout<<"YES"<<endl
#define coutN cout<<"NO"<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(15);

    string s,t; cin >> s >> t;
    int n=s.size(),m=t.size();
    if(m>n){
        cout<<"UNRESTORABLE"<<endl;
        return 0;
    }
    vstr cand;
    rep(i,n-m+1){
        bool can=true;
        rep(j,m){
            if(s[i+j]!=t[j] && s[i+j]!='?') can=false;
        }
        if(can){
            string tmp=s;
            tmp.replace(i,m,t);
            rep(i,n) if(tmp[i]=='?') tmp[i]='a';
            //cout<<tmp<<endl;
            cand.PB(tmp);
        }
    }
    sort(all(cand));
    if(cand.size()==0) cout<<"UNRESTORABLE"<<endl;
    else cout<<cand[0]<<endl;

}

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

typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<pair<long long,long long> > vpll;
typedef vector<vector<pair<ll,ll> > > vvpll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
 
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define all(x) x.begin() , x.end()
#define pb push_back
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define F first
#define S second
#define left (node << 1)
#define right (node << 1) + 1
#define pii pair<int,int> 
#define mii map<int,int>
#define vi vector<int>
#define umii unordered_map<int,int>
// #define mod 998244353
#define mod 1000000007 
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<": " <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define FILL(name,val) memset(name , val , sizeof(name))
#define repo(i,o,e) for(int i = o ; i < e ; i++)
#define rep(n) for(int i = 0 ; i < n ; i++)
#define repa(i,sta,end,inc) for(int i = sta ; i <= end ; i += inc)
#define repb(i,sta,end,inc) for(int i = sta ; i >= end ; i -= inc)
const ll sz = 1e5+5;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
 
const ll inf = 1000000000LL * 1000000000LL;

ll power(ll x , ll y){ll res = 1;x %= mod;while(y){if(y&1){res = res * x % mod;}x = x*x % mod;y /= 2;}return res%mod;}

void solve(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    if(n&1){
        cout << "No" << endl;
        return;
    }
    bool f = true;
    for(int i = 0 , j = n/2 ; i < n/2 ; ++i , ++j){
        if(s[i] != s[j]){
            f =false;
            break;
        }
    }
    cout << (f ? "Yes" :"No") << endl;
    return; 
}


int main(){
    FIO;
    int t = 1;
    // cin >> t;   
    while(t--){
        solve();
    }
    return 0;
}

 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const ll INF=mod*mod;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}

 ll gcd(ll m,ll n){
 	if(n==0){
       return m;
     }
   return gcd(n,m%n);
 }
ll lcm(ll a,ll b){
  ll g=gcd(a,b);
  return a/gcd(a,b)*b;
		

}
int main(){
  
  ll M,D;
  cin>>M>>D;
  
  ll ans=0;
  
  for(ll i=1;i<=M;i++){
    for(ll j=22;j<=D;j++){
      if(j%10>1&&(j/10)*(j%10)==i){
        ans++;
      }
    }
  }
  
  
  cout<<ans<<endl;
}

        

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main()
{
	unsigned long long n, a, b;
	cin >> n >> a >> b;
	unsigned long long ans = 0;
	if (n <= a) {
		cout << n << endl;
	}
	else if (n <= a + b) {
		cout << a << endl;
	}
	else {
		ans = n / (a + b);
		ans *= a;
		unsigned long long res = n % (a + b);
		if (res >= a) {
			ans += a;
		}
		else {
			ans += res;
		}
		cout << ans << endl;

	}
	return 0;

}

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

int main(){
    long long n;
    double m;
    cin >> n >> m;
    long long ans;
    long long m2 = m*100+0.5;
    ans = n*m2;
    ans/= 100;
    ans = (ll)ans;
    cout << ans<<endl;
    
}


Measured memory_bytes: 3704
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

namespace templates{
  ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
      if(b&1)res = res * x % MOD;
      x = x * x % MOD;
      b>>=1;
    }
    return res;
  }

  ll modinv(ll x){
    return modpow(x, MOD-2);
  }

  bool was_output = false;
  template<class t>
  void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
  }
  void outendl(){
    was_output = false;
    cout << endl;
  }
  ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
  }

  template<class t>
  istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
  }

  template<class t, class u>
  istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
  }

  template<class t>
  void in(t&x){
    cin >> x;
  }

  template<class t>
  t in(){
    t res; cin >> res; return res;
  }

  template<class t>
  void out(t x){
    cout << x;
  }

  template<class t>
  vector<t> sorted(vector<t> line,function<bool(t,t)> comp=[](t a,t b){return a<b;}){
    sort(line.begin(),line.end(),comp);
    return line;
  }

  template<class t>
  vector<t> reversed(vector<t> line){
    reverse(line.begin(),line.end());
    return line;
  }
}

using namespace templates;

int main(){
  int h1 = in();
  int m1 = in();
  int h2 = in();
  int m2 = in();
  int k = in();
  auto func =
    [](int h,int m){
      return h* 60 + m;
    };

  cout << func(h2,m2) - func(h1,m1) - k << endl;
  return 0;
}


Measured memory_bytes: 3664
def main():
    n, k = list(map(int, input().split()))
    X = list(map(int, input().split()))
    P = []
    M = []
    for x in X:
        if x >= 0:
            P.append(x)
        else:
            M.append(abs(x))
    m_range = [max(0, k - len(P)), min(len(M), k)]
    p_range = [max(0, k - len(M)), min(len(P), k)]
    P = [0, ] + P
    M = [0, ] + M[::-1]
    ans = float('inf')
    for i in range(m_range[0], m_range[1] + 1):
        ans = min(ans, 2 * M[i] + P[k - i])
    for i in range(p_range[0], p_range[1] + 1):
        ans = min(ans, 2 * P[i] + M[k - i])
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 14480
#include <iostream>

using namespace std;

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

    return 0;
}


Measured memory_bytes: 3640
#!/usr/bin/env ruby

x, y = [0, 0]
theta = 90*(Math::PI / 180.0)

while line = gets
  d, a = line.chomp!.split(",").map(&:to_i)
  break if d.zero? && a.zero?

  x += d * Math.cos(theta)
  y += d * Math.sin(theta)
  theta -= a * (Math::PI / 180.0)
end

puts x.to_i,y.to_i

Measured memory_bytes: 8960
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<int> l(n);
  for(int i=0;i<n;i++){
    cin>>l[i];
  }
  sort(l.begin(),l.end());
  int sum=0;
  for(int i=0;i<n-1;i++){
    sum+=l[i];
  }
  cout<<(l[n-1]<sum? "Yes":"No");
}

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

int main(){
    char a,b;
    cin>>a>>b;
    if(a=='H'){
        if(b=='H')  cout<<'H'<<endl;
        else        cout<<'D'<<endl;
    }else if(a=='D'){
        if(b=='H')  cout<<'D'<<endl;
        else        cout<<'H'<<endl;
    }
    return 0;
}

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

from bisect import bisect_left as binl
from copy import copy, deepcopy

def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * sy) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance


###############################################################################


def get_factors(x):
    retlist = []
    for i in range(1, int(x**0.5) + 3):
        if x % i == 0:
            retlist.append(i)
            retlist.append(x // i)
    return retlist


def main():
    n, m = intin()

    flist = get_factors(m)
    flist.sort()

    for f in flist:
        if f >= n:
            print(m // f)
            return


if __name__ == '__main__':
    main()


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

int main(){
    ll n; cin >> n;
    ll ans[n+1];
    memset(ans, 0, sizeof(ans));
    loop(i, 2, n+1) {
        ll ai; cin >> ai;
        ans[ai]++;
    }
    loop(i, 1, n+1) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 5200
#include<bits/stdc++.h>
using namespace std;
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int h,w;
char c[55][55];
int main(){
    bool a=true;
    cin>>h>>w;
    char c[h+2][w+2]={};
    for(int i=1;i<h+1;i++)for(int j=1;j<w+1;j++){
        cin>>c[i][j];
    }
    for(int i=1;i<h+1;i++){
        for(int j=1;j<w+1;j++){
            if(c[i][j]=='#'){
                if(c[i+1][j]!='#'&&c[i-1][j]!='#'&&c[i][j+1]!='#'&&c[i][j-1]!='#') a=false;
            }
            if(!a)  break;
        }
        if(!a)  break;
    }
    cout<<(a?"Yes":"No")<<endl;
    return 0;
}

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

int main(){
  int n,t;
  int h[200];
  cin >> t;

  while(t){
    cin >> n;
    
    for(int i= 0; i < n; i++)
      cin >> h[i];

    for(int i = n-1; i > 0; i--){
      h[i] = h[i] -h[i-1];
    }

    int min=0,max=0;
    for(int i = 1; i < n ; i++){
      if( min > h[i]) min  = h[i];
      if(max < h[i]) max = h[i];
    }

    min *= -1;

    cout <<max << " " << min<<endl;
    t--;
  }

  return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <set>
#include <queue>
#include <algorithm>
#include <deque>
#include <map>
#include <cmath>
#include <type_traits>
using namespace std;

#define INF 1e18
#define int long long

signed main() {
    int n; cin >> n;
    map<string, int> mp;
    for(int i = 0; i < n; i++) {
        string s; cin >> s;
        sort(s.begin(), s.end());
        mp[s]++;
    }

    int ans = 0;
    for(auto i = mp.begin(); i != mp.end(); i++) {
        ans += (i -> second) * ((i -> second) - 1) / 2;
    }

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


Measured memory_bytes: 11136
//jinhaonan
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
template<class T>inline void read(T &x){
	x=0;char c=getchar();bool f=0;
	for(;c>'9'||c<'0';f=c=='-',c=getchar());
	for(;c>='0'&&c<='9';x=(x<<1)+(x<<3)+c-'0',c=getchar());
	x=f?-x:x;
}
template<class T>inline void write(T x){
	if(x<0)putchar('-'),x=-x;
	if(x>=10)write(x/10);
	putchar(x%10+48);
}
template<class T>inline bool chkmax(T &a,T const &b){
	return a<b?a=b,1:0;
}
template<class T>inline bool chkmin(T &a,T const &b){
	return a>b?a=b,1:0;
}
const int N=100000+10;
void Main(){
	static pair<long long,int> d[N];
	static int size[N];
	static long long dis[N];
	map<long long,int> p;
	vector<pair<int,int>> ans;
	int n;read(n);
	for(int i=1;i<=n;++i){
		read(d[i].first);
		d[i].second=i;
		p[d[i].first]=i;
		size[i]=1;
	}
	sort(d+1,d+n+1);
	for(int i=n;i>1;--i){
		long long x=n-size[d[i].second]*2;
		if(x<=0){
			puts("-1");
			return;
		}
		x=d[i].first-x;
		auto it=p.find(x);
		if(it==p.end()){
			puts("-1");
			return;
		}
		dis[it->second]+=dis[d[i].second]+size[d[i].second];
		size[it->second]+=size[d[i].second];
		ans.push_back({d[i].second,it->second});
	}
	if(dis[d[1].second]!=d[1].first){
		puts("-1");
		return;
	}
	for(auto e:ans){
		write(e.first),putchar(' ');
		write(e.second),putchar('\n');
	}

}
int main(){
    // freopen("in.txt","r",stdin);
    // int test;read(test);
    // while(test--){
        Main();
    // }
    return 0;
}

Measured memory_bytes: 11368
#include<iostream>
#include<cstring>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cstdio>
#include<sstream>
#include<vector>
#include<algorithm>

using namespace std;
//#define read(x) scanf("%d",&x)
#define Read(x,y) scanf("%d%d",&x,&y)
#define gc(x)  scanf(" %c",&x);
#define mmt(x,y)  memset(x,y,sizeof x)
#define write(x) printf("%d\n",x)
#define pii pair<int,int>
#define INF 1e13
#define ll long long
const ll mod = 2333;
const int N = 1e5 + 10;
const int M = 2e6 + 1005;
using namespace std;
int a[10000];
int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    int l = s.size();
    for(int i = 0;i < l;++i){
        a[i] = s[i] - 'A';
        a[i] = (a[i]%26 + n%26)%26;
    }
    for(int i = 0;i < l;++i){
       cout<<(char)(a[i] + 65);
    }
}


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

int main()
{
    unsigned int h, w;
    std::cin >> h >> w;
    char c;
    unsigned int counter = 0;
    while(std::cin >> c)
    {
        counter += (c == '#');
    }
    std::cout << (counter == h + w - 1 ? "Possible" : "Impossible")
              << std::endl;
}


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

using namespace std;

int main()
{
    string s;
    int cnt[26]={0};
    while (cin>>s)
    {
        for (int i=0; i<s.size(); i++)
        {
            if (s[i]>='a' && s[i]<='z') cnt[s[i]-'a']++;
            if (s[i]>='A' && s[i]<='Z') cnt[s[i]-'A']++;
        }
    }
    for (char c='a'; c<='z'; c++) cout<<c<<" : "<<cnt[c-'a']<<'\n';
    return 0;
}



Measured memory_bytes: 3144
import java.io.*;
import java.util.*;
 
public class Main {
 
	void submit() {
	    
	    int[][] A = new int[3][3];
	    for(int i=0; i<3; i++){
	        for(int j=0; j<3;j++){
	            A[i][j] = nextInt();
	        }
	    }
 
	    int N = nextInt();
	    int[] b = new int[N];
	    for(int i=0; i<N; i++){
	        b[i] = nextInt();
	    }
	    
	    // アタリ初期化
	    boolean [][] appear = new boolean[3][3];
	    for(int i=0; i<3; i++){
	        for(int j=0; j<3;j++){
	            appear[i][j] = false;
	        }
	    }
	    
	    // 数値チェックして合っているならtrueで埋める
	    for(int i=0; i<3; i++){
	        for(int j=0; j<3;j++){
	            for(int k=0; k<N; k++){
    	            if(A[i][j] == b[k]) appear[i][j] = true;
	            }
	        }
	    }
 
	    String ANS = "No";
 
	    // 横チェック
	    for(int i=0; i<3; i++){
	        if(appear[i][0] && appear[i][1] && appear[i][2]) ANS = "Yes";
	    }

	    // 縦チェック
	    for(int i=0; i<3; i++){
	        if(appear[0][i] && appear[1][i] && appear[2][i]) ANS = "Yes";
	    }

	    // 斜めチェック
	    if(appear[0][0] && appear[1][1] && appear[2][2]) ANS = "Yes";
	    if(appear[0][2] && appear[1][1] && appear[2][0]) ANS = "Yes";

	    out.println(ANS);
	}
 
	void preCalc() {
 
	}
 
	void stress() {
 
	}
 
	void test() {
 
	}
 
	Main() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		preCalc();
		submit();
		//stress();
		//test();
		out.close();
	}
 
	static final Random rng = new Random();
 
	static int rand(int l, int r) {
		return l + rng.nextInt(r - l + 1);
	}
 
	public static void main(String[] args) throws IOException {
		new Main();
	}
 
	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
 
	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}
 
	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}
 
	int nextInt() {
		return Integer.parseInt(nextToken());
	}
 
	long nextLong() {
		return Long.parseLong(nextToken());
	}
 
	double nextDouble() {
		return Double.parseDouble(nextToken());
	}
}

Measured memory_bytes: 21204
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <utility>
#include <functional>

using namespace std;

int main() {
	int n, a, cnt = 0;

	cin >> n;
	while (n--) {
		cin >> a;
		if (a % 2) cnt++;
	}

	cout << (cnt % 2 ? "NO" : "YES") << endl;

	return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, d=DVSR): return pow(x, d - 2, d)
def DIV(x, y, d=DVSR): return (x * INV(y, d)) % d
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())


N,M,X,Y=LI()
xs=LI()
ys=LI()
Zmin = max(X, *xs)+1
Zmax = min(Y, *ys)

if Zmin <= Zmax:
    print('No War')
else:
    print('War')


Measured memory_bytes: 3064
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define INF 1000000000000
#define MOD 1000000007
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3)                                                 \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << endl
#define debug_4(x1, x2, x3, x4)                                             \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5)                                         \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                        \
    CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
    (__VA_ARGS__)
#else
#define debug(...)
#endif

using namespace std;
using ll = long long;

template <class T>
void printVector(const vector<T>& v) {
    for (auto value : v) {
        cout << value << " ";
    }
    cout << endl;
}

int main() {
    ll n, m, k, mi = 0;
    cin >> n >> m >> k;
    vector<ll> a(n), A(n + 1, 0);
    vector<ll> b(m), B(m + 1, 0);
    rep(i, n) {
        cin >> a[i];
        A[i + 1] = a[i] + A[i];
    }
    rep(i, m) {
        cin >> b[i];
        B[i + 1] = b[i] + B[i];
    }
    int start = 0;
    ll read_num = 0;
    rrep(i, n + 1) {
        if (A[i] > k) continue;
        for (int j = start; j < m + 1; j++) {
            // debug(A[i] + B[j], i, j, read_num);
            if (A[i] + B[j] >= k) {
                start = j;
                if (A[i] + B[j] > k) j--;
                read_num = i + j;
                // debug(A[i] + B[j], A[i], i, j, read_num);
                break;
            }
        }
        mi = max(mi, read_num);
    }
    cout << mi << endl;
    return 0;
}

Measured memory_bytes: 9224
import java.util.Scanner;

public class Main {


    public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int cnt = 0;
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		for(; a  <= b; a++){
			if(c % a == 0)
				cnt++;
		}
		System.out.println(cnt);
        scan.close();
    }

}

Measured memory_bytes: 26316
a=[int(c) for c in input()]

for i in range(2**3):
    s=a[0]
    ss=str(a[0])
    for j in range(3):
        if (i>>j)&1==1:
            s+=a[j+1]
            ss=ss+'+'+str(a[j+1])
        else:
            s-=a[j+1]
            ss=ss+'-'+str(a[j+1])
    
    if s==7:
        ss=ss+'=7'
        print(ss)
        exit(0)


Measured memory_bytes: 61916
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
int main(){
	while(1){
		int d,w;
		cin>>d>>w;
		if(!d)break;
		int e[d][w];
		rep(i,d)rep(j,w)cin>>e[i][j];
		int ans=0;
		rep(i,d){
			rep(j,w){
				REP(k,i+2,d-1){
					REP(l,j+2,w-1){
						int a=10;
						REP(m,i,k)a=min(a,min(e[m][j],e[m][l]));
						REP(m,j,l)a=min(a,min(e[i][m],e[k][m]));
						int b=0;
						REP(m,i+1,k-1){
							REP(n,j+1,l-1){
								b=max(b,e[m][n]);
							}
						}
						if(a>b){
							int t=0;
							REP(m,i+1,k-1){
								REP(n,j+1,l-1){
									t+=a-e[m][n];
								}
							}
							ans=max(ans,t);
						}
					}
				}
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 3056
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <math.h>
#include <numeric>
using namespace std;
int main(){
  string S,T;
  cin >> S;
  cin >> T;
  string ans="Yes";
  if(S.size()+1!=T.size())ans="No";
  for(int i=0;i<S.size();i++){
    if(S.at(i)!=T.at(i)){
      ans="No";
      break;
    }
  }
  cout << ans << endl;
}


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

int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  double tmp = 0;
  for (int i = 0; i < n; i++)
  {
    cin >> a[i];
    tmp += (double) 1 / a[i];
  }
  double ans = (double) 1 / tmp;
  cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 256
cards, mark = {}, ["S", "H", "C", "D"]
mark.each{|m| cards[m] = (1..13).to_a}
cnt = gets.to_i
(1..cnt).each {|i| m, n = gets.split
  cards[m].delete(n.to_i)
}
mark.each{|m| cards[m].each{|n| puts"#{m} #{n}"}}


Measured memory_bytes: 6872
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    double sum = 0;
    int n = sc.nextInt();
    double[][] arr = new double[n][2];

    public static void main(String[] args){
        new Main().run();
    }

    void run() {

        int m = n;
        for (int i=0; i<n; i++) {
            arr[i][0] = sc.nextDouble();
            arr[i][1] = sc.nextDouble();
        }

        int calc = m;
        while (1 < m--) {
            calc *= m;
        }

//        System.out.println(calc);

        dfs("");

        System.out.println(sum / calc);


    }

    void dfs(String s) {
        if (s.length() == n) {
//            System.out.println(s);
            for (int i=0; i<n-1; i++) {
                int idx = s.charAt(i) - 48;
                int next = s.charAt(i+1) - 48;
                double tmp = Math.sqrt(Math.pow(arr[idx][0]-arr[next][0], 2) + Math.pow(arr[idx][1]-arr[next][1], 2));
                sum += tmp;
            }
        }
        else {
            for (int i=0; i<n; i++) {
                if (s.contains(String.valueOf(i))) continue;
                dfs(s + i);
            }
        }
    }


}


Measured memory_bytes: 57040
#include <iostream>//数据输入输出流
#include <cstring>//字符串操作函数
#include <cstdio>//C的输入输出
#include <cstdlib>//定义杂项函数及内存分配函数
#include <cmath>//C中的数学函数
#include <string>//c++中的string类 他不能用strcpy等c函数去操作
#include <vector>//STL vetor
#include <list>//STL list
#include <map>// STL map
#include <queue>// STL queue
#include <stack>//sTL stack
#include <bitset>//bitset可按位定义串
#include <set>
//比如：bitset <1000> all;定义一个1000位的串
#include <algorithm>//STL各种算法 比如 swap sort merge max min 比较
#include <numeric>//常用数字操作 一般和algorithm搭配使用
#include <functional>//STL定义运算函数（代替运算符）
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef pair<int,int> PII;
#define fi first
#define se second
#define LOCAL
#define zeros(a,n) memset(a,0,(n)*sizeof(a[0]))
const int modn = 1e9+7;
int mod(int x) { return x<0?x+modn:x<modn?x:x-modn; }
//inv [ i ] = (modn - modn/i)*inv[ modn%i ] %modn;
int get(int x){
    int num = 0, i = 1;
    set<int>s;
    while(x > 0){
        if(x >= i){
            x -= i;
            num++;
            s.insert(i);
            i++;
        }else{
            break;
        }
    }
    return num;
}
int main()
{
    ios::sync_with_stdio(false); cin.tie(0);
    LL n;
    cin >> n;
    int ans = 0;
    for(int i = 2; i <= n / i; i++){
        if(n % i == 0){
            int num = 0;
            while(n % i == 0){
                num++;
                n /= i;
            }
            ans += get(num);
        }
    }
    if(n > 1) ans += 1;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3200
#ifdef _WIN32
#include "stdc++.h"
#else
#include <bits/stdc++.h>
#endif

// 継承可能な型
template <class Type>
struct IN : Type
{
	IN()
	{
		std::cin >> *this;
	}
};

// 継承不可能な型
template <class Type>
struct IN_
{
	Type val;

	IN_()
	{
		std::cin >> val;
	}

	operator Type&()
	{
		return val;
	}

	IN_<Type>& operator=(const Type& _value)
	{
		val = _value;
		return *this;
	}
};

template <class Char, class Type>
std::basic_ostream<Char>& operator <<(std::basic_ostream<Char>& os, const IN_<Type>& value)
{
	return os << value.val;
}

template <class Char, class Type>
std::basic_istream<Char>& operator >>(std::basic_istream<Char>& is, IN_<Type>& value)
{
	return is >> value.val;
}

template <class Type>
void OUT(const Type& value)
{
	std::cout << value << std::endl;
}

template <class Type, class ... Args>
void OUT(const Type& value, const Args& ... args)
{
	std::cout << value << ' ';
	OUT(args...);
}

void Yes()
{
	OUT("Yes");
}
void No()
{
	OUT("No");
}

using ll = long long;
using inll = IN_<ll>;
using vll = std::vector<ll>;
using setll = std::set<ll>;
using msetll = std::multiset<ll>;
using instr = IN<std::string>;

// 階乗を計算 O(N) (N=10^7 で O(10^7))
int Factorial(ll n)
{
	for (ll i = n - 1; i > 1; i--)
		n *= i;
	return n;
}

// nCrを計算 O(N) (N=10^7 で O(10^7))
ll Combination(const ll n, const ll r)
{
	return Factorial(n) / (Factorial(r) * Factorial(n - r));
}

// 素数判定 O(sqrt(N)) (N=10^7 で O(10^3))
bool IsPrime(const ll num)
{
    if (num < 2) return false;
    if (num == 2) return true;
    if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }

    return true;
}

// 各桁の和を計算 O(logN) (N=10^7 で O(7))
ll DigitSum(ll n)
{
	ll sum = 0;
	while(n != 0){
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

#define FOR(i, m, n) for (ll (i) = (m); (i) < (n); ++(i))
#define REP(i, n) for (ll (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for (ll (i) = (n); (i) >= 0; --(i))
#define ITRREP(it, v) for (auto (it) = (v).begin(); (it) != (v).end(); ++(it))
#define ITRREPR(it, v) for (auto (it) = (v).rbegin(); (it) != (v).rend(); ++(it))
#define DIVUP(a, b) (((a) + (b) - 1) / (b))

void Main();

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

	Main();

#ifdef _DEBUG
	system("pause");
#endif

	return 0;
}

using namespace std;

//////////////////////////////

void Main()
{
	inll a,b;
	ll c = b - a;

	ll wn = b - a;
	ll wh = 0;
	REP(i, wn + 1)
	{
		wh += i;
	}

	return OUT(wh - b);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
LL an;
char s[15];
void dfs(int it,LL v,LL sum){
 if(s[it]==0){
  an+=sum+v;
  return;
 }
 dfs(it+1,v*10+s[it]-'0',sum);
 dfs(it+1,s[it]-'0',sum+v);
}
int main(){
 RS(s);
 dfs(0,0,0);
 cout<<an/2<<endl; 
 return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

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

    char alpha[26] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};

    rep(i, s.size()) {
        rep(j, 26) {
            if(s[i] == alpha[j]) {
                s[i] = alpha[(j+n)%26];
                break;
            }
        }
    }

    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
import * as fs from 'fs';

namespace AtCoder {
    class ABC113 {
        /**
         * @param inp
         * 2
         * 12 5
         * 1000 2000
         */
        main(inp: string): void {
            // t-x*0.006
            const [t, a]: number[] = inp.split('\n')[1].split(' ').map(x => parseInt(x, 10));
            let ans: number = 0;
            let tmpAbs: number = 9999999;
            inp.split('\n')[2].split(' ').forEach((h, index) => {
                const abs: number = Math.abs(a - (t - parseInt(h) * 0.006));
                if (tmpAbs > abs) {
                    tmpAbs = abs;
                    ans = index + 1;
                }
            });
            console.log(ans);
        }
    }

    const func = new ABC113();
    func.main(fs.readFileSync('/dev/stdin', 'utf8').trim());
}

Measured memory_bytes: 7500
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Set<String> set = new HashSet<>();
		for (int i = 0; i < n; i++) {
			String s = sc.next();
			set.add(s);
		}
		
		System.out.println(set.size());
	}
}


Measured memory_bytes: 66228
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct Node {
    int key;
    struct Node *right, *left, *parent;
};
typedef struct Node Node;

Node *root, *NIL;

void insert(int k) {
    Node *y = NIL;
    Node *x = root;
    Node *z;
    
    z = (Node *)malloc(sizeof(Node));
    z->key   = k;
    z->left  = NIL;
    z->right = NIL;
    
    while(x != NIL) {
        y = x;
        if(z->key < x->key) {
            x = x->left;
        } else {
            x = x->right;
        }
    }
    
    z->parent = y;
    if(y == NIL) {
        root = z;
    } else {
        if( z->key < y->key) {
            y->left = z;
        } else {
            y->right = z;
        }
    }
}

void inorder(Node *u) {
    if(u == NIL) return;
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}
void preorder(Node *u) {
    if(u == NIL) return;
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
}
    
int main(void) {
    int n, i, x;
    char com[16];
    scanf("%d",&n);
    
    for(i=0;i<n;i++) {
        scanf("%s",com);
        if(!strcmp(com,"insert")) {
            scanf("%d",&x);
            insert(x);
        } else if(!strcmp(com,"print")) {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }

    return 0;
}


Measured memory_bytes: 25140