akhauriyash/Code-Regression huggingface dataset:
using System;

public class Hello
{
    public static void Main()
    {
        var p = new string[] { "lunch", "dinner", "midnight" };
        while (true)
        {
            var n = int.Parse(Console.ReadLine().Trim());
            if (n == 0) break;
            var a = new int[3];
            var b = new int[3];
            for (int i = 0; i < n; i++)
            {
                string[] line = Console.ReadLine().Trim().Split(' ', ':');
                var h = int.Parse(line[0]);
                var m = int.Parse(line[1]);
                var m2 = int.Parse(line[2]);
                var t1 = 60 * h + m;
                if (t1 >= 660 && t1 <= 899) b[0]++;
                else if (t1 >= 1080 && t1 <= 1259) b[1]++;
                else if (t1 >= 1260 && t1 <= 1439) b[2]++;
                else if (t1 >= 0 && t1 <= 119) b[2]++;
                var t2 = m2 - m;
                if (t2 < 0) t2 += 60;
                bool ok;
                ok = t2 <= 8 ? true : false;
                if (t1 >= 660 && t1 <= 899 && ok) a[0]++;
                else if (t1 >= 1080 && t1 <= 1259 && ok) a[1]++;
                else if (t1 >= 1260 && t1 <= 1439 && ok) a[2]++;
                else if (t1 >= 0 && t1 <= 119 && ok) a[2]++;
            }
            for (int j = 0; j < 3; j++)
            {
                if (b[j] == 0) Console.WriteLine("{0} no guest", p[j]);
                else Console.WriteLine("{0} {1}", p[j], a[j] * 100 / b[j]);
            }
        }
    }
}


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

using namespace std;
long long n;
vector<long long> graph[100000];
long long dp[100000][2];
bool used[100000];
void recurse(long long vertex)
{
    if(dp[vertex][0]!=0)
    {
        return;
    }
    if(used[vertex])
    {
        return;
    }
    used[vertex]=true;
    dp[vertex][0]=1;//0 for white
    dp[vertex][1]=1;//1 for black
    for(int i=0;i<graph[vertex].size();i++)
    {
        if(!used[graph[vertex][i]])
        {
            long long neighbor=graph[vertex][i];
            recurse(neighbor);
            long long temp=(dp[neighbor][0]+dp[neighbor][1])%1000000007;
            dp[vertex][0]=(dp[vertex][0]*temp)%1000000007;
            dp[vertex][1]=(dp[vertex][1]*dp[neighbor][0])%1000000007;
        }
    }
}
int main()
{
    cin>>n;
    for(int i=0;i<n-1;i++)
    {
        long long x,y;
        cin>>x>>y;
        graph[x-1].push_back(y-1);
        graph[y-1].push_back(x-1);
    }
    recurse(0);
    cout<<(dp[0][0]+dp[0][1])%1000000007<<endl;
}

Measured memory_bytes: 12928
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
constexpr int kMax = 1e7 + 1;

typedef long long LL;

int f[kMax] = {};

int main() {
  LL N; cin >> N;
  f[0] = 0;
  for (LL i = 1; i <= N; ++i) {
    for (LL j = 1; i * j <= N; ++j) {
      f[i*j]++;
    }
  }

  LL sum = 0;
  for (LL i = 1; i <= N; ++i) sum += i * f[i];
  cout << sum << endl;
}


Measured memory_bytes: 42676
#include<stdio.h>
#include<math.h>
#define P 3.1415926539/180
main()
{
	double a,b,C,c;
	
	double S,L,h;
	
	scanf("%lf %lf %lf",&a,&b,&C);
	
	S=a*b*sin(C*P)*0.5;
	
	c=sqrt(a*a+b*b-(2*a*b*cos(C*P)));
	L=a+b+c;
	
	h=2*S/a;
	
	printf("%lf\n%lf\n%lf\n",S,L,h);
	
	return 0;
}

Measured memory_bytes: 648
n=gets.to_i
a=gets.split.map &:to_i
c=[0,0]
t=[0,0]
0.upto(n-1) do |i|
  t[0]+=a[i]
  t[1]+=a[i]
  if i%2==0
    if t[0]<1
      c[0]+=1-t[0]
      t[0]=1
    end
    if t[1]>-1
      c[1]+=t[1]+1
      t[1]=-1
    end
  else
    if t[1]<1
      c[1]+=1-t[1]
      t[1]=1
    end
    if t[0]>-1
      c[0]+=t[0]+1
      t[0]=-1
    end
  end
end
p c.min


Measured memory_bytes: 8580
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bits/stdc++.h>
using namespace std;
int n,m,q;
vector <int> g[100004];
int juv[100004];
int col[100004],qu;
void bfs(int s1,int d1,int c1){
	queue <pair<int,int> > q;
	q.push(make_pair(s1,0)); 
	while (!q.empty()){
		pair<int,int> x=q.front();
		q.pop();
		if (x.second!=d1 && d1-x.second<=juv[x.first]) continue;
		else juv[x.first]=d1-x.second;
		if (col[x.first]>0);
		else col[x.first]=c1;
		if (x.second>=d1) continue;
		else for (int i=0;i<g[x.first].size();i++)
			q.push(make_pair(g[x.first][i],x.second+1));  
	}
}
int s[100004],d[100004],c[100004];
int main(){
	memset (col,0,sizeof(col)); 
	cin>>n>>m;
	for (int i=0;i<m;i++){
		int x,y;
		cin>>x>>y;
		g[x].push_back(y);
		g[y].push_back(x);  
	}
	cin>>q;
	for (int i=0;i<q;i++)
		cin>>s[i]>>d[i]>>c[i];
	reverse (s,s+q);
	reverse (d,d+q);
	reverse (c,c+q);
	for (int i=0;i<q;i++)
		bfs (s[i],d[i],c[i]);
	for (int i=1;i<=n;i++)
		cout<<col[i]<<endl;
	return 0;
}

Measured memory_bytes: 8952
from itertools import permutations
AE = [int(input()) for _ in range(5)]
perm = list(permutations(AE))
minv = 10**5
for p in perm:
    t = 0
    for i in range(len(p)-1):
        if round(p[i], -1) < p[i]:
            t += round(p[i], -1) + 10
        else:
            t += round(p[i], -1)
    t += p[-1]
    minv = min(minv, t)
print(minv)


Measured memory_bytes: 3060
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;

const ll inf = 10e17;
const ll mod = 1000000007;
const ld eps = 10e-9;


ll solve(void);

ll mulmod(ll x, ll y, ll m = mod)
{
	return (x * y) % m;
}

ll power(ll n, ll r, ll m = mod)
{
	if (r == 0) { return 1; }
	if (r == 1) { return n; }
	if (n == 0) { return 0; }
	if (n == 1) { return 1; }

	if (r % 2 == 0)
	{
		ll y = power(n, r / 2, m);
		return mulmod(y, y, m);
	}
	else
	{
		ll y = power(n, (r - 1) / 2, m);
		return n * mulmod(y, y, m) % m;
	}
}

ll solve(void)
{
	string r, s;
	cin >> r;

	for (ll i = r.length() - 1; i >= 0; i--)
		s += r[i];

	// dp[右端からi番目の文字までを選ぶ][mod13] := 場合の数
	vector<vll> dp(s.length(), vll(13,0));

	if (s[0] == '?') {
		for(ll i = 0; i < 10; i++) { dp[0][i]++; }
	}
	else { dp[0][s[0]-'0'] = 1; }


	for (ll i = 1; i < s.length(); i++)
	{
		if (s[i] == '?')
		{
			ll  p = power(10, i, 13);
			// "?" に 0 ～ 9 を入れる
			for (ll j = 0; j < 10; j++)
			{
				for (ll k = 0; k < 13; k++)
				{
					ll next = j * p + k;
					next = next % 13;
					dp[i][next] = (dp[i][next] + dp[i-1][k]) % mod;
				}
			}
		}
		else
		{
			ll j = s[i] - '0';
			for (ll k = 0; k < 13; k++)
			{
				ll next = j * power(10, i, 13) + k;
				next = next % 13;
				dp[i][next] = (dp[i][next] + dp[i - 1][k]) % mod;
			}
		}
	}

	cout << dp[s.length()-1][5] << endl;

	return 0;
}

int main(void)
{
	while (solve())
	{
	}
	return 0;
}


Measured memory_bytes: 13696
#include <iostream>

using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)

int main() {
    int N;
    cin >> N;
    int res = 0;
    REP(i, N) res += (i + 1);
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;
ll INF = 1e12;

int main() {
    int N, W;
    cin >> N >> W;
    vector<int> w(N);
    vector<int> v(N);
    rep(i, N) cin >> w[i] >> v[i];

    vector<vector<ll>> dp(N + 1, vector<ll>(N * 1000 + 1,INF));

    dp[0][0] = 0;
    rep(i, N) rep(val, N * 1000 + 1) {
        dp[i+1][val] = min(dp[i+1][val],dp[i][val]);
        if(val+v[i] > N*1000) continue;
        dp[i+1][val+v[i]] = min(dp[i+1][val+v[i]],dp[i][val]+w[i]);
    }

    for (int i = N * 1000; i >= 1; i--) {
        if (dp[N][i] <= W) {
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 80256
#include <bits/stdc++.h>
#define BPhuong ""
#define maxn 505
#define maxm
#define fi(i,a,b) for(int i = a; i<= b; i++)
#define fid(i,a,b) for(int i = a; i>= b; i--)
#define se second
#define f first
#define ll long long
#define pii pair<int, int>
#define pb push_back
#define bit(x, i) ((x>>i)&1)
#define oo 1e9
struct data{
    int x, y, z;
};
using namespace std;
int n, a[maxn], cl[maxn][maxn];
ll s[maxn], ans[maxn][maxn];
/*ll solve(int x, int y)
{
    if(x == y)
    {
        return 0;
    }
    if(cl[x][y]) return ans[x][y];
    cl[x][y] = 1;
    ans[x][y] = 1e18;
    fi(i, x, y-1)
    {
        ans[x][y] = min(ans[x][y], solve(x, i) + solve(i+1, y) + s[y] - s[x-1]);
    }
    return ans[x][y];
}*/
void nhap(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);cout.tie(NULL);
    //freopen(BPhuong".inp","r",stdin);
    //freopen(BPhuong".out","w",stdout);
    cin >> n;
    fi(i, 1, n)
    {
        cin >> a[i];
        s[i] = s[i-1] + a[i];
        fid(j, i-1, 1)
        {
            ans[j][i] = 1e18;
            fi(t, j, i-1)
            {
                ans[j][i] = min(ans[j][i], ans[j][t] + ans[t+1][i] + s[i] - s[j-1]);
            }
        }
    }
    cout << ans[1][n];
}

void xuli(){
   // cout << solve(1, n);

}

int main(){
    nhap();
    xuli();
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb push_back 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
int main(){
	ll N,K;
	string s; cin>>N>>s>>K;
	rep(i,s.sz){
		if(s[K-1]!=s[i]) cout<<"*";
		else cout<<s[i];
	}   
}

Measured memory_bytes: 256
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
z = input()
n = int(z) - 1
print(l[n])

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t N, K;
  cin >> N >> K;
  vector<vector<int64_t>> vec(N,vector<int64_t>(2));
  for(int i=0; i<N; i++){
    for(int j=0; j<2; j++){
      cin >> vec.at(i).at(j);
    }
  }
  sort(vec.begin(),vec.end());
  
  int64_t INF = 1e9 * 1e9 * 5;
  int64_t MINF = -1e9 * 1e9 * 5;
  
  int64_t ans = INF;
  
  for(int i=0; i<N; i++){
    for(int j=i+1; j<N; j++){
      if(j - i + 1 < K){
        continue;
      }
      int64_t up = MINF;
      int64_t down = INF;
      vector<int64_t> length(0);
      for(int k=i; k<=j; k++){
        length.push_back(vec.at(k).at(1));
      }
      sort(length.begin(),length.end());
      int64_t ans_x = INF;
      for(int l=0; l+K-1<length.size(); l++){
        ans_x = min(ans_x, abs(length.at(l) - length.at(l+K-1)));
      } 
      ans_x *= (vec.at(j).at(0) - vec.at(i).at(0));
      ans = min(ans,ans_x);
    }
  }
  cout << ans << endl;
}

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

int main() {
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> s(h);
    rep(i, h) cin >> s[i];

    int ans = 0;

    rep(i, (1 << h)) {
        rep(j, (1 << w)) {
            int cnt = 0;

            rep(y, h) {
                if (i & (1 << y))
                    continue;

                rep(x, w) {
                    if (j & (1 << x))
                        continue;

                    if (s[y][x] == '#')
                        cnt++;
                }
            }

            if (cnt == k)
                ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3620
#include<iostream>

using namespace std;

int main()
{
	int ss[8],i,j;
	int ans[2];
	
	for(;cin >> ss[0];)
	{
		ans[0]=ans[1]=0;
		
		for(i=1;i<8;i++)
			cin >> ss[i] ;
		
		for(i=0;i<4;i++)
		{
			if(ss[i]==ss[i+4])
			{
				ans[0]++;
				ss[i+4]=-1;
			}
		}
		for(i=0;i<4;i++)
			for(j=4;j<8;j++)
				if(ss[i]==ss[j])
					ans[1]++;
		
		cout << ans[0] << " " << ans[1] << endl;
	}
}

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

using namespace std;

int main(){
	long long k, x, y;

	scanf("%lld%lld", &x, &y);

	if (__gcd(x, y) == y){
		printf("-1\n");
	}
	else{
		for (k = 1; true; k++){
			if (k * x % y != 0){
				break;
			}
		}

		printf("%lld\n", k * x);
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, N, P1, P2;
  cin >> N >> A >> B;
  P1 = A * N;
  P2 = B;
  
  if (P1 <= P2){
      cout << P1 << endl;
  }
  else {
      cout << P2 << endl;
  } 
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
int a,b ;
scanf("%d",&a);
scanf("%d",&b);

if(a<b)
{
printf("a < b\n",a,b);
}
if(a>b)
{
printf("a > b\n",a,b);
}
if(a==b)
{
printf("a == b\n",a,b);
}
return 0 ;
}

Measured memory_bytes: 580
def dfs(color,l,r):
  if l==r:
    return
  for i in range(l,(l+r)//2+1):
    for j in range((l+r)//2+1,r+1):
      ans[i][j]=color
  dfs(color+1,l,(l+r)//2)
  dfs(color+1,(l+r)//2+1,r)

n=int(input())
ans=[[0]*(n+1) for _ in range(n+1)]
dfs(1,1,n)
for i in range(1,n):
  print(*ans[i][i+1:n+1])

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

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	int N, A, ans = 0;
	map<int, bool> memo;

	cin >> N;
	rep(i, N) {
		cin >> A;
		if (memo.count(A) > 0) {
			memo[A] = !memo[A];

			if (memo[A]) ans++;
			else ans--;
		}
		else {
			memo[A] = true;
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 4992
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#include<type_traits>
#include<numeric>
//#include<deque>
#include<limits>
#include<iomanip>
#include<set>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long long int ll;

//define
#define INF 10000000000LL //long long int専用
#define NUM 1000000007
#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)

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

	bool flag;
	int size = s.size(),mem,ans;
	for (int j = size; 0 < size; size--) {
		if ((size+1) % 2 == 0) {
			mem = size / 2;
			flag = true;
			rep(i, size / 2) {
				//cout << s[i] << " " << s[mem+i]<<"\n";
				if (s[i] != s[mem+i]) {
					flag = false;
				}
			}

			if (flag){
				cout << size - 1 << endl;
				return 0;
			}
		}
		
	}
}

Measured memory_bytes: 256
mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn get<T: FromStr>() -> T
        where <T as FromStr>::Err: Debug
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.parse().unwrap()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
        where <T as FromStr>::Err: Debug
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

fn main() {
    let rgb: Vec<isize> = util::gets();

    let x = 100 * rgb[0] + 10 * rgb[1] + rgb[2];

    println!("{}", if x % 4 == 0 { "YES" } else { "NO" });
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

vector<int> bitconversion(int i, int n, int N){
    int x = 1;
    rep(j,N){
        x *= n;
    }
    vector<int> vec(N);
    rep(j,N){
        x /= n;
        vec[j] = i / x;
        i -= x * vec[j];
    }
    return vec;
}

int main(){
    int H,W,K;
    cin >> H >> W >> K;
    vector<string> vec(H);
    rep(i,H){
        cin >> vec[i];
    }
    int num_H = 1;
    rep(i,H){
        num_H *= 2;
    }
    int num_W = 1;
    rep(i,W){
        num_W *= 2;
    }
    int ans = 0;
    rep(i,num_H){
        rep(j,num_W){
            int black = 0;
            vector<int> gyou = bitconversion(i, 2, H);
            vector<int> retu = bitconversion(j, 2, W);
            vector<vector<string> > vec_sub(H, vector<string> (W));
            rep(k,H){
                rep(l,W){
                    vec_sub[k][l] = vec[k].substr(l,1);
                }
            }
            rep(k,H){
                rep(l,W){
                    if (gyou[k] == 1) vec_sub[k][l] = "R";
                    if (retu[l] == 1) vec_sub[k][l] = "R";
                }
            }
            rep(k,H){
                rep(l,W){
                    if (vec_sub[k][l] == "#") black++;
                }
            }
            if (black == K) ans++;
        }
    }
    cout << ans << endl;
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
ll INF = 1e18;
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 qmod(ll &a,ll b){a=(a*b)%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,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  ll l,r;
  ll n,m;cin>>n;
  vector<ll>t(n);
  for(i=0;i<n;i++)cin>>t[i];
  cin>>m;
  vector<ll>p(m),c(m);
  for(i=0;i<m;i++)cin>>p[i]>>c[i];

  for(i=0;i<n;i++)sum+=t[i];
  for(i=0;i<m;i++){
    cout<<sum-t[p[i]-1]+c[i]<<endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,lol=0;

    cin>>n;
    vector<int> a;
    for(int i = 0; i<n; i++)
    {
        int x;
        cin>>x;
        a.push_back(x);
    }
    sort(a.begin(), a.end());
    long long  cnt = 0;
    for(int i = 0; i<n; i++) for(int j = i+1; j<n-1; j++)
        {
            lol = upper_bound(a.begin(), a.end(), a[i]+a[j]-1) - a.begin()-1;
            cnt+= lol - j;
        }
    cout  << cnt << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    int N;
    cin >> N;
    cout << N*(N+1)/2;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int A;
    int B;
    int C;
    cin >> A >> B >> C;
    int flag=0;
    if (A==B && B!=C){
        flag=1;
    }
    if (A==C && A!=B){
        flag=1;
    }
    if (B==C && A!=B){
        flag=1;
    }
    if (flag==1){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    } 
}

Measured memory_bytes: 256
#define ll long long
#define MOD 1000000007
#define MOD2 998244353
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define set2d(array, val, m, n) memset(array, val, sizeof(array[0][0]) * m * n);
#include <bits/stdc++.h>
using namespace std;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x %= p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
ll po(ll base, ll powerRaised)
{
    if (powerRaised != 0)
        return (base * po(base, powerRaised - 1));
    else
        return 1;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin >> s;
    for (int i = 0; i < s.length(); i++)
    {
        if (s[i] == '7')
        {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
}

Measured memory_bytes: 3640
extern crate core;

use std::io::{self, Read};

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = run(input.trim().to_string());
    println!("{}", output);
}

fn run(input: String) -> String {
    let list = input.split_whitespace().collect::<Vec<_>>();
    let mut s = list[0].chars().collect::<Vec<_>>();
    let mut t = list[1].chars().collect::<Vec<_>>();
    if s.len() < t.len() {
        "UNRESTORABLE".to_string()
    } else {
        //どこに入るか前から順番に試していく
        let mut index = None;
        for i in 0..s.len() - t.len() + 1 {
            if (0..t.len()).all(|j| s[i + j] == t[j] || s[i + j] == '?') {
                index = Some(i)
            }
        }
        match index {
            Some(index) => {
                //sをtで置き換え
                for i in 0..t.len() {
                    s[index + i] = t[i];
                }
                //?をaで置き換え
                s.into_iter()
                    .map(|x| if x == '?' { 'a' } else { x })
                    .collect::<String>()
            }
            None => "UNRESTORABLE".to_string(),
        }
    }
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!(super::run($input.to_string()), $output.to_string());
                }
            )*
        }
    }
}

tests! {
    test1: "?tc????
coder" => "atcoder",
    test2: "??p??d??
abc" => "UNRESTORABLE",
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
/*
bool compair_words(char *a, char b[][10], int n)
{
  for(int i=0; i<n; i++){
    if(strcmp(a, b[i])==0) {
      return false;
    }
  }
  return true;
}
*/



int main()
{
  int n, t, a;

  scanf("%d %d %d", &n, &t, &a);
  int h[n];

  float min=1000000000.0, temp;
  int index=0;
  
  for(int i=0 ; i<n ; i++) {
    scanf("%d", &h[i]);

    temp = fabsf(a-(t-h[i]*0.006));
    if(temp < min) {
      min = temp;
      index = i;
    }
    //    printf("%f\n", temp);
  }
  printf("%d\n", index+1);
    
}



Measured memory_bytes: 128
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <tuple>
using namespace std;
typedef long long ll;
#define REP(i,n) for (int i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

int main ()
{
    int N;
    string S;
    cin >> N >> S;

    const ll MOD = 1000000007LL;
    ll cnt[26] = {};
    REP(i,S.size()) cnt[S[i] - 'a']++;

    ll ans = 1LL;
    REP(i,26) {
        ans *= (cnt[i] + 1LL);
        ans %= MOD;
    }

    ans = (ans - 1LL + MOD) % MOD;

    cout << ans << endl;

    return 0;
}


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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
s = str(n)
m = len(str(n))

lst = [3,5,7]
que = deque([3,5,7])
for _ in range(3**m):
    x = que.popleft()
    for j in [3,5,7]:
        que.append(int(str(x)+str(j)))
        lst.append(int(str(x)+str(j)))

ans = 0
for i in lst:
    if i > n:
        break
    cnt = [0]*3
    for j in str(i):
        cnt[(int(j)-1)//3] += 1
    for j in cnt:
        if j == 0:
            break
    else:
        ans += 1
print(ans)

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

#define REPI(x) for(int i=0;i<x;i++)
#define REPJ(x) for(int j=0;j<x;j++)

#define REPISE (s,e) for(int i=s,i<e;i++)
#define REPJSE (s,e) for(int j=s,j<e;j++)

#define MAX 1000000000000000000

using namespace std;

int main ()
{
  int N;
  long long res=1,buf;
  vector <long long> v;
  
  cin >> N;

  REPI(N){
    scanf("%lld",&buf);
    v.push_back (buf);
  }
  
  sort (v.begin (), v.end ());

  REPI(N){
    if (v[i] == 0)
    {
      cout << "0" << endl;
      return 0;
    }
    
    if (v[i] > MAX / res)
    {
      cout << "-1" << endl;
      return 0;
    }

    res *= v[i];
  }

  cout << res << endl;

  return 0;
}

Measured memory_bytes: 4392
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(x)    (x).begin(),(x).end()
typedef long long ll;
const int MOD = (int)1e9 + 7;

int gcd(int a, int b){
  while(b!=0){
    int r = a - a/b * b;
    a = b;
    b = r;
  }
  return a;
}

int main(){
  int n;
  cin >> n;
  vector<int> num(n);
  rep(i,n) cin >> num[i];
  int ans = num[0];
  rep(i,n-1) ans = gcd(ans,num[i+1]);
  cout<<ans<<endl;
}



Measured memory_bytes: 640
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <bitset>
#include <cstdlib>
#include <cmath>
#include <set>
#include <list>
#include <deque>
#include <map>
#include <queue>
#include <fstream>
#include <cassert>
#include <cmath>
#include <sstream>
#include <time.h>
#include <complex>
#include <iomanip>
//#include <unordered_set>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef pair<int,int> ii;
typedef pair<double,double> dd;
typedef pair<char,char> cc;
typedef vector<ii> vii;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l4;
const double eps = 0.005;
const int maxn = 200010;
const ll mod = 1e9+7;
const int INF = 1e9;
const double pi = acos(-1);
typedef double Matrix[maxn][maxn];
int n;
ii xv[maxn];
int rk[maxn];
map<int,int> mm;
ii lr[maxn];
ll seg[4*maxn];
ll dp[maxn];
void insert(int cur, int l, int r, int p, ll x) {
    if (l == r) {
        seg[cur] = x;
        return;
    }
    int mid = (l+r)/2;
    if (mid >= p) {
        insert(2*cur,l,mid,p,x);
    } else {
        insert(2*cur+1, mid+1, r, p, x);
    }
    seg[cur] = (seg[2*cur]+seg[2*cur+1])%mod;
}

ll query(int cur, int l, int r, int L, int R) {
    if (L <= l && R >= r) {
        return seg[cur];
    }
    if (l > R || r < L) {
        return 0;
    }
    int mid = (l+r)/2;
    ll ret = 0;
    if (mid >= L) {
        ret += query(2*cur, l, mid, L, R);
    }
    if (mid < R) {
        ret += query(2*cur+1, mid+1, r, L, R);
    }
    return ret;
}

int main() {
    scanf("%d",&n);
    int x,v;
    for (int i = 0; i < n; i++) {
        scanf("%d%d",&x,&v);
        xv[i] = {v,x};
        mm[x];
    }
    int tot = 0;
    for (auto it = mm.begin(); it != mm.end(); it++) {
        it->second = tot++;
    }
    sort(xv,xv+n);
    for (int i = 0; i < n; i++) {
        rk[mm[xv[i].second]] = i;
    }
    int pt1 = 0;
    int pt2 = n-1;
    for (int i = 0; i < n; i++) {
        int x = xv[rk[i]].second;
        while (xv[pt1].second < x) {
            pt1++;
        }
        lr[i].second = pt1+1;
    }
    for (int i = n-1; i >= 0; i--) {
        int x = xv[rk[i]].second;
        while (xv[pt2].second > x) {
            pt2--;
        }
        lr[i].first = pt2+1;
    }
    sort(lr,lr+n);
    for (int i = 0; i < n; i++) {
        int r = lr[i].first;
        int l = lr[i].second;
        dp[r] += query(1, 1, n, max(l-1,1), r);
        if (l == 1) dp[r]++;
        dp[r] %= mod;
        insert(1, 1, n, r, dp[r]);
    }
    cout << dp[n] << endl;
    return 0;
}






Measured memory_bytes: 21376
using System.Linq;
using System;

public class hello
{
    public static void Main()
    {
        while (true)
        {
            var n = int.Parse(Console.ReadLine().Trim());
            if (n == 0) goto readend;
            var ary = new double[n];
            string[] line = Console.ReadLine().Trim().Split(' ');
            for (int i = 0; i < n; i++)
                ary[i] = double.Parse(line[i]);
            var ave = ary.Average();
            for (int i = 0; i < n; i++)
                ary[i] = Math.Pow((ary[i] - ave), 2);
            var anser = Math.Sqrt(ary.Sum() / n);
            Console.WriteLine(anser);
        }
        readend:;
    }
}

Measured memory_bytes: 9760
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;
const int INF=1<<17;



map<string,LL> mp;

int main(){
    int N;
    cin >> N;
    string s,t;
    for(int i=0;i<N;i++){
        cin >> s;
        mp[s]++;
    }
    int M;
    cin >> M;
    for(int i=0;i<M;i++){
        cin >> t;
        mp[t]--;
    }
    LL ans=0;
    for(auto p:mp){
        ans=max(ans,p.second);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

main() {
    int sx,sy,tx,ty; cin >> sx >> sy >> tx >> ty;
    string S;  int a=abs(tx-sx),b=abs(ty-sy);
    if(tx-sx>=0 && ty-sy>=0){
        rep(i,tx-sx) S+='R';
        rep(i,ty-sy) S+='U';
        rep(i,tx-sx) S+='L';
        rep(i,ty-sy) S+='D';
        S+='D';
        rep(i,tx-sx+1) S+='R';
        rep(i,ty-sy+1) S+='U';
        S+='L'; S+='U';
        rep(i,tx-sx+1) S+='L';
        rep(i,ty-sy+1) S+='D';
        S+='R';
    }
    else if(tx-sx>=0 && ty-sy<0){
        rep(i,a) S+='R'; rep(i,b) S+='D';
        rep(i,a) S+='L'; rep(i,b) S+='U';
        S+='U'; 
        rep(i,a+1) S+='R'; rep(i,b+1) S+='D';
        S+='L'; S+='D';
        rep(i,a+1) S+='L'; rep(i,b+1) S+='U';
        S+='R';
    } 
    else if(tx-sx<0 && ty-sy >=0){
        rep(i,a) S+='L'; rep(i,b) S+='U';
        rep(i,a) S+='R'; rep(i,b) S+='D';
        S+='D';
        rep(i,a+1) S+='L'; rep(i,b+1) S+='U';
        S+='R'; S+='U';
        rep(i,a+1) S+='R'; rep(i,b+1) S+='D';
        S+='L';
    }
    else{
        rep(i,a) S+='L'; rep(i,b) S+='D';
        rep(i,a) S+='R'; rep(i,b) S+='U';
        S+='U';
        rep(i,a+1) S+='L'; rep(i,b+1) S+='D';
        S+='R'; S+='D';
        rep(i,a+1) S+='R'; rep(i,b+1) S+='U';
        S+='L';
    }
    cout << S << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int n,m,l;
    scanf("%d %d %d",&n,&m,&l);
    long mat1[100][100]={},mat2[100][100] = {},result[100][100] = {};
    for(int i = 0;i < n;i++){
        for(int j = 0;j < m;j++){
            scanf("%ld",&mat1[i][j]);
        }
    }
    for(int i = 0;i < m;i++){
        for(int j = 0;j < l;j++){
            scanf("%ld",&mat2[i][j]);
        }
    }
    
    int x=0;
    for(int i = 0;i < n;i++){
        for(int j = 0;j < l;j++){
            for(int k = 0;k < m;k++){
                result[i][j] += mat1[i][k] * mat2[k][j];
            }
        }
    }
    
    for(int i = 0;i < n;i++){
        for(int j = 0;j < l;j++){
            if(j != l-1){
                printf("%ld ",result[i][j]);
            } else{
                printf("%ld\n",result[i][j]);
            }
        }
    }
    return 0;
}


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

int main() {
  int n;
  std::cin >> n;
  std::string c1, c2;
  int tscore = 0, hscore = 0;

  for (int i = 0; i < n; i++) {
    std::cin >> c1 >> c2;
    if (c1 > c2) tscore += 3;
    if (c1 < c2) hscore += 3;
    if (c1 == c2) {hscore++; tscore++;}
  }

  std::cout << tscore << " " << hscore << std::endl;
}



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

int main(){

	int a,b,c,d,n,count;

	while(cin>>n){
		count=0;
		for(a=0;a<=9;a++)for(b=0;b<=9;b++)for(c=0;c<=9;c++)for(d=0;d<=9;d++)
			if(a+b+c+d==n)
				count++;
		cout << count << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? 1e9:1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){int b=0;for(auto itr :a){if(b++!=0)cout << " "; cout << itr;} }
using ll  = long long;
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
struct Edge{int to,cap,rev;};
class Dinic{//max flow
public:
    int n;
    vector<vector<Edge> >G;
    vector<int> level,iter;
    Dinic(int size): n(size),G(vector<vector<Edge>>(n)){};
    void add_Edge(int from, int to, int cap){
        Edge q={to,cap,int(G[to].size())};
        G[from].emplace_back(q);
        q={from,0,int(G[from].size()-1)};
        G[to].emplace_back(q);
    }
    void bfs(int s){
        level=vector<int>(n,-1);
        queue<int>q;
        level[s]=0;
        q.push(s);
        while(!q.empty()){
            int v=q.front();q.pop();
            for(auto &e :G[v]){
                if(e.cap>0&&level[e.to]<0){
                    level[e.to]=level[v]+1;
                    q.push(e.to);
                }
            }
        }
    }
    function<int(int,int,int)>dfs = [&](int v, int t, int f) -> int{
        if(v==t)return f;
        for(iter[v];iter[v]<G[v].size();iter[v]++){
            Edge &e=G[v][iter[v]];
            if(level[v]>=level[e.to]||e.cap<=0) continue;
            int d =dfs(e.to,t,min(f,e.cap));
            if(d>0){
                e.cap-=d;
                G[e.to][e.rev].cap+=d;
                return d;
            }
        }
        return 0;
    };
    int max_flow(int s,int t) {//from s to t,ford_fulkerson
        int flow=0;
        while(1){
            bfs(s);
            if(level[t]<0)return flow;
            iter=vector<int>(n);
            int f;
            while((f=dfs(s,t,INF))>0)flow+=f;
        }
    }
};
signed main(){
    int v,e;
    cin>>v>>e;
    Dinic yebi(v+1);
    rep(i,e){
        int a,b,c;cin>>a>>b>>c;
        yebi.add_Edge(a,b,c);
    }
    cout<<yebi.max_flow(0, v-1)<<endl;
}






Measured memory_bytes: 3184
char S[1002][1002];
D[1002][1002];
H,W;
ans;
sz;fr;
Qx[1100000];
Qy[1100000];
main()
{
	scanf("%d %d\n",&H,&W);
	for(int i=1;i<=H;i++)gets(S[i]+1);
	for(int i=1;i<=H;i++)for(int j=1;j<=W;j++)
	{
		if(S[i][j]=='#')
		{
			Qx[sz]=i;
			Qy[sz]=j;
			++sz;
		}
		else
		{
			D[i][j]=100000000;
		}
	}
	while(fr<sz)
	{
		int x=Qx[fr];
		int y=Qy[fr];
		++fr;
		if(!x||!y||x>H||y>W)continue;
		if(ans<D[x][y])ans=D[x][y];
		if(D[x-1][y]>D[x][y]+1)
		{
			D[x-1][y]=D[x][y]+1;
			Qx[sz]=x-1;
			Qy[sz]=y;
			++sz;
		}
		if(D[x+1][y]>D[x][y]+1)
		{
			D[x+1][y]=D[x][y]+1;
			Qx[sz]=x+1;
			Qy[sz]=y;
			++sz;
		}
		if(D[x][y-1]>D[x][y]+1)
		{
			D[x][y-1]=D[x][y]+1;
			Qx[sz]=x;
			Qy[sz]=y-1;
			++sz;
		}
		if(D[x][y+1]>D[x][y]+1)
		{
			D[x][y+1]=D[x][y]+1;
			Qx[sz]=x;
			Qy[sz]=y+1;
			++sz;
		}
	}
	printf("%d",ans);
}


Measured memory_bytes: 13312
#include<stdio.h>
int main(){
int a,b;
scanf("%d %d",&a,&b);
if(a>=b){
printf("1\n");
}
else{
if(b%a==0){
printf("%d\n",b/a);
}
else{
printf("%d\n",b/a+1);
}
}
return 0;
}


Measured memory_bytes: 2136
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE cout << -1 << endl;return 0
#define Endl endl


signed main(void){
    int N,M;
    int L[114514],R[114514];
    cin >> N >> M;
    int l=0,r=N-1;
    REP(i,M){
        cin >> L[i] >> R[i];
        l=max(l,L[i]-1);
        r=min(r,R[i]-1);
    }
    cout << max(r-l+1,0LL) << endl;
    return 0;
}



Measured memory_bytes: 1792
/******************************************
* AUTHOR : SHUBHAM KUMAR *
* NICK : { "CODECHEF" : "SCHELEON",
           "CODEFORCES" : "SCH3130N" } *     
* INSTITUTION : BIT MESRA *
******************************************/

#include "bits/stdc++.h"

using namespace std;

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define sd(x) scanf("%lld",&x)
#define pds(x) printf("%lld ", x)
#define large 100005
#define MOD 1000000007
#define dd double
#define pb push_back
#define mk make_pair
#define rep0(i,b) for(int i=0;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define rep2(i,a,b) for(int i=a;i<=b;i++)
#define pll pair<ll, ll>
#define ld long double
#define vll vector<ll>
#define vpll vector<pll>
#define sortv(v) sort(v.begin(),v.end())  

template <typename T> void max_self(T& a, T b) {
    a = max(a, b);
}

using ll = long long int;
using ull = unsigned long long int;

ll ModE(ll x, ull y, ll p = MOD) 
{ 
    ll res = 1;
    x = x % p;    
    while (y > 0) 
    {   if (y & 1) 
            res = (res*x) % p; 
        y = y>>1;
        x = (x*x) % p;   
    } 
    return res; 
}



int main() {
    #ifdef M_DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    fastio

    // ll T; cin>>T; while(T--){}
    ll h,w;
    cin>>h>>w;
    ll dp[h+5][w+5];
    string a[h+1];
    rep1(i, h){
    	cin>>a[i];
    }
    rep0(i, h+1)
    	rep0(j, w+1)
    		dp[i][j]=0;
    dp[1][1] = 1;
    rep1(i ,h){
    	rep1(j, w){
    		if(i == 1 && j == 1){
    			continue;
    		}
    		if(a[i][j-1] == '#'){
    			continue;
    		}
    		dp[i][j] = (dp[i][j] + dp[i][j-1])%MOD;
    		dp[i][j] = (dp[i-1][j] + dp[i][j])%MOD;
    	}
    }
    // rep0(i, h+1){
    // 	rep0(j, w+1){
    // 		cout<<dp[i][j]<<" ";
    // 	}
    // 	cout<<"\n";
    // }
    cout<<dp[h][w];

    return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
  	cin.tie(NULL);
	int x;
	cin >> x;
	int a, b;
	for(int i=-118; i<=119; i++)
	{
		for(int j=-119; j<=118; j++)
		{
			if(pow(i,5) - pow(j,5) == x)
			{
				a = i;
				b = j;
			}
		}
	}
	cout << a << " " << b << "\n";
	return 0;
}

Measured memory_bytes: 4096
import java.util.Scanner;

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

    private void run() {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int K = scanner.nextInt();
        int ans  = N - K;
        if(K == 1){
            System.out.println(0);
            return;
        }
        System.out.println(ans);

    }
}


Measured memory_bytes: 21972
//#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
bool arr[1000001];
int Nmax=1000001;
vint sosu;
void Eratosthenes(){
	for(int i = 0; i < Nmax; i++){
		arr[i] = true;
	}
	arr[0]=false; arr[1]=false;
	for(int i = 2; i < sqrt(Nmax); i++){
		if(arr[i]){
			for(int j = 0; i * (j + 2) < Nmax; j++){
				arr[i *(j + 2)] = false;
			}
		}
	}
	for(int i = 0; i < Nmax; i++){
		if(arr[i]) sosu.push_back(i);
	}
}
int A[1000001];
int insu[1000001]={};
bool prime_factor_decomp(ll n) {
    vll p;
    ll m = n;
    for (int i=0;i<sosu.size()&&sosu[i]*sosu[i]<=n;++i) {
        if (m % sosu[i] != 0) continue;
        while (m % sosu[i] == 0) m /= sosu[i];
        insu[sosu[i]]++;
		if(insu[sosu[i]]>=2) return 1;
    }
	if (m > 1) {
		insu[m]++;
		if(insu[m]>=2) return 1;
	}
	return 0;
}
ll gcd(ll x,ll y){
	if(y==0) return x;
	return gcd(y,x%y);
}
int main(){
	Eratosthenes();
	int N;
	scan(N);
	rep(i,N) scan(A[i]);
	bool flag=1;
	rep(i,N){
		if(A[i]!=1){
			bool f=prime_factor_decomp(A[i]);
			debug(i,A[i],f);
			if(f){
				flag=0;
				break;
			}
		}
	}
	if(flag){
		prin("pairwise coprime");
	}
	else{
		int g=0;
		rep(i,N) g=gcd(g,A[i]);
		debug(g);
		if(g==1) prin("setwise coprime");
		else prin("not coprime");
	}
	return 0;
}


Measured memory_bytes: 8940
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
//111 222 333 444 ...999 1111
int main(){
    int a,c=0;
    scanf("%d",&a);
    c=a/100;
    if(a<=100*c+10*c+c)
        printf("%d\n",100*c+10*c+c);
    else{
        c+=1;
        printf("%d\n",100*c+10*c+c);
    }
    return 0;
}
    


Measured memory_bytes: 128
import bisect
import sys


input = sys.stdin.readline
sys.setrecursionlimit(100000)


class v:
    def __init__(self, f):
        self.f = f
        self.v = None

    def __str__(self):
        return str(self.v)

    def ud(self, n):
        if self.v is None:
            self.v = n
        else:
            self.v = self.f(self.v, n)


def read_values():
    return map(int, input().split())


def read_list():
    return list(read_values())


def main():
    M, K = read_values()
    if K >= 2 ** M:
        print(-1)
        return

    if M == 1:
        print("0 0 1 1" if K == 0 else -1)
        return

    X = [str(i) for i in range(2 ** M) if i != K]
    res = X + [str(K)] + X[::-1] + [str(K)]
    print(" ".join(res))


if __name__ == "__main__":
    main()


Measured memory_bytes: 18060
#include <cstring>
#include <iostream>
#include <queue>
using namespace std;
int main () {
	long long int m;
	int n;
	while (cin >> n >> m, n || m) {
		priority_queue<pair<int, int> > que;
		for (int i = 0; i < n; i++) {
			int d, p;
			cin >> d >> p;
			que.push(make_pair(p, d));
		}
		int result = 0;
		while (!que.empty()) {
			pair<int, int> current = que.top();
			que.pop();
			int p = current.first;
			int d = current.second;
			if (m >= d) {
				m -= d;
			}
			else {
				int x = d - m;
				m = 0;
				result += x * p;
			}
		}
		cout << result << endl;
	}
	return 0;
}

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

void Main() {
    // input
    u_int32_t N;
    cin >> N;;

    vector<u_int32_t> nums(N);
    for (u_int32_t i = 0; i < N; i++) {
        cin >> nums[i];
    }

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

    u_int32_t MAX_A = 1000000;
    bool dp[MAX_A + 1];
    for (int i = 1; i <= MAX_A; i++) {
        dp[i] = true;
    }

    u_int32_t pre_num = -1;

    for (u_int32_t i = 0; i < nums.size(); i++) {
        // cout << "-" << nums[i] << "-" << endl;
        if (nums[i] == pre_num) {
            pre_num = nums[i];
            dp[nums[i]] = false;
            continue;
        }

        for (u_int32_t j = 2 * nums[i]; j <= MAX_A; j += nums[i]) {
            // cout << j << endl;
            dp[j] = false;
        }
        pre_num = nums[i];
    }

    u_int32_t ans = 0;
    for (u_int32_t i = 0; i < nums.size(); i++) {
        // cout << nums[i] << endl;
        if (dp[nums[i]]) {
            ans++;
            // cout << "true" << endl;
        } else {
            // cout << "false" << endl;
        }
    }


    // output
    cout << ans << endl;

}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 5092
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int mod=1e9+7;
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    int i,j,k,m,n,ans=0,ans1=0;
    cin>>m>>n;
    if(m==1||m==3||m==5||m==7||m==8||m==10||m==12)
    {
        ans=1;
    }
    else if(m==2)
    {
        ans=2;
    }
    else
    {
        ans=3;
    }
    if(n==1||n==3||n==5||n==7||n==8||n==10||n==12)
    {
        ans1=1;
    }
    else if(n==2)
    {
        ans1=2;
    }
    else
    {
        ans1=3;
    }
    if(ans==ans1)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


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

int main()
{
    int n, m;
    cin >> n >> m;

    int start = 1, end = n;
    //vector<int> l(m), r(m);
    int l, r;

    for (int i = 0; i < m; i++)
    {
        //cin >> l[i] >> r[i];
        cin >> l >> r;
        if (l > start)
            start = l;
        
        if (r < end)
            end = r;
    }

    //for (int i = 0; i < m; i++)
    if (end > start)
        cout << (end - start + 1) << endl;
    else if (end == start)
        cout << 1 << endl;
    else //end < start
        cout << 0 << endl;
}


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

using namespace std;


int main(){
string s ;
  
  cin >> s;
  
  for(int i=0;i<3;i++){
  if(s[i] == '7'){
  cout << "Yes" << endl;
    
    return 0;
  }
  }
  
  cout << "No" << endl;
}

Measured memory_bytes: 3624