akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>istream &operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
//template <typename T, typename S>ostream &operator<<(ostream &os, pair<T, S> &p) {os << p.first << " " << p.second;return os;}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T, class U>bool chmin(T& a, U b) { if (a > b) { a = b; return true; }return false; }
template <class T, class U>bool chmax(T& a, U b) { if (a < b) { a = b; return true; }return false; }

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	string T; cin >> T;

	for (auto& c : T) {
		if (c == '?')c = 'D';
	}
	cout << T << endl;

	return 0;
}


Measured memory_bytes: 3776
import java.util.Scanner;
class Main {
	public static void main(String[] args){
		Scanner cin = new Scanner(System.in);
		int a, b, c;
		a = cin.nextInt();
		b = cin.nextInt();
		c = cin.nextInt();
		
		int res = serch_divisor_number(a, b, c);
		
		System.out.println(res);
	}
	private static int serch_divisor_number(int a, int b, int c){
		int count = 0;
		for (int i = a; i <= b; i++){
			if (c % i == 0){
				count++;
			}
		}
		return (count);
	}
}

Measured memory_bytes: 26388
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
x=sum(b)
for i in range(n):
  s=a[i]+a[i+1]
  t=b[i]
  x-=max(0,t-s)
  a[i+1]-=max(0,b[i]-a[i])
  a[i+1]=max(a[i+1],0)
print(x)

Measured memory_bytes: 18476
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void minAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) min(dst, src);
}

void maxAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) max(dst, src);
}

enum MOD = (10 ^^ 9) + 7;

void main()
{
    auto S = sread();
    long K = lread();
    bool[string] d;
    foreach (i; 1 .. min(S.length + 1, K * 2))
        foreach (j; 0 .. S.length - i + 1)
        {
            d[S[j .. j + i]] = true;
        }
    writeln(d.keys.sort()[K - 1]);
}


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

namespace ABCTemplate_A
{
    public class Program
    {
        static void Main(string[] args)
        {
            var a = new ProblemA();
		}
    }

    public class ProblemA
    {
        public ProblemA()
        {
            
            // スペース区切りの整数の入力
            string input = Console.ReadLine();
            var flag1 = input[2] == input[3];
            var flag2 = input[4] == input[5];

            //出力
            if (flag1 & flag2)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
            
        }
    }
}


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

using namespace std;


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

	int a, b,c;
	vector<stack<int>> aa(n,stack<int>());
	for (int i = 0; i <q; i++) {
		cin >> a >> b  ;
		if (a == 0) {
			cin >> c;
			aa[b].push(c);
		}
		if (a == 1) {
			if (!aa[b].empty()) {
				cout << aa[b].top() << endl;
			}
		}
		if (a == 2) {
			if (!aa[b].empty()) {
				aa[b].pop();
			}
		}
	}

}


Measured memory_bytes: 4380
/*1 行目には，もともとの肉の温度 A が書かれている．
2 行目には，目的の温度 B が書かれている．
3 行目には，凍った肉を 1 ℃温めるのにかかる時間 C が書かれている．
4 行目には，凍った肉を解凍するのにかかる時間 D が書かれている．
5 行目には，凍っていない肉を 1 ℃温めるのにかかる時間 E が書かれている.*/
#include<iostream>
using namespace std;
int main(){
    int a,b,c,d,e;
    cin>>a>>b>>c>>d>>e;
    if(a<=0){
      cout<<0-a*c+d+b*e<<endl;
    }
    else{
        cout<<(b-a)*e<<endl;
    }
}


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

const int N = 2e5+9;
int n, a, hd[N], nxt[2*N], cnt;
struct edge{int u, v;} e[2*N];

int main(){
    cin >> n;
    for(int i = 1; i < n; i++){
        cin >> a;
        e[++cnt] = (edge){a, i+1},
        nxt[cnt] = hd[a], hd[a] = cnt;
    }
    for(int i = 1, num = 0; i <= n; i++, num = 0){
        for(int j = hd[i]; j; j = nxt[j], num++);
        cout << num << endl;
    }
    return 0;
}

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

int main(){
  int n; cin >> n;
  vector<int> ans(n);
  vector<int> data(n);
  for(int i = 0; i < n - 1; i++){
    cin >> data.at(i);
  }
  for(int i = 0; i < n - 1; i++){
    ans.at(data.at(i) - 1)++;
  }
  for(int i = 0; i< n; i++){
    cout << ans.at(i) << endl;
  }
}

Measured memory_bytes: 4848
#include<bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int long long 
#define pb push_back
#define ins insert
#define rs resize
#define br break;
#define cont continue;
#define vi vector<int>
#define vll vector<long long>
#define vvi vector<vector<int>>
#define si set<ll>
#define sll set<long long>
#define pii pair<ll,ll>
#define pll pair<long long, long long>
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vec vector
#define cend cout<<endl;
#define sc second
#define fr first
#define retz return 0;
#define ll_MAX (ll)(1e9*1e9)
#define ll_MIN (ll)(-1e9*1e9)
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b)  for(int i=a; i<=b; i++)
#define repd(i,a,b) for(int i=a; i>=b; i--)
#define ps(arr, n) for(int i=1; i<n; i++)arr[i]+=arr[i-1];
#define inp(arr, n)for(int i=0; i<n; i++)cin>>arr[i];
#define out(arr, n)for(int i=0; i<n; i++)cout<<arr[i];
#define inp1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define out1(arr,n,m)for(int i=0; i<n; i++)for(int j=0;j<m;j++)cin>>arr[i][j];
#define loop(q) for(auto it:q)
#define loop1(q) for(auto&it:q)
#define db1 cout << "*" << endl
#define db2 cout << "YES" << endl
using namespace std;
using namespace __gnu_pbds; 
#define oset(X) tree<X,null_type,less<X>, rb_tree_tag, tree_order_statistics_node_update> 
#define roset(X) tree<X,null_type,greater<X>, rb_tree_tag, tree_order_statistics_node_update>  
#define okey order_of_key //lower_bound_set
#define ofind find_by_order
#define cyes cout << "Yes" << endl; 
#define cno cout << "No" << endl;
#define mod (long long)1000000007
#define mod2 (long long)998244353
#define INT_MAX1 900000000
#define MAXN 2000000
#define INF INT_MAX



 
void solve()
{
    int n;
    cin >> n;
    int ans = 0;
    for(int i=1; i<=n; i++)
    {
        if(i%3 and i%5)
            ans += i;
    }

    cout << ans << endl;
}


signed main()
{
    
    speed;
    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}

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

const int MOD = 1000000007;
const int INF = 1e9 + 1;

int main(){
  int n;
  const int max_n = 2 * 1e5;
  cin >> n;
  vector<int> x(n), y(n);
  for(int i = 0; i < n; i++){
    cin >> x[i] >> y[i];
  }
  
  int ru, rd, lu, ld;
  int ru_leng, rd_leng, lu_leng, ld_leng;
  int mru_leng = 0, mrd_leng = 0, mlu_leng = 0, mld_leng = 0;
  pair<int, int> ld_inf = make_pair(0,0);
  pair<int, int> lu_inf = make_pair(0, INF);
  pair<int, int> rd_inf = make_pair(INF, 0);
  pair<int, int> ru_inf = make_pair(INF, INF);
  

  for(int i = 0; i < n; i++){
    ru_leng = abs(x[i] - ru_inf.first) + abs(y[i] - ru_inf.second);
    rd_leng = abs(x[i] - rd_inf.first) + abs(y[i] - rd_inf.second);
    lu_leng = abs(x[i] - lu_inf.first) + abs(y[i] - lu_inf.second);
    ld_leng = abs(x[i] - ld_inf.first) + abs(y[i] - ld_inf.second);
    if(ru_leng > mru_leng){
      ru = i;
      mru_leng = ru_leng;
    }
    if(rd_leng > mrd_leng){
      rd = i;
      mrd_leng = rd_leng;
    }
    if(lu_leng > mlu_leng){
      lu = i;
      mlu_leng = lu_leng;
    }
    if(ld_leng > mld_leng){
      ld = i;
      mld_leng = ld_leng;
    }
  }

  int ans = 0;
  int r[] = {ru, rd, lu, ld};
  for(int i = 0; i < 4; i++){
    for(int j = 0; j < 4; j++){
      if(i == j) continue;
      ans = max(ans, abs(x[r[i]] - x[r[j]]) + abs(y[r[i]] - y[r[j]]));
    }
  }
  cout << ans << endl;


  return 0;
}

Measured memory_bytes: 4776
#abc 106 b yakusu
s=input()
ans=0
cnt=0
acgt=["A","C","G","T"]
for i in range(len(s)):
    if s[i] not in acgt:
        if ans<cnt:
            ans=cnt
        cnt=0
    else:
        cnt+=1
print(max(ans,cnt))


Measured memory_bytes: 2940
MOD_N = (10**9)+7

def main
  n, k = gets.chop.split.map(&:to_i)
  arr = gets.chop.split.map(&:to_i)

  res_p = 0
  res_n = 0
  0.upto(n-1) do |i|
    (i+1).upto(n-1) do |j|
      res_p += 1 if arr[i] > arr[j]
      res_n += 1 if arr[-i-1] > arr[-j-1]
    end
  end
  res = (res_p + res_n) * ((k * (k-1)) / 2) + (k * res_p)
  puts (res % MOD_N)
end


if __FILE__ == $0
  main
end

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

int main() {
  int n;
  string s;
  cin >> n >> s;
  int x = 0, ans = 0;
  for(int i = 0; i < n; i++){
    if(s.at(i) == 'I'){
      x++;
    }
    if(s.at(i) == 'D'){
      x--;
    }
    ans = max(x, ans);
  }
  cout << ans << endl;
}


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

//create arrays outside of main()

int a[100];

int main(){

    int a;
    int b;
    int c;

    cin >> a >> b >> c;

    int transfer = c-(a-b);

    if(transfer<0){
        cout << "0";
    } else {
        cout << transfer;
    }

    return 0;
}

Measured memory_bytes: 256
/*input
5
1 2 1
1 3 1
2 4 1
3 5 1
3 1
2 4
2 3
4 5
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}
//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
ll dis[maxn];
bool vis[maxn];
vector<pll> edge[maxn];

void dfs(int u){
	vis[u]=2;
	for(pll v:edge[u]) if(!vis[v.F]){
		dis[v.F]=dis[u]+v.S;
		dfs(v.F);
	}
}


int main()
{
	int n;
	cin>>n;
	REP(i,n-1){
		ll u,v,x;
		cin>>u>>v>>x;
		u--;v--;
		edge[u].pb(MP(v,x));
		edge[v].pb(MP(u,x));
	}
	int q,k;
	cin>>q>>k;
	k--;
	dfs(k);

	//REP(i,n) cout<<dis[i]<<" \n"[i==n-1];

	while(q--){
		int u,v;
		cin>>u>>v;
		u--;v--;
		cout<<dis[u]+dis[v]<<'\n';
	}

	return 0;
}


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

int main(){
	int k,n,x,y,sum=0;
	cin>>n>>k>>x>>y;
	sum+=(k>n)?x*n:k*x;
	n-=k;
	if(n>0)sum+=n*y;
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
using namespace std;

bool HA[4194304];
int T[256] = {0};

inline int get( unsigned char c ) {
    return T[c];
}

int main() {
    int n, sum, t, c;
    T['A'] = 1, T['C'] = 2, T['G'] = 3, T['T'] = 4;
    while ( scanf("%d", &n) != EOF ) {
        memset( HA, false, 4194304 );
        while ( getchar() != '\n' );
        for ( register int i = 0; i < n; ++ i ) {
            sum = 0;
            t = 1;
            bool flag = ( c = getchar() ) == 'i';
            while ( ( c = getchar() ) != ' ' );
            while ( ( c = T[getchar()] ) != 0 ) {
                sum += c * t;
                t *= 4;
            }
            if ( flag ) {
                HA[sum] = true;
            } else {
                puts( HA[sum] ? "yes" : "no" );
            }
        }
    }
    return 0;
}

Measured memory_bytes: 4832
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
 
signed main()
{
  int a,b,c; cin >> a >> b >> c;
  if(a==b){
      cout << c << "\n";
  }else if(b==c){
      cout << a << "\n";
  }else{
      cout << b << "\n";
  }
}

Measured memory_bytes: 3600
/// wa ^3^

#pragma GCC optimize("O3")

#include<bits/stdc++.h>
                           
#define x first
#define y second
#define pb push_back
#define sz(x) (int) x.size()
 
using namespace std;
 
using ll = long long;
using pii = pair<int, int>;                                   

const int MOD = 1e9 + 7;
const int INF32 = 1e9 + 1e2;

void stndrtn() {
#ifdef accepted
    freopen(".in", "r", stdin);
#endif        
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr), stndrtn();
    int n, m;
    cin >> n >> m;
    cout << n*(n-1)/2 + m*(m-1)/2;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    string S;
    cin >> S;
    int num[4];
    for(int j = 0 ; j < 4 ; j++){
        num[j] = S[j] - '0';
    }


    int left = 10*num[0] + num[1];
    int right = 10*num[2] + num[3];
    int check[2] = {0,0};

    if(left > 0 && left <= 12){
        check[0] = 1;
    }
    else {
        check[0] = 0;
    }

    if(right > 0 && right <= 12){
        check[1] = 1;
    }
    else {
        check[1] = 0;
    }

    string res;
    if(check[0] == 1){
        if(check[1] == 1){
            res = "AMBIGUOUS";
        }
        else {
            res = "MMYY";
        }
    }
    else {
        if(check[1] == 1){
            res = "YYMM";
        }
        else{
            res = "NA";
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#define _USE_MATH_DEFINES
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
double mysqrt(double x) {
	double l = 0, r = x;
	for (int i = 0; i < 64; ++i) {
		double m = (l + r) / 2.0;
		if (m*m < x)l = m;
		else r = m;
	}
	return l;
}

int main() {
	string s; cin >> s;
	int ans[100100];
	for (int i = 0; i < 100100; ++i)ans[i] = 0;
	int Lcnt = 0;
	int Rcnt = 0;
	for (int i = 0; i < s.size()-1; ++i) {
		if (!(s[i] == 'R'&&s[i + 1] == 'L')) {
			ans[i] = 0;
			if (s[i] == 'R')Rcnt++;
		}
		else {
			if (Rcnt % 2 == 0) {
				ans[i] += Rcnt / 2;
				ans[i + 1] += Rcnt / 2;
				i++;
			}
			else {
				ans[i] += Rcnt / 2;
				ans[i + 1] += Rcnt / 2 + 1;
				i++;
			}
			Rcnt = 0;
		}
	}
	for (int i = s.size() - 1; i > 0; --i) {
		if (!(s[i] == 'L'&&s[i - 1] == 'R')) {
			if (s[i] == 'L')Lcnt++;
		}
		else {
			if (Lcnt % 2 == 0) {
				ans[i] += Lcnt / 2;
				ans[i - 1] += Lcnt / 2;
				i--;
			}
			else {
				ans[i] += Lcnt / 2;
				ans[i - 1] += Lcnt / 2 + 1;
				i--;
			}
			Lcnt = 0;
		}
	}
	for (int i = 0; i < s.size() - 1; ++i) {
		if (s[i] == 'R'&&s[i+1] == 'L') {
			ans[i]++;
			ans[i + 1]++;
		}
	}
	for (int i = 0; i < s.size(); ++i) {
		cout << ans[i] << " ";
	}
	return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main (void)
{
  int h,w,i,j;
  while(1){
    scanf("%d%d",&h,&w);
    if(h==0&&w==0)break;
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
	printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}

Measured memory_bytes: 572
#include<bits/stdc++.h>
using namespace std;
using Int = long long;

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b)a=b;};
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b)a=b;};

signed main(){
  Int n;
  cin>>n;

  Int da=-1,ta=-1,db=-1,tb=-1;

  Int pt=-1,pa=-1,pf=0;
  double px,py;
  for(Int i=0;i<n;i++){
    Int f,a,t,x,y;
    cin>>f>>a>>t>>x>>y;
    if(pt!=t||pa==a){
      pt=t;
      pa=a;
      pf=f;
      px=x;
      py=y;
      continue;
    }
    
    Int dd=(px-x)*(px-x)+(py-y)*(py-y);
    Int df=f-pf;

    if(t==0){
      if((da<dd)||(da==dd&&ta>df)) da=dd,ta=df;      
    }
    if(t==1){
      if((db<dd)||(db==dd&&tb>df)) db=dd,tb=df;            
    }
    
    pt=t;
    pa=a;
    pf=f;
    px=x;
    py=y;
  }
  
  
  cout<<fixed<<setprecision(12);
  if(da<0) cout<<-1<<" "<<-1<<endl;
  else cout<<sqrt((double)da)<<" "<<ta/60.0<<endl;
  if(db<0) cout<<-1<<" "<<-1<<endl;
  else cout<<sqrt((double)db)<<" "<<tb/60.0<<endl;
  return 0;
}


Measured memory_bytes: 3288
#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

int x;

signed main(){
    cin >> x;
    cout << (x^1) << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long
#define all(a) (a).begin(),(a).end()

using namespace std;

int main(int argc, char const *argv[]) {
  string s1,s2,s3;
  std::cin >> s1 >> s2 >> s3;
  printf("%c%c%c\n",s1[0]-32,s2[0]-32,s3[0]-32);
  return 0;
}


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

namespace atcoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var x = int.Parse(Console.ReadLine());

            if (x == 1)
                Console.WriteLine(0);
            else
                Console.WriteLine(1);
        }
    }
}


Measured memory_bytes: 27532
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <mutex>
#include <cmath>
#include <set>
#include <climits>
#include <bitset>

#define mod 1e9+7
#define mp make_pair
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main(){
	ll A, B, r, x, tmp;
	cin >> A >> B;
	x = A * B;
	if (A<B){
    	tmp = A;
    	A = B;
    	B = tmp;
    }
	r = A % B;
    while(r!=0){
    	A = B;
    	B = r;
    	r = A % B;
    }
	ll ans = x/B;
	cout << ans;
	return 0;
}

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

#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
using tp = tuple<ll, ll, ll>;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
//constexpr long long MOD = (ll)1e9 + 7;
constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

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

//グラフ関連
struct Edge {
    ll to, cap, rev;
    Edge(ll _to, ll _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph &G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
    G[from].push_back(Edge(to, cap, (ll)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve() {
    ll n, x, t;
    cin >> n >> x >> t;
    cout << (n + x - 1) / x * t << en;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /*
    ll t;
    cin >> t;
    while(t--)*/
    solve();

    return 0;
}


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

int main(){
    string s, t;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        if(i % 2 == 0){
            t.push_back(s.at(i));
        }
    }

    cout << t << endl;

}

Measured memory_bytes: 512
// clang-format off
#include <bits/stdc++.h>
using namespace std;
using ll = 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 fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
// clang-format on

const int INF = 19191919;

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

    vector<int> c(n);
    vector<vector<int>> a(n);
    rep(i, n) {
        cin >> c[i];
        a[i] = vector<int>(m);
        rep(j, m) cin >> a[i][j];
    }

    int ans = INF;
    rep(mask, 1 << n) {
        int cost = 0;
        vector<int> v(m);
        rep(i, n) if (mask >> i & 1) {
            cost += c[i];
            rep(j, m) v[j] += a[i][j];
        }
        bool ok = true;
        rep(i, m) if (v[i] < x) ok = false;
        if (ok) ans = min(ans, cost);
    }
    if (ans == INF) ans = -1;
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3616
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let a: Vec<isize> = s.trim().split_whitespace().map(|x| x.parse().unwrap()).collect();
    
    let mut x: isize = 0;
    let mut y: isize = a.iter().fold(0, |p, q| p + q);
    let mut z: isize = std::isize::MAX;
    for i in 0..a.len()-1 {
        x += a[i];
        y -= a[i];
        if (x - y).abs() < z {z = (x - y).abs()}
    }
    println!("{}", z);
}



Measured memory_bytes: 10492
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
int n,ans;
string a,b,c;
int main(void){
    cin>>n>>a>>b>>c;
    for(int i=0;i<n;i++){
		if(a[i]==b[i]&&b[i]==c[i])continue;
		if(a[i]==b[i]||b[i]==c[i]||c[i]==a[i])ans++;
		else ans+=2;
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int a,b,c;
    scanf("%d %d %d", &a, &b, &c);
    
    int counter,divisor_num = 0;
    for(counter = a; counter <= b; counter++){
        if(c%counter == 0) divisor_num++;
    }
    printf("%d\n", divisor_num);
}


Measured memory_bytes: 2732
from collections import deque
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
G = [[] for i in range(3 * N)]
for i in range(M):
    u, v = map(int, input().split())
    u, v = u - 1, v - 1
    G[3 * u + 0].append(3 * v + 1)
    G[3 * u + 1].append(3 * v + 2)
    G[3 * u + 2].append(3 * v + 0)
S, T = map(int, input().split())
S, T = S - 1, T - 1
INF = float('inf')
d = [INF] * (3 * N)
d[3 * S] = 0


que = deque([3 * S])
while que:
    u = que.popleft()
    for w in G[u]:
        if d[w] == INF:
            d[w] = d[u] + 1
            que.append(w)


ans = d[3 * T]
if ans == INF:
    print(-1)
else:
    print(ans // 3)

Measured memory_bytes: 86768
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

ll min(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    else return b;
}

ll gcd(ll a,ll b){
    if(a<b) return gcd(b,a);
    if(b==0) return a;
    return gcd(b,a%b);
}

int main() {
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll aa,bb;
    ll cc,dd,cd;
    if(a%c==0)aa=a;
    else aa=a-a%c+c;
    bb=b-b%c;
    cc=(bb-aa)/c+1;
    if(a%d==0)aa=a;
    else aa=a-a%d+d;
    bb=b-b%d;
    dd=(bb-aa)/d+1;
    ll e=c*d/gcd(c,d);
    if(a%e==0)aa=a;
    else aa=a-a%e+e;
    bb=b-b%e;
    cd=(bb-aa)/e+1;
    cout<<b-a+1-(cc+dd-cd)<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin>>n;
    int a[n];
    
    for(int i=0; i<n; i++){
        cin>>a[i];
    }
    
    int sum = 0;
    for(int z=0; z<n; z++){
        for(int i=n-1; i>0; i--){
            int temp = a[i];
            if(a[i-1]>a[i]){
                a[i]=a[i-1];
                a[i-1]= temp;
                sum++;
            }
        }
    }
    
    for(int i=0; i<n; i++){
        if(i!=n-1)cout<<a[i]<<" ";
        else cout<<a[i]<<endl;
    }
    cout<<sum<<endl;
    
    return 0;
}


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

int const N=1e5+5, M=1e9+7, OO = 0x3f3f3f3f;

int n;
int arr[3][N];

int mem[N][4];
int solve(int i, int last)
{
    if(i==n)
        return 0;
    if(mem[i][last]!=-1)
        return mem[i][last];
    int op1= (last!=1) ? solve(i+1, 1)+arr[0][i] : 0;
    int op2= (last!=2) ? solve(i+1, 2)+arr[1][i] : 0;
    int op3= (last!=3) ? solve(i+1, 3)+arr[2][i] : 0;
    return mem[i][last]=max(op1,max(op2,op3));
}


int main()
{
//    freopen("input.txt","rt",stdin);
//    freopen("output.txt","wt",stdout);
    scanf("%d",&n);
    for(int i=0; i<n; i++)
        scanf("%d %d %d",arr[0]+i,arr[1]+i,arr[2]+i);
    memset(mem, -1, sizeof mem);
    printf("%d\n",solve(0,0));



    return 0;
}


Measured memory_bytes: 7680
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
set_a = list(set(a))
#set_a = sorted(set_a)
count_a = Counter(a)

result = []
for i in set_a:
    result.append(count_a[i]+count_a[i-1]+count_a[i+1])
print(max(result))

Measured memory_bytes: 14944
#include<iostream>
#include<string>
#include<algorithm>	
#include<cmath>
using namespace std;
int main() {
	long long n, a, b, c, sum = 0; cin >> n >> a >> b >> c;
	int d[101] = { 0 };
	for (int h = 0; h < n; h++) {
		cin >> d[h];
	}
	sort(d, d + n);
	for (int h = n - 1; h >= 0; h--) {
		if ((c + d[h]) / (a + (sum + 1)*b) >= c / (a + sum * b)) {
			c += d[h]; sum++;
		}
		else {
			cout << c / (a + sum * b) << endl;
			cin >> n; return 0;
		}
	}
	cin >> n;
}


Measured memory_bytes: 3120
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <utility>
#include <cassert>

using namespace std;

string replace(const string &s, const string &a, const string &b) {
    int prev = 0, pos = 0;
    string res = "";
    while((pos = s.find(a, prev)) != string::npos) {
        res += s.substr(prev, pos-prev);
        res += b;
        prev = pos+a.size();
    }
    res += s.substr(prev);
    return res;
}

int dfs(const string &s, const string &g, const vector<pair<string,string> > &v) {
    if(s == g) return 0;
    if(s.size() >= g.size()) return 100;

    int ans = 100;
    for(int i = 0; i < v.size(); ++i) {
        string next = replace(s, v[i].first, v[i].second);
        if(next == s) continue;
        ans = min(ans, dfs(next, g, v)+1);
    }

    return ans;
}

int main() {
    assert(replace("a", "a", "bb") == "bb");
    assert(replace("aa", "a", "bb") == "bbbb");

    while(true) {
        int N;
        cin >> N;
        if(!N) break;

        vector<pair<string,string> > v;
        for(int i = 0; i < N; ++i) {
            string a, b;
            cin >> a >> b;
            v.push_back(make_pair(a, b));
        }
        
        string s, g;
        cin >> s >> g;
        int ans = dfs(s, g, v);
        cout << (ans==100?-1:ans) << endl;
    }

    return 0;
}

Measured memory_bytes: 0
n, q = map(int, input().split())
s = input()
ans = [0 for _ in range(n)]
count = 0
for i in range(1, n):
    a = s[i-1]
    b = s[i]
    if a == 'A' and b == 'C':
        count += 1
    ans[i] = count

for i in range(q):
    l, r = map(int, input().split())
    print(ans[r-1]-ans[l-1])


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

int main(){
    using namespace std;
    vector<unsigned long> A(9);
    for(auto& i : A)cin >> i;
    unsigned long N;
    cin >> N;
    for(unsigned long i{0}, b; i < N; ++i){
        cin >> b;
        for(auto& j : A)if(j == b)j = 0;
    }
    bool f{false};
    f |= !A[0] & !A[1] & !A[2];
    f |= !A[0] & !A[3] & !A[6];
    f |= !A[0] & !A[4] & !A[8];
    f |= !A[1] & !A[4] & !A[7];
    f |= !A[2] & !A[5] & !A[8];
    f |= !A[2] & !A[4] & !A[6];
    f |= !A[3] & !A[4] & !A[5];
    f |= !A[6] & !A[7] & !A[8];
    puts(f ? "Yes" : "No");
    return 0;
}

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

int main ()
{
  int height , width;
  char c = '#';
  vector<string> str(100);
  
  cin >> height >> width;
  for (int i = 0; i < height; i++)
    cin >> str.at(i);
  
  for (int i = 0; i < width + 2; i++)
    cout << '#';
  
  cout << endl;
  for (int i = 0; i < height; i++){
    cout << '#' << str.at(i) << '#' << endl;
  }
    for (int i = 0; i < width + 2; i++)
    cout << '#';
}

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

int main() {
  
  int A,B,C,D;
  cin >> A >> B >> C >> D ;
  
  
  for(int i=0; ; i++){
    
    C -= B;
    
    if(C<=0){
      cout << "Yes" << endl;
      break;
    }
    
    A -= D;
    
    if(A<=0){
      cout << "No" << endl;
      break;
    }
  }
  
}


Measured memory_bytes: 3636
#include<stdio.h>
#include<string.h>

int main()
{
	int a,b;
	char temp;
	while(temp!='?')
	{
	scanf("%d %c %d",&a,&temp,&b);
	switch(temp)
	{
	case '+':
	printf("%d\n",a+b);	
	break;
	case '-':
	printf("%d\n",a-b);	
	break;
	case '*':
	printf("%d\n",a*b);	
	break;
	case '/':
	printf("%d\n",a/b);
	break;
}
}
	return 0;
 }
 
 


Measured memory_bytes: 2044
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

ans=0

for i in range(n):
    if a[i] >= b[i]:
        ans+=b[i]
    elif a[i] + a[i+1] <= b[i]: # kill all
        ans+=a[i]+a[i+1]
        a[i+1] = 0
    else:
        ans+=b[i]
        a[i+1] -= b[i] - a[i]

print(ans)

Measured memory_bytes: 19116
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<functional>
#include<queue>
#include<stack>
#include<math.h>
#define INF 999999
#define EPS 1.0e-6
#define MAX_V 105

using namespace std;

//??°??????????????????
/*loop
s-t path??????????????????????????°??????
?????£????????????????????£?????????
??°???????????´??°
*/

typedef struct {
	int to;
	int cap;
	int rev;
}edge;

vector<edge> G[MAX_V];
bool used[MAX_V];
int V, E;

void add_edge(int from, int to, int cap)
{
	G[from].push_back(edge{ to,cap,(int)G[to].size()});
	G[to].push_back(edge{ from,0,(int)G[from].size() - 1 });
}

int dfs(int v, int t, int f)
{
	if (v == t)return f;
	used[v] = true;
	for (int i = 0; i < G[v].size(); i++) {
		edge &e = G[v][i];
		if (!used[e.to] && e.cap > 0) {
			int d = dfs(e.to, t, min(f, e.cap));
			if (d > 0) {
				e.cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

void max_flow(int s, int t)
{
	int flow = 0;
	while (1) {
		fill(used, used + MAX_V, false);
		int f = dfs(s, t, INF);
		if (f == 0) {
			cout << flow << endl;
			return;
		}
		flow += f;
	}
}

int main()
{
	cin >> V >> E;
	int u, v, c;
	for (int i = 0; i < E; i++) {
		cin >> u >> v >> c;
		add_edge(u, v, c);
	}

	max_flow(0, V - 1);


	return 0;
}

Measured memory_bytes: 3160
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define sol (k+k)
#define sag (k+k+1)
#define orta ((bas+son)/2)
#define coc g[node][i]
#define mod 1000000007
#define inf 1000000009
#define N 1000005
using namespace std;
 
typedef long long ll;
typedef pair < int , int > ii;
 
long long a,b,k;

int main() {

	cin >> a >> b >> k;
	
	if(a <= k) // eat all of a
	{
		if(a != 0)
		{
		k -= a;
		a = 0;
		}

		if(b <= k) // eat all of b
		{
			if(b != 0)
				b = 0;
		}
		else
		{
			b -= k;
		}

	}
	else // eat some parts of a
	{
		a -= k;
	}

	cout << a << " " << b;

	return 0;
}

Measured memory_bytes: 256
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n,x = nm()
m=[]

for i in range(n):
  mm = ni()
  m.append(mm)

m = sorted(m)

cnt=n
x-=sum(m)

for i in range(n):
  while x>0:
    if x>=m[i]:
      x-=m[i]
      cnt+=1
    else:
      break

print(cnt)

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

int main(){
        
            int a,b,c; cin >> a >> b >> c;
    int k; cin >> k;
    for(int i = 0; i<k; i++){
        if(b<=a)b*=2;
        else if(c<=b)c*=2;
    }
    if(b>a and c>b)cout <<"Yes"<<endl;
    else cout <<"No" << endl;
return 0;
}




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

int N;
int M;
vector<int> A;
int n[10]={0,2,5,5,4,5,6,3,7,6};
vector<int> dp(11111,-1);

int main(){
	cin >> N >> M;
	for(int i=0;i<M;i++){
		int a;
		cin >> a;
		A.push_back(a);
	}
	
	dp[0]=0;
	for(int i=0;i<10101;i++){
		for(auto a:A)dp[i+n[a]]=max(dp[i+n[a]],dp[i]+1);
	}
	
	sort(A.begin(),A.end(),greater<int>());
	int used=0;
	for(int i=0;i<dp[N];i++){
		for(auto a:A){
			if(N-used-n[a]>=0 && dp[N-used-n[a]]==dp[N]-i-1){
				cout << a;
				used+=n[a];
				break;
			}
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef complex<double> P;
typedef vector<P> vec;

namespace std{
  bool operator < (const P &a,const P &b){
    return (a.imag()==b.imag()?
            a.real()<b.real():
            a.imag()<b.imag());
  }
};

double eps=1e-8;
double PI=acos(-1);

bool eq(double a,double b){return (b-a<eps&&a-b<eps);}
bool eq(P a,P b){return (abs(a-b)<eps);}

double dot(P a,P b){return real(b*conj(a));}
double cross(P a,P b){return imag(b*conj(a));}
P project(P a,P b,P c){b-=a;c-=a;return a+b*real(c/b);}
P reflect(P a,P b,P c){b-=a;c-=a;return a+conj(c/b)*b;}
int ccw(P a,P b,P c){
  b-=a,c-=a,a=c*conj(b);
  if(a.imag()>eps)return 1;//ccw
  if(a.imag()<-eps)return -1;//cw
  if(a.real()<-eps)return 2;//ob
  if(abs(b)+eps<abs(c))return -2;//of
  return 0;//os
}

//segment ab , point c
double dist(P a,P b,P c){
  if(dot(b-a,c-a)<0)return abs(c-a);
  if(dot(a-b,c-b)<0)return abs(c-b);
  return abs(cross(b-a,c-a))/abs(b-a);
}

bool isintersect(P a,P b,P c,P d){
  return ((ccw(a,b,c)*ccw(a,b,d)<=0)&&(ccw(c,d,a)*ccw(c,d,b)<=0));
}

//segment ab , segment cd
P intersect(P a,P b,P c,P d){
  a-=d;b-=d;c-=d;
  return d+a+(b-a)*imag(a/c)/imag(a/c-b/c);
}

double dist(P a,P b,P c,P d){
  if(isintersect(a,b,c,d))return 0;
  double ab=min(dist(a,b,c),dist(a,b,d));
  double cd=min(dist(c,d,a),dist(c,d,b));
  return min(ab,cd);
}

double calcArea(vec &t){
  double res=0;
  int n=t.size();
  for(int i=0;i<n;i++)res+=cross(t[i],t[(i+1==n?0:i+1)]);
  return abs(res/2.0);
}

double Arg(P a,P b,P c){
  b-=a,c-=a;
  return arg(c*conj(b));
}

int inPolygon(vec &t,P p){
  int n=t.size();
  double sum=0;  
  for(int i=0;i<n;i++){
    P a=t[i],b=t[(i+1==n?0:i+1)];
    if( ccw(a,b,p) == 0 )return 1;// on
    sum+= Arg(p,a,b);
  }
  if( abs(sum) < eps )return 0;//out
  else  return 2;//in
}

typedef pair<double,P> Pair;
vec ConvexHull(vec t){
  vector<Pair> u;
  vec R;
  int N=t.size(),K=0,C=0;
  for(int i=1;i<N;i++)if(t[i]<t[K])K=i;
  for(int i=0;i<N;i++)u.push_back(Pair(arg(t[i]-t[K]),t[i]));
  R.push_back(t[K]),C++;
  sort(u.begin(),u.end());
  for(int i=0;i<N;i++){
    P p=u[i].second;
    if(2<=C&&ccw(R[C-2],R[C-1],p)==0)continue;
    if(2<=C&&ccw(R[C-2],R[C-1],p)==2)continue;
    while(2<=C&&ccw(R[C-2],R[C-1],p)!=1)R.pop_back(),C--;
    R.push_back(p),C++;    
  }
  return R;
}

vec cutConvex(vec &t,P a,P b){
  int N=t.size();
  vec res;
  for(int i=0;i<N;i++){
    P c=t[i],d=t[(i+1)%N];
    int C=ccw(a,b,c),D=ccw(a,b,d);
    if(C!=-1)res.push_back(c);
    if(C+D==0&&max(C,D)==1)res.push_back(intersect(a,b,c,d));
  }
  return res;
}

double maxDist(vec &t){
  vec u=ConvexHull(t);
  int N=u.size(),K=0;
  double res=0;
  for(int i=0;i<N;i++){
    while(abs(u[i]-u[K])<abs(u[i]-u[(K+1)%N]))K=(K+1)%N;
    res=max(res,abs(u[i]-u[K]));
  }
  return res;
}


int main(){
  int n;
  cin>>n;
  vec t;
  double x,y;
  for(int i=0;i<n;i++){
    cin>>x>>y;
    t.push_back(P(x,y));
  }
  printf("%.8f\n",maxDist(t));
  return 0;
}

Measured memory_bytes: 8140
//
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(size_t i = 0; i < (n); ++i)

int main()
{
    int N, X, T;
    cin >> N >> X >> T;
    int ans = (N + X - 1) / X * T;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3620
import math

N, K=map(int,input().split())
ansA, ansB = 0, 0
for i in range(N):
    if K/(i+1) <= 1:
        ansA += 1/N
    else:
        x = math.ceil(K/(i+1))
        y = 0.5**math.ceil(math.log2(x))
        ansB += y/N

print(ansA + ansB)

Measured memory_bytes: 3060
#include    <bits/stdc++.h>
#define     ll long long
#define     ull unsigned long long
#define     ld long double
#define     prec(k) fixed << setprecision(k)
#define     up(i, k, n) for (int i = k ; i < n ; i ++)
#define     down(i, k, n) for (int i = k ; i >= n ; i --)
#define     ii pair<int, int>
#define     pll pair <ll, ll>
#define     X first
#define     Y second
#define     str basic_string <int>
#define     QuanPham
const int maxN = (int) 1e4 + 7;
const int maxM = (int) 1e5 + 7;
const int maxT = (int) 1e6 + 7;

using namespace std;


int n, k, s[4007][4007], a, b, ans = 0; char c;

int sum(int x, int y, int z, int t)
{
	return s[z][t] - s[x - 1][t] - s[z][y - 1] + s[x - 1][y - 1];
}

int Box(int x, int y)
{
	return sum(x, y, x + k - 1, y + k - 1) + sum(x + k, y + k, x + 2 * k - 1, y + 2 * k - 1);
}

void enter()
{
	cin >> n >> k;
	up(i, 0, n)
	{
		cin >> a >> b >> c;
		if (c == 'W') b += k;
		s[a % (2 * k) + 1][b % (2 * k) + 1] ++;
		s[a % (2 * k) + 1][b % (2 * k) + 1 + 2 * k] ++;
		s[a % (2 * k) + 1 + 2 * k][b % (2 * k) + 1] ++;
		s[a % (2 * k) + 1 + 2 * k][b % (2 * k) + 1 + 2 * k] ++;
	}
}

void Prepare()
{
	up(i, 1, 4 * k + 1)
	up(j, 1, 4 * k + 1)
	s[i][j] += s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1];
}

void solve()
{
	up(i, 1, 2 * k + 1)
	up(j, 1, 2 * k + 1)
	ans = max(ans, Box(i, j));
	cout << ans;
}

int main()
{
	#ifdef QuanPham
    auto start = chrono::steady_clock::now();
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //freopen ("B.INP", "r", stdin);
    //freopen ("B.OUT", "w", stdout);

    enter();
    Prepare();
    solve();

	#ifdef QuanPham
    auto end = chrono::steady_clock::now();
    cerr << "In milliseconds : "
         << chrono::duration_cast<chrono::milliseconds>(end - start).count();
    cerr << '\n' << "In seconds : "
         << chrono::duration_cast<chrono::seconds>(end - start).count() << '\n';
    #endif
    return 0;
}

Measured memory_bytes: 62848
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <random>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <ctype.h>

using namespace std;

#define _CRT_SECURE_NO_WARNINGS
#define REP(i, n) for(int i=0; i<(n); i++)
#define LLREP(i,n) for(LL i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define SORT(x) sort(ALL(x))
#define REVE(x) reverse(ALL(x))
#define MP make_pair
#define PB push_back
#define INF INT_MAX

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef vector<vector<bool>> VVB;
typedef pair<int, int> PII;
typedef vector<pair<int, int>> VPII;
typedef queue<int> QI;
typedef long long LL;

int main() {
	int a, b;
	cin >> a >> b;
	if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0)puts("Possible");
	else puts("Impossible");
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
vector<int>U[30][2];
int n, P[30], c1;
int main() {
	int i, a, j;
	scanf("%d", &n);
	for (i = 1; i <= n; i++) {
		scanf("%d", &a);
		if (a & 1)c1++;
		for (j = 2; j <= 29; j++) {
			int t = a&((1 << j) - 1);
			U[j][t >> (j - 1)].push_back(t& ((1 << (j - 1)) - 1));
		}
	}
	for (i = 2; i <= 29; i++) {
		if (!U[i][0].empty())sort(U[i][0].begin(), U[i][0].end());
		if (!U[i][1].empty())sort(U[i][1].begin(), U[i][1].end());
	}
	for (i = 1; i <= n; i++) {
		scanf("%d", &a);
		if (a & 1)P[0] ^= ((n - c1) & 1);
		else P[0] ^= (c1 & 1);
		for (j = 2; j <= 29; j++) {
			int t = (a >> (j-1)) & 1, r = 0;
			int tp = a&((1 << (j - 1)) - 1);
			if (t == 0) {
				r += U[j][0].end() - lower_bound(U[j][0].begin(), U[j][0].end(), (1 << (j - 1)) - tp);
				r += lower_bound(U[j][1].begin(), U[j][1].end(), (1 << (j - 1)) - tp) - U[j][1].begin();
			}
			else {
				r += lower_bound(U[j][0].begin(), U[j][0].end(), (1 << (j - 1)) - tp) - U[j][0].begin();
				r += U[j][1].end() - lower_bound(U[j][1].begin(), U[j][1].end(), (1 << (j - 1)) - tp);
			}
			P[j - 1] ^= (r & 1);
		}
	}
	int res = 0;
	for (i = 0; i < 29; i++)res += P[i] << i;
	printf("%d\n", res);
}

Measured memory_bytes: 29268
#include<stdio.h>
#include<string.h>
int main()
{
	int n,c,i;
	char s[100000],t[100000],b[100000];
	for(;scanf("%d\n",&n),n;)
	{
		gets(s);
		for(;n--;)
		{
			memset(t,0,sizeof(t));
			for(i=0,c=1;s[i];i++,c++)
				if(s[i]!=s[i+1])
				{
					sprintf(b,"%d%c",c,s[i]);
					strcat(t,b);
					c=0;
				}
			memcpy(s,t,sizeof(s));
		}
		puts(s);
	}
	return 0;
}

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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Palindromephobia solver = new Palindromephobia();
        solver.solve(1, in, out);
        out.close();
    }

    static class Palindromephobia {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.next();
            int[] cnt = new int[3];
            for (int i = 0; i < s.length(); i++) {
                cnt[s.charAt(i) - 'a']++;
            }
            Arrays.sort(cnt);
            out.println(cnt[2] - cnt[0] <= 1 ? "YES" : "NO");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
}



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

using namespace std;

int main()
{
    string w ;
    cin >> w ;
    int c = 0;
    sort(w.begin(), w.end());

    char a = w[0];
    for(int i=0 ; i<w.length(); i++){
        if(a == w[i]){
            c++;
        }else if( a != w[i] && c%2!=0){
            cout <<"No";
            return 0;
        }else {
            a = w[i] ;
            c = 1 ;
        }
    }

    if(c%2 == 0 )
        cout<< "Yes";
    else
        cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int counta,countb;
	for(counta=0;counta<9;counta++){
		for(countb=0;countb<9;countb++){
			printf("%dx%d=%d\n",counta+1,countb+1,(counta+1)*(countb+1));
		}
	}
	return 0;
}

Measured memory_bytes: 520