akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int alpha_count[26];

int main()
{
  string s;
  cin >> s;
  for (int i = 0;i < s.size();i++){
    alpha_count[s[i]-65]++;
  }
  int ans = 0;
  for (int i = 0;i < 26;i++){
    if (alpha_count[i] > 0)ans++;
  }
  if (ans == 2)cout << "Yes" << '\n';
  else cout << "No" << '\n';
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

#define MAXSIZE 200000

int partition(int m[], int l, int r){
	int i, j, pivot;
	int t;

	i = l-1;
	j = r;
	pivot = m[r];

	for(;;){
		while(m[++i] < pivot){
			;
		}
		while(i < --j && pivot < m[j]){
			;
		}
		if(i >= j){
			break;
		}
		t = m[i];
		m[i] = m[j];
		m[j] = t;
	}
	t = m[i];
	m[i] = m[r];
	m[r] = t;

	return i;
}

void quick_sort(int m[], int l, int r){
	int v;

	if(l >= r){
		return;
	}

	v = partition(m, l, r);
	quick_sort(m, l, v-1);
	quick_sort(m, v+1, r);
}

int main(){
	int n;
	int a[MAXSIZE] = {0};
	int i;

	scanf("%d", &n);
	for(i=0; i<n; i++){
		scanf("%d", a+i);
	}

	quick_sort(a, 0, n-1);

	for(i=0; i<n; i++){
		if(a[i] == a[i+1]){
			printf("NO");
			return 0;
		}
	}

	printf("YES");
	return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)(n);++i)
#define rep1(i, n) for (int i=1;i<=(int)(n);++i)
#define range(i, l, r) for (int i=l;i<(int)(r);++i)
#define rrange(i, l, r) for (int i=r-1;i>=(int)(l);--i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using vi=vector<int>;
using pii=pair<int, int>;

bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
int read(){int a;scanf("%lld",&a);return a;}

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

signed main()
{
	int N; cin >> N;
	int ans = 1;
	rep(i, N) ans = lcm(ans, read());
	cout << ans << endl;
}




Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<vector>
#include<deque>
#include<set>
#include<map>
#include<unordered_map>
#include<algorithm>

using namespace std;

#define endl                   '\n'
#define gap                    ' '
#define MAX                    LLONG_MAX
#define MIN                    LLONG_MIN
#define MOD                    1000000007
#define remax(a, b)            a = max(a, b)
#define remin(a, b)            a = min(a, b)
#define PI                     3.1415926535897932384626433832795
#define nps                    string::npos
#define int                    int64_t
#define double                 long double
#define vi                     vector<int>
#define di                     deque<int>
#define si                     set<int>
#define vpii                   vector<pair<int,int>>
#define dpii                   deque<pair<int,int>>
#define pi                     pair<int,int>
#define pub                    push_back
#define puf                    push_front
#define pob                    pop_back
#define pof                    pop_front
#define emb                    emplace_back
#define mpr                    make_pair
#define mtp                    make_tuple
#define rep(i, s, n)           for(int i = s; i < n; ++i)
#define repe(i, s, n)          for(int i = s; i <= n; ++i)
#define repr(i, n, s)          for(int i = n; i >= s; --i)
#define read(a)                for(auto& xy : a) cin >> xy
#define speak(a)               cout << endl; for(auto& xy : a) cout << xy << ' '
#define work(xy, a)            for(auto& xy : a)
#define dbg(x)                 cerr << endl << (#x) << " is " << (x)
#define sz(x)                  (int)(x).size()
#define all(a)                 (a).begin(),(a).end()
#define rall(a)                (a).rbegin(),(a).rend()

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n, c = 0;
    cin >> n;
    int a[n];
    read(a);

    rep(i, 0, n) {
        rep(j, i + 1, n) {
            rep(k, j + 1, n) {
                if (a[i] + a[j] > a[k] and a[j] + a[k] > a[i] and a[k] + a[i] > a[j] and a[i] != a[j] and
                    a[j] != a[k] and a[k] != a[i]) {
                    c++;
                }
            }
        }
    }
    cout << c;
}

Measured memory_bytes: 3648
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

void Main()
{
	int n;
  	cin >> n;
  	int m = (n+1)/2;
  	double ans = (double) m/n;
  	cout << ans << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 256
program prob2
    implicit none
    integer :: x1, x2, y1, y2
    integer :: a, b, x3, x4, y3, y4
    character(30) :: s,t,u,v
    read(*,*) x1, y1, x2, y2

    a = x2 - x1
    b = y2 - y1
    x3 = x2 - b
    x4 = x1 - b
    y3 = y2 + a
    y4 = y1 + a
    write(s,*) x3
    write(t,*) y3
    write(u,*) x4
    write(v,*) y4
    write(*,'(a,3(1X,a))') trim(adjustl(s)), trim(adjustl(t)), trim(adjustl(u)), trim(adjustl(v))



    stop
contains
end program prob2

Measured memory_bytes: 2936
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<random>
#include<ctime>
#include<cstdlib>
#include<unordered_map>
#include<string.h>
#include<iostream>
using namespace std;

vector<int>V;
signed main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		int a; cin >> a;
		V.push_back(a);
	}
	if (n & 1)V.push_back(0);
	int ans = 0;
	sort(V.begin(), V.end());
	for (int i = 0; i < V.size() / 2; i++) {
		ans += V[i * 2 + 1] - V[i * 2];
	}
	cout << ans << endl;
}

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

using namespace std;

int main() {
	int n; cin >> n;
	int cnt[10][10] = {};
	for (int i = 1; i <= n; ++i)
		++cnt[to_string(i)[0] - '0'][i % 10];
	int ans = 0;
	for (int i = 0; i < 10; ++i)
		for (int j = 0; j < 10; ++j)
			ans += cnt[i][j] * cnt[j][i];
	cout << ans << endl;

	return 0;
}

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

evens = [x for x in numbers if x % 2 == 0]

if all([x % 3 == 0 or x % 5 == 0 for x in numbers if x % 2 == 0]):
  print('APPROVED')
else:
  print('DENIED')
  

Measured memory_bytes: 38256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

typedef long long ll;
typedef uint64_t ull;
typedef pair<int, int> P;
constexpr double PI = 3.1415926535897932;   // acos(-1)
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

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

    int n;
    cin >> n;
    int ans = 0;
    for(int i = 0; i < n; ++i){
        int a;
        cin >> a;
        --a;
        ans += a;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<map>
#include<algorithm>
#include<functional>


using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using ll=long long;
using vll=vector<ll>;
using vvll=vector<vll>;


int min_u(int&m, int v)
{
	if(m>v || m<0)
	{
		m=v;
		return 1;
	}
	return 0;
}


int main(void)
{
	int n, k;

	while(scanf("%d%d", &n, &k)==2)
	{
		vi a(n), ap(1), an(1);
		int ans=-1;

		for(int i=0;i<n;i++)
		{
			scanf("%d", &a[i]);
			if(a[i]>0) ap.push_back(a[i]);
			if(a[i]<0) an.push_back(-a[i]);
			if(a[i]==0) k--;
		}
		sort(an.begin(), an.end());
//		for(auto ma:ap) printf("%d ", ma); printf("\n");
//		for(auto ma:an) printf("%d ", ma); printf("\n");
		if(k<=0) ans=0;
		if(k>0)
		{
			if(k<ap.size()) min_u(ans, ap[k]);
			if(k<an.size()) min_u(ans, an[k]);
		}

		for(int i=1;i<ap.size() && i<k-1;i++)
		{
			if(k-i>=an.size()) continue;
			if(min_u(ans, ap[i]*2+an[k-i]))
			{
//				printf("p ans=%d  i=%d\n", ans, i);
			}
		}

		for(int i=0;i<an.size() && i<k-1;i++)
		{
			if(k-i>=ap.size()) continue;
			if(min_u(ans, an[i]*2+ap[k-i]));
			{
//				printf("n ans=%d  i=%d\n", ans, i);
			}
		}
		printf("%d\n", ans);
	}

	return 0;
}


Measured memory_bytes: 1404
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define pb push_back
#define fi first
#define se second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void chOut(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using v_bool = vector<bool>;
using v_Pii = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;



signed main(){

    int X; cin >> X;
    int ans = 360;
    FOR(i, 1, 361){
        if((i * X) % 360 == 0){
            chmin(ans, i);
        }
    }
    Out(ans);

    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

ll mod = inf;
int x[60];
ll dp[60],dp2[60],dp3[60];

int main(){
    ll n,m;
    cin >> n;
    m = n;
    int c = 0;
    for(int i=0;i<60;i++){
        if(m%2!=0){
            x[i] = 1;
            c = i;
        }else{
            x[i] = 0;
        }
        m/=2;
    }
    if(x[0]==0){
        dp[0] = 1;
        dp2[0] = 3;
        dp3[0] = 3;
    }else{
        dp[0] = 2;
        dp2[0] = 3;
        dp3[0] = 3;
    }
    for(int i=1;i<=c;i++){
        if(x[i]==0){
            dp[i] = dp[i-1];
            dp2[i] = (dp3[i-1]+dp2[i-1]+dp[i-1])%mod;
        }else{
            dp[i] = (dp[i-1]+dp2[i-1])%mod;
            dp2[i] = (2*dp3[i-1]+dp2[i-1])%mod;
        }
        dp3[i] = (3*dp3[i-1])%mod;
    }
    cout << dp[c] << endl;

    return 0;
}

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

int main() {

	int long long x;
	cin >> x;
	
	int long long a = x / 11;
	int long long b = a * 11;
	int long long c = x - b;
	int long long d = x % 11;
	
	if (c!=0&&c < 7) {
		cout << 2 * a + 1 << endl;
	}
	else if (c == 0) {
		cout << a * 2 << endl;
	}
	else {
		cout << 2 * a + 2 << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
'''
Problem Link - https://atcoder.jp/contests/abc176/tasks/abc176_a
'''
from sys import stdin,stdout
from math import *
from collections import *

mod = 1000000007

def gcd(a,b):
	while b:
		a,b = b,a%b
	return a

def lcm(a,b): return (a*b) // gcd(a,b)

def set_bits(X):
	c = 0
	while X:
		X &= (X-1);c += 1
	return c

def compute_MOD(N,M): return (N%M + M) % M

def get_array(): return list(map(int, stdin.readline().split()))
 
def get_ints(): return map(int, stdin.readline().split())

def get_int(): return int(stdin.readline())

def get_input(): return stdin.readline().strip()

def main():
	N,X,T = get_ints()
	stdout.write(str(ceil(N/X)*T)+'\n')

if __name__ == "__main__":
    main()

Measured memory_bytes: 9368
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    int n, k; cin>>n>>k;
    int a[n]; for(auto &i : a)  cin>>i;
    for(int i = 0; i < n-k; i++) {
        if(a[i] < a[i+k])   cout<<"Yes";
        else    cout<<"No";
        cout<<"\n";
    }
}

Measured memory_bytes: 5168
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <string>
#include <algorithm>
#include <string>
#include <climits>
#include <utility>

#define REP(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define REG(i, a, b) for (int (i) = ((int)(a)); (i) < ((int)(b)); i++)
#define ALL(V) (V).begin(), (V).end()
#define PRINT(STR) cout << (STR) << endl
#define ROUNDED(N) fixed << setprecision(N)
#define SPACE " "

typedef long long ll;
using namespace std;

int nextInt() { int n; cin >> n; return n; }
double nextDouble() { double d; cin >> d; return d; }
string nextString() { string str; cin >> str; return str; }

int main() {
	cin.tie(0); //?????±?????????????????????
	ios::sync_with_stdio(false); //printf??¨??±??????????????????

	int n,m;
	while(cin>>n>>m,n){
		vector<pair<int,int>> load(n);
		REP(i,n)cin >> load[i].second >> load[i].first;
		sort(load.begin(),load.end());
		reverse(load.begin(),load.end());
		for(int i = 0;m>0&&i<n;i++){
			if(m-load[i].second>=0){//second????????¢
				m -= load[i].second;
				load[i].second = 0;
			}else{
				load[i].second -= m;
				m = 0;
			}
		}
		int ans=0;
		REP(i,n)ans += load[i].first * load[i].second;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3168
n=int(input())
max_n=1
max_c=0

for i in range(n+1):
  c=0
  num=i
  while True:
    if num/2==0:
      break
      
    if num%2==0:
      c+=1
      num=num/2     
    else:
      break
      
  if c > max_c:
    max_c=c
    max_n=i
    
print(max_n)

Measured memory_bytes: 9200
#include <stdio.h>
 
int main()
{
	int A, B;
	
	scanf("%d %d", &A, &B);
 
	if(A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0) {
		puts("Possible");
	} else {
		puts("Impossible");
	}
  
	return(0);
}

Measured memory_bytes: 128
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define sort(s) sort(s.begin(),s.end())
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<int>>
constexpr auto mod = 1000000007;


//2のn乗を求めるよ！！！
int ni(int n) {
	if (n == 0)return 1;
	int x = ni(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;
}

//フィボナッチ数列のx番目を求めるよ！
int f(int x,vector<int> s) {
	if (x == 0)return 0;
	if (x == 1)return 1;
	if (s[x] != 0)return s[x];
	s[x] = f(x - 1,s) + f(x - 2,s);
	return s[x];
}

//aとｂの最大公約数を求めるよ！
llint gcd(llint a, llint b) {
	if (a < b)swap(a, b);
	if (b == 0)return a;
	return gcd(b, a % b);
}



// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

// mod. m での a の逆元 a^{-1} を計算するよ！
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}


//aCbをmod.mで割った余りを求める
ll int c(ll int a, ll int b,ll int m) {
	ll int ans = 1;
	for (ll int i = 0; i < b; i++) {
		ans *= a - i;
		ans %= m;
	}
	for (ll int i = 1; i <= b; i++) {
		ans *= modinv(i, m);
		ans %= m;
	}
	return ans;
}

//m進数のn桁を全列挙やで
void dfs(int m, int n) {

	stack<string> st;
	st.push("");
	while (!st.empty()) {
		string now = st.top();
		st.pop();
		if (now.size() == n) {
			cout << now << endl;
		}
		else {
			for (int i = m-1; i >= 0; i--) {
				string next = now + to_string(i);
				st.push(next);
			}
		}
	}
}



int main() {
	llint a, b, c, d;
	cin >> a >> b >> c >> d;
	llint x = (a + c - 1) / c;
	llint y = b / c;
	ll ans =0;
	if (y - x + 1 > 0)ans += y - x + 1;
	x = (a + d - 1) / d;
	y = b / d;
	if(y - x + 1>0)ans+=y-x+1;
	llint z= c * d / gcd(c, d);
	x = (a + z - 1) / z;
	y = b / z;
	if (y - x + 1 > 0)ans += -(y - x + 1);
	ans = b - a + 1 - ans;
	cout << ans << endl;
}
  


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

int INF = (10 * 10 * 10) * (10 * 10 * 10) * (10 * 10 * 10);

void calc_shortest_distance(int *ds, int N, pair<int, int> *es, int M) {
    while (true) {
        bool updated = false;
        for (int i = 0; i < M * 3; ++i) {
            int src = es[i].first;
            int dst = es[i].second;
            if (ds[src] + 1 < ds[dst]) {
                ds[dst] = ds[src] + 1;
                updated = true;
            }
        }
        if (!updated) {
            break;
        }
    }
}

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

    pair<int, int> es[M];
    for (int i = 0; i < M; ++i) {
        int src, dst;
        cin >> src; cin >> dst;
        es[i].first = src - 1;
        es[i].second = dst - 1;
    }
    int S, T;
    cin >> S; cin >> T;
    pair<int, int> es2[M * 3];
    for (int i = 0; i < M; ++i) {
        es2[i*3].first = es[i].first;
        es2[i*3].second = es[i].second + N;
        es2[i*3+1].first = es[i].first + N;
        es2[i*3+1].second = es[i].second + 2 * N;
        es2[i*3+2].first = es[i].first + 2 * N;
        es2[i*3+2].second = es[i].second;
    }
    int ds[N * 3];
    for (int i = 0; i < N * 3; ++i) {
        ds[i] = INF;
    }
    ds[S - 1] = 0;
    calc_shortest_distance(ds, N, es2, M);
    int ans = ds[T - 1];
    if (ans == INF) {
        cout << "-1" << "\n";
    } else {
        cout << (ds[T - 1] / 3) << "\n";
    }
    return 0;
}


Measured memory_bytes: 4480
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase

/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}

int main(void) {
	cin.tie(0);
	string S;int i;cin>>S;
	string T="keyence";
	int a=0,n=S.size();
	for(i=0;i<7;i++){if(S[i]==T[i]){a++;}}
	REV(S);REV(T);
	for(i=0;i<7;i++){if(S[i]==T[i]){a++;}}
	cout<<(a>=7?"YES":"NO")<<endl;
}

Measured memory_bytes: 256
def CountingSort(A, k):
    B = [0]*(len(A)+1)
    C = [0]*(k+1)
    for i in A:C[i]+=1
    for i in range(1,k+1):C[i]=C[i]+C[i-1]
    for i in range(n-1,-1,-1):
        B[C[A[i]]]=A[i]
        C[A[i]]-=1
    return B[1:]
n = int(input())
A = [int(i) for i in input().split()]
B = CountingSort(A,10000)
ans = ""
for i in B:ans+=str(i)+" "
print(ans[:-1])


Measured memory_bytes: 224148
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        double x[] = new double[n];
        double y[] = new double[n];
        double sum1 = 0.0;
        double sum2 = 0.0;
        double sum3 = 0.0;
        double sum4 = 0.0;
        for (int l=0; l < n; l++) {
            x[l] = sc.nextDouble();
        }
        for (int l=0; l < n; l++) {
            y[l] = sc.nextDouble();
        }
        sc.close();
        for (int l=0; l < n; l++) {
        	sum1 += Math.abs(x[l] - y[l]);
        	sum2 += Math.abs((x[l] - y[l]) * (x[l] - y[l]));
        	sum3 += Math.abs((x[l] - y[l]) * (x[l] - y[l]) * (x[l] - y[l]));
        	sum4 = Math.max(sum4, Math.abs(x[l] - y[l]));
        }
        System.out.println(Math.pow(sum1, 1.0));
        System.out.println(Math.sqrt(sum2));
        System.out.println(Math.cbrt(sum3));
        System.out.println(sum4);
    }
}


Measured memory_bytes: 28932
using System;
 
namespace aizu
{
    class OnlineJudge
    {
        static void Main()
        {
            int count;
            var value = new int[7];
            while((count = int.Parse(Console.ReadLine())) != 0) {
                for(int i = 0; i < count; ++i) {
                    int age = int.Parse(Console.ReadLine());
                    if(age >= 70) {
                        age = 60;
                    }
                    ++value[age / 10];
                }
                for(int i = 0; i < value.Length; ++i) {
                    Console.WriteLine(value[i]);
                    value[i] = 0;
                }
            }
        }
    }
}

Measured memory_bytes: 5816
#include <stdio.h>

int main(){
int n,i,j,m,f;
char a[100],b[100],x;

while(1){
scanf("%d ",&n);
if(n==0)break;
for(i=0;i<n;i++){
scanf("%c %c ",&a[i],&b[i]);
}
scanf("%d ",&m);
for(i=0;i<m;i++){
scanf("%c ",&x);
f=0;
for(j=0;j<n;j++){
if(x==a[j]){
printf("%c",b[j]);
f=1;
break;
}
}
if(f==0){
printf("%c",x);
}
}
printf("\n");
}

return 0;
}

Measured memory_bytes: 1004
t=int(input())
arr=[]
for x in range(t):
    a=list(map(int,input().split()))
    arr.append(a)
dp=[[0 for x in range(3)]for y in range(t)]
dp[0][0]=arr[0][0]
dp[0][1]=arr[0][1]
dp[0][2]=arr[0][2]
for x in range(1,t):
    dp[x][0]=arr[x][0]+max(dp[x-1][1],dp[x-1][2])
    dp[x][1]=arr[x][1]+max(dp[x-1][0],dp[x-1][2])
    dp[x][2]=arr[x][2]+max(dp[x-1][0],dp[x-1][1])



print(max(dp[t-1]))


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

int main(){
  int n;
  cin >> n;
  double x=0;
  
  for(int i=0;i<n;i++){
    double a;
    cin >> a;
    x+=1/a;
  }
  
  printf("%.10f",1/x);
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<ext/pb_ds/hash_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long LL;
typedef unsigned long long uLL;
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
LL z = 1;
int read(){
	int x, f = 1;
	char ch;
	while(ch = getchar(), ch < '0' || ch > '9') if(ch == '-') f = -1;
	x = ch - '0';
	while(ch = getchar(), ch >= '0' && ch <= '9') x = x * 10 + ch - 48;
	return x * f;
}
int ksm(int a, int b, int p){
	int s = 1;
	while(b){
		if(b & 1) s = z * s * a % p;
		a = z * a * a % p;
		b >>= 1;
	}
	return s;
}
int main(){
	int i, j, n, m;
	n = read();
	i = j = n / 2;
	if(n % 2) i++;
	printf("%d", i * j);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(0); cin.tie(0)
typedef pair<int,int> ii;
typedef long long int ll;
typedef vector<int> vi;
vi dp;
vi h;
int n;
// dp[i] = minimo pra ir dali ate o final
int solve(int i){
	if(i == n-1) return 0; 
	if(dp[i] != -1) return dp[i];
	int ret = 2e9;
	if(i + 1 < n){
		ret = min(ret,solve(i+1) + abs(h[i]-h[i+1]));
	}
	if(i + 2 < n){
		ret = min(ret,solve(i+2) + abs(h[i] - h[i+2]));
	}
	dp[i] = ret;
	return ret;
}
 
int main(){
	fast;
	cin >> n;
	h.resize(n);
	dp.resize(n,-1);
	for(int i = 0 ; i < n ; i++){
		cin >> h[i];
	}
	cout << solve(0) << endl;
	return 0;
}

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

int main(){
  char S[100000];
  scanf("%s",S);
  int l = strlen(S);
  int color[l];
  int ans = 0;

  for(int i = 0; i < l; i ++){
    if(S[i] == '0'){
      color[i] = 0;
    }else{
      color[i] = 1;
    }
  }

  if(l == 1){
    ans = 0;
  }else{
    for(int j = 1; j < l - 1; j ++){
      if(color[j] == color[j - 1]){
        ans ++;
        if(color[j - 1] == 1){
          color[j] = 0;
        }else{
          color[j] = 1;
        }
      }
    }
    if(color[l - 1] == color[l - 2]){
      ans ++;
      if(color[l - 2] == 1){
        color[l - 1] = 0;
      }else{
        color[l - 1] = 1;
      }
    }
  }

  printf("%d",ans);
  return 0;
}


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

int main() {
    int a,b;
    cin >> a >> b;
    cout << max(0,a-b*2) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <random>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <deque>
//#include <bitset>
#include <math.h>
using namespace std ;
using ll = long long ;
using ld = long double ;
using vll = vector<ll> ;
using vvll = vector<vll> ;
using vc = vector<char> ;
using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end()
ll mod = 1000000007 ;
//long double pie = acos(-1) ;
ll INF = 1e10 ;

void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
void fix_cout(){cout << fixed << setprecision(20) ;}
void chmax(ll &a,ll b){	if(a<b) a = b ;}
void chmin(ll &a,ll b){ if(a>b) a = b ;}

void DFS(vvll &g,vll &d,int p){
	for(int i=0;i<g[p].size();i++){
		if(d[g[p][i]]!=-1) continue ;
		d[g[p][i]] = d[p]+1 ;
		DFS(g,d,g[p][i]) ;
	}
}

int main(){
	ll n,s,t ;
	cin >> n >> s >> t ;
	s-- ; t-- ;
	vvll g(n) ;
	for(int i=1;i<n;i++){
		ll a,b ;
		cin >> a >> b ;
		a-- ; b-- ;
		g[a].push_back(b) ;
		g[b].push_back(a) ;
	}
	vll d1(n,-1),d2(n,-1) ;
	d1[s] = d2[t] = 0 ;
	DFS(g,d1,s) ;
	DFS(g,d2,t) ;
	ll ans = (d1[t]-1)/2 ;
	ll even = (d1[t]%2==0) ;
	ll u,v ;
	for(int i=0;i<n;i++){
		if(d1[i]==ans&&d2[i]==d1[t]-ans) u = i ;
		if(d2[i]==ans&&d1[i]==d1[t]-ans) v = i ;
	}
	s = u ; t = v ;
	for(int i=0;i<n;i++) d1[i] = d2[i] = -1 ;
	d1[s] = d2[t] = 0 ;
	DFS(g,d1,s) ;
	DFS(g,d2,t) ;
	ll mx = 0 ;
	for(int i=0;i<n;i++){
		if(d1[i]>=d2[i]) continue ;
		chmax(mx,d1[i]+even) ;
	}
	cout << ans+mx << endl ;
}


Measured memory_bytes: 14348
#include <bits/stdc++.h>
using namespace std;
constexpr int P = 998244353;
int main() {
  int n, k;
  cin >> n >> k;
  vector<pair<int, int>> moves(k);
  for (pair<int, int> &p : moves) cin >> p.first >> p.second;
  vector<int> ways(2 * n+255,0);
  ways[1]=1;
  ways[2]=P-1;
  int prefsum = 0;
  for (int i = 1; i <= n; ++i) {
    (prefsum += ways[i]) %= P;
    for (auto &[l, r] : moves) {
      ways[i + l] = (ways[i + l] + prefsum) % P;
      ways[i + r + 1] = (P - prefsum + ways[i + r + 1]) % P;
    }
  }
  cout << prefsum << '\n';
  return 0;
}

Measured memory_bytes: 4840
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;

ll MOD=1000000007;

// mod. m での a の逆元 a^{-1} を計算する
//ただしmとaが互いにその時のみ
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(){
    ll N;
    cin >> N;
    ll K;
    cin >> K;
    for(ll i=1;i<=K;i++){
        if(N-K<i-1)cout<<0<<endl;
        else{
            ll x=1,y=1,z=1,w=1;
            for(ll j=0;j<i-1;j++){
                x*=K-1-j;
                x%=MOD
            ;}
            for(ll j=1;j<=i-1;j++){
                y*=j;
                y%=MOD
            ;}
            for(ll j=0;j<i;j++){
                z*=N-K+1-j;
                z%=MOD;
            ;}
            for(ll j=0;j<i;j++){
                w*=(j+1);
                w%=MOD
            ;}
            ll qq=(x*modinv(y,MOD))%MOD;
            ll pp=(z*modinv(w,MOD))%MOD;
            cout<<(qq*pp)%MOD<<endl;
        }
    ;}

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds; 

#define int long long
#define pb push_back
#define pf push_front
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define f first
#define s second
#define sz(x) (int)x.size()
#define endl "\n"
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout<<(x)<<endl
#define watch2(x,y) cout<<(x)<<" "<<(y)<<endl
#define watch3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld; 
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;

const int INF = 9e18;
const int mod = 1e9 + 7;
const int N = 2e5 + 5;

int i,n,d,x[N],y[N];

void solve()
{
    cin>>n>>d;
    int ans=0;
    for(i=1;i<=n;i++)
    {
        cin>>x[i]>>y[i];
        if(x[i]*x[i]+y[i]*y[i]<=d*d)
            ans++;
    }
    cout<<ans;
}

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

Measured memory_bytes: 6736
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>

typedef long long ll;
using std::vector;
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) {
    vec.resize(len);
    for (auto &v : vec) ndarray(v, args...);
}

int main() {
    //std::ifstream in("0_normal_2");
    //std::cin.rdbuf(in.rdbuf());
    
    ll N, M;
    std::cin >> N >> M;
    
    std::priority_queue<ll> queue;
    
    for (int i = 0; i < N; i++) {
        ll a;
        std::cin >> a;
        queue.push(a);
    }
    
    for (int i = 0; i < M; i++) {
        ll a = queue.top();
        queue.pop();
        queue.push(a/2);
    }
    ll ans = 0;
    while (!queue.empty()) {
        ans += queue.top();
        queue.pop();
    }
    std::cout << ans << std::endl;
}


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

int main(){
  int n, m, l; 
  long long int temp, sum;
  int A[100][100];
  int B[100][100];
  
  cin >> n >> m >> l;
  for(int i=0; i<n; i++){
    for(int j=0; j<m; j++){
       cin >> temp;
       A[i][j] = temp;
    }
  }
  for(int i=0; i<m; i++){
    for(int j=0; j<l; j++){
       cin >> temp;
       B[i][j] = temp;
    }
  }
  for(int i=0; i<n; i++){
    for(int j=0; j<l; j++){
       sum = 0;
       for(int k=0; k<m; k++){
         sum += A[i][k] * B[k][j];
       }
       cout << sum;
       if(j < l-1){
         cout << " ";
       }
    }
    cout << endl;
  }
  return 0;
}


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

vector<ll> factorize(ll n) {
  vector<ll> res;
  for (ll i = 2; i*i <= n; ++i) {
    if (n % i) continue;
    while (n%i == 0) {
      n /= i;
      res.emplace_back(i);
    }
  }
  if (n != 1) res.emplace_back(n);
  return res;
}

int keta(ll n) {
  int count = 0;
  while (n > 0) {
    n /= 10;
    count++;
  }
  return count;
}

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  ll n;
  cin >> n;
  vector<ll> res = factorize(n);
  int len = res.size();
  int ans = 100;
  for (ll bit = 0; bit < 1LL<<len; ++bit) {
    ll s = 1;
    rep(i,len) {
      if (bit & (1<<i)) s *= res[i];
    }
    int temp = max(keta(s), keta(n/s));
    ans = min(temp, ans);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = [0]

for i in range(1,N):
  t = A[i-1]-A[i]
  if (t>=0):
    B.append(t)
    A[i] = A[i] + t
r = 0
for i in B:
  r = r + i
print(r)

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

int main() {
    int N, H;
    cin >> N >> H;
    vector<int> A(N);
    vector<int> B(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i] >> B[i];
    }

    sort(A.begin(), A.end());
    reverse(A.begin(), A.end());
    sort(B.begin(), B.end());
    reverse(B.begin(), B.end());

    long long ans = 0;
    bool flag = false;
    for (int i = 0; i < N && B[i] > A[0]; i++) {
        H -= B[i];
        ans++;
        if (H <= 0) {
            flag = true;
            break;
        }
    }
    
    if (flag) cout << ans << endl;
    else cout << ans + (H + A[0] - 1) / A[0] << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x,a,b,n,m;
  cin >> x >> a >> b;
  n=max(x,a)-min(x,a);
  m=max(x,b)-min(x,b);
  if(n<m){
    cout << "A" << endl;
  }
  else {
    cout << "B" << endl;
  }
}

Measured memory_bytes: 3556
#include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define fast ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL)
vector<int >adj[100007] ;
int dp[100007] ;
int dfs(int src){
	if(adj[src].size()==0)
		return 0 ;
	if(dp[src] != -1)
		return dp[src] ;

	for(auto i:adj[src])
			dp[src] = max(dp[src],1+dfs(i)) ;
	
	return dp[src] ;
}

int main(){
int n,m,x,y ;
cin >> n >> m ;
for(int i=0;i<m;i++){
	cin >> x >> y;
	adj[x].emplace_back(y) ;
}
int res = INT_MIN ;
memset(dp,-1,sizeof(dp));

for(int i=1;i<=n;i++)
	res = max(res,dfs(i) ) ;
cout << res << endl ;
}



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

#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define mp make_pair

typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0); cerr.tie(0);
	
	int N; cin >> N;
	vector<string> words(N);
	
	for (int i=0; i<N; i++) {
		cin >> words[i];
	}
	
	for (int i=0; i<N; i++) {
		for (int j=i+1; j<N; j++) {
			if (words[i] == words[j]) {
				cout << "No";
				return 0;
			}
		}
	}
	for (int i=1; i<N; i++) {
		if (words[i-1].back() != words[i].front()) {
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
}


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

int cnt[1000006] = {0};

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int g = 0, p;
    int n;
    cin >> n;
    while (n--)
    {
        cin >> p;
        ++cnt[p];
        g = __gcd(g, p);
    }
    if (g != 1)
    {
        cout << "not coprime";
        return 0;
    }
    for (int i = 2; i <= 1e6; i++)
    {
        int val = 0;
        for (int j = i; j <= 1e6; j += i)
            val += cnt[j];
        if (val > 1)
        {
            cout << "setwise coprime";
            return 0;
        }
    }
    cout << "pairwise coprime";
}

Measured memory_bytes: 7564
//package Beginner118;

import java.io.*;
import java.util.*;


public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int m = s.nextInt();
        int k = s.nextInt();
        HashSet<Integer> set = new HashSet<>();
        for (int i = 0; i < k; i++) {
            set.add(s.nextInt());
        }
        for (int i = 1; i < n; i++) {
            k = s.nextInt();
            HashSet<Integer> set1 = new HashSet<>();
            for (int j = 0; j < k; j++) {
                set1.add(s.nextInt());
            }
            set.retainAll(set1);
        }
        System.out.println(set.size());
    }
}


Measured memory_bytes: 23892
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main(){ 
	while(true){
		int H,W;
		cin >> H >> W;
		if(H==0 && W==0){
			break;
		}
		for(int i=1;i<=H;i++){
			if(i%2==1){
				for(int j=1;j<=W;j++){
					if(j%2==1){
						cout << "#";
					} else{
						cout << ".";
					}
				}
				cout << endl;
			} else{
				for(int j=1;j<=W;j++){
					if(j%2==1){
						cout << ".";
					} else{
						cout << "#";
					}
				}
				cout << endl;
			}
		}
		cout << endl;
	}
	return 0;
}


Measured memory_bytes: 3096
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
    char s[110][11];
    int a;
    scanf("%d",&a);
    for(int i=1;i<=a;i++)
    {
        cin>>s[i];
        if(s[i][0]!=s[i-1][strlen(s[i-1])-1]&&i>1)
        {printf("No");return 0;}
        if(i>1)
        for(int j=1;j<i;j++)
        {
            if(s[i][0]==s[j][0]&&strlen(s[i])==strlen(s[j]))
            {
                for(int k=0;k<strlen(s[i]);k++)
                {
                    if(s[i][k]!=s[j][k])
                    break;
                    else
                    if(k==strlen(s[i])-1)
                    {printf("No");return 0;}
                }
                
            }
        }
    }
    printf("Yes");
}

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

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


Measured memory_bytes: 256
n=int(input())
h=list(map(int,input().split()))
b=0
c=0
cm=0
for m in h:
  if m <=b:
    c+=1
    b=m
  else:
    b=m
    if c>cm:
      cm=c
    c=0

print(max(cm,c))
      
       

Measured memory_bytes: 14252
# ss
def is_evenstring(s):
    if s[:len(s)//2] == s[len(s)//2:]:
        return True
    else:
        return False

# input
S = input()

# test
while True:
    S = S[0:-1]
    if is_evenstring(S):
        res = len(S)
        break

print(res)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
    	Scanner input = new Scanner(System.in);
      	int A = input.nextInt();
      	int B  = input.nextInt();
      	int ans = (A - 1) * (B - 1);
		System.out.print(ans);

    }
  
  	
}


Measured memory_bytes: 20180
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
const ll N = 101,M = 1e5 + 1;
ll n,W;
ll WV[N][2];
ll K[N][M];
int main(){
	speed;
	cin >> n >> W;
	for(int i = 0 ; i < n ; i++)
		cin >> WV[i][0] >> WV[i][1];
	for(int i = 1 ; i <= n ; i++){
		for(int j = W ; j > 0  ; j--){
			if(WV[i - 1][0] <= j)
				K[i][j] = max(WV[i - 1][1] + K[i - 1][j - WV[i - 1][0]],K[i - 1][j]);
			else
				K[i][j] = K[i - 1][j];
		}
	}
	cout << K[n][W];
}
/*
Timus : 288471KD
CF : Zhabka
mail : dzhon.snoudin@mail.ru
*/



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

int main()
{
  	int sum;
  	string n;
  
 	cin >> n;
  	
    while(n.at(0) != '0'){
      sum = 0;
      for(int  i = 0;i < n.length();i++){
        sum += n.at(i) - '0';
      }
      cout << sum << endl;
      
      cin >> n;
    }

}


Measured memory_bytes: 3220
import java.util.HashSet;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main{
	static IntStream REPS(int v){return IntStream.range(0,v);}
	static IntStream REPS(int l,int r){return IntStream.rangeClosed(l,r);}
	static IntStream INS(int n) {return REPS(n).map(i->getInt());}
	static Scanner s=new Scanner(System.in);
	static int getInt(){return Integer.parseInt(s.next());}

	public static void main(String[]$){
		HashSet<Integer>r=new HashSet<>();
		for(int n=getInt();n>0;--n) {
			int in=getInt();
			if(r.contains(in))
				r.remove(in);
			else
				r.add(in);
		}
		System.out.println(r.size());
	}
}

Measured memory_bytes: 51164
<?php

$input = explode(' ', trim(fgets(STDIN)));
$n = (int)$input[0];
$m = (int)$input[1];

$count=0;

if ($n*2 > $m) {
	$count = floor($m / 2);
}else{
	$count = $n;
	$remain = $m - $n*2;
	$count += floor($remain/4);
}
echo $count;

Measured memory_bytes: 4728
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
ll n;
ll t[1000],v[1000];

bool aaa(ll x,ll y) {
	REP(i,n) {
		int a = t[i] - x;
		int b = v[i] - y;
		int c = t[i + 1] - x;

		if(b < 0 && b < -a && c > 0) {
			return false;
		} 
	}
	return true;
}

#define D 2

int main(){
	cin >> n;
	t[0] = 0;
	REP(i,n) {
		cin >> t[i + 1];
	}
	t[n + 1] = 10;
	REP(i,n) {
		cin >> v[i];
		v[i] *= D;
	}
	v[n] = 0;
	n++;

	REP(i,n) {
		t[i + 1] += t[i];
	}
	REP(i,n + 1) {
		t[i] *= D;
	}

	double ans = 0;int nowv = 0;
	REP(i,n) {
		FOR(j,t[i],t[i + 1]) {
			if(v[i] >= nowv + 1 && aaa(j + 1,nowv + 1)) {
				ans += 2 * nowv + 1;
				nowv++;
			}else if(aaa(j + 1,nowv)) {
				ans += 2 * nowv;
			}else{
				ans += 2 * nowv - 1;
				nowv--;
			}
		}
	}
	printf("%0.10f\n",ans / (D * D * 2.0));
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int max(long long int *p,int N){
  int top=1;
  for(int i=2;i<=N;i++){
    if(p[top]<p[i]) top = i;
  }
  return top;
}
int main(){
  int N,R,L,d,t,x,old=1,oldt=0;
  cin >> N >> R >> L;
  long long int pt[N+1],ptime[N+1];
  for(int i=0;i<=N;i++) pt[i]=ptime[i]=0;
  for(int i=0;i<R;i++){
    cin >> d >> t >> x;
    ptime[old] += t-oldt;
    oldt = t;
    pt[d] += x;
    if(x>=0){
      if(pt[old]<pt[d]) old = d;
      if(pt[old]==pt[d]&&old>d) old = d;
    }else{
      if(old==d) old = max(pt,N);
    }
  }
  ptime[old] += L- oldt;
  int ans=1;
  for(int i=2;i<=N;i++){
    if(ptime[ans]<ptime[i]) ans = i;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2720
#include <iostream>

int main(){
    int a, b;
    std::cin >> a >> b;
    if ( a > b ) {
        std::cout << "a > b" << std::endl;
    } else if ( a == b ) {
        std::cout << "a == b" << std::endl;
    } else {
        std::cout << "a < b" << std::endl;
    }
    return 0;
}

Measured memory_bytes: 3076
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

n, k = nm()
lis = [nl() for _ in range(n)]
lis.sort()
count = 0
for i in range(n + 1):
    if count >= k:
        print(lis[i - 1][0])
        exit()
    count += lis[i][1]


Measured memory_bytes: 28160
#include <stdio.h>
#include <stdlib.h>

#define N 100000

int compare(const void *a, const void *b) {
	int ia = *(int *) a;
	int ib = *(int *) b;

	return ia - ib;
}

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

int main() {
	static int xx[N];
	int n, x, i, ans;

	scanf("%d%d", &n, &x);
	for (i = 0; i < n; i++)
		scanf("%d", &xx[i]);
	qsort(xx, n, sizeof *xx, compare);
	ans = abs(x - xx[0]);
	for (i = 0; i < n - 1; i++)
		ans = gcd(ans, abs(xx[i + 1] - x));
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 892
#include <stdio.h>

int main(void)
{
    char str[1001];
    int i, sum;

    while(1){
        scanf("%s", str);
        if(str[0] == '0'){
            break;
        }

        sum = 0;
        for(i = 0; str[i] != '\0'; i++){
            sum += str[i] - '0';
        }
        printf("%d\n", sum);
    }

    return 0;
}


Measured memory_bytes: 2080