akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll ;
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
 const ll inf=1e9+7;
ll dp[50][3000];
int main()
{
    fast;
    
    string a,b,c;
    cin>>a>>b>>c;
    
    cout<<a[0]<<b[0]<<c[0];
    
}

		
	
	
	
	


Measured memory_bytes: 3624
/*
 * author: calgagi
 *         Calvin Gagliano 
 */
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ull unsigned long long
#define ii pair<int, int>
#define ar array
#define f first
#define s second
#define dd long double

int main() {
    ios_base::sync_with_stdio(false);  
    cin.tie(NULL);
    srand(chrono::steady_clock::now().time_since_epoch().count()); 
    // freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); 
    
    int n, m;
    cin >> n >> m;
    
    vector<int> obs(n);
    for (int i = 0; i < n; i++) {
        cin >> obs[i];
    }

    vector<vector<int>> adj(n);
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        bool high = 1;
        for (auto& edge : adj[i]) {
            if (obs[edge] >= obs[i]) {
                high = 0;
                break;
            }
        }
        ans += high;
    }

    cout << ans << endl; 

    return 0;
}


Measured memory_bytes: 8676
#include<bits/stdc++.h>
using namespace std;
int countFreq(string &pat, string &txt)
{
	int M = pat.length();
	int N = txt.length();
	int res = 0;
	for (int i = 0; i <= N - M; i++)
	{
		
		int j;
		for (j = 0; j < M; j++)
			if (txt[i+j] != pat[j])
				break;

		if (j == M)
		{
		res++;
		j = 0;
		}
	}
	return res;
}

int main()
{
string txt ;int n;
string pat="ABC" ;
cin>>n>>txt;
cout << countFreq(pat, txt);
return 0;
}



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

int64_t MOD;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}
void mul(int64_t& a, int64_t b){
    a = a*b % MOD;
}

vector<int64_t> fact, seq_inv, fact_inv;

void create_fact_mod(int num){
    fact[0] = fact[1] = 1;
    for(int i=2; i<=num; i++) fact[i] = fact[i-1] * i % MOD;
}

void create_seq_inv_mod(int num){
    seq_inv[0] = seq_inv[1] = 1;
    for(int i=2; i<=num; i++) seq_inv[i] = (MOD - MOD/i) * seq_inv[MOD%i] % MOD;
}

void create_fact_inv_mod(int num){
    fact_inv[0] = fact_inv[1] = 1;
    for(int i=2; i<=num; i++) fact_inv[i] = fact_inv[i-1] * seq_inv[i] % MOD;
}

void create_mod_tables(int num){
    fact.resize(num+1);
    seq_inv.resize(num+1);
    fact_inv.resize(num+1);
    create_fact_mod(num);
    create_seq_inv_mod(num);
    create_fact_inv_mod(num);
}

int64_t comb_mod(int n, int k){
    return fact[n] * fact_inv[n-k] % MOD * fact_inv[k] % MOD;
}

int64_t perm_mod(int n, int k){
    return fact[n] * fact_inv[n-k] % MOD;
}

int64_t power_mod(int64_t num, int64_t power){
    int64_t prod = 1;
    num %= MOD;
    while(power > 0){
        if(power&1) prod = prod * num % MOD;
        num = num * num % MOD;
        power >>= 1;
    }
    return prod;
}

int64_t extgcd(int64_t a, int64_t b, int64_t& x, int64_t& y){
    int64_t d = a;
    if(b != 0){
        d = extgcd(b, a%b, y, x);
        y -= (a/b) * x;
    }else{
        x = 1; y = 0;
    }
    return d;
}

int64_t inv_mod(int64_t a){
    int64_t x, y;
    extgcd(a, MOD, x, y);
    return (MOD + x%MOD) % MOD;
}

int main(){
    int N;
    cin >> N >> MOD;
    create_mod_tables(10000);

    static int64_t dp[6010][4001];
    dp[3*N][N] = 1;
    for(int i=3*N; i>0; i--) for(int j=0; j<=2*N; j++){
        add(dp[i-1][min(2*N, j+1)], dp[i][j]);
        if(i>=2 && j > 0) add(dp[i-2][j-1], dp[i][j] * (i-1));
        if(i>=3) add(dp[i-3][j], dp[i][j] * (i-1) * (i-2));
    }

    int64_t ans = 0;
    for(int j=N; j<=2*N; j++) add(ans, dp[0][j]);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 188032
package main

import (
	"fmt"
	"sort"
)

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

	a := make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}
	sort.Ints(a)

	for i, ai := range a {
		if x < ai || (i == n-1 && x != ai) {
			break
		}
		ans++
		x -= ai
	}
	fmt.Println(ans)
}


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

int main()
{
	int N;
	cin >> N;
	vector<int> a( N );
	for( int i = 0; i < N; i++ )  {
		cin >> a[i];
	}

	set<int> ans;
	for( int i = N - 1; i >= 0; i-- ) {
		int n = i + 1;
		int sum = 0;
		for( int j = n + n; j <= N; j += n ) {
			if( ans.count( j ) ) sum++;
		}
		if( a[i] != sum % 2 ) ans.insert( n );
	}

	cout << ans.size() << endl;
	int first = 0;
	for( auto it = ans.begin(); it != ans.end(); it++ ) {
		if( first ) cout << " ";
		cout << *it;
		first = 1;
	}
	if( ans.size() ) cout << endl;

}


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

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second
#define mx1 10
#define mx2 110
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

typedef vector<LL> Vl;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef pair<DD, DD> Pdd;
typedef vector<Pll> Vpl;
typedef vector<Pdd> Vpd;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
typedef deque<LL> Dl;

LL _set(LL N, LL pos) {return N = N | (1 << pos);}
LL _reset(LL N, LL pos) {return N = N & ~(1 << pos);}
bool _check(LL N, LL pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

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

///**************************DONE****************************///

int main()
{
    int a, p;
    cin >> a >> p;

    a = 3 * a + p;
    cout << a / 2 << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    double l; cin >> l;
    printf("%.16lf\n", (l / 3.0) * (l / 3.0) * (l / 3.0));
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int ans = m;
		for(int p=m/n+1; p>=1; p--){
			if(m%p==0 && m/p>=n){
				ans = p;
              	break;
			}
		}
		System.out.println(ans);
	}
}

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

using ll = long long;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  if (fopen("input.in", "r")) {
    freopen("input.in", "r", stdin);
    freopen("output.out", "w", stdout);
  }

  ll N, K; cin >> N >> K;
  vector<ll> h(N, 0);
  for (ll i = 0; i < N; i++) cin >> h[i];

  vector<ll> dp(N, 1e10);
  dp[0] = 0;

  for (ll i = 1; i < N; i++) {
    for (ll x = 1; x <= K; x++) {
      if (i-x >= 0) dp[i] = min(dp[i], dp[i-x]+abs(h[i]-h[i-x]));
    }
  }

  cout << dp[N-1] << endl;

  return 0;
}

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

int main() {
	uint32_t N, K;
	cin >> N >> K;
	
	vector<uint32_t>a(N);
	for(uint32_t i=0; i<N; i++) cin >> a[i];
	// a is sorted
	
	vector<bool> dp(K+1);

	for(uint32_t i=a[0]; i<=K; i++) {
		for(uint32_t j=0; j<N; j++) {
			if(a[j] > i) break;
			if(!dp[i-a[j]]) {
				dp[i] = true;
				break;
			}
		}
	}
	
	string ans = dp[K] ? "First" : "Second";
	cout << ans;
	
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		char[] O = sc.next().toCharArray();
		char[] E = sc.next().toCharArray();
		String ans = "";
		for (int i=0; i < Math.max(O.length, E.length); i++) {
			try {
				ans += O[i];
				ans += E[i];
			} catch (Exception ex){
		
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 22228
n = int(input())
a,b = [],[]

for i in range(n):
  x,y = map(int,input().split())
  a.append(x + y)
  b.append(x - y)

a.sort()
b.sort()

ans = max(a[-1] - a[0], b[-1] - b[0])
print(ans)

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

long long x, k;
bool y[32], m[32], a[32];

int main() {
    cin >> x >> k;
    for (int i=0; i<32; i++) {
        y[31-i] = x%2;
        x/=2;
    }
    for (int i=0; i<32; i++) {
        m[31-i] = k%2;
        k/=2;
    }
    for (int i=0; i<32; i++) a[i] = y[i] & m[i];
    for (int i=0; i<32; i++) cout << a[i];
    cout << endl;
    for (int i=0; i<32; i++) a[i] = y[i] | m[i];
    for (int i=0; i<32; i++) cout << a[i];
    cout << endl;
    for (int i=0; i<32; i++) a[i] = y[i] ^ m[i];
    for (int i=0; i<32; i++) cout << a[i];
    cout << endl;
}


Measured memory_bytes: 3120
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>

#define ll long long
#define db double
#define rg register int

using namespace std;

int n;
string s;
int a[500005];
int f[500005][26];
int t[500005];

inline int qr(){
	register char ch; register bool sign=0; rg res=0;
	while(!isdigit(ch=getchar()))if(ch=='-')sign=1;
	while(isdigit(ch))res=res*10+(ch^48),ch=getchar();
	if(sign)return -res; else return res;
}

inline int dfs(int i){
	if(i==0)return 0;
	if(t[i])return t[i];
	t[i]=1e9;
	for(rg j=0;j<26;++j){
		t[i]=min(t[i],dfs(f[i][j])+1);
	}return t[i];
}

int main(){
	cin>>s; n=s.size();
	for(rg i=1;i<=n;++i) a[i]=s[i-1]-'a';
	for(rg i=n-1;i>=1;--i){
		for(rg j=0;j<26;++j)
			f[i][j]=f[i+1][j];
		f[i][a[i+1]]=i+1;
	}
	for(rg j=0;j<26;++j)
		f[n+1][j]=f[1][j];
	f[n+1][a[1]]=1;
	dfs(n+1);
	rg i=n+1,v=t[n+1];
	while(i){
		for(rg j=0;j<26;++j){
			if(t[f[i][j]]==v-1){
				printf("%c",j+'a');
				i=f[i][j]; v=t[i];
				break;
			}
		}
	}puts("");
	return 0;
}


Measured memory_bytes: 24452
#include<bits/stdc++.h>
using namespace std;
int k;
int main(){
	cin>>k;
	int Mod=0;
	for(int i=1;i<=1e6;i++){
		Mod=(Mod*10+7)%k;
		if(Mod==0){
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<-1<<endl;
	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll n; cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    sort(all(a));
    cout << abs(a[0]-a[n-1]) << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// 入力導入部
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int l = sc.nextInt();

		// /////////////////////////////////////////////////////////////////
		// 計算部 x=n+n-i+n-l
		int[][] a, b;
		a = new int[n][m];
		b = new int[m][l];
		long[][] c = new long[n][l];

		for (int s = 0; s < n; s++) {
			for (int t = 0; t < m; t++) {
				a[s][t] = sc.nextInt();
			}
		}

		for (int s = 0; s < m; s++) {
			for (int t = 0; t < l; t++) {
				b[s][t] = sc.nextInt();
			}
		}
		sc.close();
		// ////配列Cを作成する
		long sum;
		for (int x = 0; x < n; x++) {
			for (int y = 0; y < l; y++) {
				sum = 0;
				for (int i = 0; i < m; i++) {
					sum += a[x][i] * b[i][y];
				}
				c[x][y] = sum;
			}
		}

		for (int i = 0; i < n; i++) {
			for (int s = 0; s < l; s++) {
				if (s == 0)
					System.out.print(c[i][s]);
				else
					System.out.print(" " + c[i][s]);
			}
			System.out.println();
		}
	}
}

Measured memory_bytes: 45408
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <math.h>
#include <string>
#define ll long long
#define ull unsigned long long
#define make(type,x) type x; cin>>x
#define make2(type,x,y) type x,y; cin>>x>>y
#define fr(x,y) for(long long x=0;x<y;x++)
#define makevec(x,y,n) vector <x> y(n); for(ll i=0;i<n;i++) cin>>y[i]
#define M (ll)1000000007
#define MM (ll) 1e8
#define INF (ll) 1e18

# define IOS ios_base::sync_with_stdio(false); cin.tie(NULL)


using namespace std;


template <typename T>
T modpow(T base, T exp, T modulus) {
  base %= modulus;
  T result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}
bool sortbysec(const pair <ll,ll> &a,const pair <ll,ll> &b){
    return a.second<b.second;
}

struct cmp {
	bool operator() (const pair<int, int> &a, const pair<int, int> &b) const {
		int lena = a.second - a.first + 1;
		int lenb = b.second - b.first + 1;
		if (lena == lenb) return a.first < b.first;
		return lena > lenb;
	}
};


struct c_h {
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        x ^= FIXED_RANDOM;
        return x ^ (x >> 16);
    }
};

ll calcpow(ll x, ll y)
{
    ll temp;
    if(y == 0)
        return 1;
    temp = calcpow(x, y / 2);
    if (y % 2 == 0)
        return temp * temp;
    else
    {
        if(y > 0)
            return x * temp * temp;
        else
            return (temp * temp) / x;
    }
}
ll gcd(ll a, ll b){
    if(b==0) return a;
    return gcd(b,a%b);

}
ll egcd(ll a, ll b, ll &x,ll &y){
    if(b==0){
        x=1;
        y=0;
        return a;
    }
    ll x1;
    ll y1;
    ll g=egcd(b,a%b,x1,y1);
    x=y1;
    y=x1-y1*(a/b);
    return g;
}


bool isprime(ll a){
bool flag=1;
for(ll i=2;i*i<=a;i++){
    if(a%i==0) {flag=0; break;}
}
return flag;
}

ll dx8[8]={1,0,-1,0,1,-1,1,-1};
ll dy8[8]={0,1,0,-1,1,-1,-1,1};
ll dx4[4]={0,0,1,-1};
ll dy4[4]={1,-1,0,0};


int main(){
    IOS;
    make2(ll,n,x);
    makevec(ll,a,n);
    ll g=abs(a[0]-x);
    fr(i,n) g=gcd(g,abs(x-a[i]));
    cout<<g<<endl;


    return 0;
}


Measured memory_bytes: 3928
#include<stdio.h>
int main(){
  int n,t,sum=0;
  int i,j;
  scanf("%d",&n);
  int p[n];
  for(i=0;i<n;i++){
    scanf("%d",&p[i]);
  }
  for(i=0;i<n;i++){
    if(p[i]!=i+1)sum++;
  }
  if(sum<=2)printf("YES");
  if(sum>2)printf("NO");
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main ()
{
char crr [1001];
  cin >> crr ;
  int l = strlen (crr);
  for (int i = 0;i<=l - 1;i++)
  {
    cout <<crr [i];
  }
  if (crr [l - 1] == 's')cout <<"es\n";
  else cout <<"s\n";
  


}


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

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());


void c_p_c()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}

int32_t main()
{
//  c_p_c();
  int a,b;
  cin >> a >> b;
  if(min(a,b) <=8 && max(a,b) <= 8)
  {
    cout<<"Yay!"<<endl;
  }
  else
  {
    cout<<":("<<endl;  
  }

  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
typedef long long ll;

int get(){
    int ch;
    do{
        ch=getchar();
    }while(isspace(ch));
    return ch;
}
void read(ll &x,int &k){
    x=k=0;
    x=get()-'0';
    bool flag=0;
    while(1){
        int ch=getchar();
        if(isspace(ch))break;
        if(ch=='.')flag=1;
        else{
            if(flag)++k;
            x=x*10+ch-'0';
        }
    }
    while(x%10==0){
        x/=10;
        --k;
    }
    while(k<0){
        ++k;
        x*=10;
    }
}
typedef pair<ll,ll> P;
map<P,int> mp;

int main(){
    int n,num=0;
    scanf("%d",&n);
    for(int i=0;i<n;++i){
        ll x;
        int k;
        read(x,k);
        ll tmp1=1,tmp2=1;
        while(x%2==0){
            x/=2;
            tmp1*=2;
        }
        while(x%5==0){
            x/=5;
            tmp1*=5;
        }
        for(int i=0;i<k;++i)tmp2*=10;
        ll gcd=__gcd(tmp1,tmp2);
        ++mp[P(tmp1/gcd,tmp2/gcd)];
    }
    ll ans=0;
    for(auto it=mp.begin();it!=mp.end();++it){
        if(it->first.second==1)ans-=it->second;
        for(auto it2=mp.begin();it2!=mp.end();++it2){
            if(it->first.first%it2->first.second==0&&
                it2->first.first%it->first.second==0)ans+=it->second*(ll)it2->second;
        }
    }
    printf("%lld",ans/2);
    return 0;
}

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

Measured memory_bytes: 1704
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>
#include <bitset>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

string S;

int main() {

	cin >> S;

	cout << S;
	if (S[S.size() - 1] == 's') {
		cout << "es" << endl;
	}
	else {
		cout << "s" << endl;
	}
	return 0;
}


Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int a,b,c,d,e;
    cin>>a>>b>>c;
    d=a%b;
    if(d==0)
    {
        e=a/b;
        cout<<e*c<<endl;
    }
    else
    {
        e=a/b;
        e++;
        cout<<e*c<<endl;
    }
}


Measured memory_bytes: 3616
# 155b

def atc_155b(input_value: str) -> str:
    N = int(input_value[0])
    Ai = [int(ai) for ai in input_value[1].split(" ")]
    for i in range(0, N):
        if Ai[i] % 2 == 0 and Ai[i] % 3 != 0 and Ai[i] % 5 != 0:
            return "DENIED"
    return "APPROVED"

N = input()
Ai = input()
print(atc_155b([N, Ai]))


Measured memory_bytes: 9120
import itertools

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

N_arr = []
for i in range(N):
    N_arr.append(i+1)

index_P = 0
index_Q = 0    

tmp = 1
for i in itertools.permutations(N_arr):

    if list(i) == P:
        index_P = tmp
    if list(i) == Q:
        index_Q = tmp 
    tmp += 1  
print(abs(index_P-index_Q)) 

Measured memory_bytes: 3064
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt(),b = sc.nextInt();
    int ans = 0;
    for(int i = 0;i<2;i++){
      if(a>=b){
        ans += a;
        a--;
      }else{
        ans += b;
        b--;
      }
    }
    System.out.println(ans);
  }
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

int main(){
    ll h,w;cin >>h>>w;
    vector<vector<ll>>cost(w,vector<ll>(h,INF));
    char s[w][h];
    ll white=0;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            cin >>s[j][i];
            if(s[j][i]=='.')white++;
        }
    }
    ll dx[4]={0,1,-1,0};
    ll dy[4]={1,0,0,-1};
    queue<P>que;
    que.push({0,0});
    cost[0][0]=1;
    while(!que.empty()){
        P pos=que.front();
        que.pop();
        ll x=pos.first;
        ll y=pos.second;
        for (int i = 0; i < 4; ++i) {
            ll tx=x+dx[i];
            ll ty=y+dy[i];
            if(tx>=w||ty>=h)continue;
            if(tx<0||ty<0)continue;
            if(s[tx][ty]=='#')continue;
            if(cost[tx][ty]>cost[x][y]+1) {
                cost[tx][ty] = min(cost[tx][ty], cost[x][y] + 1);
                que.push({tx, ty});
            }
        }
    }
    ll ans;
//    for (int i = 0; i < h; ++i) {
//        for (int j = 0; j < w; ++j) {
//            cout <<cost[j][i]<<" ";
//        }
//        cout <<endl;
//    }
    if(cost[w-1][h-1]==INF)ans=-1;
    else {
        ans=white-cost[w-1][h-1];
    }
    cout <<ans<<endl;
    return 0;
}



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

namespace AtCoder_solve
{
    class Program
    {
        public const ulong mod = 1000000007;

        static void Main(string[] args)
        {
            var ab = Console.ReadLine().Split();
            int ans = 0;
            if (ab[0].Length == 2 || ab[1].Length == 2)
            {
                ans = -1;
            }
            else
            {
                ans = int.Parse(ab[0]) * int.Parse(ab[1]);
            }
            Console.WriteLine(ans);

        }
    }
}


Measured memory_bytes: 13140
from fractions import gcd

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

left = [0]*N

for i in range(N-1):
    left[i+1] = gcd(left[i],A[i])

right = [0]*N

for i in range(N-1,0,-1):
    right[i-1] = gcd(right[i],A[i])

ans_list = [gcd(l,r) for l, r in zip(left,right)]

ans = max(ans_list)

print(ans)

Measured memory_bytes: 16136
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <string>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <cmath>
#include <cstring>
using namespace std;

#define pi acos(-1)

int to_int(string s){
    int number = 0;
    for(int i=0;i<s.size();i++){
        number *= 10;
        number += s[i] - '0';
    }
    return number;
}

string to_str(int n){
    string s;
    while(n!=0){
        s += n % 10 + 48;
        n /= 10;
    }
    reverse(s.begin(),s.end());
    return s;
}

bool isLeapYear(int year)
{
    if(((year % 4 == 0 ) && (year % 100 != 0)) || (year % 400 == 0))
        return true;
    else
        return false;
}

bool isPrime(int n)
{
    if(n ==1)
        return false;
    if (n == 2)
        return true;
    if ((n & 1)==0)
        return false;
    for (int i = 3; i*i <= n;i+=2) {
        if (n%i == 0)
            return false;
    }

    return true;
}

bool isPalindrome(string s)
{
    for(int i=0,j=s.size()-1 ; i< s.size()/2 && j >= s.size()/2;i++,j--){
            if(s[i] == s[j])
                continue;
            else{
                return false;
            }
        }
    return true;
}

/*#define row 5001
#define col 10000

int arr[row][col];

void fib()
{
    arr[0][0] = 0;
    arr[1][0] = 1;
    for(int i=2;i<row;i++){
        for(int j=0;j<col;j++){
            if(arr[i-1][j] + arr[i-2][j] == 0)
                continue;
            arr[i][j] += arr[i-1][j] + arr[i-2][j];
            if(arr[i][j] > 9){
                arr[i][j+1] = arr[i][j]/10;
                arr[i][j] %= 10;
            }
        }
    }
}*/

bool comp(pair<pair<long long,long long>, long long> a, pair<pair<long long, long long>, long long> b)
{
    return a.second > b.second ;
}

int main()
{
    int R;
    cin >> R;
    
    if(R < 1200)
        cout << "ABC" << endl;
    else if(R >= 1200 && R <2800)
        cout << "ARC" << endl;
    else
        cout << "AGC" << endl;
        
	return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
    ll N, M;
    cin >> N >> M;
    vector<ll> x(N), y(N), z(N);
    for (int i = 0; i < N; i++) {
        cin >> x[i] >> y[i] >> z[i];
    }

    ll c1[] = { 1, 1, 1, 1, -1, -1, -1, -1 };
    ll c2[] = { 1, 1, -1, -1, 1, 1, -1, -1 };
    ll c3[] = { 1, -1, 1, -1, 1, -1, 1, -1 };

    ll ans = 0;

    for (int k = 0; k < 8; k++) {
        vector<vector<ll>> dp(N + 1, vector<ll>(M + 1, LLONG_MIN / 2));
        for (int i = 1; i <= N; i++) {
            dp[i - 1][0] = 0;
            for (int j = 1; j <= M; j++) {
                dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - 1] + c1[k] * x[i - 1] + c2[k] * y[i - 1] + c3[k] * z[i - 1]);
            }
        }

        ans = max(ans, dp[N][M]);
    }

    cout << ans << endl;
}


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

int main(){
  int r, c;
  int R[101][101] = {};

  cin >> r >> c;

  for( int i = 0; i < r; i++) {
    for( int j = 0; j < c; j++) {
      cin >> R[i][j];
      R[i][c] += R[i][j];
      R[r][j] += R[i][j];
      R[r][c] += R[i][j];
    }
  }

  for( int i = 0; i <= r; i++) {
    for( int j = 0; j <= c; j++) {
      if( j ) cout << " ";
      cout << R[i][j];
    }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 3116
N,K = [ int(it) for it in input().split() ]
K2 = 2*K
li = [ (lambda x,y,z:[int(x)%K2,int(y)%K2,0 if z=="W" else 1] )(*(input().split())) for i in range(N)]

bm = [[0]*(K2+1) for i in range(K2+1)]
wm = [[0]*(K2+1) for i in range(K2+1)]
for x,y,z in li:
  if (z==0):
    wm[x+1][y+1] += 1
  else:
    bm[x+1][y+1] += 1

for i in range(1,2*K+1):
  for j in range(1,2*K+1):
    bm[i][j]=bm[i-1][j]+bm[i][j-1]-bm[i-1][j-1]+bm[i][j]
    wm[i][j]=wm[i-1][j]+wm[i][j-1]-wm[i-1][j-1]+wm[i][j]

ma = 0
for i in range(K):
  for j in range(K):
    for _ in range(2):
      s = 0
      s += bm[i][j]-bm[i][0]-bm[0][j]+bm[0][0]
      s += wm[K+i][j]-wm[K+i][0]-wm[i][j]+wm[i][0]
      s += wm[i][K+j]-wm[i][j]-wm[0][K+j]+wm[0][j]
      s += bm[i+K][j+K]-bm[i+K][j]-bm[i][j+K]+bm[i][j]
      s += bm[i][2*K]-bm[0][2*K]-bm[i][j+K]+bm[0][j+K]
      s += bm[2*K][j]-bm[2*K][0]-bm[i+K][j]+bm[i+K][0]
      s += wm[2*K][j+K]-wm[2*K][j]-wm[K+i][j+K]+wm[K+i][j]
      s += wm[i+K][2*K]-wm[i][2*K]-wm[K+i][j+K]+wm[i][j+K]
      s += bm[2*K][2*K]-bm[2*K][j+K]-bm[i+K][2*K]+bm[i+K][j+K]
      ma = max(ma,s)
      bm,wm=wm,bm
print (ma)
    
    
    
    
    


              
    
  
        

Measured memory_bytes: 123736
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = 1; i <= (int)(n); i++)
#define drep(i, n) for(int i = (n)-1; i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

// Mod int
const int mod = 1000000007;
// const int mod = 998244353;
struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%mod+mod)%mod){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%mod+mod)%mod; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
  mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}
//



int main() {
  int n, t, x;
  cin >> n >> x >> t;
  int ans = 0;
  int c = 0;
  while (c < n) {
    ans += t;
    c += x;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
string alp="abcdefghijklmnopqrstuvwxyz";
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);



int main(){fastio
    ll n,k;cin>>n>>k;
    ll h[n];rep(i,0,n-1)cin>>h[i];
    ll dp[n];
    dp[0]=0;
    rep(i,1,n-1){
        dp[i]=inf;
        rep(j,max(i-k,0),i-1){
            dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]));
        }
    }
    cout<<dp[n-1]<<endl;
    
    
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = 1e9 + 7;

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

    int n, k;
    cin >> n >> k;

    int sum = 0;

    for(int i = k+1; i <= n; i++){
        sum += (n / i) * (i - k) + (n % i == 0 ? 0 : max((k == 0 ? n % i : n % i - k + 1) ,0LL));
    }
    cout << sum << endl;
}


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

using namespace std;

int N, M, A[3];
bool graph[50][50];
bool v[101][50][50];

void Calculation()
{
  cin >> N >> M;
  for(int i = 0; i < 3; i++) {
    cin >> A[i];
  }
  sort(begin(A), end(A));

  while(M--) {
    int U, V;
    cin >> U >> V;
    --U, --V;
    graph[V][U] = v[0][V][U] = true;
  }

  for(int l = 1; l <= A[2]; l++) {
    for(int k = 0; k < N; ++k) {
      for(int i = 0; i < N; ++i) {
        for(int j = 0; j < N; ++j) {
          v[l][i][j] |= v[l - 1][i][k] & graph[k][j];
        }
      }
    }
  }

  int min_cost[50], bit[50] = {};
  queue< int > que;
  memset(min_cost, -1, sizeof(min_cost));
  que.emplace(N - 1);
  min_cost[N - 1] = 0;
  while(!que.empty()) {
    int p = que.front();
    que.pop();
    if(p == 0) {
      cout << min_cost[p] << endl;
      return;
    }
    for(int i = 0; i < 3; i++) {
      for(int j = 0; j < N; j++) {
        if(!v[A[i] - 1][p][j]) continue;
        bit[j] |= 1 << i;
        if(bit[j] == 7 && min_cost[j] == -1) {
          min_cost[j] = min_cost[p] + 1;
          que.emplace(j);
        }
      }
    }
  }
  cout << "IMPOSSIBLE" << endl;

}


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

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

int main(){
	int N;
	cin >> N;
  	vector<string> S(N);  	
  	for(int i = 0; i < S.size(); i++){
    	cin >> S.at(i);
    }
  	
  	bool ans = false;
  
  	for(int i = 0; i < S.size(); i++){
    	if(S.at(i) == "Y"){
        ans = true;
        }
    }
  if(ans){
  	cout << "Four" << endl;
  }else{
  	cout << "Three" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define loops(i, s, n) for (int i = s; i < n; i++)
#define loop(i, n) for (int i = 0; i < n; i++)
#define eps 1e-9
#define loopitr(mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define init(arr, n, val)       \
    for (int i = 0; i < n; i++) \
        arr[i] = val;
#define even_set 0xAAAAAAAA ... 1010101010
#define odd_set 0x55555555 ... 01010101
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define vall(v) v.begin(), v.end()
#define mkp make_pair
#define ret return
#define cont continue
#define nl endl
#define ff first
#define ss second
#define cnt_bits __builtin_popcount
#define init(arr, n, val)       \
    for (int i = 0; i < n; i++) \
        arr[i] = val;
const int mod = 1000000007;

double dp[3000][3000];
int n;
double probs(int i, double arr[], int h, int t){
    if(i == n){
        if(h > n/2)
          ret 1.0;
        else
          ret 0;  
    }

    if(dp[h][t] != -1)
      ret dp[h][t];

    double a = probs(i+1, arr, h+1, t)*(arr[i]);
    double b = probs(i+1, arr, h, t+1)*(1-arr[i]);

    ret dp[h][t] = (a+b);
}

int main()
{

    fastio;
    cin >> n;
    double arr[n];
    loop(i, n)
    {
        cin >> arr[i];
    }

    for(int i = 0; i<= n ; i++)
      for(int j = 0; j<=n; j++)
        dp[i][j] = -1;

    cout<<fixed<<setprecision(10)<<probs(0 , arr, 0, 0)<<endl;
}

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

int main(void){
    int n;cin >> n;
    int cnt=0;
    for (size_t i = 0; i < n; i++) {
        int t;
        cin >> t;
        if (t%2==0)cnt++;
    }
    cout << pow(3,n)-pow(2,cnt);
    return 0;
}

Measured memory_bytes: 512
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  ll n;cin>>n;
  map<string,ll>M;
  rep(i,n){
    string s;cin>>s;
    M[s]++;
  }
  ll m;cin>>m;
  rep(i,m){
    string t;cin>>t;
    M[t]--;
  }
  ll ans=0;
  for(auto p:M){
    ans=max(ans,p.second);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import sys
import math
import fractions
import bisect
import queue
import heapq
from collections import deque
sys.setrecursionlimit(4100000)

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288
INF = 1e18

'''
1行のint=====================================
N, K = map(int, input().split())

A, B = map(int, input().split())

H, W = map(int, input().split())

L, R = map(int, input().split())

1行のstring=================================
S, T = input().split()

1行の整数配列================================
P = list(map(int,input().split()))

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

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

L = list(map(int,input().split()))
R = list(map(int,input().split()))

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

改行あり整数==================================
X = []
Y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    X.append(x1)
    Y.append(y1)

A = []
B = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    A.append(x1)
    B.append(y1)

Pair = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    Pair.append((x1, y1))


N行M列の初期化====================================
dp = [[VAL] * RETU for i in range(GYO)]

'''




A, B, C = map(int, input().split())
if A== B and B!=C:
    print("Yes")
elif A==C and A!=B:
    print("Yes")
elif B == C and A!=B:
    print("Yes")
else:
    print("No")








Measured memory_bytes: 5716
#include<bits/stdc++.h>
using namespace std;
char maze[15][1005];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int h,w,k,ans=0x7fffffff,cont;
    cin>>h>>w>>k;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            cin>>maze[i][j];
        }
    }
    for(int i=0;i<=(1<<h-1)-1;i++){
        vector<vector<int> >vec(h+5);
        vector<int>sum,shu;
        int loc=1,cont=0;
        vec[loc].push_back(1);
        for(int j=1,cut=i;j<h;j++,cut>>=1){//纵向划分巧克力块
            if(cut&1){
                loc++;
                vec[loc].push_back(j+1);
            }else{
                vec[loc].push_back(j+1);
            }
        }
        for(int j=0;j<=loc;j++){//初始化计数
            sum.push_back(0);
            shu.push_back(0);
        }
        bool book=false;
        for(int j=1;j<=w;j++){//循环列
            bool flag=false;
            for(int q=1;q<=loc;q++){
                shu[q]=0;
                for(int w=0;w<vec[q].size();w++){
                    if(maze[vec[q][w]][j]=='1'){
                        shu[q]++;
                        if(sum[q]+shu[q]>k) flag=true;
                    }
                }
                if(shu[q]>k){
                    book=true;
                    break;
                }
            }
            if(book) break;
            if(flag){
                cont++;
                for(int q=1;q<=loc;q++){
                    sum[q]=shu[q];
                }
            }else{
                for(int q=1;q<=loc;q++){
                    sum[q]+=shu[q];
                }
            }
        }
        if(book) continue;
        ans=min(ans,cont+loc-1);//更新答案
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
N=int(input())
w=list(map(int,input().split()))

Min=max(w)
for j in range(0,N):
	s=t=0
	for i in range(0,j):
		s=s+w[i]
	for k in range(j,N):
		t=t+w[k]
	x=abs(s-t)
	if x<=Min:
		Min=x
print(Min)

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


int main()
{
    int A,B,C;
    cin>>A>>B>>C;
    
    if (A<=C and C<=B)
    {
        cout<<"Yes"<<endl;
        
    }
    
    else
    {
        cout<<"No"<<endl;
    }
        
        
    
};


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>

typedef struct node {
    long v;
    node *parent;
    node *left;
    node *right;
} Node;

typedef struct {
    Node *root;
} Tree;

Tree T = {NULL};

void insertTree(Node *node) {
    Node *y = NULL;
    Node *x = T.root;
    while (x != NULL) {
        y = x;
        if (node->v < x->v) {
            x = x->left;
        } else {
            x = x->right;
        }
    }
    node->parent = y;
    if (y == NULL) {
        T.root = node;
    } else if (node->v < y->v) {
        y->left = node;
    } else {
        y->right = node;
    }
}

void Preorder(Node *n) {
    if (n != NULL) {
        printf(" %ld", n->v);
        Preorder(n->left);
        Preorder(n->right);
    }
}

void Inorder(Node *n) {
    if (n != NULL) {
        Inorder(n->left);
        printf(" %ld", n->v);
        Inorder(n->right);
    }
}

int main() {
    long n;
    scanf("%ld", &n);
    char command[10];
    long value;
    for (long i=0; i<n; i++) {
        scanf(" %s %ld", command, &value);
        if (command[0] == 'i') {
            Node *node = (Node *)malloc(sizeof(Node));
            node->v = value;
            node->parent = NULL;
            node->left = NULL;
            node->right = NULL;
            insertTree(node);
        } else {
            Inorder(T.root);
            printf("\n");
            Preorder(T.root);
            printf("\n");
        }
    }

    return 0;
}

Measured memory_bytes: 24468
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 2e5 + 7;
const LL inf = 1e18;
 
LL a[maxn];
int n;
LL k;
 
bool check(LL mid){
	
	LL cnt = 0;
  	for (int i = 1; i < n; ++i){
    	if (a[i] == 0){
    	  	if (mid >= 0) cnt += n - i;
    	  	continue;
    	}
    	LL d = mid / a[i];
    	if (a[i] > 0){
      		if (abs(mid) % a[i] != 0){
    			if ( (d == 0 && mid < 0) || d < 0) d--;
      		}
      		int fs = upper_bound(a + i + 1, a + n + 1, d) - a;
      		cnt += fs - i - 1;
    	}
		else{
   			if (abs(mid) % abs(a[i]) != 0){
        		if ( (d == 0 && mid < 0) || d > 0) d++;
      		}
      		int fs = lower_bound(a + i + 1, a + n + 1, d) - a;
      		cnt += n - fs + 1;
    	}
  	}
  	return (cnt >= k);
  	
}
void Read(){
	
	#define TASK "ABC"
//	freopen(TASK".inp", "r", stdin);
//	freopen(TASK".out", "w", stdout);
    ios_base::sync_with_stdio(0);
	cin >> n >> k;
  	for (int i = 1; i <= n; ++i) cin >> a[i];
	
}
void Magic(){
	
	sort(a + 1, a + n + 1);
	LL l = -inf, r = inf;
	while (l <= r){
		
		LL mid = (l + r) / 2;
		if (check(mid)) r = mid - 1;
		else l = mid + 1;
		
	}
	cout << r + 1;
	return;
	
}
int main(){
  
  	Read();
  	Magic();
  
	return 0;
}

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

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

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

void solve(){
 ll n,m;
  cin >> n >> m;
 vll h(n);
  rep(i,0,n) cin >> h[i];
 vll f(n,1); 
  rep(i,0,m) {
    ll a,b;
    cin >> a >> b;
    --a;
    --b;
    if(h[a]>h[b]) f[b]=0;
    else if(h[a]<h[b]) f[a]=0;
    else if(h[a]==h[b]) {
      f[a]=0;
      f[b]=0;
    }
  }
 
  ll res=0;
  for(auto x:f) res+=x;
  cout << res << endl;
  
}

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

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void solve() {
    int H, W, M;
    cin >> H >> W >> M;
    vector<pair<int, int>> bomb(M);
    for (int i=0; i<M; ++i) cin >> bomb[i].first >> bomb[i].second;

    for (int i=0; i<M; ++i) {
        --bomb[i].first;
        --bomb[i].second;
    }
    vector<int> cnth(H), cntw(W);
    for (auto p : bomb) {
        ++cnth[p.first];
        ++cntw[p.second];
    }
    int maxi = 0;
    for (int x : cntw) chmax(maxi, x);
    set<int> st;
    for (int i=0; i<W; ++i) if (cntw[i] == maxi) st.insert(i);
    int kind = (int)st.size();
    vector<int> cnt(H);
    for (auto p : bomb) if (st.count(p.second)) ++cnt[p.first];
    int res = 0;
    for (int i=0; i<H; ++i) {
        int tmp = cnth[i] + maxi;
        if (cnt[i] == kind) chmax(res, tmp-1);
        else chmax(res, tmp);
    }
    cout << res << '\n';
}

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

    solve();

    return 0;
}


Measured memory_bytes: 23216
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s,t;
    cin >> s >> t;
    for (int i = 0; i < 26; i++){
        string x = s;
        x += ('a'+i);
        if (x == t){
            printf("Yes\n");
            return 0;
        }
    }
    printf("No\n");
}


Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
	int n; cin>>n;
	int a[n]; long sum=0,b[n];
	rep(i,n){
		cin>>a[i];
		sum+=a[i];
		b[i]=sum;
	}
	long ans=abs(sum-2*b[0]);
	rep(i,n-1){
		if(abs(sum-2*b[i])<ans) ans=abs(sum-2*b[i]);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 2560
import math

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

Acos = float('{:.10f}'.format(A * math.cos(math.radians((30*H) + (0.5*M)))))
Bcos = float('{:.10f}'.format(B * math.cos(math.radians(6*M))))
Asin = float('{:.10f}'.format(A * math.sin(math.radians((30*H) + (0.5*M)))))
Bsin = float('{:.10f}'.format(B * math.sin(math.radians(6*M))))

cos = (Acos - Bcos) ** 2
sin = (Asin - Bsin) ** 2
print(math.sqrt((cos + sin)))

Measured memory_bytes: 9540
// 5/24
// 過去問ガリガリ
#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>;
using Graph = vector<vector<int>>;

int main() {
    int r;
    cin >> r;
    cout << 3 * r * r << endl;
}


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

using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s, tmp;
  int k;
  cin >> s >> k;
  tmp = s;
  sort(tmp.begin(), tmp.end());
  int cnt = 0;
  map<string, int> mp;
  for(int k2=0; k2<tmp.length(); k2++){
    vector<string> store;
    for(int i=0; i<s.length(); i++){
      if(s[i] == tmp[k2]){
        string a;
        for(int j=i; j<s.length()&&j<i+7; j++){
          a += s[j];
          if(!mp[a]){
            mp[a]++;
            store.push_back(a);
          }
        }
      }
    }
    sort(store.begin(), store.end());
    if(store.size() >= k){
      cout << store[k-1] << endl;
      return 0;
    }else k -= store.size();
  }
  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
#define N 100
int main(){
  int i,j,k=0,n,tmp,min,flag;
  int A[N];
  scanf("%d",&n);
  for(j=0;j<=n-1;j++){
    scanf("%d",&A[j]);
  }
  for(i=0;i<=n-1;i++){
    flag=0;
    min=i;
    for(j=i;j<=n-1;j++){
      if(A[j]<A[min]){
	min=j;
	flag=1;
      }
    }
    if(flag){
      tmp=A[i];
      A[i]=A[min];
      A[min]=tmp;
      k++;
    }
  }
  for(j=0;j<=n-1;j++){   
    printf("%d",A[j]);
    if(j<n-1)
      printf(" ");
  }
  printf("\n");
  printf("%d\n",k);
  return 0;
}

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

int main() {
    int a, b, c, x, count = 0;
    cin >> a >> b >> c >> x;
    for (int i = 0; i <= a; i++) {
        for (int j = 0; j <= b; j++) {
            for (int k = 0; k <= c; k++) {
                if ( 500*i + 100*j + 50*k == x) {
                    count++;
                }
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <climits>
#include <assert.h>
#include <cstring>
#include <set>
using namespace std;

typedef long long ll;

int main()
{
    int k;
    cin >> k;
    if(k%2 == 0 || k % 5 == 0)
    {
        cout << -1 << "\n";
        return 0;
    }
    int n = 1;
    int div = 7;
    while(true)
    {
        if(div%k==0)
        {
            cout << n << "\n";
            return 0;
        }
        n++;
        div = (div%k)*10+7;
    }
    
}

Measured memory_bytes: 3596