akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); \
                      cerr << "\n\n" << "Time elapsed: " << \
                      (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
                      return 0
#define ll long long int
#define ull unsigned long long int
#define db long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound 
#define pii pair<int , int>
#define pdd pair<db , db>
#define pll pair<ll , ll>
#define vpl vector<pll >
#define vll vector<ll >
#define mod 1000000007
#define mod1 998244353 
#define inf 1000000000000000007
#define eps 0.000001
#define stp fixed<<setprecision(20)
#define endl '\n'

pair<pll,char> points[100005];
ll n;

db calc(db time)
{
    db minx=inf,maxx=-inf,miny=inf,maxy=-inf;
    for(ll i=1;i<=n;i++)
    {
        db a,b;
        auto x=points[i];
        if(x.ss=='U')
            a=x.ff.ff,b=x.ff.ss+time;
        if(x.ss=='D')
            a=x.ff.ff,b=x.ff.ss-time;
        if(x.ss=='L')
            a=x.ff.ff-time,b=x.ff.ss;
        if(x.ss=='R')
            a=x.ff.ff+time,b=x.ff.ss;

        minx=min(minx,a);
        maxx=max(maxx,a);
        miny=min(miny,b);
        maxy=max(maxy,b);
    }
    db x=maxx-minx,y=maxy-miny;
    return x*y;
}

int main()
{
    fastio;
    #ifdef APNA_IO
        start_routine();
        freopen("input.txt", "rt", stdin);
        freopen("output.txt", "wt", stdout);    
    #endif

    cin>>n;
    for(ll i=1;i<=n;i++)
    {
        ll x,y;char d;cin>>x>>y>>d;
        points[i]={{x,y},d};
    }

    ll s=1,e=(ll)(1e9),mid,ans=1;
    while(s<=e)
    {
        mid=(s+e)/2;
        db x=calc(mid-0.5);
        db y=calc(mid);
        db z=calc(mid+0.5);
        // cout<<mid<<" "<<x<<" "<<y<<" "<<z<<endl;
        if(x>=y && y>=z)
        {
            ans=mid;
            s=mid+1;
        }
        else
        {
            e=mid-1;
        }
    }
    cout<<stp<<min({calc(0),calc(0.5),calc(ans-1),calc(ans-0.5),calc(ans+1),calc(ans+0.5),calc(ans)});

    #ifdef APNA_IO
        end_routine();  
    #endif
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
using s64 = signed long long;
using u64 = unsigned long long;
using f128 = long double;

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

    s64 sum = 0;
    for(int i = 0; i < n.size(); i++)
    {
        sum += (n[i] - '0');
        sum %= 9;
    }

    if(sum == 0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }    

    return 0;
}


Measured memory_bytes: 3724
from math import sqrt
from statistics import mean

def standard_deviate(numbers):
    m = mean(numbers)
    b = sum([(n - m)**2 for n in numbers])
    return sqrt(b/len(numbers))

if __name__ == '__main__':
    while True:
        n = int(input())
        if n == 0:
            break
        students = list(map(int, input().split()))[0:n]
        print(standard_deviate(students))



Measured memory_bytes: 7096
import itertools

n, m, q = map(int, input().split())

nums = []
for _ in range(q):
    nums.append(list(map(int, input().split())))

total = 0

l = [1,2,3,4,5,6,7,8,9,10,11]
for v in itertools.combinations_with_replacement(range(1, m+1), n):
    scores = []
    for a,b,c,d in nums:
        if v[b-1]-v[a-1] == c:
            scores.append(d)
        else:
            scores.append(0)
    if total < sum(scores):
        total = sum(scores)

print(total)


Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<ll,ll>;

ll solve() {
    ll K;
    cin >> K;
    vector<ll> A(K);
    for ( int i = 0; i < K; i++ ) {
        cin >> A[i];
    }
    auto upper_mul = [](ll x, ll m) {
        return x + m - 1 - (x + m - 1) % m;
    };
    auto lower_mul = [](ll x, ll m) {
        return x - x % m;
    };

    if ( A[K-1] != 2 ) return -1;
    pii ns(2,2);
    for ( int k = K-1; k >= 1; k-- ) {
        ll l = upper_mul(ns.first, A[k-1]);
        ll r = lower_mul(ns.second + A[k] - 1, A[k-1]);
        if ( l > r ) return -1;
        ns = pii(l,r);
    }
    cout << ns.first << " " << ns.second + A[0] - 1 << "\n";
    return 0;
}

int main() {
    auto ans = solve();
    if ( ans < 0 ) cout << ans << "\n";
    return 0;
}

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

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    set<char> left,right;
    int lcnt,rcnt;
    int ans = 0;
    for(int i = 0; i < n; i++){
        int num = 0;
        for(char c = 'a'; c <= 'z'; c++){
            bool left = false, right = false;
            for(int j = 0; j <= i; j++){
                if(s[j] == c){
                    left = true;
                    break;
                }
            }
            for(int k = i+1; k < n; k++){
                if(s[k] == c){
                    right = true;
                    break;
                }
            }
            if(left && right){
                num++;
            }
        }
        ans = max(ans,num);
    }
    cout << ans << endl;
}

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

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int main() {
    int n; cin >> n;
    vector<ll> a(n), b(n);
    rep(i, n) cin >> a.at(i) >> b.at(i);
    ll ans = 0;
    for (int i = n-1; 0 <= i; --i) {
        a.at(i) += ans;
        if (a.at(i) % b.at(i) != 0) {
            ans += b.at(i) * (a.at(i) / b.at(i) + 1) - a.at(i);
        }
    }
    cout << ans << endl;
    return 0;
}

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

using i64 = long long;
using P = pair<i64, i64>;


void solve(long long A, long long B){
    cout << max({A * B, A + B, A - B}) << endl;
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(A, B);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define FASTIO std::ios::sync_with_stdio(false);
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define inf 1e18
#define g(x) cout<<x<<" "<<endl;
#define gg(x,y) cout<<x<<" & "<<y<<" "<<endl
#define ggg(x,y,z) cout<<x<<" & "<<y<<" & "<<z<<" "<<endl
#define all(x) x.begin(),x.end()
#define input_from_file  freopen("input.txt", "r", stdin);
#define mod 1000000007
#define sz 100005
using namespace std;


ll a[23][23];
ll dp[22][1ll<<22];
ll n;
ll get(ll idx,ll msk)
{
  if(idx == n)
  {
    ll re = 0;
    for(ll i=0;i<n;i++)
    {
      if(a[idx][i+1] == 1)
      if((msk&(1ll<<i)) == 0)
      {
        re++;
      }
    }
    return re;
  }
  if(dp[idx][msk]!=-1)return dp[idx][msk];
  ll an = 0;
  for(ll i=0;i<n;i++)
  {
    if(a[idx][i+1] == 1)
    if((msk&(1ll<<i)) == 0)
    {
      an = (an + get(idx+1,(msk|(1ll<<i))))%mod;
    }
  }
  return dp[idx][msk] = an;
}
int main()
{

    FASTIO
    cin.tie(NULL);

    cin >> n;
    for(ll i=1;i<=n;i++)for(ll j=1;j<=n;j++ )cin >>a[i][j];

    ll msk = 0;
    ll ans = 0;
    memset(dp,-1,sizeof(dp));

    for(ll i=0;i<n;i++)
    {
      if(a[1][i+1] == 1)
      ans = (ans + get(2,(msk|(1ll<<i))))%mod;
    }
    if(n == 1)if(a[1][1] == 1)ans = 1;
    cout << ans << endl;




return 0;
}


Measured memory_bytes: 721280
N = int(input())
A = list(map(int, input().split()))
MOD = 1000000007
sum = 0
for i in range(N):
    sum = sum + A[i]

res = 0
for i in range(N):
    sum = sum - A[i]
    res = res + (A[i] % MOD * sum % MOD)

print(res % MOD)

Measured memory_bytes: 31396
//17-3 休憩所
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<time.h>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<set>
#include<stack>
#include<cstdlib>
#include<algorithm>
#include<random>
#include<cassert>
using namespace std;
#define LL long long
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define ROOP() while(true)
int main(){
    int N,M,D;
    cin >> N >> M >> D;

    bool mp[100][100];
    for(int i=0; i<N; i++){
        string S;
        cin >> S;
        for(int j=0; j<M; j++){
               if(S[j]=='.') mp[j][i] = true;
               else mp[j][i] = false;
        }
    }

    LL ans = 0;
    for(int i=0; i<N; i++){
        for(int j=0; j<M; j++){
            if(j+D<=M){
                bool tmp = true;
                for(int k=0; k<D; k++){
                    if(mp[j+k][i]==false) tmp = false;
                }
                if(tmp) ans++;
            }
            if(i+D<=N){
                bool tmp = true;
                for(int k=0; k<D; k++){
                    if(mp[j][i+k]==false) tmp = false;
                }
                if(tmp) ans++;
            }
        }
    }

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


Measured memory_bytes: 3200
defmodule Main do
  def main do
    IO.gets("")
    |> String.trim()
    |> String.split()
    |> Enum.map(&String.to_integer/1)
    |> process()
    |> IO.puts()
  end
  
  def process([a, b, c, d]) when a * b == c * d, do: a * b
  def process([a, b, c, d]) when a * b > c * d, do: a * b
  def process([_, _, c, d]), do: c * d 
end

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

using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,n,m) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define VEC2(x,a,b) vector<vector<ll>> x = vector<vector<ll>>(a,vector<ll>(b,0))
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "; cout<<endl
#define cout(n) cout<<fixed<<setprecision(n)
ll gcd(ll a, ll b){
  ll x;
	while(a!=b){
    if(b==0)break;
    a=a%b;
    x=b;
    b=a;
    a=x;
  }
  return a;
}

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

    ll n;
    cin>>n;
    ll res;
    cin>>res;

    FOR(i,1,n){
      ll in;
      cin>>in;
      res = gcd(res,in);
    }
    cout<<res<<endl;
}


Measured memory_bytes: 256
h, w = map(int, input().split())
a = [[i for i in input()] for j in range(h)]
for i in range(h):
  a[i].insert(0,'.')
  a[i].append('.')
b = ['.' for i in range(w+2)]
a.insert(0, b)
a.append(b)
flag = 0
for i in range(h):
  for j in range(w):
    if a[i][j] == '#':
      if a[i-1][j] == '.' and a[i+1][j] == '.' and a[i][j-1] == '.' and a[i][j+1] == '.':
        flag = 1
        break
  if flag == 1:
    print('No')
    exit()
print('Yes')


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long
#define ii pair<int, int>
#define vi vector<int>

using namespace std;

int a, b, c;

int main() {
    ios_base::sync_with_stdio(0);
    cin >> a >> b >> c;
    cout << c << ' ' << a << ' ' << b << endl;
    return 0;
}



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

#define int long long int

const int INF=1e9+5;

#undef int
int main()
{
	#define int long long int
	int n,w;
	cin>>n>>w;
	
	vector<int> weight(n,0);
	vector<int> values(n,0);
	int dp[n+5][w+5];
	memset(dp,0,sizeof(dp));
	for(int i=0;i<n;i++)
	{
		cin>>weight[i];
		cin>>values[i];
	}

	
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=w;j++)
		{
			if(i==0 || j==0)
				dp[i][j]=0;
			
			else if(j>=weight[i-1])
			{
					dp[i][j]=max(dp[i-1][j],dp[i-1][j-weight[i-1]]+values[i-1]);
			}
			
			else
				dp[i][j]=dp[i-1][j];
			
		}
	}
	
	cout<<dp[n][w];
	
}

Measured memory_bytes: 82304
def solve(f):
    cnt = 0
    for i in range(len(f)-1):
        if f[i][1] == f[i+1][1]:
            cnt += 1
    return cnt

while True:
    n = int(raw_input())
    if n == 0:
        break
    f = raw_input().split(" ")
    print solve(f)


Measured memory_bytes: 4200
#include<bits/stdc++.h> 
#define fo(i,a,b) for(i=a;i<=b;i++)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
typedef long long ll;
using namespace std;
int check(int x){
	if (x==1) return 0;
	int i;
	fo(i,2,x-1){
		if (i*i>x) break;
		if (x%i==0) return 0;
	}return 1;
}
const int maxn=1e7+5;
int i,j,n;
int a[205],ans,b[205],n1,n2,f[205];
bool bz[maxn],w[205][205];
int bk[205],bp;
void add(int x){
	if (x&1) a[++n1]=x;else b[++n2]=x;
}
bool dfs(int x){
	if (bk[x]==bp) return 0;
	bk[x]=bp;
	int i;
	fo(i,1,n2) if(w[x][i]&&(!f[i]||dfs(f[i])))return f[i]=x,1;
	return 0;
}
int main(){
	scanf("%d",&n);
	fo(i,1,n){
		int x;
		scanf("%d",&x);
		bz[x]=1;
	}
	fd(i,maxn-1,1) {
		bz[i]^=bz[i-1];
		if (bz[i]) add(i);
	}
	fo(i,1,n1)
	fo(j,1,n2) w[i][j]=check(abs(a[i]-b[j]));
	fo(i,1,n1) bp++,ans+=dfs(i);
	n1-=ans,n2-=ans;
	if (n1&1) ans++;
	ans+=n1+n2;
	printf("%d\n",ans);
}


Measured memory_bytes: 9984
#include<stdio.h>
int main(void)
{
    int a[10],M=0,i,j;
    for(i=0;i<10;i++){
        scanf("%d",&a[i]);
    }
    for(j=0;j<9;j++){
        for(i=0;i<9-j;i++){
            if(a[i]<a[i+1]){
               M=a[i];
               a[i]=a[i+1];
               a[i+1]=M;
            }

        }
    }
    
    for(j=0;j<3;j++){
        printf("%d\n",a[j]);
    }
    return 0;
}

Measured memory_bytes: 600
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<functional>
using namespace std;
typedef long long LL;
#define _CRT_SECURE_NO_WARNINGS

LL N,P;
int a[100010]={};
int main() {
	cin >> N ;
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    sort(a,a+N);
    int ans=0;
    if(a[0]%2==1){
        ans^=N;
    }
    for(int i=0;i<N;i++){
        if((a[i+1]-a[i])%2==1){
            ans^=N-(i+1);
        }
    }
    if(ans==0){
        cout<<"second";
    }else{
        cout<<"first";
    }
    return 0;
}

Measured memory_bytes: 640
import java.util.*;
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		long C = sc.nextLong();
		long K = sc.nextLong();
		long ans = 0;
		if(K < A){
			ans = K;
		}else if(K <= A + B){
			ans = A;
		}else{
			ans = A - (K - A - B);
		}
		System.out.println(ans);
	}
}

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

string solve() {
  ll a, b;
  cin >> a >> b;
  if (a * b <= 0)
    return "Zero";
  if (a > 0)
    return "Positive";
  if ((b - a) & 1)
    return "Positive";
  else
    return "Negative";
}

int main() {
  cout << solve() << endl;
  return 0;
}


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

#define ll long long

ll match[10] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

int main() {
    ll N, M;
    cin >> N >> M;
    ll A[M];
    ll dp[N + 1];
    dp[0] = 0;
    for(int i = 0;i < M;i++) {
        cin >> A[i];
    }
    sort(A, A + M, greater<ll>());
    for(int i = 1;i <= N;i++) {
        ll d_max = -1;
        for(int j = 0;j < M;j++) {
            ll po = i - match[A[j]];
            if(po < 0)continue;
            if(dp[po] < 0)continue;
            d_max = max(d_max, dp[po] + 1);
        }
        dp[i] = d_max;
    }
    for(int n = N;0 < n;) {
        for(int m = 0;m < M;m++) {
            if(match[A[m]] <= n && dp[n - match[A[m]]] == dp[n] - 1) {
                n -= match[A[m]];
                cout << A[m];
                break;
            }
        }
    }
    cout << endl;
    return 0;
}

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

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

int MOD = 1e9 + 7;
ll INF = 1e18;

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

ll C[60][60]; //C[n][k] -> nCk
void comb(int n){
    for(int i=0; i<=n; i++){
        for(int j=0; j<=i; j++){
            if(j == 0 || j == i){
                C[i][j]=1LL;
            }
            else{
                C[i][j]=(C[i-1][j-1]+C[i-1][j]);
            }
        }
    }
}

int main(){
    int n, a, b; cin>>n>>a>>b;
    vector<ll> v(n);
    for(int i=0; i<n; i++) cin>>v[i];

    sort(v.begin(), v.end(), greater<ll>());

    double ans=0;
    for(int i=0; i<a; i++){
        ans += v[i];
    }
    ans /= a;
    
    comb(n);

    cout << fixed << setprecision(10) << ans << endl;

    if(v[0] == v[a-1]){
        int cnt=0;
        for(int i=0; i<n; i++){
            if(v[0] == v[i]) cnt++;
        }

        ll ans2=0;
        for(int i=a; i<=b; i++){
            ans2 += C[cnt][i];
        }
        cout << ans2 << endl;
    }
    else{
        int cnt=0, cnt2=0;
        for(int i=0; i<n; i++){
            if(v[a-1] == v[i]) {
                cnt++;
                if(i < a) cnt2++;
            }
        }

        cout << C[cnt][cnt2] << endl;
    }
}

Measured memory_bytes: 256
while True:
    H,W=map(int,input().split())
    if H==0 and W==0:
        pass
        break
    if W%2==0:
        if H%2==0:
            for i in range(H//2):
                print("#." * (W//2))
                print(".#" * (W//2))
            print("")
        else:
            for i in range(H//2):
                print("#." * (W//2))
                print(".#" * (W//2))
            print("#." * (W//2))
            print("")
    else:    
        if H%2==0:
            for i in range(H//2):
                print("#." * (W//2)+"#")
                print(".#" * (W//2)+".")
            print("")
        else:
            if H==1 and W==1:
                print("#")
                print("")
            else:
                for i in range(H//2):
                    print("#." * (W//2)+"#")
                    print(".#" * (W//2)+".")
                print("#." * (W//2)+"#")
                print("")
            
            


Measured memory_bytes: 5616
N,A,B=map(int, input().split())
X=list(map(int, input().split()))
judge=int(B/A)
cost=0
for i in range(N-1):
  if X[i+1]-X[i]<=judge:#歩く
    cost+=A*(X[i+1]-X[i])
  else:
    cost+=B

print(cost)


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

using namespace std;

#define ll long long
#define ull unsigned long long

const double pi = acos(-1);

int main() {
    ios::sync_with_stdio(0); cin.tie(0);

    int r;
    cin >> r;
    cout << fixed << setprecision(10) << 2 * r * pi << '\n';
}

Measured memory_bytes: 3800
#include<iostream>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<cmath>
#include<map>

using namespace std;

#define rep(i,N) for(int i=0;i<N;i++) //0から


typedef long long ll;




ll binary_search(vector<ll> a, ll n, ll key){
    ll right = n, left = -1;
    ll md = (right + left) / 2;

    while(right - left > 1){
        if(a[md] <= key){
            right = md;
        }else{
            left = md;
        }
        md = (right + left) / 2;
    }
    if(left == -1) return -1; //無い場合
    return right;
}

vector<ll> prime;
void Prime(ll n){ //線形篩,素数列挙
    vector<ll> p(n,0);
    p[0]=1;
    p[1]=1;
    for(ll i=2;i<n;i++){
        if(p[i]==0){
            prime.push_back(i);
            p[i]=i;
        }
        ll k=prime.size();
        for(ll j=0;j<k && i*prime[j]<n && prime[j]<=p[i];j++){
            p[i*prime[j]]=prime[j];
        }
    }
}

#define MOD ((ll)1e+9 + 7)




//cout<<fixed<<setprecision(10);
int main(){
    string s;
    cin>>s;
    if(s[0]==s[1]||s[1]==s[2]||s[2]==s[3]){
        cout<<"Bad"<<endl;
    }
    else{
        cout<<"Good"<<endl;
    }


    return 0;
}



Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()
#define INF 1<<28

using namespace std;

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

int solve(int a, int b, vector<int> v){
	int curr = 0;
	int N = (int)v.size();
	rep (i, N){
		if (i % 2 == 0){
			curr += (int)(v[i] != a);
		}else{
			curr += (int)(v[i] != b);
		} // end if
	} // end rep
	return curr;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	int N; cin >> N;
	vector<int> v(N, 0);
	rep (i, N){
		cin >> v[i];
	} // end rep

	map<int,int> e; e.clear();
	map<int,int> o; o.clear();
	for (int i = 0; i < N; ++i){
		if (i % 2 == 0){
			++e[v[i]];
		}else{
			++o[v[i]];
		} // end if
	} // end for

	vector<P> cntE; cntE.clear();
	map<int,int>::iterator it = e.begin();
	for (; it != e.end(); ++it){
		int n = (*it).first;
		int c = (*it).second;
		cntE.push_back(P(-c,n));
	} // end for

	cntE.push_back(P(-1,INF));
	sort(ALL(cntE));	

	vector<P> cntO; cntO.clear();
	map<int,int>::iterator jt = o.begin();
	for (; jt != o.end(); ++jt){
		int n = (*jt).first;
		int c = (*jt).second;
		cntO.push_back(P(-c,n));
	} // end for

	cntO.push_back(P(-1,INF));
	sort(ALL(cntO));	
	
	int res = N;
	int curr = 0;
	if (cntE[0].second != cntO[0].second){
		curr = solve(cntE[0].second, cntO[0].second ,v);
		res = min(res, curr);
	}else{
		curr = solve(cntE[0].second, cntO[1].second, v);
		res = min(res, curr);
		curr = solve(cntE[1].second, cntO[0].second, v);
		res = min(res, curr);
	} // end if

	cout << res << endl;
				
	return 0;
}

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

#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)


struct union_find {
    vector<int> p;
    union_find(int n) : p(n, -1) {};
    bool unite(int u, int v) {
        if ((u = root(u)) == (v = root(v))) return false;
        if (p[u] > p[v]) swap(u, v);
        p[u] += p[v]; p[v] = u;
        return true;
    }
    bool find(int u, int v) { return root(u) == root(v); }
    int root(int u) { return p[u] < 0 ? u : p[u] = root(p[u]); }
    int size(int u) { return -p[root(u)]; }
};



int main() {
    int n, k, l;
    cin >> n >> k >> l;
    
    union_find uf1(n), uf2(n);
    rep(i, k) {
        int p, q;
        scanf("%d%d", &p, &q);
        p--; q--;
        uf1.unite(p, q);
    }

    rep(i, l) {
        int p, q;
        scanf("%d%d", &p, &q);
        p--; q--;
        uf2.unite(p, q);
    }

    map<pair<int, int>, int> cnt;
    rep(i, n) cnt[make_pair(uf1.root(i), uf2.root(i))]++;
    rep(i, n) {
        cout << cnt[make_pair(uf1.root(i), uf2.root(i))] << " \n"[i == n - 1];
    }

    return 0;
}

Measured memory_bytes: 13568
#include <bits/stdc++.h>
using namespace std;
int main() {
  string A, B;
  int ans = 0;
  cin >> A >> B;
  for(int i = 0; i < 3; i++) { 
    if(A.at(i) == B.at(i)) {
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3620
//ボール拾い
 #include <bits/stdc++.h>
using namespace std;

int main() {
  int N ,K , X ,sum = 0 ,x;
  cin >> N >> K;

  for (int i = 0; i < N; i++) {
  cin >> x;
 
  if ( K-x <= x ) {
  X = 2*(K-x) ;
  }
  else {
  X = 2*x;
  }
  sum = sum + X;
  }
  cout << sum << endl;
} 



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

template <class T>
class SegTree {
    int n;
    vector<T> data;
    T def;
    function<T(T,T)> operation;
    function<T(T,T)> update;

    T _query(int a, int b, int k, int l, int r) {
        if(r <= a || b <= l) return def;
        if(a <= l && r <= b) return data[k];
        else {
            T c1 = _query(a, b, 2*k+1, l, (l+r)/2);
            T c2 = _query(a, b, 2*k+2, (l+r)/2, r);
            return operation(c1, c2);
        }
    }
  public:
    SegTree(size_t _n, T _def, function<T(T,T)> _operation, function<T(T,T)> _update)
    : def(_def), operation(_operation), update(_update) {
            n = 1;
            while(n < _n) {
                n *= 2;
            }
            data = vector<T>(2*n-1, def);
    }

    void change(int i, T x) {
        i += n-1;
        data[i] = update(data[i], x);
        while(i > 0) {
            i = (i-1)/2;
            data[i] = operation(data[2*i+1], data[2*i+2]);
        }
    }

    T query(int a, int b) {
        return _query(a, b, 0, 0, n);
    }

    T operator[](int i) {
        return data[i+n-1];
    }
};

long long gcd(long long a, long long b) {
    return b ? gcd(b, a%b) : a;
}


int main() {
    int n;
    cin >> n;
    SegTree<long long> st(n, 0, [](long long a, long long b) {return gcd(a,b); },
                          [](long long a, long long b) {return b; });
    rep(i,n) {
        int a;
        cin >> a;
        st.change(i, a);
    }
    long long res = 1;
    rep(i,n) {
        long long l = st.query(0,i);
        long long r = st.query(i+1, n);
        res = max(res, gcd(l,r));
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 5368
#include <iostream>  // cin,cout
#include <stdio.h>   // printf,scanf (standard input/output)
#include <cmath>     // abs(x),pow(x,2)
#include <string>
#include <string.h>  // strlen, strcmp
#include <algorithm> // min,max, sort(v.begin(),v.end())
#include <vector>
#include <time.h>
using namespace std;

struct Data{
    int A;
    string S;
    
    bool operator<( const Data& right ) const {
        return A == right.A ? S < right.S : A < right.A;
        //return A < right.A;
    }
};

int Func(){
    int x = 0;
    return x;
}

int main(){
    int N;
    char S;
    int count[26] = {};
    char list[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
    
    cin >> N;
    for (int i=0;i<N;i++) {
        cin >> S;
        for (int j=0;j<26;j++) {
            if (S==list[j]) count[j] += 1;
        }
    }
    
    
//    
//    for (int j=0;j<26;j++) {
//        cout << count[j] << endl;
//    }
    
    long long result = 0;
    for (int i=0;i<26;i++) {
        if (count[i]!=0) {
            if (result==0) {
                result = count[i]+1;
            }
            else {
                result = result*(count[i]+1);
                result = result%1000000007;
            }
        }
    }
    result -= 1;
    
    cout << result << endl;
    
    
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atc_0027
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            int result = 0;

            if (s == "SUN")
            {
                result = 7;
            }
            else if (s == "MON")
            {
                result = 6;
            }
            else if (s == "TUE")
            {
                result = 5;
            }
            else if (s == "WED")
            {
                result = 4;
            }
            else if (s == "THU")
            {
                result = 3;
            }
            else if (s == "FRI")
            {
                result = 2;
            }
            else if (s == "SAT")
            {
                result = 1;
            }

            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 25824
#include<bits/stdc++.h>
using namespace std;
int c,h,w;
int main(){
  cin>>h>>w;
  vector<string> d(h);
  for(int i=0;i<h;i++)cin>>d[i];
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++)
      if(d[i][j]=='#')
        c++;
  vector<vector<int> > di(h,vector<int>(w,-1));
  queue<pair<int,int> > q;
  di[0][0]=1;
  q.push(make_pair(0,0));
  int dx[4]={0,0,1,-1};
  int dy[4]={1,-1,0,0};
  while(!q.empty()){
    auto v=q.front();
    q.pop();
    for(int i=0;i<4;i++){
      int nx=v.second+dx[i];
      int ny=v.first+dy[i];
      if(nx<0||nx>=w||ny<0||ny>=h)continue;
      if(di[ny][nx]!=-1)continue;
      if(d[ny][nx]=='#')continue;
      di[ny][nx]=di[v.first][v.second]+1;
      q.push(make_pair(ny,nx));
    }
  }
  if(di[h-1][w-1]==-1)
    cout<<"-1";
 else
   cout<<w*h-di[h-1][w-1]-c;
}

Measured memory_bytes: 3640
r, c = map(int, input().split())
table = []
for _ in range(r):
    table.append(list(map(int, input().split())))
for row in range(r):
    print(' '.join(map(str, table[row])), sum(table[row]), sep=' ')
# print(' '.join(map(str, [sum(table[:][col]) for col in range(c)])), sum(table), sep=' ')
col_sum = [sum([table[row][col] for row in range(r)]) for col in range(c)]
print(' '.join(map(str, col_sum)), sum(col_sum), sep=' ')



Measured memory_bytes: 5704
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define MOD 1000000007
#define pb push_back
#define cy cout<<"Yes\n"
#define cn cout<<"No\n"
typedef long long int ll;
int main()
{
   int n,k;
   cin>>n>>k;
   int a[n];
   for(int i=0;i<n;i++)
    cin>>a[i];
   sort(a,a+n);
   ll sum=0;
   for(int i=0;i<k;i++)
    sum+=a[i];
    cout<<sum<<endl;
}


Measured memory_bytes: 3640
import math
N,K=map(int,input().split())
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
for i in range(K):
  if N-K>=i:
    ans=combinations_count(N-K+1,i+1)*combinations_count(K-1,i)
    ANS=ans%(10**9+7)
    print(ANS)
  else:
    print(0)

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

#ifndef LOCAL
#define cerr dolor_sit_amet
#endif

#define mp make_pair
#define sz(x) ((int)((x).size()))
#define X first
#define Y second
#define ALL(x) (x).begin(), (x).end()

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int , int > ipair;
typedef pair < ll , ll > lpair;
const int IINF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const double DINF = numeric_limits<double>::infinity();
const int MOD = 1000000007;
const double EPS = 1e-9;
const int DX[] = { 1,  0, -1,  0,  1, -1,  1, -1};
const int DY[] = { 0,  1,  0, -1,  1, -1, -1,  1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll sqr(ll x) { return x*x; } ll sqr(int x) { return (ll)x*x; }
double sqr(double x) { return x*x; } ld sqr(ld x) { return x*x; }
mt19937 mmtw(960172);
ll rnd(ll x, ll y) { static uniform_int_distribution<ll> d; return d(mmtw) % (y - x + 1) + x; }

// ========================================================================= //

const int N = 100179;

int main() {
    ios::sync_with_stdio(false);

    int n, a, b;
    cin >> n >> a >> b;
    if ((a + b) % 2 == 0)
        std::cout << "Alice\n";
    else
        std::cout << "Borys\n";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define reg register
#define ll long long
inline ll read()
{
	ll x=0,w=0;char ch=getchar();
	while(!isdigit(ch))w|=ch=='-',ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	return w?-x:x;
}
ll n;
int main()
{
    n=read();if(n&1){puts("0");return 0;}
    reg ll ans=0;n/=2;
    while(n)
    {
        ans+=n/5;
        n/=5;
    }cout<<ans<<"\n";
	return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    readLine()
    val aa = readLine()!!.split(' ').map(String::toInt)
    var muFour = 0
    var muTwo = 0
    aa.forEach { a ->
        if (a % 4 == 0) {
            muFour++
        } else if (a % 2 == 0) {
            muTwo++
        }
    }
    println(if (aa.size shr 1 <= (muTwo shr 1) + muFour) "Yes" else "No")
}


Measured memory_bytes: 51912
### A - Cookie Exchanges
a = [ int(i) for i in input().split() ]

cnt=0
if a[0] % 2 == 1 or a[1] % 2 == 1 or a[2] % 2 == 1:
    pass
elif a[0] == a[1] and a[1] == a[2]:
    cnt=-1
else:
    while True:
        if a[0] % 2 == 1 or a[1] % 2 == 1 or a[2] % 2 == 1: break
        cnt += 1
        a[0], a[1], a[2] = (a[1]+a[2])/2 , (a[0]+a[2])/2, (a[0]+a[1])/2

print(cnt)



Measured memory_bytes: 3064
// 基本テンプレート
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
signed main() {
    int A, B, C; cin >> A >> B >> C;
    int cells = C - 1;
    if(A + B >= cells) {
        cout << B + C << endl;
    }
    else {
        cells = A + B;
        int ansC = cells + 1;
        cout << ansC + B << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n,k,i;
    cin>>n>>k;
    ll arr[n];
    for(i=0;i<n;i++)
        cin>>arr[i];
    if(n<=k)
        cout<<1<<endl;
    else{
        cout<<1+ceil((double)(n-k)/(double)(k-1))<<endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <time.h>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define reps(x,c) for(auto x:c)
#define all(x) begin(x), end(x)
#define pb(a) emplace_back(a) 
#define mp(a,b) make_pair((a),(b))
#define pl pair<ll,ll>
#define INF 2147483647
#define MOD 1000000007
#define fi first
#define se second
#define dbg(x) cout << #x"="<< (x) << endl
#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl

ll N;
vector<ll> node,lazy;
vector<bool> lazyFlag;
ll IDEN=INF;
 
ll op(ll x,ll y){
	return min(x,y);
}
 
void seg_init(vector<ll> v){
	int sz=v.size();
	N=1;while(N<sz)N*=2;
	node.resize(2*N-1,IDEN);
	lazy.resize(2*N-1, IDEN);
	lazyFlag.resize(2*N-1, false);
	rep(i,sz)node[i+N-1]=v[i];
	for(int i=N-2; i>=0; i--) node[i]=op(node[2*i+1],node[2*i+2]);
}

void eval(ll k, ll l, ll r) {
  if(lazyFlag[k]) {
    node[k] = lazy[k];
    if(r - l > 1) {
        lazy[k*2+1] = lazy[k*2+2] = lazy[k];
        lazyFlag[k*2+1] = lazyFlag[k*2+2] = true;
    }
    lazyFlag[k] = false;
  }
}

void update(ll a, ll b,ll val,ll k=0,ll l=0, ll r=-1){
	if(r < 0) r = N;
	eval(k, l, r);
	if(b<=l || r<=a) return;
	if(a<=l && r<=b){
		lazy[k] = val;
    lazyFlag[k] = true;
    eval(k, l, r);
	}else{
		update(a,b,val,2*k+1,l,(l+r)/2);
		update(a,b,val,2*k+2,(l+r)/2,r);
		node[k]=op(node[2*k+1],node[2*k+2]);
	}
}

ll query(ll a,ll b, ll k=0, ll l=0, ll r=-1){
	if(r<0) r=N;
	eval(k,l,r);
	if(b <= l || r <= a) return IDEN;
  if(a <= l && r <= b) return node[k];
  ll vl = query(a, b, 2*k+1, l, (l+r)/2);
  ll vr = query(a, b, 2*k+2, (l+r)/2, r);
  return op(vl,vr);
}

int main(){
 	ll n,q;cin>>n>>q;
 	seg_init(vector<ll>(n, INF));
 	bool flg;
 	ll s,t,x;
 	rep(i,q){
 		cin>>flg>>s>>t;
 		if(flg==1){
 			cout<<query(s,t+1)<<endl;
 		}else{
 			cin>>x;
 			update(s,t+1,x);
 		}
 	} 
  return 0;
}


Measured memory_bytes: 7844
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()
const long long INF = 1e15;
using namespace std;
typedef long long ll;
int main() {
  ll r;
  cin >> r;
  cout << r * r << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include <stdlib.h>
int main()
{
	int w,a,b;
	scanf("%d %d %d",&w,&a,&b);
	if(abs(w+b-a)<w*2&&abs(w+a-b)<w*2){
		printf("%d\n",0);
	}else{
		if(a>b){
			printf("%d\n",abs(a-(b+w)));
		}else{
			printf("%d\n",abs(b-(a+w)));
		}
	}
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<functional>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{ 
	int temp;
	vector<int>a;
	for(int i=0;i<10;i++){
		cin >> temp;
		a.push_back(temp);
	}
	sort(a.begin(),a.end());
	cout << a[9] << endl << a[8] << endl << a[7] << endl;
	return 0;
}

Measured memory_bytes: 1216
#include <algorithm>
#include <iostream>
#include <set>
#include <vector>
#include <utility>

const int N = 100000;

int main() {
  int n, channels;
  std::cin >> n >> channels;
  std::vector<int> laps(N + 1, 0);
  std::set<std::pair<int, int>> startset, endset;
  for (int ni = 0; ni < n; ++ni) {
    int s, t, c;
    std::cin >> s >> t >> c;
    if (startset.count(std::make_pair(c, t))) {
      --laps[t - 1];
      ++laps[t];
    }
    if (endset.count(std::make_pair(c, s))) {
      ++laps[s];
      --laps[s - 1];
    }
    ++laps[s - 1];
    --laps[t];
    startset.insert(std::make_pair(c, s));
    endset.insert(std::make_pair(c, t));
  }
  for (int i = 1; i <= N + 1; ++i) {
    laps[i] += laps[i - 1];
  }
  int ans = 0;
  for (int i = 0; i <= N + 1; ++i) {
    ans = std::max(ans, laps[i]);
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 9984
#include <iostream>
#include <string>
#define rep(i,n) for(long long i=0;i<n;i++)

using namespace std;
using ll = long long;

int main(void)
{
    int n,P,ans;
    cin>>n;
    int s,a[n];
    rep(i,n) cin>>a[i];
    rep(i,n) s+=a[i];
    double p=(double)s/n;
    int q=s/n;
    if(p-q<q+1-p)
    {
        P=q;
    } else P=q+1;

    rep(i,n)
    {
        ans+=(a[i]-P)*(a[i]-P);
    }
    cout<<ans<<endl;


    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Graph=vector<vector<int>>;
#define INF 1000000000
#define p make_pair

int bfs(int s,int t,int v,int w,Graph graph)
{
    int n=graph.size(),m=graph[0].size();
    Graph visit(n,vector<int> (m,0));
    Graph dis (n,vector<int> (m,INF));
    visit[s][t]=1;
    dis[s][t]=0;
    queue<pair<int,int>> que;
    que.push(p(s,t));
    int x,y,a,b;vector<pair<int,int>> next(4);
    while (!que.empty())
    {
        x=que.front().first;y=que.front().second;
        que.pop();
        next={p(x-1,y),p(x+1,y),p(x,y-1),p(x,y+1)};
        for (int i=0;i<4;i++)
        {
            a=next[i].first;b=next[i].second;
            if (0<=a && a<n && 0<=b && b<m)
            {
                if (graph[a][b]==1 && visit[a][b]==0)
                {
                    dis[a][b]=dis[x][y]+1;
                    visit[a][b]=1;
                    que.push(p(a,b));
                }
            }
        }
    }
    return dis[v][w];
}

int main()
{
    int H,W,cnt=0,root;cin>> H >>W;
    Graph graph(H,vector<int> (W,0));
    string input;
    for (int i=0;i<H;i++)
    {  
        cin >> input;
        for (int j=0;j<W;j++)
        {
            if (input[j]=='.')
            {
                graph[i][j]=1;
                cnt++;
            }
        }
    }
    root=bfs(0,0,H-1,W-1,graph);
    if (root==INF) cout << -1 << endl;
    else cout << cnt-root-1 << endl;
return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;

class Program
{
	static void Main(string[] args)
	{
		string[] s1 = Console.ReadLine().Split(' ');
        char[] a = s1[0].ToCharArray();
        char[] b = s1[1].ToCharArray();

		if (a[0] > b[0])
		{
			Console.WriteLine(">");
		}
		else if(a[0] < b[0])
		{
			Console.WriteLine("<");
		}
        else
        {
            Console.WriteLine("=");
        }

	}
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
#define T top()
#define E end()
#define PS push
#define Q queue
#define PP pop()
#define L0 (LL)0
#define V vector
#define ST stack
#define FI first
#define MAX 4e18
#define MIN -MAX
#define DQ deque
#define RE rend()
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define SE second
#define DL double
#define G getline
#define IN insert
#define endl "\n"
#define EM empty()
#define EE emplace
#define RB rbegin()
#define MD 1000000007
#define PSB push_back
#define PI acos(-1.00)
#define PPB pop_back()
#define PSF push_front
#define ub upper_bound
#define lb lower_bound
#define PPF pop_front()
#define EB emplace_back
#define LL long long int
#define PQ priority_queue
#define N cout<<"NO"<<endl
#define Y cout<<"YES"<<endl
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
#define UOSMOY v.C;w.C;ww.C;uu.C;uo.C;vo.C;vu.C;ab.C;bc.C;cc.C;uuu.C;a.C;b.C;c.C;u.C
V<LL>v;
V<LL>w,ab,bc;
set<LL>uo;
map<LL,LL>ww,cc,u;
V<pair<LL,LL> >uu,su;
map<LL,V<LL> >uuu;
map<pair<LL,LL>,LL> vo;
map<pair<LL,LL>,LL> vu;
map<LL,pair<LL,pair<LL,LL > > > vs;
LL dxx[]= {-1,0,1,0};
LL dyy[]= {0,1,0,-1};
LL dx[]= {2,1,-1,-2,-2,-1,1,2};
LL dy[]= {1,2,2,1,-1,-2,-2,-1};
int main()
{
//  BRR;
//  file;
    FAST;
    char ch;
    string a,b,c;
    DL x,y,d,e,f,g,h;
    LL n,m,i,j,k,p,q,o,l,s,tt=1,t,z,aa,r=0;
//    cin>>tt;
    for(LL mau=1;mau<=tt;mau++)
    {
        UOSMOY;
        cin>>n;
        k=0;
       for(i=1;i<=n;i++)
       {
           l=n/i;
           o=n%i;
           k+=l;
           if(o==0)
           {
               k--;
           }
       }
       cout<<k<<endl;


    }
    return 0;
    //IN
    //AL
}


Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    ll sum = 0, cnt = 0, mi = LINF;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        sum += abs(a[i]);
        mi = min(mi, abs(a[i]));
        cnt += (a[i] < 0 ? 1 : 0);
    }
    ll ans = sum;
    if(cnt % 2 == 1){
        ans -= mi * 2;
    }
    cout << ans << endl;
    return 0;
}


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

typedef long long ll;

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

    ll L0 = 2;
    ll L1 = 1;
    ll L;

    if (n == 1) {
        L = L1;
    } else {
        for (int i = 2; i <= n; i++) {
            L = L0 + L1;
            L0 = L1;
            L1 = L;
        }
    }

    cout << L << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
using namespace std;
typedef pair<int,int> pii;
pii mx(pii a, pii b){
	int i,ma1 = -1,ma2 = -1,c[4];
	c[0] = a.first,c[1] = a.second,c[2] = b.first,c[3] = b.second;
	for(i=0;i<4;i++){
		if(ma1<c[i]){
			ma2 = ma1; ma1 = c[i];
		}else if(ma2<c[i]){
			ma2 = c[i];
		}
	}
	return {ma1,ma2};
}
int a[1<<20];
pii dp[1<<20];
int main(){
	int i,j,n;
	cin >> n;
	for(i=0;i<(1<<n);i++){
		cin >> a[i];
		dp[i] = {a[i],0};
	}
	for(i=0;i<n;i++){
		for(j=0;j<(1<<n);j++){
			if(j&(1<<i)){
				dp[j] = mx(dp[j],dp[j^(1<<i)]);
			}
		}
	}
	int ans = a[0] + a[1];
	for(i=1;i<(1<<n);i++){
		ans = max(ans,dp[i].first + dp[i].second);
		cout << ans << endl;
	}
}

Measured memory_bytes: 9216
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int h,w,n;
vvi a;

int main(){
	cin>>h>>w>>n;
	a=vvi(h,vi(w));
	for(int i=0;i<h;i++) for(int j=0;j<w;j++){
		char c;
		cin>>c;
		if(c=='1') a[i][j]=1;
	}
	int res=inf;
	for(int i=0;i<1<<(h-1);i++){
		int t=0;
		for(int j=0;j<h-1;j++) if(i&1<<j) t++;
		int m=t+1;
		vi b(h),c(m);
		int id=0;
		for(int j=0;j<h;j++){
			b[j]=id;
			if(i&1<<j) id++;
		}
		for(int j=0;j<w;j++){
			bool flag=0;
			vi d=c;
			for(int k=0;k<h;k++) d[b[k]]+=a[k][j];
			for(int k=0;k<m;k++) if(d[k]>n) flag=1;
			if(flag){
				t++;
				for(int k=0;k<m;k++) c[k]=d[k]-c[k];
				flag=0;
				for(int k=0;k<m;k++) if(c[k]>n) flag=1;
				if(flag){
					t=inf;
					break;
				}
			}
			else c=d;
		}
		res=min(res,t);
	}
	cout<<res<<endl;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

unsigned long long int gcd(unsigned long long a, unsigned long long b){
  return b ? gcd(b, a % b) : a;
}

int main(){
  int a[3], b[3];
  while( ~scanf("%d %d %d %d %d %d", &a[0], &b[0], &a[1], &b[1], &a[2], &b[2]) && a[0]){
    unsigned long long int x[] = {1, 1, 1};
    unsigned long long int cnt[3] = {};
    unsigned long long int now = 0;
    while( !cnt[0] || !cnt[1] || !cnt[2] ){
      now++;
      for(int i = 0; i < 3; i++){
        x[i] = (a[i] * x[i]) % b[i];
        if(x[i] == 1 && !cnt[i]){
          cnt[i] = now;
        }
      }
    }
    cnt[0] = (cnt[0] * cnt[1]) / gcd(cnt[0], cnt[1]);
    printf("%llu\n", (cnt[0] * cnt[2]) / gcd(cnt[0], cnt[2]));
  }
  return 0;
}

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(20);

  int n, T;
  cin >> n >> T;
  int min_t = 1001;
  int min_c = 1001;
  rep(i, n) { 
    int c, t;
    cin >> c >> t;
    if (t <= T && c < min_c) {
      min_t = t;
      min_c = c;
    }
  }
  if (min_t == 1001) {
    cout << "TLE" << endl;
  } else {
    cout << min_c << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define FOR(i,a,b) for(int i=(a);i<=(b);++i) 
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i) 
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>0;--i)
#define CI cin>> 
#define CO cout<<
#define EN <<endl 
#define all(x) (x).begin(),(x).end() 
#define asn ans
using namespace std;
template <typename T> istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; 	return is; }
using ll = long long;

int main() {
	int n, t; CI n >> t;
	int ans = 100000;
	int memo = 0;
	vector<pair<int,int>> a(n);
	REP(i, n) {
		CI a[i].first >> a[i].second;
	}
	REP(i, n) {
		if (a[i].second <= t) {
			if (ans >= a[i].first) {
				ans = min(ans, a[i].first);
				memo = i;
			}
		}
	}
	if (ans == 100000) { CO "TLE" EN; }
	else CO a[memo].first EN;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359
#define tMOD 998244353
#define mkpr(x,y) make_pair(x,y)




int main(){

ll N;
cin>>N;
vector<ll> a(N);

for(ll i=0;i<N;i++){
    cin>>a[i];
}
ll tt=1;
for(ll i=0;i<N;i++){
    if(a[i]%2==0){
        if(a[i]%3==0||a[i]%5==0){}
        else{
            tt=0;
        }
    }
}

if(tt==1){
cout<<"APPROVED"<<endl;
}
else{
cout<<"DENIED"<<endl;
}


}


Measured memory_bytes: 256
#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 fi first
#define se second
#define mp make_pair
#define pb push_back
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	string s; cin>>s;
	ll ans=0; ll c=0;
	for(int i=0;i<s.length();i++)
	{
		if(s[i]=='W') ans+=c;
		else c++;
	}
	cout<<ans<<'\n';
}


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

int main()
{
    int n;
    cin >> n;
    while(n > 0)
    {
        if(n % 4 == 0 || n % 7 == 0) return cout << "Yes\n" ,0;
        else n -= 7;
    }
    cout << "No\n";
}

Measured memory_bytes: 3616
#include<stdio.h>
#include<string.h>
int main()
{
	int k;
	char s[105];
	scanf("%d", &k);
	scanf("%s", s);
	int len = strlen(s);
	for(int i=0; i<k; i++)
	{
		if (k>= len)
		{
			printf("%s", s);
			break;
		}else if(k<len)
		{
			printf("%c",s[i]);
		}
	}
	if(k < len ) printf("...\n");
	
	return 0;
}

Measured memory_bytes: 2152