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

#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(NULL);
#define mem(i,j) memset(i,j,sizeof (i));
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(), (a).end()
#define lowbit(x) ((x)&(-(x)))
#define siz(v) (long long)(v).size()
typedef int64_t ll;
typedef uint64_t ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
const double EPS  = 1e-8;
const int INF     = 0x3F3F3F3F;
const ll LINF     = 4611686018427387903;
const int MOD     = 1e9+7;
const int MAXN    = 2e5+9;
/*-----------------------------------------------------------------------------------------------------*/

signed main() {
	EmiliaMyWife

	ll a, b = 100, i;
	cin >> a;
	for(i = 0; b < a; i++, b+=(b/100)) ;
	cout << i;

	return 0;
}


Measured memory_bytes: 3648
function main(input) {
  var a = input[1].trim().split(" ").map(e => parseInt(e, 10));
  var a_max = 10**6+1;
  var dp = new Array(a_max+1).fill(0);
  for(var i of a){
    dp[i]++;
  }
 
  for(var i=1;i<=a_max;i++){
    if(dp[i]===0){ 
      continue;
    }
    for(var j=i+i;j<=a_max;j+=i){
      if(dp[j]!==0){
        dp[j]=0;
      }
    }
  }
  console.log(dp.filter(function(x){return x===1}).length);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));

Measured memory_bytes: 66052
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <string>
#include <math.h>
#include <vector>
#include <cstdlib>
#include <queue>
#include <iomanip> //小数点以下を表示させる(setprecision())

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n';

typedef long long ll;

using namespace std;

int main()
{

    int A, B;
    cin >> A >> B;

    if (A >= B)
    {
        cout << 10 << endl;
    }
    else
    {
        cout << 0 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
n = int(input())
A = [int(input()) for i in range(n)]
ans = 0
light = 1
list = [0] * n

while True:
    if light == 2:
        break
    elif list[light - 1] == 1:
        ans = -1
        break
    else:
        ans = ans + 1
        list[light - 1] = 1
        light = A[light - 1]

print(ans)

Measured memory_bytes: 7852
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int h,n,dp[10001][16],i,j,wk1,wk2,wk3,x,y,a[10001],k,mx;
	int pat[4]={3,6,12,15},b[4]={1,2,4,8},cnt[4]={1,1,1,2};
	scanf("%d %d",&h,&n);
	for(i=0;i<h;i++)	a[i]=0;
	for(i=0;i<n;i++)	{
		scanf("%d %d",&x,&y);
		a[y]=(a[y]|b[x]);
	}
//	for(i=0;i<h;i++)	printf("%d\n",a[i]);
	for(i=0;i<h;i++)	{
		for(j=0;j<16;j++)	dp[i][j]=0;
	}
	for(i=0;i<4;i++)	{
		wk1=a[0]&pat[i];
		wk2=a[1]&pat[i];
		if(wk1==0 && wk2==0)	{
			wk3=a[1]|pat[i];
			dp[1][wk3]=cnt[i];
		}
	}
//	for(i=0;i<16;i++)	printf(" %d",dp[1][i]);	printf("\n");
	for(i=1;i<h-1;i++)	{
		for(j=0;j<16;j++)	{
//			if(dp[i][j]!=0)	{
				wk3=a[i+1];
				dp[i+1][wk3]=max(dp[i+1][wk3],dp[i][j]);
				for(k=0;k<4;k++)	{
					wk1=(j|a[i])&pat[k];
					wk2=a[i+1]&pat[k];
					if(wk1==0 && wk2==0)	{
//						if(i==2)	printf("j=%d\n",j);
						wk3=a[i+1]|pat[k];
						dp[i+1][wk3]=max(dp[i+1][wk3],dp[i][j]+cnt[k]);
					}
				}
//			}
		}
	}
//	for(i=0;i<h;i++)	{
//		for(j=0;j<16;j++)	printf("%d ",dp[i][j]);
//		printf("\n");
//	}
	
	
	mx=-1;
	for(i=0;i<16;i++)	mx=max(mx,dp[h-1][i]);
	printf("%d\n",mx);
	return 0;
}


Measured memory_bytes: 3400
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{

	public static void main(String[] arg) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] str = br.readLine().split(" ");

		double a = Double.parseDouble(str[0]);
		double b = Double.parseDouble(str[1]);
		double degree = Double.parseDouble(str[2]);

		double rad = Math.toRadians(degree);

		double cx = b * Math.cos(rad) * (-1) + a;
		double cy = b * Math.sin(rad);

		double sq = (a*cy) / 2;
		double len = Math.sqrt(cx*cx + cy*cy) + a + b;

		System.out.printf("%.5f %.5f %.5f\n",sq ,len ,cy);
	}
}

Measured memory_bytes: 24820
import sys
h, w = map(int, input().split())
C = [list(input()) for i in range(h)]
ans = 0

for i in range(h):
    for j in range(w):
        visited = [[0 for i in range(w)] for i in range(h)]
        data = []
        if C[i][j] == '.':
            data.append([i, j])
            visited[i][j] = 1
            
            dy_dx = [[1,0], [0,1], [-1,0], [0,-1]]
            
            while len(data) > 0:
                now = data.pop(0)
                for k in range(4):
                    y = now[0] + dy_dx[k][0]
                    x = now[1] + dy_dx[k][1]
                    
                    if 0 <= y and y < h and 0 <= x and x < w:
                        if C[y][x] != '#' and visited[y][x] == 0:
                            #移動回数カウント
                            visited[y][x] = visited[now[0]][now[1]] + 1
                            data.append([y, x])
        for l in range(h):
            for m in range(w):
                ans = max(ans, visited[l][m])

print(ans - 1)

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

using namespace std;
const double PI=3.14159265358979323846;

#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))


int main() {

	int N;

	cin >> N;

	int i = N % 10;
	int ii = (N / 10) % 10;
	int iii = (N / 100) % 10;

	string ans = "No";
	if (i == 7 || ii == 7 || iii == 7) ans = "Yes";

	cout << ans << endl;

}

Measured memory_bytes: 3620
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long 
int F[2100010];

int Mul(int a, int b) {
	return ((a % mod) * (b % mod)) % mod;
}

void fact(void) {
	F[0] = 1;
	F[1] = 1;
	for (int i = 2; i <= 2100000; i++) {
		F[i] = Mul(i, F[i - 1]);
	}
}
int square(int x) {
	return (x * x) % mod;
}

int power(int x, int y) {
	if (y == 0) return 1;
	else if (y == 1) return x % mod;
	else if (y % 2 == 0) return square(power(x, y / 2)) % mod;
	else return square(power(x, y / 2)) * x % mod;
}

int Div(int a, int b) {
	return Mul(a, power(b, mod - 2));
}
int P(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	return Div(F[n], F[n - r]);
}

int C(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	int ret;
	ret = Div(F[n], Mul(F[n - r], F[r]));
	return ret;
}
int H(int n, int r) {
	if (n == 0 && r == 0) return 1;
	return C(n + r - 1, r);
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    if(abs(n - m) > 1) {
        cout << 0 << endl;
        return 0;
    }
    fact();
    if(n == m) {
        cout << Mul(2, Mul(F[n], F[n])) << endl;
    } else {
        cout << Mul(F[n], F[m]) << endl;
    }

    return 0;
}


Measured memory_bytes: 16640
#include <iostream>
#include <iomanip> //setprecision()
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <set>
using ll = long long;
using namespace std;

double Mcos(double k){return cos(k*atan(1.0)*4/180);}

void monmo(){
    
}

int main() {
    ll n;
    string name="abcdefghijklmnopqrstuvwxyz";
    string ans="";
    cin>>n;
    while(n>0){
        n--;
        ans+=name[n%26];
        n/=26;
    }
    
    for(int i=ans.size()-1;i>=0;i--){
        cout<<ans[i];
    }
    
}

 


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

#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << ": " << arg1 << "\t|";
    __f(comma + 1, args...);
}


#define print(x) for(auto it : x) cout<< it << ' '; cout << '\n';
typedef long long ll;
typedef unsigned long long ull;

const int MOD = 1e9 + 7;
ll mod(ll a) { return (ll) (a % MOD + MOD) % MOD; }
ll mul(ll a, ll b) { return (ll) mod(mod(a) * mod(b));}

int w[100];
int v[100];

ll dp[100][100001];

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int N, W; cin >> N >> W;
    for (int i = 0; i < N; i++)
        cin >> w[i] >> v[i];

    dp[0][0] = 0;
    dp[0][w[0]] = v[0];
    for (int i = 1; i < N; i++) {
        dp[i][0] = 0;
        for (int j = 1; j <= W; j++) {
            // leave it
            dp[i][j] = dp[i - 1][j];
            
            // take it
            if (j >= w[i])
                dp[i][j] = max(dp[i][j], v[i] + dp[i - 1][j - w[i]]);
        }
    }
    ll ans = 0;
    for (int j = 0; j <= W; j++) {
        ans = max(ans, dp[N - 1][j]);
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 80964
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n; scanf("%d", &n); std::vector<int> a(n), b(n);
	for(int i = 0; i < n; i++) scanf("%d", &a[i]);
	for(int i = 0; i < n; i++) scanf("%d", &b[i]);
	
	std::vector<int> tan(n, -1); tan[0] = a[0]; tan[n - 1] = b[n - 1];
	for(int i = 0; i < n - 1; i++) {
		if(a[i] == a[i + 1]) continue;
		tan[i + 1] = a[i + 1];
	}
	for(int i = n - 1; i > 0; i--) {
		if(b[i] == b[i - 1]) continue;
		if(tan[i - 1] != -1 and tan[i - 1] != b[i - 1]) {
			printf("0\n");
			return 0;
		}
		tan[i - 1] = b[i - 1];
	}
	if(a[n - 1] != b[0]) {
		printf("0\n");
		return 0;
	}
	for(int i = 0; i < n - 1; i++) {
		if(std::max(a[i], b[i + 1]) == a[n - 1]) continue;
		printf("0\n");
		return 0;
	}
	
	i64 ans = 1;
	const int MOD = 1e9 + 7;
	for(int i = 0; i < n; i++) {
		if(~tan[i]) continue;
		(ans *= std::min(a[i], b[i])) %= MOD;
	}
	
	printf("%lld\n", ans);
	return 0;
}


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

int main() {
  int a,b;
  cin >> a >> b;
  string s = to_string(b);
  int x = a*pow(10,s.size()) + b;
  bool ok = false;
  for (int i = 0;i<x;i++) {
    if (i*i==x) ok = true;
  }
  if (ok) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
map<string,int> mp;
int main()
{
	vector<string> v;
	string s;
	int n,i,m=0;
	cin>>n;
	map<string,int>::iterator it;
	for(i=0;i<n;i++){
		cin>>s;
		mp[s]++;
		m=max(mp[s],m);
	}
	for(it=mp.begin();it!=mp.end();it++){
		if(it->second==m){
			v.push_back(it->first);
		}
	}
	sort(v.begin(),v.end());
	int sz=v.size();
	for(i=0;i<sz;i++){
		cout<<v[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 26868
#include<stdio.h>

#define MAX_N 300000

int n, q, c, qq;
int chk[MAX_N + 1];

int main(void)
{
	int max;
	int i, j;
	
	max = 0;
	for( i=0; i<MAX_N + 1; i++ ) {
		chk[i] = 0;
	}
	
	scanf( "%d %d", &n, &q );
	
	while ( n-- ) {
		scanf( "%d", &c );
		chk[c] = 1;
		if ( max < c ) max = c;
	}
	
	while ( q-- ) {
		scanf( "%d", &qq );
		for( i=qq-1; ; i-- ) {
			for( j=i; j <= max; j+=qq ) {
				if ( chk[j] ) {
					printf( "%d\n", i );
					goto NUKI;
				}
			}
		}
		
		NUKI:;
	}
	
	return 0;
}

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll N, A, B, N2;
ll i, j, k, ans;
int main(){
    scanf("%lld%lld%lld", &N, &A, &B);
    if(abs(A-B)%2==0){
        printf("%lld", abs(A - B) / 2);
    }else{
        ll a = (A + B - 1) / 2;
        ll b = (N - A + N - B + 1) / 2;
        printf("%lld", min(a, b));
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

int main(int argc, char const *argv[]) {
    ll k,a,b;
    cin >> k >> a >> b;

    // A個+1個 > b個 -> k+1
    // A個+1個 <= b個 -> k/(a+1)*b+k%(a+1)
    if (a+1 >= b) cout << k+1 << endl;
    else {
        ll ans = 0ll;
        k = k-a+1;

        ll tmp = k/2;
        ans = tmp*b-(tmp-1)*a;
        ans += k%2;

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

Measured memory_bytes: 256
N=input()
p=list(map(int,input().split()))
p_sample=sorted(p)
ans=[]

for i ,j in zip(p,p_sample):
    if i == j:
        ans.append(0)
    else:
        ans.append(1)

if sum(ans) <= 2:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int A,B,C;
    cin >> A >> B >> C;
    for(int i=1; i<=B; i++){
        if(A*i%B==C){
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
}

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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

// clang-format off
template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) { return stream << p.first << "," << p.second; }
template <typename T>
void print(const vector<T> vec) { rep (i, vec.size() - 1) cout << vec[i] << ' '; cout << vec[vec.size() - 1] << '\n'; }
template <typename Arg>
void print(const Arg arg) { cout << arg << '\n'; }
template <typename Head, typename... Args>
void print(const Head head, const Args... args) { cout << head << " "; print(args...); }
template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) { rep (i, v.size()) cin >> v[i] >> w[i]; }
template <typename T>
void init(vector<T>& v) { rep (i, v.size()) cin >> v[i]; }
template <typename T>
T sum_(vector<T> vec, T init = 0) { return std::accumulate(all(vec), T(init)); }
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    int n, a, b;
    cin >> n >> a >> b;
    int div = n / (a + b);
    int rem = n % (a + b);
    if (rem > a) rem = a;
    print(a * div + rem);

    return 0;
}


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

#define CK(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--)
#define F first
#define S second
#define ll long long

const int INF = 1e9;
const long long LLINF = 1e18;

using namespace std;

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

/*==================================================*/
/*variable*/
int N;
string S[310];
map<string, int> m;
int dst[310][310];   //変換した盤のi行目について, j文字目から始まるの文字列
/*==================================================*/
/*function*/

/*==================================================*/

int main() {
    cin>>N;
    REP(i,0,N){
        cin>>S[i];
    }

    int ans = 0;

    int a = 0;
    REP(b,0,N){
        bool f = true;
        REP(i,0,N){
            REP(j,0,N){
                if(S[i][j] != S[(j+b-a+100*N) % N][(i+a-b+100*N) % N]){
                    f = false;
                    break;
                }
            }
            if(!f) break;
        }
        if(f) ans++;
    }
    
    cout<<ans*N<<endl;


//    cin>>N;
//    int sc = 0;
//    REP(i,0,N){
//        cin>>S[i];
//        if(m.find(S[i]) == m.end()){
//            m[S[i]] = sc;
//            sc++;
//        }
//    }
//
//    REP(j,0,N){
//        string tmp;
//        REP(i,0,N) tmp += S[i][N-1-j];
//        REP(i,0,N) {
//
//            if(m.find(tmp) == m.end()){
//                m[tmp] = sc;
//                sc++;
//            }
//            dst[j][i] = m[tmp];
//
//            if(i < N-1) tmp = tmp.substr(i+1, N-1-i) + tmp.substr(0,i+1);
//        }
//    }
//
//
//    int cnt = 0;
//    REP(a,0,N){
//        REP(b,0,N) {
//            bool flag = true;
//            REP(i,0,N) {
//                cout<<"a: "<<a<<", "<<"b: "<<b<<" : "<<dst[((N-1)-(b-a)+100*N)%N][(i+(b-a)+100*N)%N]<<endl;
//                cout<<"m[S["<<i<<"]]: "<<m[S[i]]<<endl;
//                //if(m[S[i]] != dst[(i+(b-a)+100*N)%N][((N-1)-(b-a)+100*N)%N]){
//                if(m[S[i]] != dst[((N-1)-(b-a)+100*N)%N][(i+(b-a)+100*N)%N]){
//                    flag = false;
//                    break;
//                }
//            }
//            if(flag) cnt++;
//        }
//    }
//
//    cout<<cnt<<endl;

    return 0;
}


Measured memory_bytes: 384
#pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool Finish_read;
template<class T>inline void read(T &x){Finish_read=0;x=0;int f=1;char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;if(ch==EOF)return;ch=getchar();}while(isdigit(ch))x=x*10+ch-'0',ch=getchar();x*=f;Finish_read=1;}
template<class T>inline void print(T x){if(x/10!=0)print(x/10);putchar(x%10+'0');}
template<class T>inline void writeln(T x){if(x<0)putchar('-');x=abs(x);print(x);putchar('\n');}
template<class T>inline void write(T x){if(x<0)putchar('-');x=abs(x);print(x);}
/*================Header Template==============*/
#define mp make_pair
#define x first
#define y second
pair<int,int>a[105],b[105];
int n;
bool vis[105];
int v[512][512],cp[512],u[512];
bool find(int x) {
	for (int i=1; i<=n; ++i)
		if (v[x][i] && !u[i]) {
			u[i]=1;
			if (!cp[i] || find(cp[i])) {
				cp[i]=x;
				return 1;
			}
		}
	return 0;
}

int main() {
	read(n);
	for(int i=1;i<=n;i++) {
		pair<int,int>tmp;
		read(tmp.x),read(tmp.y);
		a[i]=tmp;
	}
	for(int i=1;i<=n;i++) {
		pair<int,int>tmp;
		read(tmp.x),read(tmp.y);
		b[i]=tmp;
	}
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	int ans=0;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			if(a[i].x<=b[j].x&&a[i].y<=b[j].y)
				v[i][j]=1;
	for(int i=1;i<=n;++i)
		memset(u,0,sizeof u),ans+=find(i);
	printf("%d\n",ans);
}

Measured memory_bytes: 512
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	list := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&list[i])
	}

	result := 0
	now := 1
	flag := 0

	for i := 0; i < n; i++ {
		if list[i] == 1 {
			flag = 1
		}
		if list[i] != now {
			result++
		} else {
			now++
		}

	}
	if flag == 1 {
		fmt.Println(result)
	} else {
		fmt.Println(-1)
	}
}


Measured memory_bytes: 6656
#include<bits/stdc++.h>
#define maxn 10000007
#define maxm 20001
#define reg register
using namespace std;
bool not_prime[maxn];
int n,  pos[maxm], d[maxn], prime[maxn],a[maxm], m, cnt, siz[maxm]; 
int nt[maxm], fi[maxm], go[maxm], vis[maxm], visx[maxm], link[maxm]; 
inline int  read() {
    reg int s = 0, t = 0; reg char ch = getchar();
    while(ch > '9' || ch < '0') t |= ch == '-', ch = getchar();
    while(ch >= '0' && ch <= '9') s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
    return t ? -s : s;
}
void add(int x, int y){
    nt[++cnt] = fi[x]; fi[x] = cnt; go[cnt] = y;
    nt[++cnt] = fi[y]; fi[y] = cnt; go[cnt] = x;
}
void col(int x){
    for(int i = fi[x]; i; i = nt[i]){
        int v = go[i]; 
        if(!vis[v]) {
            vis[v] = 3 - vis[x]; col(v);
        }
    }
}
int find(int x, int tim){
    if(visx[x] == tim) return 0; visx[x] = tim;
    for(int i = fi[x]; i; i = nt[i]){
        int v =  go[i];
        if(!link[v] || find(link[v], tim)){
            link[v] = x; return 1;
        }
    }
    return 0;
}
int main(){
    n = read(); int ans = 0;
    for(int i = 1; i <= n; i++) 
        pos[i] = read(), d[pos[i]] = 1; a[0] = -1;
    sort(pos + 1, pos + n + 1);
    n = unique(pos + 1, pos + n + 1) - pos - 1;
    for(int i = 1; i <= n; i++) {
        if(!d[pos[i] - 1] && a[m] != pos[i]) a[++m] = pos[i];
        if(!d[pos[i] + 1]) a[++m] = pos[i] + 1; 
    }
    for(int i = 2; i < maxn; i++) {
        if(!not_prime[i]) prime[++cnt] = i;
        for(int j = 1; j <= cnt && prime[j] * i < maxn; j++){
            not_prime[i * prime[j]] = 1;
            if(i % prime[j] == 0) break;
        }
    }
    not_prime[2] = 1; cnt = 0; not_prime[1] = 1;
    for(int i = 1; i <= m; i++)
        for(int j = i + 1; j <= m; j++)
            if(!not_prime[a[j] - a[i]]) add(i, j); 
    for(int i = 1; i <= m; i++)
        if(!vis[i]) { vis[i] = 1; col(i); }
    for(int i = 1; i <= m; i++)
        if(vis[i] == 1) ans += (link[i] = find(i, i));       
    int sum1 = 0, sum2 = 0;
    for(int i = 1; i <= m; i++){
        if(link[i]) continue; 
        sum1 += (a[i] & 1);
        sum2 += (a[i] % 2 == 0);
    }
    if(sum1 & 1) ans += 3;
    ans += sum1 / 2 * 2 + sum2 / 2 * 2;
    cout << ans << endl;
}

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

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(input())
A = list(map(int, input().split()))

A_and_i = [[a, i] for i, a in enumerate(A)]
A_and_i.sort(reverse=True)

DP = [[0] * (N + 1) for _ in range(N + 1)]

for i in range(N):
    a, idx = A_and_i[i]

    for j in range(N):
        # 右に持っていく
        if j <= i:
            DP[i + 1][j] = max(DP[i + 1][j], DP[i][j] +
                               a * abs(N - 1 - (i - j) - idx))
            DP[i + 1][j + 1] = max(DP[i + 1][j + 1], DP[i]
                                   [j] + a * abs(idx - j))

ans = max(DP[N])
print(ans)


Measured memory_bytes: 100548
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll int64_t
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

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; }


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

char grid[2020][2020];
int H[2020][2020],W[2020][2020];


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w;
    cin>>h>>w;
    
    REP(i,h) REP(j,w) cin>>grid[i][j];

    REP(i,h){
        REP(j,w){
            if(grid[i][j]=='#') continue;
            else{
                int tmp=0;
                for(int x=j;x<w;x++){
                    //cout<<i<<":"<<x<<endl;
                    if(grid[i][x]=='#'){
                        tmp=x;
                        break;
                    }
                    if(x==w-1) tmp=w;
                }
                int mas;
                if(j==w-1) mas = 1,tmp=w;
                else mas=tmp-j;

                for(int x=j;x<tmp;x++){
                    //cout<<2<<endl;
                    W[i][x]=mas;
                }
                j=tmp;
            }
        }
    }
    REP(j,w) REP(i,h){
        if(grid[i][j]=='#')continue;
        else{
            int tmp=0;
            for(int y=i;y<h;y++){
                //cout<<3<<endl;
                if(grid[y][j]=='#'){
                    tmp=y;
                    break;
                }
                if(y==h-1) tmp=h;
            }
            int mas;
            if(i==h-1) mas = 1,tmp=h;
            else mas=tmp-i;
            for(int y=i;y<tmp;y++){
                //cout<<4<<endl;
                H[y][j]=mas;
            }
            i=tmp;
        }
        
    }
    int ans=0;
    REP(i,h) REP(j,w){
        if(grid[i][j]=='#') continue;
        chmax(ans,W[i][j]+H[i][j]);
    }
    /*REP(i,h){
        REP(j,w){
        cout<<H[i][j];
        }
        cout<<endl;
    }
    cout<<endl;
    REP(i,h){
        REP(j,w){
        cout<<W[i][j];
        }
        cout<<endl;
    }*/
    cout<<ans-1<<endl;
}

Measured memory_bytes: 36096
import itertools
from operator import add

def li():
    return list(map(int, input().split()))
def mi():
    return map(int, input().split())
def ii():
    return int(input())
def lim(N):
    return [int(input()) for i in range(N)]

N, M, X = mi()
C = []
A = []
for i in range(N):
    CA = li()
    C.append(CA[0])
    A.append(CA[1:])

Cost = 10 ** 8
for i in range(1, N + 1):
    # 組み合わせを作成する。
    it = itertools.combinations(range(N) ,i)

    # 組み合わせに対しての理解度を合計し、それぞれMを超えているのかを確認する。
    for i in it:
        rikaido = [0] * M
        cur_cost = 0
        for j in i:
            rikaido = list(map(add, rikaido, A[j]))
            cur_cost += C[j]

            rikaiflag = True
            for k in range(M):
                if rikaido[k] < X:
                    rikaiflag = False
                    break
            if rikaiflag:
                Cost = min(Cost,cur_cost)

if Cost == 10 ** 8:
    print(-1)
else:
    print(Cost)

Measured memory_bytes: 9300
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

#ifndef ULLONG
typedef unsigned long long ULLONG;
#endif
#ifndef LLONG
typedef long long LLONG;
#endif
template <class _T> static _T tp_abs(const _T& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void get3int(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}
template <class _T> static _T tp_pow(int base, int exp)
{
	_T ans = 1;

	for (int i = 0; i < exp; i++) {
		ans *= base;
	}
	return ans;
}
static void getstring(char* buff) {
	if (scanf(" %s", buff) < 0) {
		printf("getstr error!\n");
	}
}
static const long long MOD_NUM = 1000000007LL;

static void C_task();

#if 1
int main()
{
	C_task();
	fflush(stdout);
	return 0;
}
#endif


static void C_task()
{
	int N;
	get1int(N);

	std::map<std::string, LLONG> grams;
	for (int i = 0; i < N; i++) {
		char str[11] = { 0 };
		getstring(str);

		std::sort(str, str + 10);
		std::string tmp = str;
		grams[tmp]++;
	}

	LLONG ans = 0;
	for (auto it = grams.begin(); it != grams.end(); it++) {
		ans += (it->second * (it->second - 1)) / 2;
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 11136
#1_7_A
while True:
    m , f , r = map(int,input().split())
    if m == f == r == -1:
        break
    if m == -1 or f == -1:
        print('F')
    elif m + f >= 80:
        print('A')
    elif 65 <= m + f < 80:
        print('B')
    elif 50 <= m + f < 65:
        print('C')
    elif 30 <= m + f < 50:
        if r >= 50:
            print('C')
        else:
            print('D')
    else:
        print('F')


Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
string s;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin>>s;
    if (s[2]==s[3]&& s[4]==s[5]) cout<<"Yes";
    else cout<<"No";
 
 
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args)  {
		Scanner scan = new Scanner(System.in);
		int n = Integer.parseInt(scan.next());
		int[] s_count = new int [26];
		int[] min_count = new int[26];
		Arrays.fill(min_count, 999);
		String s;

		for (int i = 0;i < n; ++i){
			s = scan.next();
			Arrays.fill(s_count, 0);
			for(char k :s.toCharArray()){
				s_count[k-97]+=1;
			}

			for (int k = 0;k < 26; ++k){
				min_count[k]=Math.min(s_count[k], min_count[k]);
			}
		}

		for (int i = 0;i < 26; ++i){
				for (int k = 0;k < min_count[i]; ++k){
					System.out.print(String.valueOf((char)(i+97)));
			}
		}
	}
}
//end


Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    ll n,a,b,c,d,e;
    cin >> n >> a >> b >> c >> d >> e;
    ll saisyo =  min(a,min(b,min(c,min(d,e))));
    ll k = n/saisyo;
    if(n%saisyo != 0) k++;
    cout << k +4 << endl;
    
}

Measured memory_bytes: 256
n = int(input())

xyh = [list(map(int, input().split())) for _ in range(n)]

ext = lambda x: list(x)[0]

def check(zero, h):
    for xy in zero:
        if h - xy > 0:
            return False
    return True

for xcand in range(101):
    for ycand in range(101):
        values = set()
        zero = list()
        for x, y, h in xyh:
            if h == 0:
                zero.append(abs(xcand - x) + abs(ycand - y))
            else:
                values.add(abs(xcand - x) + abs(ycand - y) + h)
        if len(values) == 1:
            v = ext(values)
            if check(zero, v):
                print(xcand, ycand, v)
                exit()


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

public class Main {
    public static void main(String[] args) {
        Set<Integer> set = new HashSet<>();
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        for (int i = 0; i < N; i++) {
            int num = sc.nextInt();
            if (set.contains(num)) set.remove(num);
            else set.add(num);
        }

        System.out.println(set.size());
    }
}


Measured memory_bytes: 62912
import collections
import sys

S1 = collections.deque()
S2 = collections.deque()
S3 = collections.deque()

for i, j in enumerate(sys.stdin.readline()):
    if j == '\\':
        S1.append(i)
    elif j == '/':
        if S1:
            left_edge = S1.pop()
            new_puddle = i - left_edge
            while True:
                if S2:
                    if S2[-1] > left_edge:
                        S2.pop()
                        new_puddle += S3.pop()
                    else:
                        break
                else:
                    break
            S2.append(left_edge)
            S3.append(new_puddle)
        else:
            pass


print(sum(S3))

print(len(S3), *S3)

Measured memory_bytes: 8448
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int n;
long long sum;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		if(i%3==0||i%5==0)
		{
			continue;
		}
		sum+=i;
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 3764
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <map>
#include <functional>

using namespace std;


int main() {
	int N;
	cin >> N;
	vector<int> a(N);
	for (int i = 0; i < N;i++) {
		cin >> a[i];
	}
	sort(a.begin(),a.end());
	cout << a[N-1] - a[0] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cctype>
#include <numeric>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define all(a) (a).begin(),(a).end()

int N, Q;
bool T[300002];
int L[300002];
int q[100002];

void solve() {
  int K = 300000;

  int val = -1;
  for (int i = 1; i <= K; i++) {
    L[i] = val;
    if (T[i]) {
      val = i;
    }
  }

  int mxVal = val;
  rep(z,Q) {
    int query = q[z];
    int cur = mxVal;
    int ans = -1;
    while (1) {
      ans = max(ans, cur % query);
      if (cur < query) break;
      cur -= cur % query;
      cur = L[cur];
    }
    printf("%d\n", ans);
  }

}

int main() {
  while (cin>>N>>Q) {
    memset(T, 0, sizeof T);
    int c;
    rep(i,N) {
      cin>>c;
      T[c] = true;
    }
    rep(i,Q) {
      cin>>q[i];
    }
    solve();
  }
  
  return 0;
}

Measured memory_bytes: 3008
#include <iostream>
#include <vector>
#include <string>
#include <map>

using namespace std;

int main() {
    string str;

    int n, m, count;
    while (cin >> n >> m) {
        count = 0;
        if (n == 0 && m == 0) break;
        for (int i = 1; i <= n; i++) {
            for (int j = i+1; j <= n; j++) {
                for (int k = j+1; k <= n; k++) {
                    if (i + j + k == m) {
                        count++;
                    }
                }
            }
        }
        cout << count << endl;
    }
}



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

int main() {
  int N;
  cin >> N;
  vector<int> data(N);
  for(int i=0;i<N;i++)
    cin >> data.at(i);
  int p=0;
  for(int i=0;i<N;i++)
    p += data.at(i);
  
  if(p % N == 0){
    p /= N;
  }
  else if( (double)(p%N)/N <= 0.5 ){
    p = (p-(p%N)) / N;
  }
  else {
    p = ( (p-(p%N)) / N ) + 1; 
  }
  
  int answer=0;
  for(int i=0;i<N;i++)
    answer += ((data.at(i) - p)*(data.at(i) - p))  ;
  cout << answer;
  
}

Measured memory_bytes: 3552
b1,b2,b3=map(int,input().split())
if b1>b2==b3:
    print("Close")
elif b2>b1==b3:
    print("Close")
elif b1==b2>b3:
    print("Open")
elif b1==b2<b3:
    print("Open")
elif b1==b2==b3:
    print("Close")


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

using namespace std;

#define FOR(i,a,b) for(int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for(int i = (a); i >= (b); --i)
#define RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<pii, int> para;
const int inf = 1e9 + 7;
const int maxN = 5e6 + 5;

string s;
int n;
int main() {
	ios_base::sync_with_stdio(0);
	cin >> n;
	cin >> s;
	REP(i, s.size()) {
		char x = s[i] + n;
		if (x > 90) {
			x %= 90;
			x += 64;
		}
		cout << x;
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<queue>
#include<cmath>
//#include<bits/stdc++.h>
#define int long long
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define mp make_pair
#define all(x) x.begin(),x.end()
#define puts(x) cout << x << "\n"
#define endwith return
constexpr int mod = 1000000007;
using namespace std;
int input() { int t; cin >> t; return t; }
int x, n, a[123];
int ans = -1;
signed main() {
	cin >> x >> n;
	for1(i, n)a[input()] = 1;
	for0(i, 110)if (!a[i] && abs(x - ans) > abs(x - i))ans = i;
	puts(ans);
}

Measured memory_bytes: 3584
#include <stdio.h>

int main(void){
  int a, b, c;
  int sum = 0, login = 0;
  scanf("%d %d %d",&a, &b, &c);
  
  while(sum < c){
    login += 1;
    sum += a;
    if(login % 7 == 0){
      sum += b;
    }
  }
  
  printf("%d\n",login);
  return 0;
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    long long p = 2019;
    long long l, r;
    cin >> l >> r;
    if (r - l > p) {
        cout << 0 << endl;
        return 0;
    }
    long long best = p-1;
    for (long long i = l; i <= r; ++i) {
        for (long long j = i+1; j <= r; ++j) {
            best = min(best, (i*j) % p);
        }
    }
    cout << best << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char negate_(char x) {
  return x=='S'?'W':'S';
}
bool test(string& ox, string& sw){
  for(int i=0;i<ox.size();++i){
    int left=(ox.size()+i-1)%ox.size();
    int right=(i+1)%ox.size();
    if(sw[i]=='S'&&ox[i]=='o'||sw[i]=='W'&&ox[i]=='x'){
      if(sw[left]=='?'){
        sw[left]=sw[right];
      }else if(sw[right]=='?'){
        sw[right]=sw[left];
      }else{
        if (sw[left]!=sw[right])return false;
      }
    }else{
      if(sw[left]=='?'){
        sw[left]=negate_(sw[right]);
      }else if(sw[right]=='?'){
        sw[right]=negate_(sw[left]);
      }else{
        if (sw[left]==sw[right])return false;
      }
    }
  }
  return true;
}
main(){
  int N;
  string s;
  cin>>N>>s;
  string sw;
  sw=string(s.size(),'?');
  sw[0]='S';
  sw[1]='S';
  if(test(s,sw)){
    cout<<sw<<endl;
    return 0;
  }
  sw=string(s.size(),'?');
  sw[0]='S';
  sw[1]='W';
  if(test(s,sw)){
    cout<<sw<<endl;
    return 0;
  }
  sw=string(s.size(),'?');
  sw[0]='W';
  sw[1]='S';
  if(test(s,sw)){
    cout<<sw<<endl;
    return 0;
  }
  sw=string(s.size(),'?');
  sw[0]='W';
  sw[1]='W';
  if(test(s,sw)){
    cout<<sw<<endl;
    return 0;
  }
  cout<<-1<<endl;
}


Measured memory_bytes: 640
k, s = map(int, input().split())
dst = 0
for z in range(k, -1, -1):
    if s - z > k*2:
        continue
    for y in range(k, -1, -1):
        x = s - z - y
        if x > k:
            continue
        dst += (x >= 0)
print(dst)


Measured memory_bytes: 3060
A,B=map(int,input().split())
S = str(input().rstrip())
if len(S) == A+B+1 and S[A]=="-":
  for i in range(len(S)):
    if i != A:
      if S[i]=="-": 
        print("No")
        break
  else: print("Yes")
else: print("No")

Measured memory_bytes: 3060
import java.util.Scanner;

class Main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        while (true) {
            String number = scan.nextLine();
            int num = 0;
            if (number.equals("0")) {
                break;
            }
            for(int i = 0; i < number.length(); i++) {
                char ch = number.charAt(i);
                num += Character.getNumericValue(ch);
            }
                System.out.println(num);
        }
    }
}

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

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

    long long hp[N];
    for(int i=0; i<N; i++) {
      cin >> hp[i];
    }

    sort(hp, hp+N);  // ascending
    long long ans = 0;
    if(N>K) {
      for(int i=0; i<N-K; i++) ans+=hp[i];
    }
  
    cout << ans << endl;
    return 0;
}

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


using namespace std;


int main()
{

	int N;
	int ans = 0;

	cin >> N;

	for (int ni = 9; ni <= N; ni += 2) {
		int cnt = 0;
		for (int ti = 1; ti <= ni; ti++) {
			if (ni % ti == 0) cnt++;
		}
		if (cnt == 8) ans++;
	}

	printf("%d", ans);

    return 0;
}



Measured memory_bytes: 256
A, B, C, D = map(int, input().split())
if C > D:
  C, D = D, C
c, d = C, D
while True:
  c, d = d%c, c
  if c == 0:
    break
E = C*D//d
#print(d, E)
r = (B-A+1)-(B//C-(A-1)//C)-(B//D-(A-1)//D)+(B//E-(A-1)//E)
print(r)


Measured memory_bytes: 3060
#include <iostream>
#include <queue>

using namespace std;

int main() {
  int N, K, h;
  queue<int>q;
  int ret = 0;
  cin >> N >> K;
  for(int i = 0; i < N; i++) {
    cin>>h;
    q.push(h);
  }
  for (int i = 0; i < N; i++) {
    if (q.front() >= K) ret++;
    q.pop();
  }
  cout << ret << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <string>
#include <deque>
#include <iomanip>
#include <bitset>
#include <complex>
#include <sstream>
#include <algorithm>
#include <limits>
#include <cmath>
#include <utility>
#include <tuple>
using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;

constexpr int INF = 1e9;
constexpr ll LINF = 1e18;
constexpr int mod = 1e9+7;
constexpr ld eps = 1e-10;
constexpr ld pi = acos(-1.0);

#define DUMP(a) cout << #a << ": " << (a) << endl


int main() {
    ll res = 0;
    ll W, H;
    cin >> W >> H;
    vector<pair<ll, ll>> cost(W+H);
    for(int i=0; i<W; ++i) {
        cin >> cost[i].first;
        cost[i].second = 0;
    }
    for(int i=W; i<H+W; ++i) {
        cin >> cost[i].first;
        cost[i].second = 1;
    }
    W++;
    H++;
    sort(cost.begin(), cost.end());
    for(auto p : cost) {
        if(p.second == 0) {
            res += H * p.first;
            W--;
        } else {
            res += W * p.first;
            H--;
        }
    }
    cout << res << endl;
}



Measured memory_bytes: 3328
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define all(x) x.begin(),x.end()
#define gll greater<ll>()

void solve(){
 ll n,k;
  cin >> n >> k;
 vll p(n);
  rep(i,0,n) cin >> p[i];
  ll ans=0;
  sort(all(p));
  rep(i,0,k) ans+=p[i];
  
  cout << ans << endl;
}
int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}

Measured memory_bytes: 3652
// Problem : D - Caracal vs Monster
// Contest : AtCoder Beginner Contest 153
// URL : https://atcoder.jp/contests/abc153/tasks/abc153_d
// Memory Limit : 1024.000000 MB 
// Time Limit : 2000.000000 milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

// writer: w33z8kqrqk8zzzx33
#include <bits/stdc++.h>
using namespace std;
 
#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    ll N; cin >> N;
	int mbit = -1; rep(i, 63) if(N & (1ull<<i)) mbit = i;
	rep(i, 63) if(i <= mbit) N |= (1ull<<i);
	cout << N << endl;
}



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

int main() {
    std::string str;

    while (std::cin >> str) {
        std::size_t found;

        while (found = str.find("@"),
               found != std::string::npos) {
        
            std::string rest(std::stoi(str.substr(found + 1, 1)),
                            str[found + 2]);

            str.erase(found, 3);
            str.insert(found, rest);
        }

        std::cout << str << std::endl;
    }

    return 0;
}

Measured memory_bytes: 1212
import java.util.Arrays;
import java.util.Scanner;

/* Super_Metropolis */
public class Main {	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt(); // 縦の道の本数
		int h = sc.nextInt(); // 横の道の本数
		int n = sc.nextInt(); // 目的地の数
		int x, y;
		
		//PROCESS
		int myX = sc.nextInt(); // 現在地情報を初期化
		int myY = sc.nextInt();
		int dx = 0, dy = 0; // 座標の距離を格納
		int[] dif = new int[2]; // 座標の差を格納
		dif[0] = 0;
		dif[1] = 0;
		int cnt = 0; // 通った本数を保持する	
		for(int i=0; i<n-1 ;i++) {
			x = sc.nextInt();
			if(x < 1 && x > w) System.exit(-1);
			y = sc.nextInt();
			if(y < 1 && y > h) System.exit(-1);
			dx = x - myX; // スポットのx座標までの距離
			dy = y - myY; // スポットのy座標までの距離
			dif[0] = Math.abs(dx); // xの差を格納
			dif[1] = Math.abs(dy); // yの差を格納
			cnt += dif[0] + dif[1]; // 斜めの道を考えない通り方
			// System.out.printf("dif[0] = %d dif[1] = %d cnt = %d\n", dif[0], dif[1], cnt);
			if((dx > 0 && dy > 0) || (dx < 0 && dy < 0)) { // 斜めの道があるときの処理
				Arrays.sort(dif); // 小さい方の数を先頭にソート
				cnt -= dif[0]; // 小さい方を排除
				// System.out.printf("ifの中身 cnt = %d\n", cnt);
			}
			myX = x; // 現在地の更新
			myY = y;
		}
		//OUTPUT
		System.out.println(cnt);
	}
}

Measured memory_bytes: 25520
#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 <cmath>
#include <limits>
typedef long long ll;
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define mod 1000000007
#define fst first
#define pb push_back
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 x, ll y) { return y ? gcd(y, x % y) : x; }


int main()
{
	int K;
	cin >> K;
	int A, B;
	cin >> A >> B;
	int count = 0;
	for (int i = A; i <= B; i++) {
		if (i % K == 0) {
			count++;
		}
	}
	if (count > 0) {
		cout << "OK" << endl;
	}
	else {
		cout << "NG" << endl;
	}
}

Measured memory_bytes: 3600