akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<functional>
#include<utility>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>

#define MOD 1000000007
using namespace std;

int n, m,l;
string s;

int main() {
	cin >> n >> m >> l;
	cout << n + m + l - max(max(n, m), l) << endl;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	long long N;
	cin >> N;
	int ans = 12;
	for(long long i=1;i<=sqrt(N);i++)
	{
	 if(N%i==0) {
	       ans = min(ans,(int)to_string(N/i).size());
	 }
	}
cout << ans << endl;
}

Measured memory_bytes: 256
//#if 1
//#include"pch.h"
//#define _CRT_SECURE_NO_WARNINGS
//#endif
#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;
int main() {
	int A, B, X;
	cin >> A >> B >> X;
	if (A > X)puts("NO");
	else if (A + B >= X)puts("YES");
	else puts("NO");

	return(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, ans = 0;
  cin >> n >> a >> b;
  for(int i = 1; i <= n; i++) {
    int sum = 0;
    int j = i;
    while(j > 0) {
      sum += (j%10);
      j /= 10;
    }
    if(a <= sum and sum <= b) ans += i;
  }
  cout << ans << "\n";
}

Measured memory_bytes: 256
H, N = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(N)]

# モンスターの体力をi、dp[i]を魔力の最小値とする
dp = [10**9]*(H+1)
# 正確にやるなら一番小さい魔力値で与えられるダメージより小さいiはその魔力値とした方がよさそう
dp[0] = 0

# 各魔法は何度同じのを使ってもよいので、1回のループではそれだけしか使わないパターンでやってみる
# それを各ループで同じdp配列を更新して、何度同じのを使ってもよいという状態を実現する
for i in range(N):
    a, b = ab[i]
    for j in range(H):
        # 残り体力 + 与えるダメージ
        k = min(j + a, H)
        # そのときの魔力最小値と、今回のダメージ与える前の魔力 + 使用魔力で小さい方を新たな魔力最小値とする
        dp[k] = min(dp[k], dp[j] + b)

print(dp[H])

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

int main(){
    long long A;
    string B;
    cin>>A>>B;
    long long B100=(B[0]-'0')*100+(B[2]-'0')*10+(B[3]-'0');
    long long C=A*B100;
    cout<<C/100<<endl;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int> d(N);
    for(int i = 0;i < N;i ++){
        cin >> d[i];
    }
    sort(d.begin(),d.end());
    d.erase(unique(d.begin(),d.end()),d.end());
    cout << d.size() << endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = [int(i) for i in input().split()]

'''
b = 0
c = 0
cnt = 0
flag = False
while True:
    b = 0
    c = 0
    for i in range(n):
        if a[i] % 2 == 0 and c == 0:
            a[i] /= 2
            c += 1
        else:
            b += 1
    #print(a,b)
    if b != n:
        cnt += 1
    else:
        break
'''
b = [0] * n
for i in range(n):
    while True:
        if a[i] % 2 == 0:
            a[i] /= 2
            b[i] += 1
        else:
            break

print(sum(b))


Measured memory_bytes: 4148
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,k;
int main(){
    scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&k);
    cout<<(((e-a)<=k)&&((d-a)<=k)&&((c-a)<=k)&&((b-a)<=k)&&((e-b)<=k)&&((d-b)<=k)&&((c-b)<=k)&&((e-c)<=k)&&((d-c)<=k)&&((e-d)<=k)?"Yay!":":(")<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(long long i=0;i<(n);i++)
#define REP1(i,n) for(long long i=1;i<=(n);i++)
#define REP2D(i,j,h,w) for(long long i=0;i<(h);i++) for(long long j=0;j<(w);j++)
#define REP2D1(i,j,h,w) for(long long i=1;i<=(h);i++) for(long long j=1;j<=(w);j++)
#define PER(i,n) for(long long i=((n)-1);i>=0;i--)
#define PER1(i,n) for(long long i=(n);i>0;i--)
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define FORE(i,a,b) for(long long i=(a);i<=(b);i++)
#define ITE(arr) for(auto ite=(arr).begin();ite!=(arr).end();++ite)
#define ALL(a) ((a).begin()),((a).end())
#define RANGE(a) (a),((a)+sizeof(a))
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define YNPRT(b) cout<<((b)?"Yes":"No")<<endl
#define ENTER printf("\n")
#define REV(arr) reverse(ALL(arr))
#define PRT(a) cout<<(a)<<endl

#ifdef DEBUG
#define DBPRT(a) cout << "[Debug] - " << #a << " : " << (a) << endl
#define DBSTART if(1){
#define DBEND }
#define PRTLST(arr,num) REP(_i,num) cout<<_i<<" - "<<arr[_i]<<endl;
#define PRTLST2(arr2,d1,d2) REP(_i,d1) REP(_j,d2) cout<<_i<<","<<_j<<" : "<<arr2[_i][_j]<<endl;
#define PRTLST2D(arr2,d1,d2) do{cout<<"L\t";REP(_i,d2) cout<<_i<<"\t"; cout<<endl; REP(_i,d1){cout<<_i<<"\t";REP(_j,d2){cout<<arr2[_i][_j]<<"\t";}cout<<endl;}}while(0);
#else
#define DBPRT(a) if(0){}
#define DBSTART if(0){
#define DBEND }
#define PRTLST(arr,num) if(0){}
#define PRTLST2(arr2,d1,d2) if(0){}
#define PRTLST2D(arr2,d1,d2) if(0){}
#endif

#define TOSUM(arr,sum,n) {sum[0]=arr[0];REP1(i,n-1) sum[i]=sum[i-1]+arr[i];}

#define MIN(target,v1) (target)=min(target,v1)
#define MAX(target,v1) (target)=max(target,v1) 
#define P1 first
#define P2 second
#define PB push_back
#define UB upper_bound
#define LB lower_bound
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF_INT = 2147483647;
const ll INF_LL = 9223372036854775807LL;
const ull INF_ULL = 18446744073709551615Ull;
const ll P = 92540646808111039LL;
const int Move[4][2] = {-1,0,0,1,1,0,0,-1};
const int Move_[8][2] = {-1,0,-1,-1,0,1,1,1,1,0,1,-1,0,-1,-1,-1};
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p) {os<<"( "<<p.P1<<" , "<<p.P2<<" )";return os;}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {ITE(v) os << (ite-v.begin()) << " : " << *ite <<endl;return os;}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& v) {os<<" { ";ITE(v) {os<<*ite;if(ite!=--v.end()){os<<" , ";}} os<<" } ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const map<T1,T2>& m) {ITE(m) {os<<ite->P1<<"\t\t|->\t\t"<<ite->P2<<endl;} return os;}

//---------------------
#define MAXN 200005
//---------------------

ll n;
ll a[MAXN];

int main(){
	cin >> n;
	REP(i,n) cin >> a[i];
	ll findnum = 1;
	REP(i,n){
		if(a[i]==findnum){
			findnum++;
		}
	}
	findnum--;
	if(findnum == 0)PRT(-1);
	else PRT(n-findnum);
	return 0;
}









Measured memory_bytes: 1792
#include<stdio.h>
int main(){
  int n,m,a,b,i;
  int d[200010]={};
  scanf("%d %d",&n,&m);
  while(m--){
    scanf("%d %d",&a,&b);
    if(a==1)d[b]+=2;
    if(b==1)d[a]+=2;
    if(a==n)d[b]+=1;
    if(b==n)d[a]+=1;
  }
  for(i=2;i<n;i++){
    if(d[i]==3)break;
  }
  if(i==n)printf("IM");
  printf("POSSIBLE\n");
  return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
#define int long long

using namespace std;

signed main(){
	int N,M;
	cin>>N>>M;
	int arr[N];
	for(int i=0;i<N;i++){
		cin>>arr[i];
	}
	int sum=0;
	for(auto i:arr){
		sum+=i;
	}
	sort(arr,arr+N);
	reverse(arr,arr+N);
	
	if(arr[M-1]>=sum*(1/((double)M*4))){
		cout<<"Yes";
	}
	else{
		cout<<"No";
	}
	
}

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

#define vi vector<int>
#define vl vector<long long>
#define vvi vector< vector<int> >
#define vvl vector< vector<ll> >
#define vp vector<P>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPD(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORD(i, a, b) for (int i = (int)(a); i >= (int)(b); i--)
#define INF 1e18
const int INFTY = 10000000;
const int mod = 1000000007;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

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

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

int n, m;
const int MAX_N = 16;
int dp[1<<MAX_N][MAX_N];
int d[MAX_N][MAX_N];

int rec(int S, int v) {
    if (dp[S][v] >= 0) return dp[S][v];
    if (S == (1<<n)-1 && v == 0) return dp[S][v] = 0;

    int res = INFTY;
    REP(u, n) {
        if (d[v][u] == INFTY) continue;
        if (!(S & (1<<u))) {
            chmin(res, rec((S | (1<<u)), u)+d[v][u]);
        }
    }
    return dp[S][v] = res;
}

int main() {
    cin >> n >> m;
    memset(dp, -1, sizeof(dp));
    REP(i, n) {
        REP(j, n) {
            d[i][j] = INFTY;
        }
    }
    REP(i, m) {
        int s, t, dist;
        cin >> s >> t >> dist;
        d[s][t] = dist;
    }
    int res = rec(0, 0);
    if (res == INFTY) cout << -1 << endl;
    else cout << res << endl;
    return 0;
}


Measured memory_bytes: 7196
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = LONG_LONG_MAX / 2;
const ll mod = 1000000000 + 7;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main() {
  int N;
  cin >> N;
  ll ans = 0;
  for (int i = 1; i <= N; i++) {
    ans += N / i;
    if (N % i == 0) ans--;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3648
from sys import stdin


def main():
    lines = stdin.readlines()
    N = int(lines[0].split()[0])
    S = lines[1]
    lr = [[int(j) - 1 for j in i.split()] for i in lines[2:]]
    AC = [0] * N
    pre = 0
    for i, c1, c2 in zip(range(1, N), S[:], S[1:]):
        AC[i] += pre
        if c1 == "A" and c2 == "C":
            AC[i] += 1
        pre = AC[i]
    for l, r in lr:
        print(AC[r] - AC[l])
    return


main()


Measured memory_bytes: 33172
//a
#include <iostream>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <memory>
#include <functional>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>

#define REP(i,b,n) for(int i=b;i<n;i++)
#define REPR(i,b,n) for(int i=n-1;i>=b;i--)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define EACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define BIT(n, b) ((n>>b) & 1)
#define PB push_back
#define MP make_pair

using namespace std;

static const double PI = acos(-1.0);
static const double EPS = 1e-9;
typedef long long ll;
typedef pair<int, int> pii;

int con[1000000] = {0};

int main(){
	
	for(int i=1; i<1000; ++i){
		
		int sum = i;
		
		for(int j=i+1; j<1000; ++j){
			sum += j;
			con[sum]++;
		}
	}
	
	int n;
	
	while(cin>>n, n){
		
		cout << con[n] << endl;
	}
	
	
	return 0;
}

Measured memory_bytes: 3112
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoderBeginnerContest
{
    public class Program
    {
        public static void Main(string[] args)
        {
            // A

            var line = Console.ReadLine().Split(' ');
            var a = long.Parse(line[0]);
            var b = long.Parse(line[1]);
            var c = long.Parse(line[2]);

            if(b-a == c-b )
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}


Measured memory_bytes: 13140
import sys
from collections import deque, defaultdict
import copy
import bisect
sys.setrecursionlimit(10 ** 9)
import math
import heapq
from itertools import product, permutations,combinations
import fractions

import sys
def input():
	return sys.stdin.readline().strip()

H, W = list(map(int, input().split()))
G = []
for i in range(H):
	G.append(input())

tansaku = [[0]*W for _ in range(H)]
total = 0
for i in range(H):
	for j in range(W):
		if tansaku[i][j] == 0 and G[i][j] == '#':
			tansaku[i][j] = 1
			black = 1
			white = 0
			que = deque([])
			que.append((i, j))
			delta = ((0, 1), (0, -1), (1, 0), (-1, 0))
			while len(que) > 0:
				loc = que.popleft()

				for d in range(4):
					x = loc[0] + delta[d][0]
					y = loc[1] + delta[d][1]
					if x >= H or y >= W or x < 0 or y < 0:
						continue

					if tansaku[x][y] == 0:
						if G[loc[0]][loc[1]] == '#' and G[x][y] == '.':
							white += 1
							tansaku[x][y] = 1
							que.append((x, y))
							#print((x, y), loc)
						elif G[loc[0]][loc[1]] == '.' and G[x][y] == '#':
							black += 1
							tansaku[x][y] = 1
							que.append((x, y))
							#print((x, y), loc, 1)
			total += black*white
			#print(i, j, black, white)
print(total)


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


//c++ templte for help............................................................................................................................................
typedef long long ll;

//template<typename... T>
//void print1(T... t){
	//((cout<<t<<" "),...);
//}

//template<typename... T>
//void print2(T... t){
		//vector<vector<ll>> ans={t...};
		//for(ll i=0;i<(ll)ans.size();i++){
			//if(i!=0) cout<<"\t\t";
			//else cout<<"\t";
			//for(ll j=0;j<(ll)ans[i].size();j++){
				//cout<<ans[i][j]<<" ";
			//}
			//if(i!=(ll)ans.size()-1)
			//cout<<endl;
		//}
//}	
//#define deb(...) cout<<" [ "#__VA_ARGS__<<" : "; print1(__VA_ARGS__); cout<<"]"<<endl; 
//#define vdeb(...) cout<<" [ "#__VA_ARGS__<<" : "; print2(__VA_ARGS__); cout<<"]"<<endl;





	
 
//for loop
//#define fo(i,n) for(int i=0;i<(ll)n;i++)
//#define Fo(i,k,n) for(int i=k;i<n;i++)
 
 
//to print vector element 
//template<typename T>
//void printV(T vec){
	//fo(i,vec.size()) cout<<vec[i]<<" "<<flush;
	//cout<<endl;
	//}
	
 
#define M int(1e9+7)
const int INF=1e9+5;
 
//iterate map
//template<typename T>
//void itR(T map){
	 //for(auto itr=map.begin();itr!=map.end();itr++){
				//deb(itr->first,itr->second);
			//}
	//cout<<endl;
//}
 
 
 
//c++ template for help...........................................................................................................................................


ll solve(){
	string s,t;
	cin>>s>>t;
	
	ll count=0;
	for(int i=0;i<s.size();i++){
		if(s[i]!=t[i]) count++;
	}
	
	return count;
}

int main() {
	//stringstream ss;
	//ss<<"akhil";
	//cout<<ss.str()<<endl;
	cout<<setprecision(50);
	ios::sync_with_stdio(0);
	cin.tie(0);
	

	//ll testCase;
	//cin>>testCase;
	//for(ll tt=0;tt<testCase;tt++){
		//solve();
		ll ans=solve();
		cout<<ans<<endl;
	//}
	return 0;
}


Measured memory_bytes: 3796
#! /usr/bin/python3
# Sum of Three Integers

"""
    2 ≦ K ≦ 2500
    0 ≦ S ≦ 3K
    K, S は整数である。
"""

test = False

K, S = map(int, input().split())


def scan(k, s):
    """
    x, y の値を動かすと z は一意に定まる。
    """
    counter = 0

    for x in range(k+1):
    # x = 0,1,2,…,k
        if x > s:
            break
        if s - x > 2*k:
            continue

        for y in range(K+1):
        # y = 0,1,2,…,k
            if x + y > s:
                break
            if s - x - y > k:
                continue
            if test:
                print('x = {}\ty = {}\tz = {}'.format(x, y, s-x-y))
            counter += 1

    return counter


def main():
    """
    関数に値を適用
    """
    answer = scan(K, S)
    print(answer)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#define r(i,n) for(int i=0; i<n; i++)
typedef long long ll;
using namespace std;

int main(void){
  int n;
  ll a[10010]={};
  ll b[10010]={};
  ll l=0;
  ll s=0;
  int t1=0;
  cin >> n;
  r(i,n){
    cin >> a[i];
  }
  r(i,n){
    cin >> b[i];
    if(a[i]<=b[i]){
      s+=b[i]-a[i];
      if((b[i]-a[i])%2==1){
        l+=(b[i]-a[i])/2+1;
      }else{
        l+=(b[i]-a[i])/2;
      }
    }
    else{
      l+=a[i]-b[i];
    }
  }

  if(s>=l){cout << "Yes" << endl;}
  else{cout << "No" << endl;}

  return 0;
}


Measured memory_bytes: 384
s=input()
n=len(s)
ans = [0]*n
cntR=0
cntL=0
nowL=False
idx=-1
for i in range(n):
	if s[i] == "R":
		if nowL:
			ans[idx-1] = (cntR+1)//2 +cntL//2
			ans[idx] = cntR//2 + (cntL+1)//2
			nowL=False
			cntR=0
			cntL=0
		cntR+=1
	else:
		cntL+=1
		nowL=True
		if s[i-1]=="R":
			idx = i

ans[idx-1] = (cntR+1)//2 +cntL//2
ans[idx] = cntR//2 + (cntL+1)//2

print(" ".join([str(x) for x in ans]))

Measured memory_bytes: 10492
#include<bits/stdc++.h>
using namespace std;
int a[1000];
int main()
{
	int n,m;
	int s=0,k,f;
	scanf("%d %d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&k);
		for(int j=1;j<=k;j++)
		{
			scanf("%d",&f);
			a[f]++;
		}
	}
	for(int i=1;i<=m;i++)
	{
		if(a[i]==n)
			s++;
	}
	printf("%d",s);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    long long int d, n;
    cin >> d >> n;
    if (n == 100) n += 1;
    if (d == 0) {
        cout << n << endl;
    } else if (d == 1) {
        cout << 100 * n << endl;
    } else {
        cout << n * 100 * 100 << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
using P = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using Graph = VV;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int Inf = (1 << 30);
ll inf = (1LL << 60);
const int MOD = 1e9 + 7;
int n;
void dfs(string s, int k) {
	if (s.size() == n) {
		cout << s << endl;
		return;
	}
	rep(i, k + 2) {
		string t = s;
		char ss = 'a';
		ss += i;
		t += ss;
		dfs(t, max(k, ss - 'a'));
	}
}
int main() {
	cin >> n;
	dfs("", -1);
	return 0;
}

Measured memory_bytes: 1536
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <math.h>

#define ll long long
#define vll vector<ll>
#define vvll vector<vll>
#define vstr vector<string>

using namespace std;

int main()
{
	ll test;
	cin >> test;
	ll ac = 0, tle = 0, wa = 0, re = 0;
	for (ll t = 0; t < test; t++)
	{
		//cout << "ans: " << endl;
		string str;
		cin >> str;
		if (str == "AC") ac++;
		if (str == "RE") re++;
		if (str == "TLE") tle++;
		if (str == "WA") wa++;
	}
	cout << "AC x " << ac << endl;
	cout << "WA x " << wa << endl;
	cout << "TLE x " << tle << endl;
	cout << "RE x " << re << endl;
}

Measured memory_bytes: 3228
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  int n; cin >> n;
  set<string> st;
  rep(i,n){
    string s; cin >> s;
    st.insert(s);
  }
  cout << st.size() << endl;
}

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

using namespace std;

typedef unsigned long long ull;
#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
#define all(a) (a).begin(), (a).end()

const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

int main(){
	int h, w;
	cin >> h >> w;
	int field[55][55];
	for(int i=0; i< 55; i++) for(int j=0; j< 55; j++) field[i][j] = inf;

	for(int i=0; i< h; i++){
		string s; cin >> s;
		for(int j=0; j< w; j++) field[i][j] = stoi(s.substr(j, 1));
	}
	for(int i = h-1; 0 <= i; i--){
		for(int j = w-1; 0 <= j; j--){
			if(i == h-1 && j == w-1) continue;
			field[i][j] += min(field[i+1][j], field[i][j+1]);
		}
	}
	cout << field[0][0] << endl;
}

Measured memory_bytes: 1232
x = gets.to_i
ans = []
for i in (-150)..150
  y = (x+(i**5))**0.2
  if (x+(i**5)) > 0 && y.to_i**5 - i**5 == x
    ans = [y.to_i,i]
    break
  end
end

puts "#{ans[0]} #{ans[1]}"

Measured memory_bytes: 14676
n,m = map(int,input().split())
st = [[int(i) for i in input().split()] for j in range(n)]
ch = [[int(i) for i in input().split()] for j in range(m)]
ans =[]
for i in range(n):
    a = st[i][0]
    b = st[i][1]
    md = [abs(a-ch[j][0]) + abs(b -ch[j][1]) for j in range(m)]
    ans += [md.index(min(md))+1]
for i in range(n):
    print(ans[i])

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                       \
  cerr << "(" << #x << "," << #y << ") = " \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define each(a, x) for (auto& a : (x))
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 3 * (1e6 + 5) + 5, INF = 5LL << 57, MOD = 1e9 + 7;

int X, Y;

void input() { cin >> X >> Y; }
const int MAX = MX;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
// comb
long long COM(int n, int k) {
  if (n < k) {
    return 0;
  }
  if (n < 0 || k < 0) {
    return 0;
  }
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int A, B;
void solve() {
  COMinit();
  if ((X + Y) % 3 != 0) {
    cout << 0 << endl;
    return;
  }

  int m = (X + Y) / 3;
  A = -1, B = -1;
  rep(a, 0, MX) {
    int b = m - a;
    if ((a + 2 * b == X) && (2 * a + b == Y)) {
      A = a;
      B = b;
      break;
    }
  }
  if (A < 0 || B < 0) {
    cout << 0 << endl;
    return;
  }

  cout << COM(A + B, A) << endl;
}

signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 70656
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve
{
    class Pair
    {
        public int Key { get; }
        public int Value { get; }
        public Pair(int a, int b)
        {
            Key = a;
            Value = b;
        }
    }

    public static int Main()
    {
        var nm = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int n = nm[0], m = nm[1];
        var pairs = new Pair[m];
        for (int i = 0; i < m; i++)
        {
            var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
            pairs[i] = new Pair(ab[0], ab[1]);
        }

        var secondWays = pairs.Where(e => e.Value == n).OrderBy(e => e.Key).ToArray();

        if (!secondWays.Any())
        {
            Console.WriteLine("IMPOSSIBLE");
            return 0;
        }
        var lastWay = secondWays[secondWays.Length - 1];
        var beginWay = secondWays[0];
        var firstWays = pairs.Where(e => e.Key == 1).Where(e => e.Value >= beginWay.Key).Where(e => e.Value <= lastWay.Key).OrderBy(e => e.Value).ToArray();


        var secondWayKeys = secondWays.Select(e => e.Key).ToArray();

        foreach (var firstWay in firstWays)
        {
            int index = Array.BinarySearch(secondWayKeys, firstWay.Value);

            if (index >= 0)
            {
                Console.WriteLine("POSSIBLE");
                return 0;
            }
        }

        Console.WriteLine("IMPOSSIBLE");

        return 0;
    }
}

Measured memory_bytes: 31508
N, K = map(int, input().split())
A_i = list(map(int, input().split()))

place = 1
road = [0 for i in range(N)]
cycle = 0

road[0] = 1

while K != 0:
    place = A_i[place - 1]
    K -= 1
    if road[place - 1] == 1:
        loop_place = place
        break
    road[place - 1] = 1

while K != 0:
    loop_place = A_i[loop_place - 1]
    cycle += 1

    if place == loop_place:
        break

if cycle != 0:
    K = K % cycle

while K != 0:
    place = A_i[place - 1]
    K -= 1

print(place)


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

int main() {
  int N, A, B;
  cin >> N >> A >> B;

  if ((N * A) < B) {
    cout << N * A << endl;
  }
  else if ((N * A) >= B) {
    cout << B << endl;
  }
 }


Measured memory_bytes: 256
#include"bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for (int i = b - 1; i > a; i--)
#define RREP(i, n) RFOR(i, 0, n)
#define rep(i, a, b) for (auto i = a; i < b; i++)
#define rrep(i, a, b) for (auto i = b; i > a; i--)
#define range(i, a, b) (a <= i && i < b)
#define fi first
#define fs first
#define se second
#define sc second
#define ll long long
using namespace std;
using vec = vector<int>;
using mat = vector<vec>;
typedef pair<int, int> P;

int h, w;
vector<string> s;
int dx[] = { 0,1,0,-1 }, dy[] = { -1,0,1,0 };

bool make(){
    bool flag = false;
    REP(i, h) REP(j, w) {
        if (s[i][j] == '#') continue;
        int check = 0;
        REP(k, 4) {
            int x = i + dx[k], y = j + dy[k];
            if (0 <= x && x < h && 0 <= y && y < w && s[x][y] == '.') check++;
        }
        if (check <= 1) s[i][j] = '#', flag = true;
    }
    return flag;
}

mat used(50,vec(50));
vector<P> nx;

bool dfs(int x, int y, int d,int pre) {

    if (nx[d].fi == x && nx[d].se == y)
    {
        ++d;
        if (d == 4)
        {
            return true;
        }
    }

    REP(i, 4) {
        int k = (i + pre - 1 + 4) % 4;
        int xx = x + dx[k], yy = y + dy[k];
        if (0 <= xx && xx < h && 0 <= yy && yy < w && s[xx][yy] == '.' && used[xx][yy] == 0) {
            used[xx][yy] = 1;
            if (dfs(xx, yy, d, k))return true;
            //used[xx][yy] = 0;
            continue;
        }
    }

    return false;
}

bool check() {
    int x = 0, y = 0, d = 0;
    while (d<4) {
        bool flag = true;
        REP(i, 4) {
            int k = (i + d) % 4;
            int xx = x + dx[k], yy = y + dy[k];
            if (0 <= xx && xx < h && 0 <= yy && yy < w && s[xx][yy] == '.' && used[xx][yy] == 0) {
                x = xx; y = yy; used[x][y] = 1; flag = false;
                break;
            }
        }
        if (flag) return false;
        if (x == nx[d].fs && y == nx[d].sc) d++;
    } 
    return true;
}

void solve() {
    nx = { P(h - 1,0),P(h - 1,w - 1),P(0,w - 1),P(0,0) };
    s.resize(h);
    REP(i, h) cin >> s[i];

    /*while (1) {
        if (!make()) break;
    }*/

    //REP(i, h) {
    //    REP(j, w) cout << s[i][j];
    //    cout << endl;
    //}
    //cout << endl;

    if (s[0][0] == '#' || s[0][w - 1] == '#' || s[h - 1][0] == '#' || s[h - 1][w - 1] == '#') {
        cout << "NO" << endl;
        return;
    } 

    REP(i, 50) used[i].assign(50, 0);
    if (dfs(0,0,0,1)) cout << "YES" << endl;
    else cout << "NO" << endl;
} 

int main() {
    while (cin >> h >> w, h) solve();
}


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

class Cube{
public:
	int f[6];
	Cube(){}
	void roll_z(){ roll(1,2,4,3);}
	void roll_y(){ roll(0,2,5,3);}
	void roll_x(){ roll(0,1,5,4);}
	void roll(int i,int j,int k,int l){
		int t = f[i]; f[i]= f[j]; f[j]=f[k]; f[k]=f[l]; f[l] = t; 
	}
};

int getRight( Cube c1, int f1, int f2){
	for(int i = 0; i < 6; i++){
		for(int j = 0; j < 4; j++){
			if( c1.f[0] == f1 && c1.f[1] == f2) return c1.f[2];
			c1.roll_z();
		}
		if( i % 2 == 0 )c1.roll_y();
		else c1.roll_x();
	}
	return -1;
}

int main(){
	Cube c;
	int f1,  f2;

	for( int i = 0; i < 6; i++)cin >> c.f[i];
	int q; cin >> q;

	for( int i = 0; i < q; i++){
		cin >> f1 >> f2;
		cout << getRight(c, f1, f2) << endl;
	}

	return 0;
}

Measured memory_bytes: 3080
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
int n;//細胞の数

double cost[100][100];
double mincost[100];//集合Xからの辺の最小コスト
bool used[100];
double X[100],Y[100],Z[100],R[100];
#define INF 10000000
double prime(){
  for(int i = 0;i <n;i++){
    mincost[i] = INF;
    used[i] = false;
  }
  mincost[0] = 0;
  double res = 0;
  while(1){
    int v = -1;
    for(int u = 0;u <n;u++){
      if(!used[u]&&(v==-1||mincost[u]<mincost[v]))
	v = u;
    }
    if(v==-1)
      break;
    used[v] = true;
    res +=mincost[v];
    for(int u =0;u <n;u++){
      mincost[u] =min(mincost[u],min(cost[v][u],cost[u][v]));
    }
  }
  return res;
}



int main()
{
  while(cin>>n,n){
    
    for(int i = 0;i < n;i++){
      cin>>X[i]>>Y[i]>>Z[i]>>R[i];
    }
    for(int i = 0;i < n-1;i++){
      for(int j = i+1;j < n;j++){
	double du =(X[i]-X[j])*(X[i]-X[j])+(Y[i]-Y[j])*(Y[i]-Y[j])+(Z[i]-Z[j])*(Z[i]-Z[j]);
	double d =sqrt(du)-(R[i]+R[j]);
	if(d <=0){
	  cost[i][j] = 0;
	  cost[j][i] = 0;
	}else{
	  cost[i][j] = d;
	  cost[j][i] = d;
	}
      }
    }
    printf("%.3lf\n",prime());
  }
  return 0;
}

Measured memory_bytes: 1324
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int64_t power = 1;
  for (int i = 1; i<N+1; i++) {
    power *= i;
    power %= 1000000000 + 7;
    
  }
  cout << power << endl;
}

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

using namespace std;

#define	MOD	1000000007

int main(int argc, char *argv[])
{
	int n, k;
	cin >> n >> k;
	vector<long long> a, b;
	for (int i = 0; i < n; i++) {
		long long x;
		cin >> x;
		if (x < 0) b.push_back(-x);
		else a.push_back(x);
	}

	sort(a.begin(), a.end());
	sort(b.begin(), b.end(), greater<long long>());

	long long ans = 1;
	if (n == k) {
		for (int i = 0; i < a.size(); i++) ans = ans * a[i] % MOD;
		for (int i = 0; i < b.size(); i++) ans = ans * b[i] % MOD;
		if (b.size() % 2) ans = (MOD - ans) % MOD;
	} else if (a.size() == 0) {
		if (k % 2) {
			for (int i = 0; i < k; i++) ans = ans * b[b.size() - 1 - i] % MOD;
			ans = (MOD - ans) % MOD;
		} else {
			for (int i = 0; i < k; i++) ans = ans * b[i] % MOD;
		}
	} else {
		ans = 0;
		vector<long double> x(1, 0), y(1, 0);
		for (int i = a.size() - 1; i >= 0; i--)
			if (a[i] != 0) x.push_back(logl(a[i]));
		for (int i = 0; i < b.size(); i++)
			if (b[i] != 0) y.push_back(logl(b[i]));

		for (int i = 1; i < x.size(); i++) x[i] += x[i - 1];
		for (int i = 1; i < y.size(); i++) y[i] += y[i - 1];

		int best_i = -1;
		long double best = -1;
		for (int i = 0; i < y.size() && i <= k; i += 2) {
			long double c = y[i];
			if (k - i >= 0 && k - i < x.size()) {
				c += x[k - i];
				if (best_i < 0 || c > best) {
					best_i = i;
					best = c;
				}
			}
		}
		if (best_i >= 0) {
			int i = best_i;
			ans = 1;
			for (int j = 0; j < i; j++) ans = ans * b[j] % MOD;
			for (int j = 0; j < (k - i); j++)
				ans = ans * a[a.size() - 1 - j] % MOD;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 10904
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;

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

        int n = sc.nextInt();
        int d = sc.nextInt();

        int sv = 2 * d + 1;

        if(n % sv == 0){
            System.out.println(n / sv);
        }else{
            System.out.println(n / sv + 1);
        }
        
        

        






    }
}

Measured memory_bytes: 23764
class Integer
  def mod_pow(n, mod)
    x = self
    res = 1

    while n > 0
      res = res * x % mod if n[0] == 1
      x = x * x % mod
      n >>= 1
    end

    res
  end

  def mod_inverse(mod = 10 ** 9 + 7)
    mod_pow(mod - 2, mod)
  end
end

MOD = 10 ** 9 + 7
N = gets.to_i
X = gets.split.map(&:to_i)

D = X.each_cons(2).map { |a, b| b - a }

cn = [0]

1.upto(N) do |n|
  cn << cn.last + n.mod_inverse
  cn[n] %= MOD
end

ans = 0

D.each.with_index(1) do |d, i|
  ans += d * cn[i]
  ans %= MOD
end

v = 1
1.upto(N - 1) do |i|
  v *= i
  v %= MOD
end

puts (ans * v) % MOD


Measured memory_bytes: 12860
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		try (Scanner sc = new Scanner(System.in);) {
			
			List<Double> answer = new ArrayList<>();
			
			while(true) {
				int n = sc.nextInt();
				
				if(n == 0) break;
				
				List<Integer> points = new ArrayList<>();
				int sum = 0;
				
				for(int i = 0; i < n; i++) {
					int point = sc.nextInt();
					points.add(point);
					sum += point;
				}
				
				double average = (double)sum / n;
				
				double sigmaSum = 0;
				for(int p : points) {
					sigmaSum += (p - average) * (p - average);
				}
				double variance = sigmaSum / n;
				double deviation = Math.sqrt(variance);
				
				answer.add(deviation);
			}
			
			answer.stream().forEach(e -> System.out.format("%.6f\n", e));
		}
	}
}


Measured memory_bytes: 35620
import sys


def resolve():
    import numpy as np

    readline = sys.stdin.readline

    N = int(readline())

    f = np.zeros(10001, np.int64)

    for x in range(1, 101):
        for y in range(1, 101):
            for z in range(1, 101):
                n = x * x + y * y + z * z + x * y + y * z + z * x
                if n > 10000:
                    continue
                f[n] += 1
    for i in range(1, N + 1):
        print(f[i])

resolve()


Measured memory_bytes: 27268
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.util.LinkedList;
import java.util.Arrays;
import java.util.stream.Collectors;

class Main {
  public static void main(String[] args) {
    try {
        var stdin = new BufferedReader(new InputStreamReader(System.in));
        String line = null;
        
        // 読み込み
        while((line = stdin.readLine()) == null);
        Long n = Long.valueOf(line);
        
        if (n == 1) {
            System.out.println("0");
            return;
        }
        
        line = null;
        while((line = stdin.readLine()) == null);
        var splited = line.split(" ");
        var a = Arrays.asList(line.split(" ")).stream().map(s -> Long.valueOf(s)).collect(Collectors.toList());
        
        Long result = 0L;
        for(Integer i = 0; i < n - 1;i++) {
            Long dai = Math.max(0, a.get(i) - a.get(i+1));
            result += dai;
            a.set(i + 1, a.get(i+1) + dai);
        }
        
        System.out.println(result);
    } catch(Exception e) {
    }
   
  }
}

Measured memory_bytes: 84596
#include <bits/stdc++.h>
#define ld double
#define ull unsigned long long
#define ll long long
#define pii pair <int, int>
#define iiii pair <int, pii >
#define mp make_pair
#define INF 1000000000
#define MOD 1000000007
#define rep(i, x) for(int (i) = 0; (i) < (x); (i)++)
inline int getint() {
  int x = 0, p = 1; char c = getchar();	
  while (c <= 32) c = getchar();
  if (c == 45) p = -p, c = getchar();
  while (c > 32) x = x * 10 + c - 48, c = getchar();
  return x * p;
}
using namespace std;
//ruogu_alter
const int N = 2e5 + 10;
const int s = N - 1;
const int t = N - 2;
int n, pre[N], pree[N], flow[N];
ll dis[N];
bool vis[N];
struct edge {
  int to, val, cost, rev;
};
const ll inf = 2e18;
vector<edge> g[N];
//
inline void addedge(int x, int y, int z, int w) {
  g[x].emplace_back((edge){y, z, w, (int)g[y].size()});
  g[y].emplace_back((edge){x, 0, -w, (int)g[x].size() - 1}); 
}
bool spfa() {
  memset(vis, 0, sizeof(vis)); pre[t] = -1;
  rep(i, N) dis[i] = -inf, flow[i] = INF; dis[s] = 0;
  queue<int> qu; qu.emplace(s);
  while (qu.size()) {  
    int u = qu.front(); qu.pop(); vis[u] = false;
    rep(i, g[u].size()) {
      edge &e = g[u][i];
      if (e.val && dis[e.to] < 1ll * e.cost + dis[u]) {
        dis[e.to] = 1ll * e.cost + dis[u];
        pre[e.to] = u;
        pree[e.to] = i;
        flow[e.to] = min(flow[u], e.val);
        if (!vis[e.to]) {
          vis[e.to] = true;
          qu.emplace(e.to);
        }
      }
    }
  }
  return pre[t] >= 0;
}
ll ek() {
  ll res = 0;
  while (spfa()) {
    int now = t;
    res += 1ll * flow[t] * dis[t];
    while (now != s) {
      int u = pre[now], x = pree[now];
      g[u][x].val -= flow[t];
      g[now][g[u][x].rev].val += flow[t];
      now = u;
    }
  }
  return res;
}
int main() {
  n = getint();
  rep(i, n) {
    int x = getint(), y = getint(), c = getint();
    addedge(s, i, c, 0);
    addedge(i, 2 * n, INF, x + y);
    addedge(i, 2 * n + 1, INF, x - y);
    addedge(i, 2 * n + 2, INF, y - x);
    addedge(i, 2 * n + 3, INF, -x - y);
  }
  for (int i = n; i < 2 * n; i++) {
    int x = getint(), y = getint(), c = getint();
    addedge(i, t, c, 0);
    addedge(2 * n, i, INF, -x - y);
    addedge(2 * n + 1, i, INF, y - x);
    addedge(2 * n + 2, i, INF, x - y);
    addedge(2 * n + 3, i, INF, x + y);
  }
  cout << ek() << endl;
  return 0;
}


Measured memory_bytes: 8832
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>

#define CH(N,A,B) (A<=N&&N<B)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define RREP(i,a,b) for(int i=(b-1);a<=i;i--)

using namespace std;

int N, candidate[26];

int main() {
  while(1){
    cin>>N;
    if(N==0) break;
    int left = N, ansNum = 0;
    char ansId;
    bool flag = false;
    REP(i,0,26) candidate[i] = 0;
    vector<int> v;
    REP(i,0,N){
      char tmp;
      cin>>tmp;
      v.push_back(tmp);
    }
    REP(i,0,v.size()){
      char tmp = v[i];
      candidate[tmp-'A']++;
      int t[26];
      REP(j,0,26) t[j]=candidate[j];
      sort(t,t+26);
      left--;
      if(t[25] > t[24]+left){
        flag = true;
        ansNum = i+1;
        REP(k,0,26){
          if(candidate[k]==t[25]){
            ansId = (char)('A'+k);
            break;
          }
        }
        break;
      }
    }
    if(flag) cout<<ansId<<" "<<ansNum<<endl;
    else cout<<"TIE"<<endl;
  }

  return 0;
}

Measured memory_bytes: 3112
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//long long型の最大値(LLONG_MAX)など
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;
typedef long double lb;

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


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

    if(a > 0){
        cout << "Positive" << endl;
    }else if(a <= 0 && 0 <= b){
        cout << "Zero" << endl;
    }else if((b-a+1) % 2 == 0){
        cout << "Positive" << endl;
    }else{
        cout << "Negative" << endl;
    }
}


Measured memory_bytes: 3596
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
main(){
int n,a[1000];
while(1){
cin >>n;
if(n==0) break;
for(int i=0;i<n;i++) cin >>a[i];
int sum=0;
for(int i=0;i<n;i++) sum=sum+a[i];
double m=1.0*sum/n;
double dist=0.0;
for(int i=0;i<n;i++){
dist=dist+(m-a[i])*(m-a[i]);
}
printf("%lf\n",sqrt(dist/n));
}
}

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

int main() {
    int N, AC = 0, WA = 0, TLE = 0, RE = 0;
    string S;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> S;
        if (S == "AC") {
            ++AC;
        }
        if (S == "WA") {
            ++WA;
        }
        if (S == "TLE") {
            ++TLE;
        }
        if (S == "RE") {
            ++RE;
        }
    }

    cout << "AC x " << AC << endl;
    cout << "WA x " << WA << endl;
    cout << "TLE x " << TLE << endl;
    cout << "RE x " << RE << endl;
}

Measured memory_bytes: 3616
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <list>
#include <cmath>
using namespace std;
typedef long long ll;
#define rep(i,m,n) for (int i = (ll) (m); i < (int) (n); i++)
#define per(i,n,m) for (int i = (ll) (n-1); i >= (int) (m); i--)
#define all(x)     (x).begin(), (x).end()
ll gcd(ll x,ll y){
    if(y==0)return x;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
    return x*y/gcd(x,y);
}
int main(void){
    string S;
    ll N,i,base=1,rem=0,ans=0,keta=1,count;
    ll mod[2019]={0};
    cin>>S;
    N=S.size();
    //余り
    mod[0]=1;
    for(i=N-1;i>=0;i--){
        //ある桁においての余り
        count=(rem+(S[i]-'0')*keta)%2019;
        rem=count;
        //ユークリッドの互除法(桁分の余り)
        keta=(keta*10)%2019;
        //同じ余りが生じた際、割り切れるものが存在するため、保存
        ans+=mod[count];
        mod[count]++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3776
# 2019/12/27

from heapq import heapify,heappop,heappush
import sys

input=sys.stdin.readline
n,m=map(int,input().split())
ab=[[] for _ in range(m+1)]

for i in range(n):
    a,b=map(int,input().split())
    if a>m:continue
    ab[a].append(-b)

que=[]
heapify(que)
ans=0
for i in range(1,m+1):
    if ab[i]:
        for e in ab[i]:
            heappush(que,e)
    if que:
        ans+=heappop(que)

print(-ans)

Measured memory_bytes: 17604
#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) rep2(i,0,n)

using namespace std;


main(){
    ll int a,b;
    int k;
    cin>>a>>b>>k;
    rep2(i,a,b+1){
        if((i-a)<k||(b-i)<k)
        cout<<i<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void) {
    int sum = 0;

    int i, score;
    for(i = 0; i < 5; i++) {
        scanf("%d", &score);
        if(score >= 40) sum += score;
        else            sum += 40;
    }

    printf("%d\n", sum / 5);

    return 0;
}

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

int main() {
  	int n;
  string s;
  cin >> n >> s;
  int cnt = 0;
  for (int i=0; i+2<n; i++)
    if (s[i] == 'A')
      if (s[i+1] == 'B')
        if (s[i+2] == 'C')
          ++cnt;
  
  cout << cnt << '\n';
  
	return 0;
}

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

typedef string::iterator state;
typedef map<char, bool> Env;

char get_oper(state& s) {
    if (*s == '-') {
        ++s;
    }

    return *(s++);
}


bool formula(state& s, Env& env) {
    if (*s == 'T') {
        ++s;
        return true;
    }
    if (*s == 'F') {
        ++s;
        return false;
    }

    if ('a' <= *s && *s <= 'k') {
        return env[*(s++)];
    }

    if (*s == '-') {
        return !formula(++s, env);
    }

    assert(*s == '(');

    ++s; // '('
    bool lhs = formula(s, env);
    char oper = get_oper(s);
    bool rhs = formula(s, env);
    ++s; // ')'

    if (oper == '*') {
        return lhs && rhs;
    } else if (oper == '+') {
        return lhs || rhs;
    } else if (oper == '>') {
        return !lhs || rhs;
    }

    return NULL;
}

bool equation(state& s, Env env) {
    bool left = formula(s, env);

    assert((*s) == '=');
    ++s;

    bool right = formula(s, env);
    return left == right;
}

int main() {
    Env env;
    string expr;
    while (true) {
        cin >> expr;
        if (expr == "#") {
            break;
        }

        bool is_equation = true;

        for (int k = 0; k < (1 << 11) && is_equation; ++k) {
            for (int l = 0; l < 11; ++l) {
                env['a' + l] = (k & (1 << l)) != 0;
            }

            auto iter = begin(expr);
            bool res = equation(iter, env);
            is_equation = is_equation && res;
        }

        cout << (is_equation ? "YES" : "NO") << endl;
    }
    return 0;
}

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

#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
#define test cout<<"test"<<endl;
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
const ll zero=0;
using P = pair<ll, ll>;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0;
  bool judge = true;
  ll n;cin>>n;
  vector<ll>a(n);
  for(i=0;i<n;i++)cin>>a[i];
  sort(ALL(a));
  ll sumbuf=a[0];res=1;
  for(i=1;i<n;i++){
    if(sumbuf*2>=a[i]){
      sumbuf+=a[i];
      res++;
    }
    else{
      res=1;
      sumbuf+=a[i];
    }
  }
  cout<<res<<endl;

  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
 
int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}
 
int main() {
  int n;
  cin>>n;
  vector<int> a(n);
  rep(i,n) cin>>a[i];
  vector<int> l(n), r(n);
  rep(i,n-1) l[i+1] = gcd(l[i], a[i]);
  for (int i = n-1; i >= 1; i--) r[i-1] = gcd(r[i], a[i]);
  int ans = 1;
  rep(i,n) ans = max(ans, gcd(l[i],r[i]));
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 1408
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        PriorityQueue<Integer> surplus = new PriorityQueue<>(Comparator.reverseOrder());
        int count = 0;
        long shortage = 0L;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            b[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            if (a[i] == b[i]) continue;
            if (a[i] > b[i]) {
                surplus.add(a[i] - b[i]);
            } else {
                shortage += b[i] - a[i];
                count++;
            }
        }
        while (shortage > 0) {
            Integer i = surplus.poll();
            if (i == null) {
                System.out.println(-1);
                return;
            }
            shortage -= i;
            count++;
        }

        System.out.println(count);
    }
}


Measured memory_bytes: 86788
while 1:
    n,p=map(int,input().split())
    if n==0:break
    a=[0]*n
    b,c=0,p
    while 1:
        b%=n
        if c==0:c,a[b]=a[b],0
        else:
            c-=1
            a[b]+=1
        if a[b]==p:break
        b+=1
    print(b)

Measured memory_bytes: 7592