akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <sstream>
#include <string>
#include <map>
#include <set>
#include <stdlib.h>
#include <cmath>
#include <math.h>
#include <fstream>
#include <bitset>
#include <time.h>
#include <queue>
#include <cassert>
#include <cstdio>
#include <complex>
#define int long long
using namespace std;
char otv;
bool checker(string str){
    if (str[str.size() - 1] != '9'){
        str[str.size() - 1] += 1;
        cout << "? " << str << endl;
        cout.flush();
        cin >> otv;
        if (otv == 'Y') return true;
        return false;
    }
    bool has = false;
    for (int i=0; i < str.size(); i++){
        if (str[i] != '9') has = true;
    }
    if (has){
        int now = str.size() - 1;
        while (true){
            if (str[now] != '9'){
                str[now] ++;
                break;
            }
            str[now] = '0';
            now--;
        }
        cout << "? " << str << endl;
        cout.flush();
        cin >> otv;
        if (otv == 'Y') return true;
        return false;
    }
    string new_s = "1";
    for (int i=0;i<str.size(); i++){
        new_s += '0';
    }
    cout << "? " << new_s << endl;
    cout.flush();
    cin >> otv;
    if (otv == 'Y') return false;
    return true;
}
signed main()
{
    string now = "";
    int counter = 0;
    while (true){
        int left = -1;
        int right = 9;
        if (counter == 0) left = 0;
        while (right - left > 1){
            int mid = (left + right) / 2;
            string answer = now;
            answer += ('0' + mid);
            while (answer.size() < 17){
                answer += '9';
            }
            cout << "? " << answer << endl;
            cout.flush();
            cin >> otv;
            if (otv == 'Y'){
                right = mid;
            }
            else left = mid;
        }
        now += ('0' + right);
        if (checker(now)) break;
        counter++;
    }
    cout << "! " << now << endl;
    return 0;
}

Measured memory_bytes: 596
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	string s;
	cin >> s;

	for (auto v : s) {
		cout << (v == '1' ? '9' : '1');
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
require 'matrix'

def turn_right()
    Matrix[
        [0, 1],
        [-1, 0]
        ]
end

while (n = gets.to_i) > 0
    x = Vector[1, 0]
    v = Vector[-1, 0]

    (n-1).times do
        v = turn_right() * v
        x += v
        v = x
        v /= - v.r
    end

    printf("%.3f\n", x[0])
    printf("%.4f\n", x[1])
end

Measured memory_bytes: 9256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
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; }
const ll INF=1LL<<60;
const int mod=1e9+7;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;cin >> s;
    int n=s.size();
    bool f=true;
    for(int i=0;i<n/2;i++){
        if(s[i]!=s[n-1-i]){
            f=false;
        }
    }
    string t=s.substr(0,n/2);
    int m=t.size();
    for(int i=0;i<m/2;i++){
        if(t[i]!=t[m-1-i]){
            f=false;
        }
    }
    if(f){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

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

using namespace std;

int N, M;
int MapData[152][1002];
vector<pair<int, int> > StoneInfo[152];
int DpSum[152][1002][78];

const int INF = 999999999;

void solve() {
	int curRowStone, curCol, cost, minSum;

	curRowStone = StoneInfo[1].size();
	for (int i = 0; i < curRowStone; ++i) {
		curCol = StoneInfo[1][i].first;
		DpSum[1][curCol][0] = 0;
	}

	curRowStone = StoneInfo[2].size();
	for (int i = 0; i < curRowStone; ++i) {
		curCol = StoneInfo[2][i].first;
		DpSum[2][curCol][1] = 0;
	}

	for (int i = 1; i < N; ++i) {
		for (int j = 1; j < 1002; ++j) {
			for (int k = 0; k <= M; ++k) {
				if (DpSum[i][j][k] == INF) {
					continue;
				}

				curRowStone = StoneInfo[i + 1].size();
				for (int t = 0; t < curRowStone; ++t) {
					curCol = StoneInfo[i + 1][t].first;
					cost = (MapData[i][j] + StoneInfo[i + 1][t].second) * abs(j - curCol);
					DpSum[i + 1][curCol][k] = min(DpSum[i + 1][curCol][k], DpSum[i][j][k] + cost);
				}

				if (k == M || i == N - 1) {
					continue;
				}
				curRowStone = StoneInfo[i + 2].size();
				for (int t = 0; t < curRowStone; ++t) {
					curCol = StoneInfo[i + 2][t].first;
					cost = (MapData[i][j] + StoneInfo[i + 2][t].second) * abs(j - curCol);
					DpSum[i + 2][curCol][k + 1] = min(DpSum[i + 2][curCol][k + 1], DpSum[i][j][k] + cost);
				}
			}
		}
	}

	minSum = INF;
	for (int i = 0; i < 1002; ++i) {
		for (int k = 0; k <= M; ++k) {
			minSum = min(minSum, DpSum[N][i][k]);
		}
	}
	for (int i = 0; i < 1002; ++i) {
		for (int k = 0; k < M; ++k) {
			minSum = min(minSum, DpSum[N - 1][i][k]);
		}
	}
	cout << minSum << endl;
}

int main() {
	int k, col, value;

	while (cin >> N >> M, N) {
		for (int i = 0; i < 152; ++i) {
			StoneInfo[i].clear();
			for (int j = 0; j < 1002; ++j) {
				MapData[i][j] = INF;
			}
		}
		for (int i = 1; i <= N; ++i) {
			cin >> k;
			for (int j = 0; j < k; ++j) {
				cin >> col >> value;
				MapData[i][col] = value;
				StoneInfo[i].push_back({ col,value });
			}
		}
		//fill_n(&DpSum[0][0][0], N * 1002 * M, INF);
		for (int i = 0; i < 152; ++i) {
			for (int j = 0; j < 1002; ++j) {
				for (int k = 0; k < 78; ++k) {
					DpSum[i][j][k] = INF;
				}
			}
		}
		solve();
	}

	return 0;
}


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

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

int main() {
    int K;
    cin >> K;
    int ans = 0;
    for(int a=1;a<=K;++a)for(int b=1;b<=K;++b)for(int c=1;c<=K;++c){
        ans+=gcd(a,gcd(b,c));
    }
    cout << ans << endl;
}


Measured memory_bytes: 3636
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    List<Integer>p = new ArrayList<>();
    for(int i=0;i<n;i++){
      p.add(sc.nextInt()-1);
    }
    int ans = 0;
    for(int i=1;i<n-1;i++){
      if((p.get(i)-p.get(i-1))*(p.get(i+1)-p.get(i))>0)ans++;
    }
    System.out.println(ans);

  }
}


Measured memory_bytes: 25044
#include <iostream>
#include<string>
#include<set>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;

int main()
{
    int a, b,c,d;
    cin >> a >> b >> c >> d;
    int n = ((a - 1) / d) + 1;
    int m = ((c - 1) / b) + 1;
    if (n >= m) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
int main( )
{
	string a;
	int v=0;
	cin>>a;
	for(int i=0;i<a.size();i++) 
	{
		if(a[i]=='C')v=1;
		if(a[i]=='F'&&v==1)
		{
			cout<<"Yes\n";
			return 0;
		}
	}
	cout<<"No\n";
	return 0;
}

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    a = [I() for _ in range(n)]
    r = sum(a)
    r -= max(a) // 2

    return r


print(main())


Measured memory_bytes: 5404
/*****Be Name Khoda*****/

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

#define F first
#define S second
#define Size(x) ((int)x.size())
#define All(x) x.begin() , x.end()

using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int a , b , c , d;
	cin >> a >> b >> c >> d;
	cout << max(0 , min(d , b) - max(a , c));
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
struct item{
    int wt,val;
};
ll solve(item arr[],int n,int W){
    ll dp[n+1][W+1];
    for(int w=0;w<=W;w++){
        dp[1][w] = 0;
    }
    dp[1][arr[1].wt] = arr[1].val;
    for(int i=2;i<=n;i++){
        for(int w=0;w<=W;w++){
            dp[i][w] = dp[i-1][w];
            if(arr[i].wt > w){
                continue;
            }
            dp[i][w] = max(dp[i][w],arr[i].val + dp[i-1][w-arr[i].wt]);
        }
    }
    return *max_element(dp[n],dp[n]+W+1);
}
int main(){
    int n,W;
    cin>>n>>W;
    item arr[n+1];
    for(int i=1;i<=n;i++){
        cin >> arr[i].wt >> arr[i].val;
    }
    cout<<solve(arr,n,W)<<endl;
    return 0;
}

Measured memory_bytes: 81700
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <sstream>

using namespace std;

int const INT_MAX = 10000000;

bool map[100][100];

int main(){
	
	while(true){
		
		int n, m;
		
		cin >> n;
		
		if(n == 0){
			break;
		}
		
		for(int i = 0; i < 100; i++){
			for(int j = 0; j < 100; j++){
				map[i][j] = false;
			}
		}
		
		for(int i = 0; i < n; i++){
			int num1, num2;
			cin >> num1 >> num2;
			map[num1][num2] = true;
		}
		
		cin >> m;
		
		int pos_x = 10;
		int pos_y = 10;
		
		for(int loop = 0; loop < m; loop++){
			char c;
			int num;
			cin >> c >> num;
			for(int i = 0; i < num; i++){
				if(c == 'N'){
					pos_y++;
				}else if(c == 'S'){
					pos_y--;
				}else if(c == 'E'){
					pos_x++;
				}else{
					pos_x--;
				}
				map[pos_x][pos_y] = false;
			}
		}
		
		bool flag = true;
		
		for(int i = 0; i <= 20; i++){
			for(int j = 0; j <= 20; j++){
				if(map[i][j]){
					flag = false;
				}
			}
		}
		
		if(flag){
			cout << "Yes" << endl;
		}else{
			cout << "No" << endl;
		}
		
	}
	return 0;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(a); (i)<(b); ++(i))
#define rFor(i, a, b) for(int (i)=(a)-1; (i)>=(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;

typedef struct UnionFindTree{
    vector<int> par;
    
    UnionFindTree(int n){
        par.resize(n, -1);
    }
    
    int find(int x){
        if(par[x] < 0) return x;
        return par[x] = find(par[x]);
    }
    
    int size(int x){
        return -par[find(x)];
    }
    
    bool unite(int x, int y){
        x = find(x);
        y = find(y);
        if(x == y) return false;
        if(size(x) < size(y)) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    bool same(int x, int y){
        return find(x) == find(y);
    }
}UF;

int main(){
    int n;
    scanf("%d", &n);
    int MAX = 200010;
    int d = 100000;
    UF uf(MAX);
    int x[n], y[n];
    rep(i, n){
        scanf("%d%d", &x[i], &y[i]);
        uf.unite(x[i], y[i] + d);
    }
    pii p[MAX];
    int s[MAX];
    rep(i, MAX) p[i] = pii(0, 0), s[i] = 0;
    bool usedx[MAX], usedy[MAX];
    rep(i, MAX) usedx[i] = usedy[i] = false;
    rep(i, n){
        if(!usedx[x[i]]) ++p[uf.find(x[i])].fi, usedx[x[i]] = true;
        if(!usedy[y[i]]) ++p[uf.find(y[i] + d)].se, usedy[y[i]] = true;
        ++s[uf.find(x[i])];
    }
    lint ans = 0;
    rep(i, MAX)if(p[i].fi) ans += (lint)p[i].fi * p[i].se - s[i];
    printf("%lld\n", ans);
}

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

#define INF 1000000007
#define LINF 1000000000000000007

using namespace std;

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

int h, w;
char c[52][52];

int main(){
	cin >> h >> w;
	for(int i = 0; i <= h+1; i++) for(int j = 0; j <= w+1; j++){
		if(i == 0 || i == h+1 || j == 0 || j == w+1) c[i][j] == '.';
		else cin >> c[i][j];
	}
	
	int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};
	bool b = 1;
	for(int i = 1; i <= h; i++){
		for(int j = 1; j <= w; j++){
			if(c[i][j] == '#'){
				bool s = 0;
				for(int k = 0; k < 4; k++){
					if(c[i+dx[k]][j+dy[k]] == '#'){
						s = 1;
					}
				}
				if(!s) b = 0;
			}
		}
	}
	if(b) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

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

#define fori(i, ini, lim) for(int i = int(ini); i < int(lim); i++)
#define ford(i, ini, lim) for(int i = int(ini); i >= int(lim); i--)

#define debug(x) cout << "> " << #x << " = " << x << endl;
#define debug_at(arr, at) cout << "> " << #arr << "[" << at << "] = " << arr[at] << endl;
#define debug_pair(p) cout << "> " << #p << " = (" << p.first << ", " << p.second << ")" << endl;

#define gcd __gcd

using namespace std;

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

    int n, k;
    cin >> n >> k;
    int g = 0;
    int maxi = 1;
    fori(i, 0, n) {
        int val;
        cin >> val;
        g = gcd(g, val);
        maxi = max(maxi, val);
    }
    if(k % g == 0 and k <= maxi) {
        cout << "POSSIBLE\n";
    }
    else {
        cout << "IMPOSSIBLE\n";
    }

    return 0;
}


Measured memory_bytes: 256
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int64_t, int64_t>;

// std::cout << std::setprecision(20) << 1.1 << endl;

const int64_t kMod = 1E9 + 7;
// const int kMod = 998244353LL;
struct Mint {
  int64_t value;
  Mint(int64_t value = 0LL) : value((value % kMod + kMod) % kMod) {}
  Mint operator-() const {
    return Mint(-value);
  }
  Mint &operator+=(const Mint rhs) {
    if ((value += rhs.value) >= kMod) {
      value -= kMod;
    }
    return *this;
  }
  Mint &operator-=(const Mint rhs) {
    if ((value += kMod - rhs.value) >= kMod) {
      value -= kMod;
    }
    return *this;
  }
  Mint &operator*=(const Mint rhs) {
    (value *= rhs.value) %= kMod;
    return *this;
  }
  Mint operator+(const Mint rhs) const {
    return Mint(*this) += rhs;
  }
  Mint operator-(const Mint rhs) const {
    return Mint(*this) -= rhs;
  }
  Mint operator*(const Mint rhs) const {
    return Mint(*this) *= rhs;
  }
  Mint Pow(int64_t p) const {
    if (p == 0LL) {
      return 1LL;
    } else if (p < 0LL) {
      return Pow(-p).Pow(kMod - 2LL);
    }
    Mint temp = Pow(p >> 1LL);
    temp *= temp;
    if (p & 1LL) {
      temp *= (*this);
    }
    return temp;
  }
  Mint Inv() const {
    return Pow(kMod - 2LL);
  }
  Mint &operator/=(const Mint a) {
    return *this *= a.Inv();
  }
  Mint operator/(const Mint a) const {
    return Mint(*this) /= a;
  }
};
std::ostream &operator<<(std::ostream &os, const Mint &a) {
  os << a.value;
  return os;
}

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

  int64_t N, K;
  cin >> N >> K;
  vector<int64_t> A(N);
  for (int64_t i = 0; i < N; ++i) {
    cin >> A[i];
  }
  vector<int64_t> left_larger(N, 0);
  vector<int64_t> larger(N, 0);
  for (int64_t i = 0; i < N; ++i) {
    for (int64_t j = 0; j < N; ++j) {
      if (A[j] > A[i]) {
        ++larger[i];
        if (j < i) {
          ++left_larger[i];
        }
      }
    }
  }
  Mint result = 0;
  for (int64_t i = 0; i < N; ++i) {
    Mint L = larger[i];
    Mint LL = left_larger[i];
    Mint outer = (L * Mint(K) * Mint(K - 1) / Mint(2));
    Mint inner = LL * K;
    cerr << "i=" << i << ", L=" << L << ", LL=" << LL << endl;
    cerr << "i=" << i << ", outer=" << outer << ", inner=" << inner << endl;
    result += (outer + inner);
  }

  cout << result << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 
 using namespace std;
  
 int main()
 {
   string a,b;
   getline(cin,a);
     for(int i=0;i<a.length();i++)
     { 
       if(a[i]>='a'&&a[i]<='z') b+=('A'+(a[i]-'a'));
       else b+=a[i];
     }
     cout<<b<<endl;
   //while(1);      
   return 0;    
 }

Measured memory_bytes: 3156
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
 
#define endl '\n'
#define loop(i, m, n) for (lli i = m; i < n; i++)
#define loope(i, m, n) for (lli i = m; i <= n; i++)
#define epool(i, m, n) for (lli i = m; i >= n; i--)
#define pool(i,m,n) for(lli i=m; i>n; i++)
#define maxe *max_element
#define mine *min_element
#define plli pair<lli, lli>
#define mod 1000000007
#define mod2 998244353
#define vt vector<lli>
#define fi first
#define se second
#define pb push_back
#define umap unordered_map
#define mmap multimap
#define mp make_pair
#define inp1(a) cin >> a
#define inp2(a, b) cin >> a >> b
#define inp3(a, b, c) cin >> a >> b >> c
#define inp4(a, b, c, d) cin >> a >> b >> c >> d
#define inp5(a, b, c, d, e) cin >> a >> b >> c >> d >> e
#define inp6(a, b, c, d, e, f) cin >> a >> b >> c >> d >> e >> f
#define pr0() cout << " "
#define pr1(a) cout << a << " "
#define pr2(a, b) cout << a << " " << b << " "
#define pr3(a, b, c) cout << a << " " << b << " " << c << " "
#define pr4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << " "
#define emp emplace //used to push a pair etc..
#define empf emplace_front
#define empb emplace_back
#define ret(x) return cout << x, 0;
#define all(v) v.begin(),v.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
//especially for deque both sides dynamic
#define pf push_front
//list doubly linked lists can insert at mid. splice fn can be used
#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
using namespace std;
 
lli gcd(lli a, lli b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
 
lli lcm(lli a, lli b){
    return (a * b) / gcd(a, b);
}
 
lli modi(lli n,lli m=mod){ 
    if(n==0) return 0;
    n%=m;
    n+=m;
    n%=m;
    return n;
}
 
lli mpow(lli base, lli exp){
    base %= mod;
    lli result = 1;
    while (exp > 0){
        if (exp & 1)
            result = ((lli)result * base) % mod;
        base = ((lli)base * base) % mod;
        exp >>= 1;
    }
    return result;
}
const lli INF=1e18;
const lli N=2e5+5;
lli a[N]={0},b[N]={0};

int32_t main(){
    fast_io
    lli i = 0,j=0;
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    
    vt v,v1,v2;
    lli a,b,c,d,e,f;

    lli n;
    cin >> n;
    bool flag=0;
    if(n%10==7) flag=1;
    if((n/10)%10==7) flag=1;
    if((n/100)%10==7) flag=1;

    if(flag) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1000000007;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
template<class itr, class itr2> bool next_sequence2(itr first, itr last, itr2 first2, itr2 last2){ itr now = last; itr2 now2 = last2; while(now != first){ now--, now2--; (*now)++; if((*now) == (*now2)){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    int N;
    cin >> N;
    string S;
    cin >> S;
    Yes(S.substr(0, N / 2) == S.substr(N / 2, N));
}


Measured memory_bytes: 256
/*
  A - AtCoder *** Contest
  Contest 048
  Rakesh Kumar --> 03/08/2020
 */

#include <bits/stdc++.h>

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0); std::cout.tie(0);

    std::string s;
    std::getline(std::cin, s);
    std::string r;
    r += s[0];
    for (std::size_t i = 1; i < s.size(); ++i)
        if (std::isupper(s[i]) && s[i - 1] == ' ')
            r += s[i];
    std::cout << r << std::endl;

    return 0;
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
ll L,A,B,M;
ll i,j,k;

ll dmul[3][3];
ll mul[3][3];
ll ans[3][3];
void calc(ll a){
    if(a==0)
        return;
    ll i, j,k,l;
    if(a&1){
        fornum(i,0,3){
            fornum(j,0,3){
                dmul[i][j] = ans[i][j];
            }
        }
        fornum(i,0,3){
            fornum(j,0,3){
                ans[i][j]=0;
                fornum(k,0,3){
                    ans[i][j] = (ans[i][j] + dmul[i][k] * mul[k][j])%M;
                }
            }
        }
    }
    fornum(i,0,3){
        fornum(j,0,3){
            dmul[i][j] = mul[i][j];
        }
    }
    fornum(i,0,3){
        fornum(j,0,3){
            mul[i][j]=0;
            fornum(k,0,3){
                mul[i][j] = (mul[i][j] + dmul[i][k] * dmul[k][j])%M;
            }
        }
    }    
    calc(a / 2);
}

int main(){
    scanf("%lld%lld%lld%lld", &L, &A, &B, &M);
    //A %= M;
    //B %= M;
    ans[0][0] = 1;
    ans[1][1] = 1;
    ans[2][2] = 1;
    
    ll a = 0;
    ll b = 10;
    fornum(i,0,18){
        ll l = 0;
        ll r = L;
        while(l<r){
            ll c = (r + l) / 2;
            ll C = A + B * c;
            if(C<b){
                l = c + 1;
            }else{
                r = c;
            }
        }
        //printf("%lld,%lld\n", a, r);
        fornum(j,0,3){
            fornum(k,0,3){
                mul[j][k] = 0;
            }
        }
        mul[0][0] = b%M;
        mul[1][0] = 1;
        mul[1][1] = 1;
        mul[2][1] = B%M;
        mul[2][2] = 1;
        calc(r - a);
        a = r;
        b *= 10;
    }
    /*
    fornum(i,0,3){
        fornum(j,0,3){
            printf("%lld ", ans[i][j]);
        }
        printf("\n");
    }*/
    printf("%lld", (A%M * ans[1][0] + ans[2][0]) % M);
    return 0;
}

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

  long temp;
  vector<P> h;
  rep(i, n){
    cin >> temp;
    h.push_back(P(temp, 1));
//    cout << h[i].first << endl;
  } 
  vector<long> a(m);
  vector<long> b(m);
  rep(i, m) cin >> a[i] >> b[i];
  
  long ct=0;
  rep(i, m){
    if(h[a[i]-1].first >= h[b[i]-1].first){
      h[b[i]-1].second=0;
//	  cout << a[i] << endl;
    }
    if(h[a[i]-1].first <= h[b[i]-1].first){
      h[a[i]-1].second=0;
//	  cout << b[i] << endl;
    }
  }
  rep(i, n) ct += h[i].second;

  cout << ct << endl;
  return 0;
}

Measured memory_bytes: 6408
#include <bits/stdc++.h>
//登録しよう！→ https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define gre greater //sortを降順にする
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示
const string YES = "Yes";
const string NO = "No";

void solve(long long A, long long B, std::string S){
  if(S.length() != A+B+1)cout << NO << endl;
  for (int i = 0; i < S.length(); i++) {
    if(i < A){
      if(!('0' <= S[i] && S[i] <= '9')){
        cout << NO << endl;
        return;
      }
    }
    if(S[A] != '-'){
      cout << NO << endl;
      return;
    }
    if(A+1 < i){
      if(!('0' <= S[i] && S[i] <= '9')){
        cout << NO << endl;
        return;
      }
    }
  }
  cout << YES << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    std::string S;
    std::cin >> S;
    solve(A, B, S);
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	var s []byte
	fmt.Scan(&s)
	alpha := []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
	for i := range s {
		for j, a := range alpha {
			if s[i] == a {
				fmt.Print(string([]byte{alpha[(j+n)%len(alpha)]}))
			}
		}
	}
	fmt.Println()
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 896
from collections import deque

INF = 10**18
N, M = map(int, input().split())

graph = [[] for _ in range(N)]

for _ in range(M):
    a, b = map(int,input().split())
    graph[a - 1].append(b - 1)

loopsize = INF

for root in range(N):
    queue = deque([root])
    dist = [INF for _ in range(N)]
    dist[root] = 0
    prev = [None for _ in range(N)]
    while queue:
        node = queue.popleft()
        for adj in graph[node]:
            if adj == root:
                dist[root] = dist[node] + 1
                prev[root] = node
                break
            if dist[adj] != INF:
                continue
            dist[adj] = dist[node] + 1
            prev[adj] = node
            queue.append(adj)
        else:
            continue
        break
    else:
        continue
    if loopsize > dist[root]:
        loopsize = dist[root]
        path = [root]
        node = root
        while prev[node] != root:
            node = prev[node]
            path.append(node)

if loopsize != INF:
    print(loopsize)
    for node in path:
        print(node + 1)
else:
    print(-1)

Measured memory_bytes: 9648
#include <stdio.h>
#include<math.h>

using namespace std;

struct Point {
    double x;
    double y;
};
double th = M_PI * 60.0 / 180.0;

void koch(int n, Point a, Point b) {
    if(n == 0) return;
    Point s, u, t;
    s.x = (2.0*a.x + 1.0*b.x)/3.0;
    s.y = (2.0*a.y + 1.0*b.y)/3.0;

    t.x = (1.0*a.x + 2.0*b.x)/3.0;
    t.y = (1.0*a.y + 2.0*b.y)/3.0;

    u.x = (t.x - s.x)*cos(th) - (t.y - s.y)*sin(th) + s.x;
    u.y = (t.x - s.x)*sin(th) + (t.y - s.y)*cos(th) + s.y;

    koch(n-1, a, s);
    printf("%.8f %.8f\n", s.x, s.y);

    koch(n-1, s, u);
    printf("%.8f %.8f\n", u.x, u.y);

    koch(n-1, u, t);
    printf("%.8f %.8f\n", t.x, t.y);

    koch(n-1, t, b);
}

int main()
{
    int n;
    scanf("%d", &n);
    Point startPoint, endPoint;
    startPoint.x = 0;
    startPoint.y = 0;
    endPoint.x = 100;
    endPoint.y = 0;
    printf("%.8f %.8f\n", startPoint.x, startPoint.y);
    koch(n, startPoint, endPoint);
    printf("%.8f %.8f\n", endPoint.x, endPoint.y);
    return 0;
}

Measured memory_bytes: 3000
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=(0);i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

const int N=5005;
int n,K,mn=233,mx;
char s[N],t[N],ans[N];

void doit(int K,int l,int r){
	rep(T,1,K-1){
		rep(i,1,l-1)t[i]=t[i+n-(l-1)];
		reverse(t+l,t+n+1);
		if(r<n)l=n-(r-l),r=n;
		else l=2*l-n-1;
		if(l<=0)return;
	}
	rep(i,l,n)t[i-l+1]=t[i];
	reverse(t+n-l+2,t+n+1);
}

int main(){
	read(n),read(K);
	K=min(K,15);
	scanf("%s",s+1);
	memcpy(ans,s,sizeof s);
	rep(i,1,n)
		mn=min(mn,(int)s[i]);
	for(int l=1,r;l<=n;l++)
		if(s[l]==mn){
			for(r=l;r<n&&s[r+1]==mn;r++);
			if(r-l<mx&&r<n)continue;
			mx=max(mx,r-l);
			memcpy(t,s,sizeof s);
			doit(K,l,r);
			if(strcmp(t+1,ans+1)<0)memcpy(ans,t,sizeof t);
			l=r;
		}
	puts(ans+1);
	return 0;
}

Measured memory_bytes: 256
import numpy as np
N=int(input())
G=[[] for n in range(N+1)]
for n in range(N-1):
    [u,v,w]=[int(_) for _ in input().split()]
    G[u].append(v*((-1)**w))
    G[v].append(u*((-1)**w))
D=[-1 for n in range(N+1)]
V=[0,1]
while V!=[0]:
    now=V[1]
    for nex in G[now]:
        if D[abs(nex)]==-1:
            if np.sign(nex)==1:
                D[abs(nex)]=D[now]%2
            else:
                D[abs(nex)]=(D[now]+1)%2
            V.append(abs(nex))
    V.pop(1)
for n in range(1,N+1):
    print(D[n])

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

const int INF = 1e9+5;

int main()
{
    int n;
    cin>>n;
    vector<int> h(n);
    for(int& x : h)
    {
        cin>>x;
    }
    vector<int> dp(n,INF);
    dp[0]=0;
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<=i+2; j++)
        {
            if(j<n)
            {
                dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]));
            }
        }
    }
    cout<<dp[n-1];
    return 0;
}

/*        _____WA_____
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    vector<int> h(n);
    int c=0;
    for(int& x : h)
    {
        cin>>x;
    }
    for(int i=0; i<n;)
    {
        if(i==n-1)
            break;
        if(c+abs(h[i]-h[i+1])<c+abs(h[i]-h[i+2])||i==n-2)
            {c+=abs(h[i]-h[i+1]); i++;}
        else
            {c+=abs(h[i]-h[i+2]); i+=2;}
    }
    cout<<c;
    return 0;
}

            ____TLE____
#include<bits/stdc++.h>
using namespace std;

int N;
vector<int> ar;
int ans(int i);

int main()
{
    cin>>N;
    for(int i=0;i<N;i++)
    {
        int a;
        cin>>a;
        ar.push_back(a);
    }
    cout<<ans(0);
}


int ans(int i)
{
    if(i>=(N-1)) return abs(ar[N-1]-ar[i]);
    else
    {
        return min(abs(ar[i+1]-ar[i])+ans(i+1),abs(ar[i+2]-ar[i]+ans(i+2)));
    }   
}
*/

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    int T; cin >> T;
    rep(i, T) {
        ll A, B, C, D; cin >> A >> B >> C >> D;
        if(A < B || B > D) {
			cout << "No" << endl;
			continue;
		}
		if(C >= B) {
			cout << "Yes" << endl;
			continue;
		}
		ll G = gcd(B, D);
		A %= B;
		ll M = A + (A > C ? 0 : (B - 1 - A) / G * G);
		if(M > C) {
			cout << "No" << endl;
			continue;
		} else {
			cout << "Yes" << endl;
		}
    }
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
char S[210][210];
int n,G[210][210];
bool col[210],vis[210];
void dfs(int x){
	vis[x]=1;
	for(int i=1;i<=n;++i)
		if(S[x][i]=='1'){
			if(!vis[i])col[i]=!col[x],dfs(i);
			else if(col[i]==col[x])puts("-1"),exit(0);
		}
}
int main(){
#ifdef XZZSB
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	n=gi();
	memset(G,63,sizeof G);
	for(int i=1;i<=n;++i)scanf("%s",S[i]+1);
	for(int i=1;i<=n;++i)
		for(int j=1;j<=n;++j)
			if(S[i][j]=='1'||i==j)G[i][j]=1;
	dfs(1);
	for(int k=1;k<=n;++k)
		for(int i=1;i<=n;++i)
			for(int j=1;j<=n;++j)
				G[i][j]=std::min(G[i][j],G[i][k]+G[k][j]);
	int ans=0;
	for(int i=1;i<=n;++i)
		for(int j=1;j<=n;++j)
			ans=std::max(ans,G[i][j]);
	printf("%d\n",ans+1);
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100005
#define INF 1000000005
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 1000005;
const int MOD = 1000000007;
int main(){
    ll k;
    vector<ll>a(3);
    REP(i,3)cin>>a[i];
    cin>>k;

    ll ans=0;
    REP(i,3){
        ans+=(1-i)*min(a[i],k);
        k-=a[i];
        if(k<=0)break;
    }
    OUT(ans);
    return 0;
}

Measured memory_bytes: 3636
n = int(input())

tmp = 0
i = -1
tmp_list= []
while tmp<=n:
  i+=1
  tmp+=26**i
  tmp_list.append(26**i)
n-=(tmp-tmp_list[-1])

tmp = []
while 1:
  if n<26:
    tmp.append(n%26)
    break
  tmp.append(n%26)
  n = n//26
alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]

result = ""
for arg in reversed(tmp):
  result += alphabet[arg]

for _ in range(i-len(result)):
  result = "a"+result
print(result)


Measured memory_bytes: 9216
N,x = list(map(int, input().split()))
a =  list(map(int, input().split()))


counter = 0


dif1 = a[N-2] + a[N-1] - x
if dif1 > 0:
        a1 = a[N-2] - dif1
        if a1 > 0:
            a[N-2] -= dif1
            counter  += dif1
        else:
            a[N-1]-= -a1
            a[N-2] = 0
            counter += dif1

for i in range(N-2):
    dif1 = a[i] + a[i+1] - x
    if dif1 > 0:
        a1 = a[i+1] - dif1
        if a1 > 0:
            a[i+1] -= dif1
            counter  += dif1
        else:
            a[i]-= -a1
            a[i+1] = 0
            counter += dif1

       
while a[N-2] + a[N-1] > x:
    if a[N-2] > 0:
        a[N-2] -= 1
    else :
        a[N-1] -= 1
    
    counter += 1

print(counter)

Measured memory_bytes: 14480
#include <cstdio>
#include <cmath>
using namespace std;

#define FOR(i,S,E) for(int i=S; i<E; i++)
#define ri(x) scanf("%d", &x)
#define rii(x,y) scanf("%d%d", &x, &y)

typedef long long ll;

const int MAXK = 1e5+1;
int A[MAXK], K;
bool prop;
ll middle(ll x, ll y) {
    return (x+y)/2;
}

bool p(ll x, int maximizing = 0) {
    FOR(i,0,K) {
        x /= A[i];
        x *= A[i];
    }
    if (maximizing) return x <= 2 && prop;
    return x >= 2 && prop;
}

bool good(ll x) {
    FOR(i,0,K) {
        x /= A[i];
        x *= A[i];
    }
    return x == 2 && prop;
}

int main() {
    ri(K);
    FOR(i,0,K) ri(A[i]);
    prop = (A[K-1] == 2);
    // find minimum
    ll lo=1, hi=1e14;
    while (lo < hi) {
        ll mid = middle(lo,hi);

        if (p(mid)) {
            hi = mid;
        } else {
            lo = mid+1;
        }
    }
    ll minim=-1;
    if (good(lo)) minim = lo;

    // find maximum
    lo=2, hi=1e14+1;
    while(lo<hi-1) {
        ll mid = middle(lo,hi);
        if (p(mid, 1)) {
            lo = mid;
        } else {
            hi = mid-1;
        }
    }
    ll maxim = lo;
    if (good(hi)) maxim = hi;
    if (minim == -1) {
        printf("-1\n");
    } else {
        printf("%lld %lld\n", minim, maxim);
    }

}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#include <vector>
using namespace std;
int main(){
  int a,b,c;
  cin >> a >> b >> c;
  cout << c << " " << a << " " << b << endl;
  return 0;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]

// Input
#[allow(unused_macros)]
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} };}
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
#[allow(unused_imports)]
use std::cmp::{min,max};

// Main
fn main(){
    input!{
        a: u64,
        b: u64,
        h: u64,
    }
    println!("{}", (a+b)*h/2);
}


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

int main(void)
{
  char a[10];
  scanf("%s", a);
  int lenght = strlen(a);
  int counter = 0;
  for (int i = 0; i < lenght; i += 2)
  {
    if (a[i] == 'h' && a[i + 1] == 'i')
    {
    }
    else
    {
      counter++;
    }
  }
  if (counter == 0)
  {
    printf("Yes");
    return 0;
  }
  else
  {
    printf("No");
    return 0;
  }
}

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

typedef long long ll;
typedef vector<ll> vll;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll k, i, t = 0;
	string s;
	cin >> s;
	cin >> k;
	vll eq;
	for (i = 0; i < s.size(); i++) {
		if (i > 0 and s[i] != s[i - 1]) {
			eq.push_back(t);
			t = 0;
		}
		t++;
	}
	eq.push_back(t);
	
	if (eq.size() == 1) {
		cout << (eq[0] * k) / 2 << "\n";
	} else {
		if (s[s.size() - 1] != s[0]) {
			t = 0;
			for (i = 0; i < eq.size(); i++)
				t += (eq[i] / 2);
			cout << t * k << "\n";
		} else {
			t = 0;
			for (i = 1; i < eq.size() - 1; i++)
				t += (eq[i] / 2);
			t = (t * k) + (eq[0] / 2) + (eq[eq.size() - 1] / 2) + ((eq[0] + eq[eq.size() - 1]) / 2) * (k - 1);
			cout << t << "\n";
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cmath>
#define mod 1000000007
using namespace std;
long long n;
char str[100010];
long long a[6]={1,10,9,12,3,4};
long long dp[100010][20];
int main()
{
	cin>>str+1;
	n=strlen(str+1);
	dp[0][0]=1;
	for(long long i=1;i<=n;++i)
		for(long long j=0;j<13;++j)
		{
			if(str[i]!='?')
			{
				long long num=(str[i]-'0')*a[(n-i)%6]%13;
				dp[i][j]=dp[i-1][(j+13-num)%13];
			}
			else
			{
				long long num=a[(n-i)%6];
				for(long long k=0;k<10;++k)
					dp[i][j]+=dp[i-1][(j+13-num*k%13)%13],dp[i][j]%=mod;
			}
		}
	cout<<dp[n][5]<<endl;
	return 0;
}

Measured memory_bytes: 16000
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  while(a>0){
    c-=b;
    if(c<=0)
      break;
    a-=d;
  }
  cout<<(a>0?"Yes":"No");
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m=0;
  cin>>n;
  vector<int> a(n),b(n);
  for(int i=0;i<n;++i)cin>>a[i];
  for(int i=0;i<n;++i)cin>>b[i];
  for(int i=1;i<n;++i)a[i]+=a[i-1];
  for(int i=n-2;i>=0;--i)b[i]+=b[i+1];
  for(int i=0;i<n;++i)m=max(m,a[i]+b[i]);
  cout<<m;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,ll>
const ll MOD=998244353;
const int INF=1e9;
const double PI=acos(-1);


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

    int n;
    cin >> n;
    int r=n%1000;
    int ans=(r==0)?0:1000-r;
    cout << ans << endl; 

}


Measured memory_bytes: 3628
import sys
readline = sys.stdin.readline
writelines = sys.stdout.writelines
N = int(readline())
L = [None]*N; R = [None]*N
S = [-1]*N
P = [-1]*N
D = [-1]*N
DG = [0]*N
H = [-1]*N
for i in range(N):
    i, l, r = map(int, readline().split())
    L[i] = l; R[i] = r
    if l != -1:
        P[l] = i
        DG[i] += 1
    if r != -1:
        P[r] = i
        DG[i] += 1
    if l != -1 != r:
        S[l] = r; S[r] = l
def dfs(v, d):
    D[v] = d
    H[v] = h = max((dfs(L[v], d+1) if L[v] != -1 else 0), (dfs(R[v], d+1) if R[v] != -1 else 0))
    return h+1
dfs(P.index(-1), 0)
writelines(["node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, %s\n" % (i, P[i], S[i], DG[i], D[i], H[i], 'root' if P[i] == -1 else 'leaf' if DG[i] == 0 else 'internal node') for i in range(N)])



Measured memory_bytes: 5624
#include <iostream>
#include <array>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <list>
#include <cmath>
#include <stack>
#include <queue>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using namespace std;

const int mod = 1000000007;
struct mint {
	ll x; // typedef long long ll;
	mint(ll x = 0) :x((x% mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	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 {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};

struct combination {
	vector<mint> fact, ifact;
	combination(int n) :fact(n + 1), ifact(n + 1) {
		fact[0] = 1;
		for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
		ifact[n] = fact[n].inv();
		for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
	}
	mint operator()(int n, int k) {
		if (k < 0 || k > n) return 0;
		return fact[n] * ifact[k] * ifact[n - k];
	}
} comb(2000005);

mint g(int r, int c) {
	return comb(r + c + 2, r + 1) - 1;
}

int main()
{
	int n;
	cin >> n;
	cout << ((n % 2 == 0) ? 0.5 : ((double)(n / 2 + 1) / n));
}


Measured memory_bytes: 31488
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
amin = []
bmin = []

for i in range(N):
    if A[i] < B[i]:
        amin.append(B[i]-A[i])
    elif A[i] > B[i]:
        bmin.append(A[i]-B[i])

if amin == []:
    print(0)
    exit()
#amin.sort()
bmin.sort()

#print(bmin)

if sum(amin) > sum(bmin):
    print(-1)
    exit()

num = sum(amin)
for i in range(len(bmin)):
    #print(bmin[len(bmin)-i-1])
    num -= bmin[len(bmin)-i-1]
    if num < 0:
        print(len(amin)+i+1)
        break
else:
    print(N)


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

#define int long long
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(), a.end()

const int mod = 1e9+7;
const int inf = 2e18;

int32_t main()
{	
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	string s;
	unordered_map<string,int> mp;
	while(n--)
	{
		cin>>s;
		mp[s]++;
	}

	vector<string> v{"AC","WA","TLE","RE"};
	for(string &temp:v)
	{
		cout<<temp<<" "<<"x"<<" "<<mp[temp]<<'\n';
	}
	return 0;
}	

Measured memory_bytes: 3660