akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    scanf("%d",&n);
    int A[105];
    for(int i=0;i<n;i++)scanf("%d",&A[i]);
    int flag=1,ans=0;
    for(int i=1;i<=n;i++){
        if(A[i]==A[i-1]&&i<n)flag++;
        else {
            if(flag>1&&flag%2==0)
                ans+=flag/2;
            else if(flag>1&&flag%2!=0)
                ans+=(flag-1)/2;
            flag=1;
        }
    }
    printf("%d",ans);
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
	string str;
  cin>>str;
  for(int i=0;i<str.size();i++){
  	if(str[i] == 'A') cout<<'T';
    if(str[i] == 'T') cout<<'A';
    if(str[i] == 'G') cout<<'C';
    if(str[i] == 'C') cout<<'G';
  }
}

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

int main(void)
{
    int n;
    cin>>n;
    int t,x,y;
    int t0=0,x0=0,y0=0;
    int dis;
    bool flag=true;
    for(int i=0;i<n;++i)
    {
        cin>>t>>x>>y;
        if(!flag)
        {
            continue;
        }
        dis=abs(x-x0)+abs(y-y0);
        int temp=t-t0-dis;
        if(temp<0)
        {
            flag=false;
            continue;
        }
        if(((t-t0)-dis)%2==0)
        {
            t0=t;
            x0=x;
            y0=y;
        }
        else
        {
            flag=false;
        }
    }
    if(flag)
    {
        cout <<"Yes"<<endl;
    }
    else
    {
        cout <<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
import kotlin.system.exitProcess

fun main(args: Array<String>) {
    val s= readLine()!!.split(" ")
    val n = s[0].toInt()
    val y = s[1].toInt()

    for( i in 0..n ){
        for( j in 0..n-i ){
            var k = n-i-j
            var sum = 10000*i + 5000*j + 1000*k
            if( y == sum) {
                println("$i $j $k")
                exitProcess(0)
            }
        }
    }
    println("-1 -1 -1")
}

Measured memory_bytes: 37816
from fractions import gcd
# from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter, deque
import sys
from bisect import *
import itertools
import copy
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7


def main():
    
    h, w = map(int, input().split())
    s = [list(input()) for i in range(h)]
    start = []
    for i in range(h):
        for j in range(w):
            if s[i][j] == "#": 
                start.append([i,j])

    ans = [0,0]
    vis = [[-1 for i in range(w)] for j in range(h)]
    def f(x, y, pre):
        vis[x][y] = 1
        if s[x][y] == "#":
            ans[0] += 1
        else:
            ans[1] +=1
        for i, j in [[1, 0], [-1, 0], [0, 1], [0, -1]]:
            nx = i + x
            ny = j + y
            if nx >= 0 and ny >= 0 and nx < h and ny < w and vis[nx][ny] == -1:
                if pre == "B" and s[nx][ny] == ".":
                    f(nx,ny,"W")
                elif pre == "W" and s[nx][ny] == "#":
                    f(nx, ny, "B")
                
    
    ret = 0
    for i, j in start:
        if vis[i][j] == -1:
            f(i, j, "B")
        ret += ans[0] * ans[1]
        ans[0] = ans[1] = 0
    print(ret)
        

if __name__ == '__main__':
    main()


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
typedef long long ll;

int main() {
    ll n,a,b; cin >> n >> a >> b;
    ll A = a + b;
    ll N = n / A;
    if(N < 1){
        cout << min(a,n) << endl;
    }else{
        ll B  = N * a;
        ll C = n - N * A;
        cout << B + min(C,a) << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define     ll      long long
#define     pb      push_back
#define     F       first
#define     S       second
#define     n1      "\n"
#define     sz      size()
#define     cinfast ios_base::sync_with_stdio(false); cin.tie(NULL);


int main ()
{
string s ; cin >> s ;
if (s=="ARC")cout << "ABC";
else cout << "ARC";


}






Measured memory_bytes: 3632
// {{{
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(ll i = static_cast<ll>(a); i < static_cast<ll>(b); i++)
#define FORR(i, a, b) for(ll i = static_cast<ll>(a); i >= static_cast<ll>(b); i--)
#define REP(i, n) for(ll i = 0ll; i < static_cast<ll>(n); i++)
#define REPR(i, n) for(ll i = static_cast<ll>(n); i >= 0ll; i--)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> IP;
typedef pair<ll, LP> LLP;

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

constexpr int INF = 100000000;
constexpr ll LINF = 10000000000000000ll;
constexpr int MOD = static_cast<int>(1e9 + 7);
constexpr double EPS = 1e-9;

static inline ll mod(ll x, ll m)
{
    ll y = x % m;
    return (y >= 0 ? y : y+m);
}

// }}}

int N;
int a[100];

void solve()
{
    vector<double> ra;
    REP(i, N){
        ra.pb(1./(double)(a[i]));
    }
    double ans = 0;
    REP(i, N){
        ans += ra[i];
    }
    cout << fixed << setprecision(10) << 1./ans << endl;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N;
    REP(i, N) cin >> a[i];
    solve();
    return 0;
}

// vim:set foldmethod=marker:


Measured memory_bytes: 256
/*
在太阳西斜的这个世界里
置身天上之森。
等这场战争结束之后
不归之人与望眼欲穿的众人
人人本着正义之名
长存不灭的过去
逐渐消逝的未来
我回来了
纵使日薄西山
即便看不到未来
此时此刻的光辉
盼君勿忘
*/

#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

long long a,b,c,d;

int main(){
    cin>>a>>b>>c>>d;
    if(a>=0) {
    	if(c>=0) cout<<b*d;
    	if(c<0 && d>=0) cout<<b*d;
    	if(d<0) cout<<a*d;
	}
	if(a<0 && b>=0) {
    	if(c>=0) cout<<b*d;
    	if(c<0 && d>=0) cout<<max(a*c,b*d);
    	if(d<0) cout<<a*c;
	}
	if(b<0) {
    	if(c>=0) cout<<b*c;
    	if(c<0 && d>=0) cout<<a*c;
    	if(d<0) cout<<a*c;		
	}
	return 0;
}

Measured memory_bytes: 3672
-- Your code here!
import Control.Monad
import Data.Bits

calc :: [[Int]] -> [Int] -> [Int] -> Int
calc ks ps ns = length . filter (==True) $ map allOk ns 
  where
    allOk n = all (\(k,p) -> calc' k p n) (zip ks ps)


calc' :: [Int] -> Int -> Int -> Bool
calc' k p n = jdg
  where 
    ct = length . filter (==1) $ map (\e -> (.&.) (shift n (1-e)) 1 ) k
    jdg = if ct`mod`2 == p then True else False
    

main = do
  [n,m] <- map read . words <$> getLine
  k <- replicateM m $ tail . map read . words <$> getLine :: IO [[Int]]
  p <- map read . words <$> getLine :: IO [Int]
  let ans = calc k p [0..2^n-1]
  print ans

Measured memory_bytes: 892
var
  n,k,i,ans:longint;
  a:array[0..100000]of longint;
Procedure qs(l,r:longint);
var
  i,j,t,mid:longint;
begin
   i:=l;j:=r;mid:=a[(l+r)div 2];
   repeat
     while a[i]<mid do inc(i);
     while a[j]>mid do dec(j);
     if i<=j then
       begin
         t:=a[i];a[i]:=a[j];a[j]:=t;
         inc(i);dec(j);
       end;
   until i>j;
   if l<j then qs(l,j);
   if i<r then qs(i,r);
end;
begin
  readln(n,k);
  for i:=1 to n do
    readln(a[i]);
  qs(1,n);
  ans:=a[n]-a[1];
  for i:=1 to n-k+1 do
    if a[i+k-1]-a[i]<ans then ans:=a[i+k-1]-a[i];
  write(ans);
end.


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

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;

typedef set<int>::iterator sit;
typedef map<int, int>::iterator mit;
typedef vector<int>::iterator vit;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define _ % MOD
#define __ %= MOD

#define each(it, s) for (auto it = s.begin(); it != s.end(); ++it)
#define sortA(v) sort(v.begin(), v.end())
#define sortD(v) sort(v.begin(), v.end(), greater<auto>())
#define fill(a) memset(a, 0, sizeof(a))

#define swap(a, b) \
   {               \
      a = a + b;   \
      b = a - b;   \
      a = a - b;   \
   }
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repA(i, a, n) for (ll i = a; i <= (n); ++i)
#define repD(i, a, n) for (ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) << endl

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define fbo find_by_order
#define ook order_of_key

#define pv(a)                               \
   {                                        \
      rep(i, a.size()) cout << a[i] << " "; \
      cout << endl;                         \
   }
#define mark(v) cout << "Here--" << v << endl;

const double EPS = (1e-7);
int dcmp(double x, double y) { return fabs(x - y) <= EPS ? 0 : x < y ? -1 : 1; }

ll gcd(ll a, ll b)
{
   if (b == 0)
      return a;
   else
      return gcd(b, a % b);
}
ll power(ll x, ll y)
{
   ll res = 1;
   while (y > 0)
   {
      if (y & 1)
         res = res * x;
      y = y >> 1;
      x = x * x;
   }
   return res;
} // modular exponent

int main()
{
   ios_base::sync_with_stdio(false); // don't use printf and scanf
   cin.tie(NULL);                    // cout<<fixed<<setprecision

   int n;
   cin >> n;
   vector<double> p(n);
   rep(i, n) cin >> p[i];
   vector<vector<double>> coins(n + 1, vector<double>(n + 1, 0));
   coins[0][0] = 1;
   repA(i, 1, n)
   {
      repA(j, 0, i)
      {
         if (j == 0)
         {
            coins[i][j] = coins[i - 1][j] * (1 - p[i - 1]);
         }
         else if (j > 0)
         {
            coins[i][j] = coins[i - 1][j] * (1 - p[i - 1]) + coins[i - 1][j - 1] * p[i - 1];
         }
      }
   }

   double res = 0;
   repA(i, (n + 1) / 2, n)
   {
      res += coins[n][i];
   }
   printf("%.10f\n", res);

   return 0;
}

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

int s,d;

void solve(){
	int ans=0;
	int now=s;

	do{
		int kisha=1<<29;
		while(1){
			if(now%kisha==0){
				if(now+kisha<=d){
					now+=kisha;
					break;
				}
			}
			kisha>>=1;
		}
		ans++;
	}while(now!=d);

	cout<<ans<<endl;
}

int main(){
	int n;
	cin>>n;
	while(n--){
		cin>>s>>d;
		solve();
	}
	return 0;
}

Measured memory_bytes: 3080
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,Q,K,A,B;
string S;
const ll MOD = 998244353;
//const ll MOD = (1e+9) + 7;
typedef pair<ll, ll> P;
const ll INF = (1LL<<62);

class mint{
    public:
        ll x;
        static unsigned long long mod;
        static unsigned long long mod_plus;
        mint(){x = 0;}
        mint(ll _x) : x((_x < 0 ? ((_x += mod_plus) < 0 ? _x + mod_plus : _x) : _x)%mod){}
        /*mint& operator=(const ll &a){
            x = a;
            return *this;
        }*/

        mint operator-(){
            return x == 0 ? 0 : mod - x;
        }
        mint& operator+=(const mint& a){
            if((x += a.x) >= mod) x -= mod;
            return *this;
        }
        mint operator+(const mint& a) const{
            mint res(*this);
            return res += a;
        }
        mint& operator-=(const mint& a){
            if((x -= a.x) < 0) x += mod;
            return *this;
        }
        mint operator-(const mint& a) const{
            mint res(*this);
            return res -= a;
        }
        mint& operator*=(const mint& a){
            (x *= a.x)%=mod;
            return *this;
        }
        /*mint& operator*=(const ll& a){
            mint temp(a);
            return *this *= temp;
        }*/
        mint operator*(const mint& a) const{
            mint res(*this);
            return res *= a;
        }
        /*mint operator*(const ll& a) const{
            mint res(*this);
            return res *= a;
        }*/
        mint pow(unsigned long long pw) const{
            mint res(1), comp(*this);
            while(pw){
                if(pw&1) res *= comp;
                comp *= comp;
                pw >>= 1;
            }
            return res;
        }
        //以下、modが素数のときのみ
        mint inv() const{
            mint res(*this);
            return res.pow(mod - 2);
        }
        mint& operator/=(const mint &a){
            (x *= a.inv().x)%=mod;
            return *this;
        }
        mint operator/(const mint &a) const{
            mint res(*this);
            return res /= a;
        }
};
ostream& operator<<(ostream& os, const mint& a){
    os << a.x;
    return os;
}
unsigned long long mint::mod = 998244353;
unsigned long long mint::mod_plus = (LLONG_MAX / mint::mod) * mint::mod;
typedef vector<mint> vm;

int main() {
    cin>>N>>K;
    vec a(N);
    rep(i,N) cin>>a[i];
    vector<vm> dp(N + 1, vm(K + 1, 0));
    dp[0][0] = 1;
    rep(i,N){
        rep(j ,K + 1){
            dp[i+1][j] += dp[i][j] * 2;
            if(j + a[i] <= K) dp[i+1][j + a[i]] += dp[i][j];
        }
    }
    cout<<dp[N][K]<<endl;
}

Measured memory_bytes: 73748
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
int diff[] = {1, 3, 4, 5};

int solve(vector<int> a){
    int res = 0;
    for(int i=0; i<(int)a.size(); i++){
        for(int d=0; d<4; d++){
            if(i%4==0 and diff[d]==3) continue;
            if(i%4==3 and (diff[d]==1 or diff[d]==5)) continue;
            if(i+diff[d] < (int)a.size() and a[i] == a[i+diff[d]]){
                auto b = a;
                b.erase(b.begin() +i+diff[d]);
                b.erase(b.begin() +i);
                res = max(res, solve(b) +2);
            }
        }     
    }
    return res;
}

int main(){
    int nt;
    cin >> nt;
    for(int rep=0; rep<nt; rep++){
        vector<int> a(20);
        for(int i=0; i<20; i++){
            cin >> a[i];
        }
        cout << 20 -solve(a) << endl;
    }
    return 0;
}


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

int main() {
  int a, b, t;

  while (true) {
    cin >> a >> b;
    if (a == 0 && b == 0) break;
    if (a > b) t = a, a = b, b = t;
    cout << a << " " << b << "\n";
  }
  cout << flush;

  return 0;
}
  

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
//-std=c++11
#define print(x) printf("%.12f",x);
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for(int i =0 ; i < n; ++i)
#define repr(i, n) for(int i=n-1;i>=0;i--)
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define Repr(i,a,b) for(int i=a;i>=b;i--)
#define pii pair < int, int >
#define iter ::iterator
#define forit(a) for(it=a.begin();it!=a.end();it++)
typedef vector<int> vi;
typedef  long long ll;
const int inf = int(1e9);
const int mod = 998244353;
const int N = (int)2e5 + 5;

ll f(ll n){
	if(n>0)n--;
	return n*(n+1)/2;
}

void solve(){
	ll n;
	cin>>n;
	ll a[n];
	map<ll,ll>m;
	vector<ll>v;
	rep(i,n){
		cin>>a[i];
		m[a[i]]++;
		if(m[a[i]]==1)v.pb(a[i]);
	}
	ll ans=0;
	rep(i,sz(v)){
		ans+=f(m[v[i]]);
	}
	// for(auto i:m){
	// 	cout<<i.F<<" "<<i.S<<endl;
	// }
	// cout<<"####"<<endl;
	rep(i,n){
		ll l=f(m[a[i]]-1);
		ll r=f(m[a[i]]);
		cout<<ans-r+l<<endl;
	}
	

}


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

Measured memory_bytes: 12020
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
const long long mod = 1000000007LL;

int main() {
  ll n, k;
  cin >> n >> k;
  vll p(n);
  rep(i,n) cin >> p[i];
  sort(p.begin(),p.end());
  ll ans = 0LL;
  rep(i,k) ans += p[i];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
import java.io.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;

class Room {
	int number, cost;

	Room(int number, int cost) {
		this.number = number;
		this.cost = cost;
	}
}

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Supplier<String> sc) {
		int N = Integer.parseInt(sc.get());
		int M = Integer.parseInt(sc.get());
		var rawRooms = new IntStream.Builder[N];
		Arrays.setAll(rawRooms, $ -> IntStream.builder());
		for (int i = 0; i < M; i++) {
			int A = Integer.parseInt(sc.get())-1;
			int B = Integer.parseInt(sc.get())-1;
			rawRooms[A].add(B);
			rawRooms[B].add(A);
		}

		var rooms = new int[N][];
		for (int i = 0; i < rooms.length; i++) {
			rooms[i] = rawRooms[i].build().toArray();
		}


		int[] result = new int[N];
		Arrays.fill(result, -1);

		var deque = new PriorityQueue<Room>(Comparator.comparingInt(r -> r.cost));
		deque.add(new Room(0, 0));
		while (!deque.isEmpty()) {
			Room room = deque.remove();
			int index = room.number;
			int cost = room.cost;
			for (int next : rooms[index]) {
				if (result[next] == -1) {
					result[next] = index;
					var nextRoom = new Room(next, cost + 1);
					deque.add(nextRoom);
				}
			}
		}

		System.out.println("Yes");
		var joiner = new StringJoiner("\n");
		for (int i = 1; i < result.length; i++) {
			joiner.add(String.valueOf(result[i] + 1));
		}
		System.out.println(joiner);
	}
}

class Main {
	public static void main(String... args) {
		var reader = new BufferedReader(new InputStreamReader(System.in));
		Solver.INSTANCE.solve(new Supplier<>() {
			StringTokenizer line;

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

Measured memory_bytes: 78844
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
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;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N;
    cin >>N;
    vector<ll> A(N);
    vector<ll> m(N+5);
    vector<ll> cm(N+5);
    rep(i,N){
        ll a;
        cin>>a;
        a--;
        A[i] = a;
        m[a]++;
    }
    ll sum = 0;
    rep(i,N){
        cm[i] = m[i]*(m[i]-1)/2;
        sum+=cm[i];
    }

    rep(i,N){
        cout << sum - m[A[i]]*(m[A[i]]-1)/2 + (m[A[i]]-2)*(m[A[i]]-1)/2 << endl;

    }
    


    return 0;
    

}

Measured memory_bytes: 7988
//In The Name Of God
#include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define L(x) (2*(x))
#define R(x) ((2*(x))+1)
#define pii pair<int, int>
#define pb push_back
using namespace std;
const int N = 3e3 + 5, Mod = 1e9 + 7, P = 727, Lg = 22, TOF = 1900, Inf = 3e18 + 10;

long long Dp[N][N], A[N];
int main(){
      ios_base::sync_with_stdio(0); cin.tie(0);
      int n; cin >> n;
      for(int i = 1; i <= n; i++)
            cin >> A[i];
      for(int i = 1; i <= n; i++)
            Dp[i][i] = A[i];
      for(int i = 2; i <= n; i++)
            for(int j = 1; j <= n - i + 1; j++)
                  Dp[j][j + i - 1] = max(-Dp[j][j + i - 2] + A[j + i - 1], -Dp[j + 1][j + i - 1] + A[j]);
      return cout << Dp[1][n], 0;
}



Measured memory_bytes: 70144
import math
 
N,M = map(int,input().split())
S = list(str(input()))
T = list(str(input()))
g = math.gcd(N,M)
gn,gm = N//g,M//g
for i in range(g):
  if S[i*gn] != T[i*gm]:
    print(-1)
    exit()

print(gn*gm*g)

Measured memory_bytes: 10328
N = int(input())

dp = [[0] * 9 for _ in range(9)]

for i in range(1, N+1):
  if i % 10 != 0:
    si = str(i)
    start = int(si[0])
    fin = int(si[-1])
    dp[start-2][fin-2] += 1

ans = 0
for i in range(9):
  for j in range(9):
    ans += dp[i][j] * dp[j][i]

print(ans)


Measured memory_bytes: 73808
from operator import itemgetter

N = int(input())

XYH = []

for i in range(N):
    tmp = list(map(int, input().split()))
    XYH.append(tmp)

XYH.sort(key=itemgetter(2))
XYH.reverse()

for i in range(101):
    for j in range(101):
        
        H = XYH[0][2]+abs(XYH[0][0]-i)+abs(XYH[0][1]-j)
        flag = 1
        
        for k in range(1, N):
            if not max(H-abs(XYH[k][0]-i)-abs(XYH[k][1]-j), 0) == XYH[k][2]:
                flag = -1
                break
        
        if flag > 0:
            break
    if flag > 0:
        break    

ans = str(i)+' '+str(j)+' '+str(H)
  
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String C1 = sc.next();
		String C2 = sc.next();
		String C3 = sc.next();

		System.out.println( ""+C1.charAt(0) + C2.charAt(1) + C3.charAt(2) );
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <climits>
#include <map>
#include <queue>

#define ll long long
#define MAX 25 * 1e13
#define N  200010

#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define EB(X) emplace_back(X)
#define REP(i,a) for(int i=0;i<(a);++i)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()
#define VI vector<int>;

using namespace std;
int MOD = 1000000007;
const int INF = 2e9;
  int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n,0);
  vector<int> has(1e6 + 1,0);
  int mina = 1e7;
  REP(i,n) {
    cin >> a[i];
    mina = min(mina,a[i]);
    has[a[i]]++;
  }

  int cnt = 0;
  const int maxa = 1000000;
  for(int i = mina; i <= maxa ; ++i) {
    int cu = i;
    if( has[cu] == 0 ) continue;
    if( has[cu] > 1 ) {
      for(int j = 2; j * cu <= maxa; ++j) {
        has[j*cu] = 0;
      }
      continue;
    }
    else if( has[cu] == 1) {
      cnt++;
      has[cu] = 0;
      for(int j = 2; j * cu <= 1e6; ++j) {
        has[j*cu] = 0;
      }
    }
  }

  cout << cnt << endl;
  return 0;
}


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

int tb[8][8] = 
{
	{0,0,0,0,0,0,0,0},
	{0,0,300,500,600,700,1350,1650},
	{0,6,0,350,450,600,1150,1500},
	{0,13,7,0,250,400,1000,1350},
	{0,18,12,5,0,250,850,1300},
	{0,23,17,10,5,0,600,1150},
	{0,43,37,30,25,20,0,500},
	{0,58,52,45,40,35,15,0}
};


int d,hd,md,a,ha,ma;

int to_m(int h,int m){
	return h * 60 + m;
}
bool time_ok(){
	int dt = to_m(hd,md);
	int at = to_m(ha,ma);
	int t1730 = to_m(17,30);
	int t1930 = to_m(19,30);
	return (dt >= t1730 && dt <= t1930) || (at >= t1730 && at <= t1930);
}
bool is_half(){
	return tb[a][d] <= 40 && time_ok();
}
int roundup(int f){
	int h = f % 50;
	if(h > 0){
		return f - h + 50;
	}
	else{
		return f;
	}
}
int fee(){
	return is_half() ? roundup(tb[d][a] / 2) : roundup(tb[d][a]);
}

int main(){
	while(cin >> d, d != 0){
		cin >> hd >> md >> a >> ha >> ma;
		cout << fee() << endl;
	}
	return 0;
}



Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
#define LINF LLONG_MAX/3
#define mp make_pair
#define pb push_back
#define EB emplace_back
#define fi first
#define se second
#define all(v) ALL(v)
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
constexpr double eps = 1e-14; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int N;
vvi G;

namespace TreeMatching{
    vector<vector<int>> g;
    vector<bool> matched;

    bool dfs(int cur,int pre){
        if(g[cur].size()==1 && pre!=-1){
            if(matched[pre]) return false;
            else{
                matched[pre] = matched[cur] = true;
                return true;
            }
        }

        for(int v : g[cur]) if(v != pre){
            if(!dfs(v,cur)) return false;
        }

        if(!matched[cur]){
            if(pre==-1 or matched[pre]) return false;
            else{
                matched[cur] = matched[pre] = true;
                return true;
            }
        }
        return true;
    }

    bool isPerfectMatching(const vector<vector<int>>& g_,int root=0){
        g = g_;
        matched = vector<bool>(g_.size());
        if(dfs(root,-1)){
            return true;
        }else{
            return false;
        }
    }
}



int main(){
    cin >> N;
    G = vvi(N,vi());
    rep(i,N-1){
        int a,b;
        cin >> a >> b;
        a--;b--;
        G[a].pb(b);
        G[b].pb(a);
    }
    
    bool f = TreeMatching::isPerfectMatching(G,0);

    if(f){
        cout << "Second" << endl;
    }else{
        cout << "First" << endl;
    }
}


Measured memory_bytes: 11392
#include <bits/stdc++.h>  // clang-format off
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (Int i = (a), lim##i = (b); i < lim##i; i++)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { std::cin.tie(nullptr), std::ios::sync_with_stdio(false), std::cout << std::fixed << std::setprecision(13); } } setup_io;
#ifndef dump
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sun May 31 22:01:10 JST 2020
 **/

signed main() {
    Int n;
    std::cin >> n;
    std::vector<Int> a(n), b(n);
    REP(i, n) std::cin >> a[i] >> b[i];
    std::sort(a.begin(), a.end());
    std::sort(b.begin(), b.end());
    Int ans = -1;
    if (n % 2) {
        ans = b[n / 2] - a[n / 2];
    } else {
        ans = (b[n / 2 - 1]  + b[n / 2]) - (a[n / 2 - 1] + a[n / 2]);
    }
    std::cout << ans + 1 << std::endl;
}


Measured memory_bytes: 6368
#ifndef LOCAL
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define sim template < class c
#define int long long
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << '\n'; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef tree< pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef long long ll;
const ll MOD = 1e9 + 7 ;
const ll N = 2e5 + 10 ;
const ll INF = 1e18 + 10 ;
int n , m ; 
vector<vector<int> > g ;
vector<vector<bool> > vis ;
int cnt = 0 ;
bool inRange(int x, int y){
    if ( x < 0 || x >= n ) return false ;
    if ( y < 0 || y >= m ) return false ;
    return true ;
}
int X[] = {0, 0, -1, 1} ;
int Y[] = {1,-1, 0, 0} ;
int black = 0 ; 
int white = 0 ;
void dfs(int x, int y, int px, int py){
    int cur = g[x][y] ;
    vis[x][y] = true ;
    if ( cur == 1 ) black++ ;
    else white++ ;
    for(int i = 0; i < 4; i++){
        int a = x + X[i] , b = y + Y[i] ;
        if ( not inRange(a, b) ) continue  ;
        if ( a == px && b == py ) continue ;
        if ( vis[a][b] ) continue ;
        if ( g[a][b] == cur ) continue ;
        dfs(a, b, x, y) ;
    }
}
signed main(){
    fastio
    cin >> n >> m ;
    g = vector<vector<int> >(n, vector<int>(m)) ;
    vis = vector<vector<bool> >(n, vector<bool>(m)) ;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            char c ;
            cin >> c ;
            if ( c == '#' ) g[i][j] = 1 ;
        }
    }
    int ans = 0 ;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            if ( not vis[i][j] ) {
                black = 0 ;
                white = 0 ;
                dfs(i , j, -1, -1) ;
                debug() << imie(cnt) ;
                ans += white * black ;
            }
        }
    }
    cout << ans << endl;
    return 0; 
}

// .#.
// ..#
// #..

// 4 3
// ###
// .##
// ...
// ###



Measured memory_bytes: 17116
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=1;i<=n;i++)
 
int main(void) {
  int n = 0;
  cin >> n;
  
  vector<int> prm;
  rep(i,n){
    prm.push_back(i);
  }
  
  int tmp = 0;
  vector<int> prm1;
  rep(i,n) {
    cin >> tmp;
    prm1.push_back(tmp);
  }
  
  vector<int> prm2;
  rep(i,n) {
    cin >> tmp;
    prm2.push_back(tmp);
  }
  
  int cnt = 0,a=0,b=0;
  do {
        if(prm1 == prm){
          a = cnt+1;
        }
        if(prm2 == prm){
          b = cnt+1;
        }
        cnt++;
    }
  while (next_permutation(prm.begin(), prm.end()));
  
  cout << abs(a-b) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

int n;

void dfs(vector<int>& v, int max)
{
    int siz = (int)v.size();
    if (siz == n) {
        vector<char> s;
        int i;
        for (i = 0; i < n; i++) {
            s.push_back('a' + v[i]);
        }
        s.push_back('\0');
        printf("%s\n", &s[0]);
        return;
    }
    int i;
    for (i = 0; i <= max + 1; i++) {
        v.push_back(i);
        int max2 = MAX(max, i);
        dfs(v, max2);
        v.pop_back();
    }
    return;
}

void solve()
{
    scanf("%d", &n);
    int i;
    vector<int> v;
    v.push_back(0);
    dfs(v, 0);

    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 1536
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <array>
#include <initializer_list>
#include <random>
#include <regex>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <cassert>
using namespace std;

char s[222222];
int dat[222222];
int vis[222222];
map<int, vector<int>> pos;
map<int, vector<int>> parent;

int getparent(vector<int> &vt, int t)
{
    return vt[t] == t ? t : vt[t] = getparent(vt, vt[t]);
}

void merge(vector<int> &vt, int a, int b)
{
    a = getparent(vt, a);
    b = getparent(vt, b);
    vt[min(a, b)] = max(a, b);
}

int main()
{
    scanf("%s", s + 1);

    int len = strlen(s + 1);

    pos[0].push_back(0);

    for (int i = 1; i <= len; i++)
    {
        dat[i] = dat[i - 1] ^ (1 << (s[i] - 'a'));
        pos[dat[i]].push_back(i);
    }

    for (auto &e : pos)
    {
        parent[e.first].resize(e.second.size() + 1);
        for (int j = 0; j <= e.second.size(); j++) parent[e.first][j] = j;
    }

    queue<int> que;

    for (int x : pos[0])
    {
        vis[x] = 1;
        que.push(x);
    }

    for (int i = 0; i < 26; i++)
    {
        if (pos.count(1 << i) == 0) continue;
        for (int x : pos[1 << i])
        {
            vis[x] = 1;
            que.push(x);
        }
    }

    while (que.empty() == false)
    {
        int x = que.front(); que.pop();

        for (int i = 0; i < 26; i++)
        {
            int nxt = dat[x] ^ (1 << i);
            if (pos.count(nxt) == 0) continue;

            int p = upper_bound(pos[nxt].begin(), pos[nxt].end(), x) - pos[nxt].begin();

            for (p = getparent(parent[nxt], p); p < pos[nxt].size(); merge(parent[nxt], p, p + 1), p = getparent(parent[nxt], p))
            {
                int y = pos[nxt][p];
                if (vis[y] == 0)
                {
                    vis[y] = vis[x] + 1;
                    que.push(y);
                }
            }
        }
    }

    printf("%d\n", vis[len]);
}


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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n,c;
int a[525];
int b[525];

ll dp[525][525];

ll powmod(ll a,ll b,const ll m){
  ll r = 1;
  while(b){
    if(b&1)r=r*a%m;
    a=a*a%m;
    b>>=1;
  }
  return r;
}

int main(){
  scanf("%d%d",&n,&c);
  REP(i,n)scanf("%d",a+i);
  REP(i,n)scanf("%d",b+i);
  // O(NCmax{b-a})
  dp[0][c] = 1;
  REP(i,n){
    FOR(x,a[i],b[i]+1){
      ll sum = 0;
      FORR(y,0,c+1){
        sum *= x;
        sum += dp[i][y];
        sum %= MOD;
        dp[i+1][y] += sum;
        dp[i+1][y] %= MOD;
      }
    }
  }
  printf("%lld\n",dp[n][0]);
  return 0;
}


Measured memory_bytes: 1920
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;
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; }

struct TopologicalSort{
    vector<vll> G; //* DAG
    TopologicalSort(ll N){ G.resize(N); }
    void add_edge(ll a, ll b) { G[a].push_back(b); }
    bool visit_by_dfs(vll &order, vll &color, ll v) {
        //* color[v] meaning: 0: unvisited, 1: pre-visit, 2: post-visit
        //! return false if this graph has a cycle
        color[v] = 1; //* pre-visit this vertex
        for(auto u: G[v]) {
            if(color[u] == 2) continue; //* this vertex is done (already put in order)
            if(color[u] == 1) return false; //* re-visit this vertex means a cycle
            if(!visit_by_dfs( order, color, u)) return false; //* a cycle detected further
        }
        order.push_back(v);
        color[v] = 2;
        return true;
    }
    bool sort(vll &order) {
        //! return false if this graph has a cycle
        ll n = G.size();
        vll color(n, 0);
        REP(u, n) if( !color[u] && !visit_by_dfs(order, color, u)) return false;   
        reverse(order.begin(), order.end()); 
        return true;
    }
};

int main(){
    ll N, M; cin >> N >> M;
    TopologicalSort st(N);
    REP(_, M){
        ll u, v; cin >> u >> v;
        st.add_edge(u, v);
    }
    vll order;
    st.sort(order);
    REP(i, N) cout<< order[i] << endl;
    return 0;
}



Measured memory_bytes: 3932
a = []
for i in range(3):
    a.append([int(x) for x in input().split()])
bing = [[0]*3,[0]*3,[0]*3]

N=int(input())
bs = [int(input()) for _ in range(N)]

for b in bs:
    for i in range(3):
        for j in range(3):
            if a[i][j]==b:
                bing[i][j]=1



def isbingo(board):
    for i in range(3):
        if sum(board[i])==3:
            return True
    for j in range(3):
        if sum([board[i][j] for i in range(3)])==3:
            return True
    if sum([board[0][0],board[1][1],board[2][2]])==3:
        return True
    if sum([board[0][2],board[1][1],board[2][0]])==3:
        return True
    return False
print('Yes'if isbingo(bing) else 'No')

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <unordered_map> 
#include <map>
#include <math.h>
#include <algorithm>
#include <stdio.h>
#include <string>
using namespace std;

int main(){
  int a,b;
  cin >> a >> b;
  int A = 0,B = 0;
  string AA,BB;
  for(int i=0;i<b;i++){
    A += a * pow(10,i);
  }

  for(int i=0;i<a;i++){
    B += b * pow(10,i);
  }
  AA = to_string(A);
  BB = to_string(B);
  if(AA < BB) cout << A << endl;
  else cout << B << endl;
  
  return 0;
  }


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

using namespace std;

int main() {
  string s, t;
  cin >> s >> t;

  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  reverse(t.begin(), t.end());

  if (s < t) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import scala.io.StdIn.readLine

object Main extends App {
  def calc(op:String,x:Int,y:Int) = {
    op match {
      case "+" => x+y
      case "-" => x-y
      case "*" => x*y
    }
  }

  val l = readLine.split(" ").toList

  def revP(l:List[String],stack:List[Int]):Int =  {
    l match {
      case Nil => stack(0)
      case hd::tl =>
        val stack2 =
          if(hd.forall(_.isDigit)) hd.toInt::stack
          else {
            val x::y::tail = stack
            calc(hd,y,x)::tail
          }
        revP(tl,stack2)
    }
  }

  println(revP(l,Nil))

}

Measured memory_bytes: 43684
#include<bits/stdc++.h>
#define N 2005
#define oo 0x7fffffff
#define ll_inf 0x7fffffffffffffff
#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 ren(i,n) for(int i=0;i<(n);i++)
#define abs(x,y) ((x)>(y)?(x)-(y):(y)-(x))
#define fi first
#define se second
#define pb push_back

using namespace std;

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


ll n,m,k,nn;
ll dap;
ll a,b,c;


int main(void){
	ll x=0,y,z;
	double xx,yy;
	//freopen("in.txt","r",stdin);
	scanf("%lld %lld %lld",&a,&b,&c);
/*	xx=(double)4*a*b;
	yy=(double)c-(double)(a+b);
	yy=yy*yy;*/

	x=4*a*b;
	y=c-(a+b);
	if(y<0){
		printf("No");
		return 0;
	}
	y*=y;


	//printf("%s",xx<yy?"Yes":"No");
	printf("%s",x<y?"Yes":"No");

	return 0;
}


Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
li = [a,b,c,d,e]

for i in range(len(li)):
    if li[i]%10 != 0:
        if li[i]%10 == min([x%10 if x%10 != 0 else 10 for x in li]):
            N = i+0
            break
else:
    N = 0


for j in range(len(li)):
    if j == N:
        continue
    elif li[j]%10 != 0:
        li[j] += 10 - li[j]%10

print(sum(li))


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef pair<ll,ll> pairs;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 1000100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    ll a,b,k;
    cin >> a >> b >> k;
    for (ll i=0;i<k;i++){
        if (i%2==0){
            b+=a/2;
            a/=2;
        }else{
            a+=b/2;
            b/=2;
        }
    }
    cout << a << " " << b << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
txy = [[0, 0, 0]]
txy.extend([list(map(int, input().split())) for i in range(N)])

for i in range(N):
    time = txy[i + 1][0] - txy[i][0]
    length = abs(txy[i + 1][1] - txy[i][1]) + abs(txy[i + 1][2] - txy[i][2])
    if time >= length and time % 2 == length % 2:
        continue
    else:
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 28148
fn main() {
    let s: String = read();
    let s: Vec<char> = s.chars().collect();
    let mut n = s.len() / 2 - 1;
    while n > 0 {
        let front = &s[0..n];
        let back = &s[n..2*n];
        if front == back {
            println!("{}", n*2);
            break;
        } else {
            n -= 1;
        }
    }
}

// 以下関数


use std::io::*;
use std::str::FromStr;
pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

pub const MOD: u64 = 1_000_000_007;

pub fn is_prime(n: i32) -> bool {
    if n < 2 {
        return false;
    } else if n == 2 {
        return true;
    }
    let mut i = 2;
    while i * i < n {
        if n % i == 0 {
            return false;
        } else {
            i += 1;
            continue;
        }
    }
    true
}

pub fn lcm(mut n: i32, mut m: i32) -> i32 {
    n = if n > m { m } else { n };
    m = if n > m { n } else { m };
    let mut i = n;
    while i % m != 0 {
        i += n;
    }
    i
}

pub fn abs(n: i32) -> i32 {
    if n >= 0 {
        n
    } else {
        -n
    }
}

pub fn max(n: i32, m: i32) -> i32 {
    if n >= m {
        n
    } else {
        m
    }
}

pub fn min(n: i32, m: i32) -> i32 {
    if n <= m {
        n
    } else {
        m
    }
}

pub fn factorial(n: u32) -> u32 {
    if n == 0 {
        return 1
    }
    let mut r = n;
    for i in 0..n-1{
        r *= n-i-1;
    }
    r
}

pub fn combination(n: u32, m: u32) -> u32 {
    factorial(n) / factorial(m) / factorial(n-m)
}

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

int h, w, m;
int cnt_row[300005];
int cnt_col[300005];
vector<pair<int, int>> v;
vector<pair<int, int>> v_row;
vector<pair<int, int>> v_col;
bool check_row[300005];
bool check_col[300005];

int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	cin >> h >> w >> m;
	v.resize(m);
	for (auto &i : v) {
		cin >> i.first >> i.second;
		cnt_row[i.first]++;
		cnt_col[i.second]++;
	}
	sort(v.begin(), v.end());
	for (int i = 1; i <= h; i++) {
		v_row.emplace_back(cnt_row[i], i);
	}
	for (int i = 1; i <= w; i++) {
		v_col.emplace_back(cnt_col[i], i);
	}
	sort(v_row.rbegin(), v_row.rend());
	sort(v_col.rbegin(), v_col.rend());
	
	int n_row = v_row.front().first;
	int n_col = v_col.front().first;

	vector<int> vv_row;
	vector<int> vv_col;

	ll n_all = 0;
	ll n_chk_row = 0;
	ll n_chk_col = 0;
	for (auto i : v_row) {
		if (i.first != n_row) break;
		// vv_row.push_back(i.second);
		check_row[i.second] = true;
		n_chk_row++;
	}

	for (auto i : v_col) {
		if (i.first != n_col) break;
		// vv_col.push_back(i.second);
		check_col[i.second] = true;
		n_chk_col++;
	}

	for (auto i : v) {
		if (check_row[i.first] && check_col[i.second]) n_all++;
	}

	// for (auto i : vv_row) {
	// 	for (auto j : vv_col) {
	// 		if (!binary_search(v.begin(), v.end(), make_pair(i.second, j.second))) {
	// 			cout << n_row + n_col << endl;
	// 			return 0;
	// 		}
	// 	}
	// }

	cout << n_row + n_col - (n_all == n_chk_row * n_chk_col) << endl;
}

Measured memory_bytes: 16216
import sys
def m(L,R):
 global c
 T=[];i=j=0
 for _ in L[:-1]+R[:-1]:
  if L[i]<R[j]:T+=[L[i]];i+=1
  else:T+=[R[j]];j+=1
  c+=1
 return T
def d(A):s=len(A)//2;return m(d(A[:s])+[1e9],d(A[s:])+[1e9]) if len(A)>1 else A
c=0
input()
print(*d(list(map(int,sys.stdin.readline().split()))))
print(c)


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

int main() {
  int D, N;
  cin >> D >> N;
  if (N != 100) {
    cout << N * pow(100, D);
  }
  else {
    if (D == 0 || D == 1) {
      cout << 101 * pow(100, D);
    }
    else {
      cout << 1010000;
    }
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
	int n;
	int a[4]={0};
	string type;
	while(cin>>n){
		cin.ignore();
		cin>>type;
		if(type=="A")a[0]++;
		else if(type=="B")a[1]++;
		else if(type=="AB")a[2]++;
		else if(type=="O")a[3]++;
	}
	for(int i=0;i<4;i++)cout<<a[i]<<endl;
	return 0;
}

Measured memory_bytes: 1204