akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
typedef pair<int,int> P;

const int MOD=1000000007;
int INF=100100100100100;
int a[200010];
signed main(){
  int n;cin>>n;
  rep(i,n)cin>>a[i];
  int mi=INF,ans=0;
  rep(i,n){
    if(a[i]<mi)mi=a[i],ans++;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 5176
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
#define loop(i,a,n) for (int i = (a); (i) < (n); ++ (i))
#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF (int)1e9
#define MOD 0
//#define int ll
using namespace std;
typedef vector<long long> vl;

signed main() {

  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,c;
  cin >> a >> b >> c;
  cout << c << ' ' << a << ' ' << b << endl;
  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<climits>
#include<cmath>
#include<cstdio>
#include<deque>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

int A[31] = { 1,1 };

int a(int n) {
	if (A[n])return A[n];
	if (n - 1 >= 0)A[n] += A[n - 1] ? A[n - 1] : a(n - 1);
	if (n - 2 >= 0)A[n] += A[n - 2] ? A[n - 2] : a(n - 2);
	if (n - 3 >= 0)A[n] += A[n - 3] ? A[n - 3] : a(n - 3);
	return A[n];
}

int main() {
	for (int n; cin >> n&&n;)
		cout << ceil((double)a(n) / (365 * 10)) << endl;
	return 0;
}

Measured memory_bytes: 1232
#include <stdio.h>

#define f(i, q) for(int i = 0; i < q; i++)  
#define MAX 100001

typedef long long ll;

int main() {
    ll N, Q, sum = 0, temp, temp_b, temp_c;
    ll size_num[MAX] = {0};

    scanf("%lld", &N);
    for(int i = 0; i < N; i++) {
        scanf("%lld", &temp);
        size_num[temp]++;
        sum += temp;
    }

    scanf("%lld", &Q);
    for(int i = 0; i < Q; i++) {
        scanf("%lld %lld", &temp_b, &temp_c);
        temp = size_num[temp_b];
        size_num[temp_b] = 0;
        size_num[temp_c] += temp;
        sum -= temp * temp_b;
        sum += temp * temp_c;
        printf("%lld\n", sum);
    }

    return 0;
}


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

int main(){
stack <double> s;
string ss,aa;
while(getline(cin,ss)){
//cout<<ss<<endl;
stringstream sss(ss);
while(sss>>aa){
 if(aa=="-"){

	 double a=s.top();s.pop();

	 double b=s.top();s.pop();
	 s.push(b-a);
 }else if(aa=="+"){
	 double a=s.top();s.pop();

	 double b=s.top();s.pop();
	 s.push(b+a);

 }else if(aa=="*"){
	 double a=s.top();s.pop();

	 double b=s.top();s.pop();
	 s.push(b*a);

 }else if(aa=="/"){
	 double a=s.top();s.pop();

	 double b=s.top();s.pop();
	 s.push(b/a);
 }else{
	// cout<<aa<<endl;
	 //cout<<aa[0]<<" "<<aa[1]<<endl;
	 if(aa[0] != '-'){
int suma=0;
	 	 for (int i = 0; i<aa.length() ; ++i) {
	 		 suma+=pow(10,aa.length()-1-i)*(aa[i]-'0');
	 	 }

	 	s.push(suma);
}else{
	int suma=0;
		 	 for (int i = 1; i<=aa.length()-1 ; ++i) {
		 		 suma+=pow(10,aa.length()-1-i)*(aa[i]-'0');
		 	 }
suma=-1*suma;
		 	s.push(suma);

}
 }

}

printf("%.10lf\n",s.top());

}
}

Measured memory_bytes: 3396
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long a,b;
  cin >> a >> b;
  if(a>12){
    cout << b << endl;
  }else if(a>5){
    cout << b/2 << endl;
  }else{
    cout << "0\n";
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

	    for(int i=0; i<N; ++i) {
	        stones[i] = sc.nextInt();
        }

	    int r = minimumTotalCost(stones, N);
	    System.out.println(r);
    }

    public static int minimumTotalCost(int[] s, int N) {
        int[] v = new int[N];
        int r = 0;
        v[0] = 0;
        v[1] = Math.abs(s[0]-s[1]);
//        r += v[1];
        for(int i=2; i<N; ++i) {
            v[i] = Math.min(Math.abs(s[i-1]-s[i]) +v[i-1], Math.abs(s[i-2]-s[i]) +v[i-2]);
//            if(v[i] == Math.abs(s[i-1]-s[i])) {
//                r += v[i-1];
//            }
//            else {
//                r += v[i-2];
//            }
        }

        return v[N-1];
    }
}


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

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int c, r;
  cin >> r >> c;
  vector<string> g(r);
  queue<tuple<int, int, int>> q;
  for (int i = 0; i < r; ++i) {
    cin >> g[i];
    for (int j = 0; j < c; ++j) {
      if (g[i][j] == '#') {
        q.push(make_tuple(i, j, 0));
      }
    }
  }
  vector<int> dx = { -1, 0, 1, 0 };
  vector<int> dy = { 0, 1, 0, -1 };
  int maxD = 0;
  while (!q.empty()) {
    auto cur = q.front();
    q.pop();
    int y = get<0>(cur), x = get<1>(cur), d = get<2>(cur);
    maxD = max(maxD, d);
    for (int i = 0; i < 4; ++i) {
      int nx = x + dx[i];
      int ny = y + dy[i];
      if (nx >= 0 && nx < c) {
        if (ny >= 0 && ny < r) {
          if (g[ny][nx] != '#') {
            q.push(make_tuple(ny, nx, d + 1));
            g[ny][nx] = '#';
          }
        }
      }
    }
  }
  cout << maxD << endl;
  return 0;
}



Measured memory_bytes: 13456
using System;
class sosuu
{
    static void Main()
    {
        int[] a = new int[10000];
        a[0] = 2;
        int z = 1;
        int g = 2;
        for(;; )
        {
            for(int m = 0; m < z; m++)
            {
                if (g % a[m] == 0)
                    goto stop;
            }
            a[z] = g;
            z++;
            stop:;
            if (g % 2 == 0)
                g++;
            else
                g += 2;
            if (z == 10000)
                break;
        }
        ulong[] k = new ulong[50];
        int j = 0;
        while (true)
        {
            int b = int.Parse(Console.ReadLine());
            if (b == 0) break;
            ulong c = 0;
            for(int i = 0; i < b; i++)
                c += (ulong)a[i];
            k[j] = c;
            j++;
        }
        for(int i = 0; i < j; i++)
        {
            Console.WriteLine(k[i]);
        }
    }
}

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

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;
constexpr ll mo2 = 998244353;
const double PAI = acos(-1);
constexpr long double eps = 1e-9;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n;
    cin>>n;
    vector<pair<int,int>> v(n);
    for(int i=0;i<n;++i){
        int a;cin>>a;
        v[i] = {a,i};
    }
    sort(v.rbegin(),v.rend());
    vector<vector<ll>> dp(2050,vector<ll>(2050,-inf));
    dp[0][0] = 0;
    for(int i=0;i<n;++i)for(int x=0;x<=i;++x){
        int y = i-x;
        dp[x+1][y] = max(dp[x+1][y],dp[x][y] + 1ll*v[i].first * abs(v[i].second - x));
        dp[x][y+1] = max(dp[x][y+1],dp[x][y] + 1ll*v[i].first * abs(n-y-1 - v[i].second));
    }
    ll ret = -inf;
    for(int i=0;i<=n;++i){
        ret = max(ret,dp[i][n-i]);
    }
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 36208
N = int(input())

P = list(map(int,input().split()))

ans = 0
for i in range(1,N-1):
    if P[i+1]>P[i] and P[i]>P[i-1]: ans+=1
    elif P[i-1]>P[i] and P[i]>P[i+1]: ans+=1
        
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;  
#define ordered_set tree<ll, null_type , less<ll> , rb_tree_tag , tree_order_statistics_node_update> 
#define ll long long
#define ull unsigned long long
#define pb push_back
#define inf 1e18
#define mk make_pair
#define ld long double
#define mod 1000000007
#define fi first
#define se second
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test ll t; cin>>t; while(t--)
ll power(ll a,ll n)
{
    ll p;
    if(n==0)
    {
        return 1;
    }
    p=power(a,n/2);
    p=((p%mod)*(p%mod))%mod;
    if(n%2==1)
    {
        p=((p%mod)*(a%mod))%mod;
    }
    return p;
}
int main()
{
    ll n;
    cin>>n;
    ll a[n],i;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    vector<set<ll>>v(1000001);
    ll x,y,val,val1;
    for(int i=0;i<n;i++)
    {
        x=a[i];
        y=0;
        while(x%2==0)
        {   
            y++;
            x/=2;
        }
        v[2].insert(y);
        for(int j=3;j<=sqrt(x);j++)
        {
            if(x%j==0)
            {
                y=0;
                while(x%j==0)
                {
                    y++;
                    x/=j;
                }
                v[j].insert(y);
            }                          
        }
        if(x>2)
        {
            v[x].insert(1);
        }
    }
    ll ans=1;
    for(int i=1;i<1000001;i++)
    {
        if(v[i].size()>0)
        {
            x=*v[i].rbegin();
            ans=((ans%mod)*(power(i,x)%mod))%mod;
        }
    }
    ll b[n];
    val=0;
    for(int i=0;i<n;i++)
    {
        b[i]=((ans%mod)*(power(a[i],mod-2)%mod))%mod;
        val=(val+b[i])%mod;
    }
    cout<<val<<'\n';
    return 0;
}

Measured memory_bytes: 47744
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int N=100005;
int n,last[N],ans[N];
char s[N];
int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	for(int i=n;i>=1;i--){
		if(s[i]=='R'){
			if(s[i+1]!='R'){
				last[i]=i;
			}else{
				last[i]=last[i+1];
			}
			if((last[i]-i)%2==0){
				ans[last[i]]++;
			}else{
				ans[last[i]+1]++;
			}
		}
	}
	for(int i=1;i<=n;i++){
		if(s[i]=='L'){
			if(s[i-1]!='L'){
				last[i]=i;
			}else{
				last[i]=last[i-1];
			}
			if((i-last[i])%2==0){
				ans[last[i]]++;
			}else{
				ans[last[i]-1]++;
			}
		}
	}
	for(int i=1;i<=n;i++){
		printf("%d ",ans[i]);
	}
	return 0;
}

Measured memory_bytes: 1280
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define pb push_back
#define pf pop_front
#define mp make_pair
#define mod 1000000007
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mat vector<vector<int>>
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define fo(i,n) for(int i=0;i<(n);i++)
#define inp(a) int a;cin>>a;
#define inpa(a,n)vector<int> a(n);fo(i,n)cin>>a[i];
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
using namespace std;
#define int ll
#define INF (int)1e18


auto max(auto a){auto ans=a[0];for(auto i:a)if(i>ans)ans=i;return ans;}
auto min(auto a){auto ans=a[0];for(auto i:a)if(i<ans)ans=i;return ans;}
void print(auto a){for(auto i:a)cerr<<i<<' ';cerr<<'\n';}


signed main()
{
	fio
	inp(n)
	if(n%2==0)
	{
		cout<<n/2-1<<'\n';
	}
	else
	{
		cout<<n/2<<'\n';
	}
	printclock;
}

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

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

  bool yellow = false;

  char color;
  for(int i = 0; i < N; i++){
    cin >> color;
    if(color == 'Y'){
      yellow = true;
      break;
    }
  }
  if(yellow){
    cout << "Four" << endl;
  }
  else{
    cout << "Three" << endl;
  }
}


Measured memory_bytes: 3568
# import sys
# readline = sys.stdin.readline
# generator = (readline().strip() for _ in range(N))

# import numpy as np
# from itertools import permutations
# from itertools import combinations
# from itertools import combinations_with_replacement
# import queue
# import heapq

# N, M = map(int, input().split())
# As = list(map(int, input().split()))
# queries = (input() for _ in range(N))

import math

def solve():
    A, B, H, M = map(int, input().split())

    minutes = H * 60 + M

    theta_A = 2 * math.pi * minutes / 720
    rad_A = math.pi / 2 - theta_A
    pos_A = (A * math.cos(rad_A), A * math.sin(rad_A))

    theta_B = 2 * math.pi * minutes / 60
    rad_B = math.pi / 2 - theta_B
    pos_B = (B * math.cos(rad_B), B * math.sin(rad_B))

    dist = math.sqrt((pos_A[0]-pos_B[0])**2 + (pos_A[1]-pos_B[1])**2)

    return dist


def main():
    print(solve())


if __name__ == "__main__":
    main()


Measured memory_bytes: 9524
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int,int> PP;

/*
    freopen("input","r",stdin);
    freopen("output","w",stdout);
*/

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    vector<int> A, B;
    int N;
    cin >> N;
    A.resize(N);
    for (int i = 0;i < N;i++) cin >> A[i];
    B = A;
    sort(B.begin(), B.end());
    int idx = N / 2 - 1;
    for (int i = 0;i < N;i++) {
    	if (A[i] <= B[idx]) cout << B[idx + 1];
    	else cout << B[idx];
    	cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3840
H,W = gets.split.map(&:to_i)
S = Array.new(H)
H.times do |n|
	S[n] = gets.chomp.split("")
end
score = S.flatten.count('.')
S[0][0] = 1
node = []
node.push [0,0]
direction = [[-1,0],[1,0],[0,-1],[0,1]]

while !node.empty?
	cur = node.shift
	
	if cur == [H-1,W-1]
		break
	end

	direction.each do |d|
		if (cur[0]+d[0]).between?(0,H-1) && (cur[1]+d[1]).between?(0,W-1)
			if S[cur[0]+d[0]][cur[1]+d[1]] == '.'
				S[cur[0]+d[0]][cur[1]+d[1]] = S[cur[0]][cur[1]] + 1
				node.push [(cur[0]+d[0]), (cur[1]+d[1])]
			end
		end
	end
end
if S[H-1][W-1].kind_of?(Integer)
	print "#{score-S[H-1][W-1]}\n"
else
	print "-1"
end

Measured memory_bytes: 2172
n,m,x = map(int, input().split())
l=list(map(int ,input().split()))
pcnt=0
mcnt=0
for i in range(x,n+1):
    if i in l:
        pcnt+=1
for i in range(x,0,-1):
    if i in l:
        mcnt+=1
print(min(pcnt,mcnt))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 1e5 + 5;

int32_t main()
{
	IOS;
	string s;
	cin >> s;
	if(s[1] == 'B')
		s[1] = 'R';
	else
		s[1] = 'B';
	cout << s;
	return 0;
}

Measured memory_bytes: 3644
n = int(input())
x = [0]*n
y = [0]*n
for i in range(n):
    x[i], y[i] = map(int, input().split())
    
result = 0

for i in range(n):
    for j in range(i, n):
        result += ((x[i] - x[j])**2 + (y[i] - y[j])**2)**(0.5)
        
print(result*2/n)

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main()
{
	char str1[10], str2[10], str3[10];
	
	cin >> str1 >> str2 >> str3;
	
	str1[0] -= 0x20;
	str2[0] -= 0x20;
	str3[0] -= 0x20;
	
	cout << str1[0] << str2[0] << str3[0] << endl;
	
	return (0);
}

Measured memory_bytes: 256
/*
 * 配るDP
 */
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        sc.close();
        // A[i]：i円引き出す時の最小回数。
        int[] A = new int[N+1];
        Arrays.fill(A, N);
        A[0] = 0;
        for(int n = 0; n <= N; n++){
            for(int i = 1; n+i <= N; i*=6){
                A[n+i] = Math.min(A[n+i], A[n]+1);
            }
            for(int i = 1; n+i <= N; i*=9){
                A[n+i] = Math.min(A[n+i], A[n]+1);
            }
        }
        System.out.println(A[N]);
    }

}


Measured memory_bytes: 23892
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main()
{
  int A, B, T;
  cin >> A >> B >> T;
  cout << B * (T / A) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<algorithm>
using namespace std;
#define ll long long
ll b;
ll MA=50000;
ll f(ll a,ll b){

    return (b*(b+1LL)/2LL)-(a*(a-1LL)/2LL);
}

void solve(ll b){

    for(ll i=MA;i>=1;i--){
        ll ng=0,ok=1000000000+6;
        ll mid;
        
        while(abs(ok-ng)>1){
            mid=(ok+ng)/2;
            
            if(f(mid,mid+i-1)==b)break;
            
            if(f(mid,mid+i-1)>b){
                ok=mid;
            }
            else{
                ng=mid;
            }
        }
        //cout<<ok<<" "<<i<<endl;
        if(f(mid,mid+i-1)==b){
            cout<<mid<<" "<<i<<endl;
            return;
        }
    }
}

int main(void){
    while(cin>>b,b){
        solve(b);
    }
}



Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
long long  dp[101][100001],n,w,a[101], wt[101];
long long mxW(int i, long long W){
    if(i==n || W <= 0){
        return 0;
    }
    if(dp[i][W] != -1){
        return dp[i][W];
    }
    long long  temp =0;
    if(wt[i] <= W){
        temp = mxW(i +1,W-wt[i])+a[i];
    }
    dp[i][W] = max(temp, mxW(i +1,W));
    
    
    return dp[i][W];
}

int main() {
	cin>>n>>w;
	for(int i=0;i<n;i++){
	    cin>>wt[i]>>a[i];
	    }
	    memset(dp ,-1 , sizeof(dp));
	    cout<<mxW(0, w);
	return 0;
}

Measured memory_bytes: 82540
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
#define debug(x) std::cout << #x << ": " << x << '\n';
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(20); 
    #endif
    int n, A, B;
    cin >> n >> A >> B;
    vector <int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }   
    int ans = 0;
    for (int i = 0; i + 1 < n; ++i) {
        ans += min((a[i + 1] - a[i]) * A, B);
    }   
    cout << ans << endl;
}


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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = 10e15;
const ll MINF = -10e10;
//const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<P, vector<P>, greater<P>> PQ_ASK;
const int mod = 1000000007;

int main() {

    int n;
    cin >> n;

    vector<int> cards(n);
    rep(i, n) {
        cin >> cards[i];
    }
    sort(cards.rbegin(), cards.rend());

    ll alice = 0;
    ll bob = 0;

    for (int i = 0; i < n; i++) {
        if (i % 2 == 0) alice += cards[i];
        else bob += cards[i];
    }

    cout << alice - bob << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
const long N = 1e5+7;
vector<long> v[N];
long k[N];
long fun(long i)
{
	long &hj=k[i];
	if(hj!=-1)
	{
		return hj;
	}
	else 
	{
		hj=0;
		for(long j=0;j<v[i].size();j++)
		{
			hj=max(hj,1+fun(v[i][j]));
		}
	}
	return hj;
}
int32_t main()
{
		IOS;
		  memset(k, -1, sizeof(k));
		long n,m;
		cin>>n>>m;
		for(long i=0;i<m;i++)
		{
			long u,t;
			cin>>u>>t;
			v[u].push_back(t);
		}
		long fans=0;
		for(long i=0;i<n+1;i++)
		{
			if(v[i].size()!=0)
			{
				fans=max(fans,fun(i));
			}
		}
		cout<<fans<<endl;
}

Measured memory_bytes: 8576
h,w = map(int,input().split())
a = []
for i in range(h):
    atemp = list(input())
    a.append(atemp)

#行を削除
i = 0
counter = 0
line = 0
while counter < h:
    k = 0
    check = True
    while k<w and check:
        if a[i][k] == "#":
            check = False
        else:
            k += 1
    if check:
        a.pop(i)
        line += 1
    else:
        i += 1
    counter += 1

#列を削除
i = 0
k = 0
counter = 0
while counter < w:
    i = 0
    check = True
    while i < h-line and check:
        if a[i][k] == "#":
            check = False
        else:
            i += 1
    if check:
        for j in range(len(a)):
            a[j].pop(k)
    else:
        k += 1
    counter += 1

for i in range(len(a)):
    for k in range(len(a[i])):
        if k != len(a[i]) -1:
            print(a[i][k],end = "")
        else:
            print(a[i][k])

Measured memory_bytes: 4724
#include <stdio.h>
#include <math.h>
#include <algorithm>

using namespace std;

struct Team{
	char name[21];
	int score;
};

int main(){

	int n,win,lose,even;
	bool First = true;

	while(true){
		scanf("%d",&n);
		if(n == 0)break;

		if(!First)printf("\n");

		Team array[n];

		for(int i=0; i < n; i++){
			scanf("%s %d %d %d",array[i].name,&win,&lose,&even);
			array[i].score = 3*win+even;
		}

		for(int i=1; i <= n-1; i++){
			for(int k=n-1; k >= i; k--){
				if(array[k].score > array[k-1].score)swap(array[k],array[k-1]);
			}
		}
		for(int i=0; i< n; i++){
			printf("%s,%d\n",array[i].name,array[i].score);
		}

		if(First)First = false;
	}

    return 0;
}

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

int main() {
  int W, H, N;
  cin >> W >> H >> N;
  vector<vector<int>> field(H, vector<int>(W, 0));

  for (int i = 0; i < N; i++) {
    int x, y, a;
    cin >> x >> y >> a;

    if (a == 1) {
      for (int i = 0; i < H; i++) {
        for (int j = 0; j < x; j++) {
          field.at(i).at(j) = 1;
        }
      }
    }
    else if (a == 2) {
      for (int i = 0; i < H; i++) {
        for (int j = x; j < W; j++) {
          field.at(i).at(j) = 1;
        }
      }
    }
    else if (a == 3) {
      for (int i = 0; i < y; i++) {
        for (int j = 0; j < W; j++) {
          field.at(i).at(j) = 1;
        }
      }
    }
    else if (a == 4) {
      for (int i = y; i < H; i++) {
        for (int j = 0; j < W; j++) {
          field.at(i).at(j) = 1;
        }
      }
    }
  }

  int cnt = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (field.at(i).at(j) == 0) cnt++;
    }
  }
  cout << cnt << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int n,k,x,y;
    cin>>n>>k>>x>>y;
    if(n<=k)
        cout<<n*x<<endl;
    else{
        cout<<(k*x)+(n-k)*y<<endl;
    }
}


Measured memory_bytes: 3608
#include <stdio.h>
#include <iostream>
#include <algorithm>

int main(){
	int H,W;
	
	while(true){
		scanf("%d %d", &H, &W);
		if(H==0 &&W==0)
			break;
		for(int i=0;i<H;i++){
			if(i%2==0){
				for(int j=0;j<W;j++){
					if(j%2==0)
						printf("#");
					else
						printf(".");
				}
				printf("\n");
			}
			else{
				for(int j=0;j<W;j++){
					if(j%2==0)
						printf(".");
					else
						printf("#");
				}
				printf("\n");
			}
		}
		printf("\n");
	}
}


Measured memory_bytes: 3152
def main():
    a, b = map(int, input().split())
    k = 50
    gw = [['.'] * 2 * k for _ in range(k)]
    gb = [['#'] * 2 * k for _ in range(k)]
    for i in range(b - 1):
        h = (i // k) * 2
        w = (i % k) * 2
        gw[h][w] = '#'
    for i in range(a - 1):
        h = (i // k) * 2 + 1
        w = (i % k) * 2 + 1
        gb[-h][-w] = '.'
    ans = gw + gb
    print(2 * k, 2 * k)
    for l in ans:
        print(*l, sep='')


if __name__ == '__main__':
    main()

Measured memory_bytes: 4468
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main  implements Runnable {
    public static void main(String[] args) {
        new Thread(null, new Main(), "", 64 * 1024 * 1024).start();
    }

    public void run() {
    	FastScanner sc = new FastScanner(System.in);
    	PrintWriter out = new PrintWriter(System.out);
		//long n = Long.parseLong(sc.next());
		int q = Integer.parseInt(sc.next());
		int[] a = new int[100001];
		Arrays.fill(a, 1);
		a[0] = 0;
		a[1] = 0;
		for (int i = 2; i < 100001; i++) {
			if(a[i]==1)
			{
				int p = 2;
				while(p*i <= 100000)
				{
					a[p*i] = 0;
					p++;
				}
			}
		}
		int[] b = new int[100001];
		int cr = 0;
		for (int i = 0; i < 100001; i++) {
			if(a[i]==1 && a[(i+1)/2]==1)
			{
				cr++;
			}
			b[i] = cr;
		}
		for (int i = 0; i < q; i++) {
			int l = Integer.parseInt(sc.next());
			int r = Integer.parseInt(sc.next());
			out.println(b[r]-b[l-1]);
		}
		//out.println();
		out.flush();
    }

    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;
        public FastScanner(String in) {
        	StringReader sr = new StringReader(in);
            reader = new BufferedReader(new BufferedReader(sr));
            tokenizer = null;
        }
        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }
        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
    }
}

Measured memory_bytes: 49292
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
typedef long long ll;
const int mod= 1e+9+7;

int main() {
    int W,H,N; cin>>W>>H>>N;
    vector<vector<int>>x(N,vector<int>(3));
    vector<vector<bool>>b(H+1,vector<bool>(W+1,true));
    rep(i,N){
        cin>>x[i][0]>>x[i][1]>>x[i][2];
        if(x[i][2]==1){
           rep(j,x[i][0]){
          for(int k=0;k<H+1;k++) {
                //b[j][k]=false;
                 b[k][j]=false;
            }
            }
        }
        else if(x[i][2]==2){
            for(int k=0;k<H+1;k++){
            for(int j=x[i][0]+1;j<W+1;j++){
                //b[j][k]=false;
                 b[k][j]=false;
            }
            }
        }
        else if(x[i][2]==3){
            for(int k=0;k<W+1;k++){
            for(int j=H-x[i][1]+1;j<H+1;j++){
                //b[k][j]=false;
                 b[j][k]=false;
            }
            }
        }
        else{
            for(int k=0;k<W+1;k++){
            for(int j=0;j<H-x[i][1];j++){
                //b[k][j]=false;
                 b[j][k]=false;
            }
            }
        }
    }
    int ans =0;
    rep(i,H){
        rep(j,W){
            if(b[i][j]==true && b[i+1][j+1]==true&&b[i+1][j]==true&&b[i][j+1]==true)ans++;
        }
    }
    cout<<ans<<endl;

}
 



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


#define FSCNd64 "%" SCNd64
#define FPRId64 "%" PRId64

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vpii=vector<pii>;

#define PI 3.1415926535897932384626433832795

template<typename X>
bool max_u(X&m, X v)
{
	if(m<v)
	{
		m=v;
		return true;
	}
	return false;
}


template<typename X>
bool min_u(X&m, X v)
{
	if(m>v)
	{
		m=v;
		return true;
	}
	return false;
}


struct solve
{
	solve(){}
	ll operator()() {
		return 0;
	}
};

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

	for(;;)
	{
		int x, y;
		cin >> x >> y;
		if(cin.fail()) break;
		bool ans=true;
		if(y<x*2) ans=false;
		if(y>x*4) ans=false;
		if(y&1) ans=false;

		cout << (ans?"Yes":"No") << "\n";
	}
	return 0;
}


Measured memory_bytes: 3652
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;

// #define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

const int MOD = 1e9 + 7;
const int INF = INT_MAX;

signed main() {
    Fast();

    string n;
    cin >> n;

    cout << ((n[0] == n[1] && n[1] == n[2]) ||
        (n[1] == n[2] && n[2] == n[3]) ? "Yes" : "No") << endl;

    return 0;
}



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

int main() {
    int32_t n;
    cin >> n;
    int32_t a[n];
    for(int32_t i = 0; i < n; i++) {
        cin >> a[i];
        a[i] -= i + 1;
    }

    sort(a, a + n);

    int64_t answer = 0;
    for (int32_t i = 0; i < n; i++) {
        answer += abs(a[i] - a[n / 2]);
    }
    cout << answer << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <iostream>
#include <set>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define PRIME1 99999883
#define PRIME2 99999893
#define EPS 0.00000001
using namespace std;

enum Type{
	None,
	GreaterEqual,
	SmallerEqual,
};

struct Data{
	Type type;
	int number;
};

struct Info{
	Data data[101];
	bool used;
};

int main(){

	int num_of_SC,num_of_skill,K;
	scanf("%d %d",&num_of_SC,&num_of_skill);
	Info info[num_of_SC];
	for(int i = 0; i < num_of_SC; i++){
		info[i].used = false;
		for(int a = 1; a <= num_of_skill;a++)info[i].data[a].type = None;
	}

	int skill_code,skill_level;

	char eq[4];
	bool FLG = true;

	//??????????????\???
	for(int i = 0; i < num_of_SC; i++){
		scanf("%d",&K);
		for(int a = 0; a < K; a++){
			scanf("%d %s %d",&skill_code,eq,&skill_level);
			if(info[i].data[skill_code].type == None){
				info[i].data[skill_code].number = skill_level;
				if(eq[0] == '>'){
					info[i].data[skill_code].type = GreaterEqual;
				}else{
					info[i].data[skill_code].type = SmallerEqual;
				}
			}else{ //??????????????§?????????????????????????????§??????!!!
				if(info[i].data[skill_code].type == GreaterEqual){
					if(eq[0] == '>'){
						//Do nothing <?¨????????§??????????????????§?°??????????????????????????????????????????????????????????>
					}else{
						if(info[i].data[skill_code].number > skill_level){
							FLG = false;
						}
					}
				}else{
					if(eq[0] == '>'){
						if(info[i].data[skill_code].number < skill_level){
							FLG = false;
						}
					}
				}
			}
		}
	}

	if(!FLG){
		printf("No\n");
		return 0;
	}

	int count = 0;
	stack<int> S;

	while(true){

		//???????????????????????????????????§???????????????special skill???1????????????special skill?????¢???<?????????????????????????????????special skill??????????????????FLG???false?????????>
		for(int i = 0; i < num_of_SC; i++){ //??????????????????
			if(info[i].used == true)continue;

			FLG = true;
			for(int a = 0; a < num_of_SC; a++){ //????????????????±?????????????
				if(i == a || info[a].used == true)continue;

				for(int b = 1; b <= num_of_skill;b++){ //skill????????????

					switch(info[a].data[b].type){
					case None:
						//Do nothing
						break;
					case GreaterEqual:

						/*if(info[i].data[b].type == GreaterEqual && info[i].data[b].number > info[a].data[b].number){
							FLG = false;
						}*/
						break;
					case SmallerEqual:
						if(info[i].data[b].type == GreaterEqual && info[i].data[b].number > info[a].data[b].number){
							FLG = false;
						}
						break;
					}
				}
				if(!FLG)break;
			}
			if(FLG){
				S.push(i);
				break;
			}
		}

		if(S.empty())break;

		while(!S.empty()){
			info[S.top()].used = true;
			count++;
			S.pop();
		}
	}

	if(count == num_of_SC){
		printf("Yes\n");
	}else{
		printf("No\n");
	}

    return 0;
}

Measured memory_bytes: 3244
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
const Int MOD = 998244353;
int main() {
    int N, S; cin >> N >> S;
    vector<int> X(N); for (auto &x : X) cin >> x;
    vector<int> A(S + 1), B(S + 1);
    A[0] = 1;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= S; j++) B[j] = A[j] * 2 % MOD;
        for (int j = 0; j <= S; j++) {
            if (j + X[i] <= S) {
                B[j + X[i]] += A[j];
                B[j + X[i]] %= MOD;
            }
        }
        swap(A, B);
    }
    cout << A[S] << '\n';
    return 0;
}


Measured memory_bytes: 3684
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

vector<int> V;

int D, G, p[12], c[12], tmpP[12];

int CALC(vector<int> V) {

	for (int i = 1; i <= D; i++) { tmpP[i] = p[i]; }

	int ret = 0; int sum = 0;
	for (auto y : V) {
		/*while (sum < G && tmpP[y]>0) {
			sum += y * 100; tmpP[y]--; ret++;
		if (tmpP[y] == 0) { sum += c[y]; }
		}
		if (sum >= G) { return ret; }*/
		
		int num = ((G - sum) / 100 + y - 1) / y;

		num = min(num, tmpP[y]);
		sum += num * 100 * y;
		ret += num;
		if (num == tmpP[y]) { sum += c[y]; }

		if (sum >= G) { return ret; }
	}
	return 99999;
}

int main(void) {
	cin >> D >> G;
	for (int i = 1; i <= D; i++) { cin >> p[i] >> c[i]; }
	

	for (int i = 1; i <= D; i++) { V.push_back(i); }
	int ans = 99999;
	do {

		int ret = CALC(V);
		ans = min(ans, ret);

		//for (auto y : V) { cout << y; }cout << endl;
	} while (next_permutation(V.begin(), V.end()));

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
#define ll long long

using namespace std;



int main()
{


   map<int,int>mapp;
   map<int,int>::iterator itr;









     long long a,a1,k, coun1, i,t,ar,n,m,maxx = 0,c2=0,r,c3=0,c4=0,A,sum=0,sum1=0,b,flag=0,B,c=0,w=0,e,f,g,l=0;

     /*int arr[20001];
     int arr1[100];
*/




         vector<long long>arr;
         vector<int>arr1;

         ll coun=0;


         cin >> n;


    for(long long i=0;i<n;i++)
    {
        cin >> a;
        arr.push_back(a);

    }


    int ins_valu =arr[0];
     for(long long i=1;i<n;i++)
      {

        if(ins_valu > arr[i] )
        {
             flag +=ins_valu - arr[i];

        }
          else if(ins_valu < arr[i] )
        {
             ins_valu = arr[i];

        }
          else if(ins_valu == arr[i] )
        {
               flag+=0;
        }

     }

     cout << flag;


     return 0;
}


Measured memory_bytes: 5340
x,y = map(int, input().split())
if x > 0:
  if x > y:
    if y >= 0:
      print(min(x-y+2,x+y+1))
    else:
      print(abs(x+y)+1)
  else:
    print(y-x)
    
elif x == 0:
  if y >= 0:
    print(y)
  else:
    print((-y)+1)
else:
  if x > y:
    print(x-y+2)
  else:
    if abs(x) > y:
      print(min(abs(x)-y+1,y-x))
    else:
      print(y-abs(x)+1)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n; cin >> n;
    vector<long long> v(n);
    long long all = 0; int minuscnt = 0; int pluscnt = 0;
    long long absmin = 1e9; int absminindex = -1;
    for (int i = 0; i < n; i++) {
        cin >> v[i];
        if (v[i] < 0) minuscnt++;
        if (v[i] > 0) pluscnt++;
        if (absmin > abs(v[i])) {
            absmin = abs(v[i]);
            absminindex = i;
        }
        all += abs(v[i]);
    }
    vector<bool> plus(n);
    if (minuscnt == n) {
        for (int i = 0; i < n; i++) {
            plus[i] = false;
        }
        plus[absminindex] = true;
    } else if (pluscnt == n) {
        for (int i = 0; i < n; i++) {
            plus[i] = true;
        }
        plus[absminindex] = false;
    } else {
        for (int i = 0; i < n; i++) {
            plus[i] = v[i] > 0;
        }
        for (int i = 0; i < n; i++) {
            if (v[i] == 0) {
                plus[i] = !plus[(i+1)%n];
                break;
            }
        }
    }
    long long ans = 0;
    vector<long long> x, y;
    for (int i = 0; i < n; i++) {
        if (plus[i]) ans += v[i];
        else ans -= v[i];
        if (plus[i]) x.emplace_back(i);
        else y.emplace_back(i);
    }
    vector<pair<int, int>> op;
    for (int i = 0; i < x.size(); i++) {
        if (x[i] == x.back()) break;
        op.emplace_back(v[y.front()], v[x[i]]);
        v[y.front()] -= v[x[i]];
    }
    op.emplace_back(v[x.back()], v[y.front()]);
    v[x.back()] -= v[y.front()];
    for (int i = 0; i < y.size(); i++) {
        if (y.front() == y[i]) continue;
        op.emplace_back(v[x.back()], v[y[i]]);
        v[x.back()] -= v[y[i]];
    }
    cout << v[x.back()] << endl;
    for (int i = 0; i < op.size(); i++) {
        cout << op[i].first << " " << op[i].second << endl;
    }
    return 0;
}

Measured memory_bytes: 5176
/*  -*- coding: utf-8 -*-
 *
 * d.cc: D - Semi Common Multiple
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100000;

/* typedef */

typedef long long ll;

/* global variables */

int as[MAX_N];

/* subroutines */

template <typename T>
T gcd(T m, T n) {  // m > 0, n > 0
  if (m < n) swap(m, n);
  while (n > 0) {
    T r = m % n;
    m = n;
    n = r;
  }
  return m;
}

/* main */

int main() {
  int n, m;
  scanf("%d%d", &n, &m);

  for (int i = 0; i < n; i++) {
    scanf("%d", as + i);
    as[i] >>= 1;
    if (as[i] > m) {
      puts("0");
      return 0;
    }
  }

  ll lcm = as[0];
  for (int i = 1; i < n; i++) {
    ll g = gcd<ll>(lcm, as[i]);
    lcm = lcm * as[i] / g;
    if (lcm > m) {
      puts("0");
      return 0;
    }
  }

  for (int i = 0; i < n; i++)
    if (((lcm / as[i]) & 1) == 0) {
      puts("0");
      return 0;
    }
  
  int c = m / lcm;
  printf("%d\n", (c + 1) / 2);
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#include <iomanip>
#define rep(i,N) for(int i=0;i<(int)N;++i)
//cout << fixed << setprecision(20) << *** << endl;
typedef long long ll;
using namespace std;
ll gcd(ll a,ll b){
	ll t;
	if(a<b){
		t=a;
		a=b;
		b=t;
	}
	if(a%b==0)return b;
	return gcd(b,a%b);
}
int main()
{
	ll K,A=1,B=1,C=1,ANS=0;
	cin>>K;
	for(;;){
		ANS=ANS+gcd(gcd(A,B),C);
		//cout<<A<<":"<<B<<":"<<C<<endl;
		//cout<<gcd(gcd(A,B),C)<<endl;
		if(A==K&&B==K&&C==K)break;
		if(C!=K)C++;
		else if(C==K&&B!=K){
			C=1;
			B++;
		}
		else{
			A++;
			B=1;
			C=1;
		}
	}
	cout<<ANS<<endl;
}

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

using namespace std;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	long long a, br = 1, x = 50;
	cin >> a;
	if(a % 2){
		cout << 0;
		return 0;
	}
/*	for(int i = 2; i <= a; i += 2){
		br *= i;
		br %= 1000000000;
		cout << i << " " << br << endl;
	}*/
	br = a / 10;
	while(x <= a){
		br += a / x;
		x *= 5;
	}
	cout << br;

	return 0;
}



Measured memory_bytes: 256
r,m,y,s;mov(int*a,int*b){r=*a,*a=*b,*b=7-r;}
main(t,c){s=!scanf("%d",&c),c?:exit(0);for(m=2,y=3;c--;s+=t)scanf("%s",&r),
r%=8,r-2?r-3?r-4?r-5?r-6?r-7?:mov(&t,&y):mov(&t,&m):mov(&y,&t):mov(&y,&m):mov(&m,&t):mov(&m,&y);
main(1,printf("%d\n",s+1));}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
//型に気を付けよう
//a=0x61=97 '0'=0x30=48
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long  ll;
typedef long double  ld;
typedef string str;
typedef pair<int,int> pairii;
typedef vector<int> veci;
const double pi=3.1415926535;
const ll  mod=1000000007;
//桁数指定　cout << fixed << setprecision(2)
int main() {
  int x,y;
  cin>>x>>y;
  if(y%2){cout<<"No"<<endl;return 0;}
  if(y>4*x||y<2*x){cout<<"No"<<endl;return 0;}
  cout<<"Yes"<<endl;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x; 
  cin >> x;
  while(true){
    bool ok=1;
    for(int i=2;i<=sqrt(x);i++){
      if(x%i==0){ok=0; break;}
    }
    if(ok==1){cout << x;return 0;}
    x++;
  }
  return 0;
}

Measured memory_bytes: 3652
#include <cstring>
#include <cassert>
#include <utility>
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <bitset>
#include <chrono>
#include <cstdlib>
#include <functional>
#include <tuple>
#include <climits>
#include <limits>
#include <deque>
#include <list>
#include <array>
#include <stack>
#include <queue>
#include <random>
#include <complex>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ll              long long
#define pi              pair<int,int>
#define pll             pair<ll,ll>
#define pb              push_back
#define F               first
#define S               second
#define vi              vector<int>
#define vll             vector<ll>
#define endl            '\n'
#define all(v)          (v).begin(),(v).end()
#define MP(a,b)         make_pair(a,b)
#define debug(x)        cerr<< #x << " : " << x << endl;
#define debugp(p)       cerr<< #p << " : " << "(" << (p).first << "," << (p).second << ")\n";
#define debugv(v)       cerr<< #v << " : " << "["; for(int i = 0; i < (v).size(); i++) cerr << v[i] << " "; cerr<<"]\n";
#define debugs(m)       cerr<< #m << " : [ "; for(auto itr = m.begin(); itr != m.end(); itr++) cerr <<*itr << " "; cerr << "]\n";
#define debugm(m)       cerr<< #m << " : [ "; for(auto itr = m.begin(); itr != m.end(); itr++) cerr <<"(" << itr->first << "," << itr->second << ") "; cerr << "]\n";

/* ordered set: 
tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>
member functions :
1. order_of_key(k) : number of elements strictly lesser than k
2. find_by_order(k) : k-th element in the set
*/

inline ll modexp(ll x, ll ex , ll md) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % md;
        ex >>= 1ll;
        x = (x * x) % md;
    }
    return ans;
}

const int inf = 1e9 + 7;

void Solve(){
    int n;
    cin >> n;
    if (n % 1000 == 0) cout << 0 << endl;
    else cout << 1000 - (n % 1000) << endl;
}
int main(){
    ios :: sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr);
    
    int T = 1;
    // cin >> T;
    for(int tc = 1; tc <= T; tc++){
        // cout << "Case #" << tc << ": ";
        Solve();
    }
    #ifdef LOCAL
    cerr << "Time elapsed\t: " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";       
    #endif
}



Measured memory_bytes: 3648
//Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long
#define endl '\n'
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
bool sortbysec(const pair<ll,ll>&a,const pair<ll,ll>&b)
{
    return (a.second<b.second);
}

int main()
{
    ios;
    double d,t,s;
    cin>>d>>t>>s;
    double k=d/s;
    if(k<=t)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

}




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

int main() {
  int N, sum;
  cin >> N ;
  vector<int> vec(N);
  
  for(int i = 0; i < N; i++){
  cin >> vec.at(i) ;
  }
  
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  
  for(int i = 0; i < N-1; i++){
  
    if (vec.at(i+1) - vec.at(i) != 0)
      sum++;
  
  }
  cout << sum+1 <<endl;
}


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

A = []
for i in range(1, N+1):
    if 6**i > N:
        break
    else:
        A.append(6**i)
    if 9**i <= N:
        A.append(9**i)
A.sort(reverse=True)

money = [i for i in range(N+1)]
for i in A:
    for j in range(i,N+1):
        money[j] = min(money[j], money[j-i]+1)
print(money[N])


Measured memory_bytes: 7064
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <stack>
#include <queue>
using namespace std;
string a;
int main(){
    cin>>a;
    int l;
    l=a.size();
    int w;
    cin>>w;
    for(int i=0;i<l;i+=w){
        cout<<a[i];
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i< (n); i++)
using ll = long long;
using P = pair<int, int>;
int main()
{
    int a,b,h,m;
    cin >> a >> b >> h >> m;
    double hx,hy,mx,my;
    double htheta = M_PI*(h + (double)m/60)* 30/180;
    double mtheta = M_PI*(h*60 + m)*6/180;
    hx = a*sin(htheta);
    hy = a*cos(htheta);
    mx = b*sin(mtheta);
    my = b*cos(mtheta);
    double ans = sqrt(pow(hx-mx,2) + pow(hy-my,2));
    cout << fixed << setprecision(10) << ans << endl;
return 0;
}

Measured memory_bytes: 4072
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var N string
	fmt.Scan(&N)
	A, _ := strconv.Atoi(string(N[0]))
	B, _ := strconv.Atoi(string(N[1]))
	C, _ := strconv.Atoi(string(N[2]))
	D, _ := strconv.Atoi(string(N[3]))
	op := []string{"+", "-"}
	for i := 0; i < 2; i++ {
		for j := 0; j < 2; j++ {
			for k := 0; k < 2; k++ {
				res := 0
				if i == 0 {
					res = A + B
				} else {
					res = A - B
				}
				if j == 0 {
					res = res + C
				} else {
					res = res - C
				}
				if k == 0 {
					res = res + D
				} else {
					res = res - D
				}
				if res == 7 {
					fmt.Printf("%d%s%d%s%d%s%d%s\n", A, op[i], B, op[j], C, op[k], D, "=7")
					goto END
				}
			}
		}
	}
END:
}


Measured memory_bytes: 512