akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<ll> heights(N);
    for (int i = 0; i < N; i++)
    {
        cin >> heights.at(i);
    }
    ll answer = 0;
    while (true)
    {
        ll count = 0;
        bool isPrevZero = true;
        for (int i = 0; i < N; i++)
        {
            if (heights.at(i) > 0)
            {
                if (isPrevZero)
                {
                    count++;
                    isPrevZero = false;
                }
                heights.at(i)--;
            }
            else
            {
                isPrevZero = true;
            }
        }
        if(count == 0)
        {
            break;
        }
        answer += count;
    }
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 256
import math
 
prime = [0 for i in range(11000)]
k = 0
r = 105000
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        prime[k] = i+1
        k += 1
        l = i
        for j in range(2*i+1,r,i+1):
            p[j] = 0


for i in range(l+1,r):
    if p[i]:
        prime[k] = i+1
        k += 1
        
while True:
    n = int(raw_input())
    if not n:
        break
    print sum(prime[:n])

Measured memory_bytes: 8644
//https://atcoder.jp/contests/abc126/tasks/abc126_d
//D - Even Relation
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
template< typename T >
struct edge {
	int src, to;
	T cost;
	edge(int _to, T _cost) : src(-1), to(_to), cost(_cost) {}
	edge(int _src, int _to, T _cost) : src(_src), to(_to), cost(_cost) {}
	edge &operator=(const int &x) {
		to = x;
		return *this;
	}
	operator int() const { return to; }
};

template< typename T>
struct node {
	vector<edge<T>> edges;
    ll color=-1;
};

template< typename T >
using Edges = vector< edge< T > >;
template< typename T >
using WeightedGraph = vector< node< T > >;
using UnWeightedGraph = vector< vector< int > >;
template< typename T >
using Matrix = vector< vector< T > >;

int main() {
    ll N; cin>>N;
    WeightedGraph<ll> graph(N+1); //木
    REP(e,N){
        ll u,v,w; cin>>u>>v>>w;
        graph.at(u).edges.emplace_back(v,w);
        graph.at(v).edges.emplace_back(u,w);
    }
    graph.at(1).color=0;
    function<void(ll)> dfs = [&](ll n){
        auto& nd=graph.at(n);
        for(auto e: nd.edges){
            auto& nx = graph.at(e.to);
            if(nx.color != -1) continue;
            nx.color = e.cost%2==0?nd.color:(nd.color+1)&1;
            dfs(e.to);
        }        
    };
    dfs(1);
    FOR(i,1,N+1){
        cout<<graph.at(i).color<<endl;
    }
    return 0;
}

Measured memory_bytes: 10752
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N = int(input())

MOD = int(1e9) + 7
a = 1
for i in range(1, N + 1):
    a = a * i % MOD

print(a)

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  int n;cin>>n;
  vector<int> d(n), d1, d2;
  map<int, int> m;
  rep(i, n){
    cin>>d[i];
    m[ d[i] ]++;
  }

  if(n==1) { cout << d[0] << endl; return 0; }

  for(auto p:m)if(p.second>2) { cout<< 0 <<endl; return 0; }

  for(auto p:m){
    if(p.second==2){
      d2.push_back( p.first );
      d2.push_back( 24-p.first );
    }else{
      d1.push_back(p.first);
    }
  }

  int result=0;
  rep( s, 1<<d1.size() ){
    int c = 0;
    vector<int> times({0, 24});
    rep(i, d1.size()){
      if(s & 1<<i)times.push_back( 24-d1[i] );
      else times.push_back( d1[i] );
    }

    for(auto p:d2)times.push_back(p);

    int t = 24;
    sort(times.begin(), times.end());
    rep(i, times.size()-1) t = min(t, times[i+1] - times[i] );
    result = max(result, t);
  }

  cout<<result<<endl;

  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
	static final int K = 10000;
	public static void main(String[] args) throws NumberFormatException, IOException {
		
		//System.setIn(new FileInputStream("./ALDS1_6_A-in8.txt"));
		/*BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		*/
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		
		int[] c = new int[K + 1];
		//int[] a = new int[n+1];
		//String[] l = br.readLine().split(" ");
		for(int i = 0; i < n; ++i) {
			//a[i] = Integer.parseInt(l[i]);
			//a[i] = Integer.parseInt(sc.next());
			//c[a[i]] += 1;
			c[Integer.parseInt(sc.next())] += 1;
		}
		sc.close();
		
		/*for(int i = 1; i <= MAX_A_I; ++i) {
			c[i] += c[i-1];
		}*/
		/*
		int[] b = new int[n+1];
		for(int i = n - 1; i >= 0; --i){
			//System.out.println(i + " " + a[i] + " " + c[a[i]]);
			b[c[a[i]] - 1] = a[i];
			c[a[i]] -=  1;
		}
		*/
		StringBuilder sb = new StringBuilder();//10*n);
		//long start = System.nanoTime();
		/*for(int i= 0; i < n; ++i) {
			sb.append(b[i] + " ");
		}*/
		for(int i = 0; i <= K; ++i) {
			while(c[i] > 0){
				sb.append(i);
				sb.append(" ");
				c[i] -= 1;
			}
		}
		sb.deleteCharAt(sb.length() - 1);
		System.out.println(sb);
		//System.out.println((System.nanoTime() - start)/1000/1000 + " ms");
	}

}

Measured memory_bytes: 182652
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void solve(){
    string s;
    getline(cin, s);
    for(int i = 0; i < (int)s.length(); i++){
	  if (s[i] >= 'a' && s[i] <= 'z') s[i] += 'A' - 'a';	
	}
  cout << s << endl;
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}



Measured memory_bytes: 3080
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <utility>

using namespace std;

#define ll long long

ll H, W;
vector<vector<char>> S;
vector<vector<ll>> C;
void solve()
{
    cin >> H >> W;
    S = vector<vector<char>>(H, vector<char>(W));
    C = vector<vector<ll>>(H, vector<ll>(W, -1));
    for (ll i = 0; i < H; i++)
    {
        for (ll j = 0; j < W; j++)
        {
            cin >> S.at(i).at(j);
        }
    }
    vector<pair<ll, ll>> delta = {
        make_pair(0, 1),
        make_pair(1, 0),
        make_pair(0, -1),
        make_pair(-1, 0)};
    ll maxCost = 0;
    for (ll gx = 0; gx < H; gx++)
    {
        for (ll gy = 0; gy < W; gy++)
        {
            if (S.at(gx).at(gy) == '#')
            {
                continue;
            }

            C = vector<vector<ll>>(H, vector<ll>(W, -1));
            queue<pair<ll, ll>> que;
            que.push(make_pair(gx, gy));
            bool isStart = false;
            C.at(gx).at(gy) = 0;
            ll cost = 0;
            while (!que.empty())
            {
                auto fr = que.front();
                que.pop();
                ll nx = fr.first;
                ll ny = fr.second;
                for (ll ix = 0; ix < 4; ix++)
                {
                    ll dx = nx + delta.at(ix).first;
                    ll dy = ny + delta.at(ix).second;
                    if (0 <= dx && dx < H && 0 <= dy && dy < W)
                    {
                        char s = S.at(dx).at(dy);
                        if (s != '#' && C.at(dx).at(dy) == -1)
                        {
                            que.push(make_pair(dx, dy));
                            C.at(dx).at(dy) = C.at(nx).at(ny) + 1;
                            cost = C.at(dx).at(dy);
                        }
                    }
                }
            }

            maxCost = max(maxCost, cost);
        }
    }

    cout << maxCost << endl;

    // // 400 * 400 = 160000通りのスタートとゴールが設定できる
    // for (int i = 0; i < H; i++)
    // {
    //     for (int j = 0; j < W; j++)
    //     {
    //         cout << C.at(i).at(j);
    //     }
    //     cout << endl;
    // }

    return;
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    string s;
    cin >> s;
    ll b = 0;
    ll w = 0;
    ll ans = 0;
    REPS(c, s) {
        if (c == 'B') b++;
        else ans += b;
    }
    cout << ans << endl;
}


Measured memory_bytes: 720
A, B, C, X, Y = map(int,input().split())

ans = 0

ab_total =  (C*2) * max(X,Y)

if C*2 < A+B:
    ans += min(X,Y) * (C*2)
    if X > Y:
        ans += (X - Y) * A
    else:
        ans += (Y - X)  * B
else:
    ans = A*X + B*Y

if ab_total < ans:
    print(ab_total)
else:
    print(ans)


Measured memory_bytes: 8976
#include<iostream>
#include<algorithm>
using  namespace  std;
int  main (){
int  d[10];
for(int  i = 1;  i<= 4;  i++)d[i] = 0;
for(int  i = 0;  i<6;  i++){
int  z;
scanf("%d" , &z );
d[z]++;
}
if(d[1]>=3 || d[2]>=3 || d[3]>=3 || d[4]>=3) printf("NO\n");
else printf("YES\n" );
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<V>;
using VVV = vector<VV>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VVVL = vector<VVL>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
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; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
int main() {
	int h1, m1, h2, m2, k;
	cin >> h1 >> m1 >> h2 >> m2 >> k;
	int dist = (h2 - h1) * 60 + m2 - m1;
	cout << max(dist - k, 0) << endl;
	return 0;
}

Measured memory_bytes: 3620
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		long N = long.Parse(Console.ReadLine());
		long ans = 9999999999999999;
		var list = enum_div(N);
		for(var i=0;i<list.Count;i++){
			long n1 = list[i];
			long n2 = N/list[i];
			ans = Math.Min(ans,n1-1+n2-1);
		}
		Console.WriteLine(ans);
	}
	
	public static List<long> enum_div(long n){
		long tmp = n;
		var list = new List<long>();
		for(long i=1;i*i<=n;i++){
			if(n%i==0){
				list.Add(i);
				if(i*i!=n){
					list.Add(n/i);
				}
			}
		}
		return list;
	}
}

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

bitset<5001> leftsum[5002], rightsum[5002];
int dat[5002];

int main()
{
	int n, k;
	scanf("%d%d", &n, &k);
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", &dat[i]);
		if (dat[i] > k) dat[i] = k;
	}

	leftsum[0][0] = true;

	for (int i = 1; i <= n; i++)
	{
		leftsum[i] = leftsum[i - 1] | (leftsum[i - 1] << dat[i]);
	}

	rightsum[n + 1][0] = true;
	for (int i = n; i >= 1; i--)
	{
		rightsum[i] = rightsum[i + 1] | (rightsum[i + 1] << dat[i]);
	}

	int ans = 0;

	for (int i = 1; i <= n; i++)
	{
		vector<int> l, r;
		for (int j = k; j >= 0; j--) if (leftsum[i - 1][j]) l.push_back(j);
		for (int j = 0; j <= k; j++) if (rightsum[i + 1][j]) r.push_back(j);

		int p1 = 0, p2 = 0;
		for (int t : l)
		{
			while (p1 < r.size() && r[p1] < k - dat[i] - t) p1++;
			while (p2 < r.size() && r[p2] < k - t) p2++;
			if (p1 < p2)
			{
				++ans;
				break;
			}
		}
	}

	printf("%d\n", n - ans);
}


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


int main() {
  int N,l;
  cin >> N >> l;
  vector<string>bun(N);
  for (auto &i : bun)
    cin >> i;
  sort(bun.begin(),bun.end());
  
  string s;
  for (int i=0; i<N; i++)
    s += bun.at(i);
  cout << s;
    
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
const int N=3007;
int n,a[N];
std::vector<int>e[N];
int v1[N];
void f1(int w,int pa){
	v1[w]=0;
	for(int i=0;i<e[w].size();++i){
		int u=e[w][i];
		if(u==pa)continue;
		f1(u,w);
		v1[w]|=a[w]>a[u]&&!v1[u];
	}
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%d",a+i);
	for(int i=1,x,y;i<n;++i){
		scanf("%d%d",&x,&y);
		e[x].push_back(y);
		e[y].push_back(x);
	}
	for(int i=1;i<=n;++i){
		f1(i,0);
		if(v1[i])printf("%d ",i);
	}
	return 0;
}

Measured memory_bytes: 640
/*  Author:  Hariom_Pandey
    Created: 2/9/2020 5:27:57 PM
*/
 
#include "bits/stdc++.h"
using namespace std;

#define ll              long long int
int32_t main(){
    string str,str2,str3;
    int num, snum;
    cin>>str >>str2;
    cin>>num >>snum;
    cin>>str3;
    if(str3==str) cout<<num-1<<" "<<snum<<"\n";
    else cout<<num<<" "<<snum-1<<"\n";

   
   
}





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

#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i,a) for (auto i = rbegin(a); i != rend(a); ++i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
using namespace std;
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
ll mod = static_cast<ll>(1e9 + 7);
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr void mins(T& a, Args... args) { a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr void maxs(T& a, Args... args) { a = max<T>({ a,args... }); }
template<class A, int N, class T>
void fillArray(A(&array)[N], const T& val) { std::fill((T*)array, (T*)(array + N), val); }

template<class T>
struct ModInt {
    T x;
    ModInt(T x = 0) :x((x + mod) % mod) {}
    ModInt& operator+=(const ModInt a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    ModInt& operator-=(const ModInt a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    ModInt& operator*=(const ModInt a) {
        (x *= a.x) %= mod;
        return *this;
    }
    ModInt operator+(const ModInt a) const {
        ModInt res(*this);
        return res += a;
    }
    ModInt operator-(const ModInt a) const {
        ModInt res(*this);
        return res -= a;
    }
    ModInt operator*(const ModInt a) const {
        ModInt res(*this);
        return res *= a;
    }
    ModInt pow(T t) const {
        if (!t) return 1;
        ModInt a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    ModInt inv() const {
        return pow(mod - 2);
    }
    ModInt& operator/=(const ModInt a) {
        return (*this) *= a.inv();
    }
    ModInt operator/(const ModInt a) const {
        ModInt res(*this);
        return res /= a;
    }
};
using mint = ModInt<long long>;


int n, k;
int a[105];
mint dp[105][100005];
void solve() {
    cin >> n >> k;
    rep(i, n) cin >> a[i];

    dp[0][0] = 1;
    rep(i, n) {
        vector<mint> v(k + 1);
        mint res = 0;
        rep(j, k + 1) {
            res += v[j] + dp[i][j];
            dp[i + 1][j] = res;
            if (j + a[i] + 1 <= k) v[j + a[i] + 1] -= dp[i][j];
        }
    }
    cout << dp[n][k].x << endl;
}

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


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

int main(){
  string s;
  cin >> s;
  bool ans = true;
  if(s.length() % 2 != 0) ans = false;
  for(size_t i = 0; i < s.length(); i++){
	if(s[i] != ((i%2 == 0) ? 'h' : 'i'))
      ans = false;
  }
  cout << (ans ? "Yes" : "No") << endl;
  return 0;
}

Measured memory_bytes: 256
// D - Lucky PIN
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define all(x) (x).begin(),(x).end()
#define ubound(x,c) upper_bound(all(x),(c))-(x).begin()

int main(){
	int N; string S; cin>>N>>S;
	vector<int> ix[10]; rp(i, 0, N) ix[S[i]-'0'].push_back(i);
	int p,q,ans = 0;
	rp(a, 0, 10){
		if((p = ubound(ix[a], -1)) >= ix[a].size()) continue;
		rp(b, 0, 10){
			if((q = ubound(ix[b], ix[a][p])) >= ix[b].size()) continue;
			rp(c, 0, 10) if(ubound(ix[c], ix[b][q]) < ix[c].size()) ans++;
		}
	}
	cout<< ans <<endl;
}

Measured memory_bytes: 512
import java.util.*;

class Main {
    // ABC152
    static final long MOD = 1_000_000_007;
    //10^9+7
    static final int MAX = 2_147_483_646;
    //intの最大値
    static final int INF = 1_000_000_000;
    //10^9
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        if(n < m){
            for(int i = 0;i < m;i++){
                System.out.print(n);
            }
        }else{
            for(int i = 0;i < n;i++){
                System.out.print(m);
            }
        }

    }
}


Measured memory_bytes: 20564
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;

void dfs(const vector<vector<int>> &g, int x, vector<int> &v)
{
	if (v[x] != 0) {
		return;
	}
	v[x] = 1;
	for (int y : g[x]) {
		dfs(g, y, v);
	}
}

int count_island(const vector<vector<int>> &g)
{
	const int N = g.size();
	vector<int> v(N, 0);

	int ans = 0;
	for (int i = 0; i < N; ++i) {
		if (v[i] == 0) {
			dfs(g, i, v);
			++ans;
		}
	}
	return ans;
}

template <typename C, typename T>
void remove_erase(C &c, const T &x)
{
	c.erase(remove(c.begin(), c.end(), x), c.end());
}

void remove_edge(vector<vector<int>> &g, int i, int j)
{
	remove_erase(g[i], j);
	remove_erase(g[j], i);
}

void add_edge(vector<vector<int>> &g, int i, int j)
{
	g[i].push_back(j);
	g[j].push_back(i);
}

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

	vector<vector<int>> g(N);
	for (int i = 0; i < M; ++i) {
		int a, b;
		cin >> a >> b;
		--a;
		--b;
		add_edge(g, a, b);
	}

	int ans = 0;
	for (int i = 0; i < N; ++i) {
		for (auto j : g[i]) {
			if (i < j) {
				auto g2 = g;
				remove_edge(g2, i, j);
				if (count_island(g2) > 1) {
					++ans;
				}
			}
		}
	}

	cout << ans << endl;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000

#define FROM 305
#define TO 305
#define COST 1e17
vector<vector<ll>> d(FROM, vector<ll>(TO, COST));
void warshall_floyd(ll n) {
	rep1(k, n) {			// 経由する頂点
		rep1(i, n) {		// 始点
			rep1(j, n) {	// 終点
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
}

vector<vector<ll>> e(FROM, vector<ll>(TO, COST));
void warshall_floyd2(ll n) {
	rep1(k, n) {			// 経由する頂点
		rep1(i, n) {		// 始点
			rep1(j, n) {	// 終点
				e[i][j] = min(e[i][j], e[i][k] + e[k][j]);
			}
		}
	}
}

void solve_abc_e() {
	ll n, m, l;
	cin >> n >> m >> l;

	rep1(i, n) {
		rep1(j, n) {
			d[i][j] = COST;
			e[i][j] = COST;
		}
		d[i][i] = 0;
		e[i][i] = 0;
	}

	ll a, b, c;
	rep(i, m) {
		cin >> a >> b >> c;
		d[a][b] = min(d[a][b], c);
		d[b][a] = min(d[b][a], c);
	}

	warshall_floyd(n);

	rep1(i, n) {
		rep1(j, n) {
			if (i != j) {
				if (d[i][j] <= l) {
					e[i][j] = 1;
				}
			}
		}
	}
	warshall_floyd2(n);

	ll q;
	cin >> q;
	
	V s(q), t(q);
	rep(i, q) {
		cin >> s[i] >> t[i];
	}

	rep(i, q) {
		if (e[s[i]][t[i]] < COST) {
			cout << e[s[i]][t[i]] - 1 << "\n";
		}
		else {
			cout << -1 << "\n";
		}
	}
}

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

	solve_abc_e();

	return 0;
}

Measured memory_bytes: 6076
#include<stdio.h>
int main(void){
    int a,b;
    scanf("%d %d",&a,&b);
    if(a<b){     
        printf("a < b\n");
    }else if(a>b){
        printf("a > b\n");
    }else if(a==b){
        printf("a == b\n");
    }
    return 0;
}


Measured memory_bytes: 2608
/*input
5
10 10 10 10 10
*/

//sometimes it's the people who no one imagines anything of 
//who do the things that no one can imagine.

//code author: iamxlr8

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

#define ll long long
#define N 300005
#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int main() 
{
    off;
    ll n;
    cin>>n;
    vector<ll> v(n+1);
    for(ll i=1;i<=n;i++)
        cin>>v[i];
    ll dp[n+1][n+1];
    memset(dp,0,sizeof(dp));
    vector<ll> pre(n+1);
    pre[0]=0;
    for(ll i=1;i<=n;i++)
        pre[i]=pre[i-1]+v[i];
    for(ll len=1;len<n;len++)
    {
        for(ll i=1;i<=n-len;i++)
        {
            ll j=i+len;
            ll y=100000000000000;
            ll x=pre[j]-pre[i-1];
            for(ll k=i;k<j;k++)
                y=min(y,dp[i][k]+dp[k+1][j]);
            dp[i][j]=x+y;
        }  
    }
    cout<<dp[1][n];
    return 0;
}

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

int h, w;
string field[100];

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

void dfs(int y, int x, char mark){
    field[y][x] = '-';

    for(int i = 0; i < 4; i++){
        int yy = y + dy[i];
        int xx = x + dx[i];
        if(yy < 0 || h <= yy ||
           xx < 0 || w <= xx || 
           field[yy][xx] != mark) continue;

        dfs(yy, xx, mark);
    }
}

int main(void){
    while(1){
        cin >> h >> w;
        if(h == 0 && w == 0) break;

        for(int y = 0; y < h; y++){
            cin >> field[y];
        }

        int res = 0;
        for(int y = 0; y < h; y++){
            for(int x = 0; x < w; x++){
                if(field[y][x] != '-'){
                    dfs(y, x, field[y][x]);
                    res++;
                }
            }
        }

        cout << res << endl;
    }

	return 0;
}

Measured memory_bytes: 4108
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int A, B;
	
	cin>>A>>B;
	
	cout<< A * B / __gcd(A, B)<<endl;
	
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */

int main() {
    int n;
    cin >> n;
    vector<ll> A(n + 1, 0);
    A[0] = 0;
    rrep(i, n) {
        ll a;
        cin >> a;
        A[i] = A[i - 1] + a; 
    }
    ll ans = LINF;
    rrep(i, n) {
        ll value = abs(2 * A[i] - A[n]);
        ans = min(ans, value);
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;

#define CTOTINI 1200001

int n, m, x, ctotmin = CTOTINI;
vector<int> c;
vector<vector<int>> a;

void dfs(int ctot, vector<int> atot, int length) {
    if(length == n) {
        for(int j = 0; j < m; ++j) {
            if(atot.at(j) < x) return;
        }
        
        ctotmin = min(ctotmin, ctot);

        return;
    }

    length++;

    dfs(ctot, atot, length);

    ctot += c.at(length - 1);
    for(int j = 0; j < m; ++j) {
        atot.at(j) += a.at(length - 1).at(j);
    }
    dfs(ctot, atot, length);

    return;
}

int main() {

    cin >> n >> m >> x;

    c = vector<int>(n);
    a = vector<vector<int>>(n, vector<int>(m));

    for(int i = 0; i < n; ++i) {
        cin >> c.at(i);
        for(int j = 0; j < m; ++j) {
            cin >> a.at(i).at(j);
        }
    }

    dfs(0, vector<int>(m, 0), 0);

    if(ctotmin == CTOTINI) {
        printf("-1\n");
    } else {
        printf("%d\n", ctotmin);
    }
    return 0;
}

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

int k;
string s;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> k >> s;
	if (s.length() > k) cout << s.substr(0, k) << "...\n";
	else cout << s << '\n';

	return 0;
}

Measured memory_bytes: 3660
#include <stdio.h>
#include <math.h>
#include <algorithm>
#pragma warning(disable: 4996)

#define sqr(x) ((x)*(x))
int x[11][11];

int main() {
	int n, d, cnt = 0; scanf("%d %d", &n, &d);
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= d; j++) {
			scanf("%d", &x[i][j]);
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j < i; j++) {
			int s = 0;
			for (int k = 1; k <= d; k++) {
				s += sqr(x[i][k] - x[j][k]);
			}
			int t = (int) sqrt((double)s);
			if (sqr(t) == s) cnt++;
		}
	}
	printf("%d", cnt);
	return 0;
}

Measured memory_bytes: 128
def A(n,k):
    return 2*n
def B(n,k):
    return n+k
def square(n,k):
    a=A(c[0],k)
    b=B(c[0],k)
    i[0]-=1
    if i[0]==-1:
        return n
    else: 
        if a>=b:
            """
            print("A")
            print(a)
            print("B")
            print(b)
            """
            c[0]=b
            return square(c[0],k)
        else:
            """
            print("B")
            print(b)
            """
            c[0]=a
            return square(c[0],k)
c=[1]
n=int(input())
i=[n]
k=int(input())
print(square(n,k))

Measured memory_bytes: 3064
#include<cstdio>

using namespace std;

int main()
{
	int i;
	int input;
	int deg[4] = { 0, };
	int cnt1 = 0, cnt2 = 0;

	for (i = 0; i < 6; i++)
	{
		scanf("%d", &input);

		deg[input - 1]++;
	}

	for (i = 0; i < 4; i++)
	{
		if (deg[i] == 1)
		{
			cnt1++;
		}

		else if (deg[i] == 2)
		{
			cnt2++;
		}
	}

	if (cnt1 == 2 && cnt2 == 2)
	{
		printf("YES\n");
	}

	else
	{
		printf("NO\n");
	}

	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
#define N 200010
typedef struct
{
    int u,v,w;
}Node;
Node e[N];
int cmp1(Node a,Node b)
{
    return a.u<b.u;
}
int cmp2(Node a,Node b)
{
    return a.v<b.v;
}
int main()
{
    int i,j,k,n;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&e[i].u);
        e[i].v=i;
    }
    sort(e,e+n,cmp1);
    k=n/2;
    for(i=0;i<n;i++)
    {
        if(i>=k)
            e[i].w=e[k-1].u;
        else
        if(i<k)
        e[i].w=e[k].u;
    }
    sort(e,e+n,cmp2);
    for(i=0;i<n;i++)
        printf("%d\n",e[i].w);
    return 0;
}


Measured memory_bytes: 4480
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <type_traits>

using namespace std;


int main(int argc, const char * argv[]) {
  string s;
  cin >> s;
  int a = 0;
  int b = 0;
  for(int i = 0; i < s.size(); i++){
    if(s[i] == '1'){
      a++;
    }else{
      b++;
    }
  }
  cout << 2 * min(a,b) << endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int N; cin >> N;
    vector<int> a(N), b(N), c(N);
    for (int i = 0; i < N; i++) cin >> a[i];
    for (int i = 0; i < N; i++) cin >> b[i];
    for (int i = 0; i < N; i++) cin >> c[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());

    ll ans = 0;
    for (int i = 0; i < N; i++) {
        ll tmp = (ll) (lower_bound(a.begin(), a.end(), b[i]) - a.begin());
        tmp *= N - (ll) (upper_bound(c.begin(), c.end(), b[i]) - c.begin());
        ans += tmp;
    }
    cout << ans << '\n';
}


Measured memory_bytes: 1536
import sys
import math
from  collections import defaultdict


# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')

def solve(test):
	n, w = map(int, input().split())
	val = [None] * n
	wgt = [None] * n
	for i in range(n):
		wgt[i], val[i] = map(int, input().split())
	dp = [[0 for j in range(w + 1)] for i in range(n + 1)]
	for i in range(1, n + 1):
		for j in range(1, w + 1):
			dp[i][j] = dp[i - 1][j]
			if wgt[i - 1] <= j:
				dp[i][j] = max(dp[i][j], val[i - 1] + dp[i - 1][j - wgt[i - 1]])
	ans = dp[-1][-1]
	print(ans)



if __name__ == "__main__":
	test_cases = 1
	for t in range(1, test_cases + 1):
		solve(t)


Measured memory_bytes: 171400
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>
#include <tuple>

template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
  if (lhs > rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
  if (lhs < rhs) {
    lhs = rhs;
    return true;
  }
  return false;
}

// [l, r) from l to r
struct range {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { ++i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr l, r;
  constexpr range(int l_, int r_): l(l_), r(std::max(l_, r_)) { }
  constexpr itr begin() const { return l; }
  constexpr itr end() const { return r; }
};

// [l, r) from r to l
struct revrange {
  struct itr {
    int i;
    constexpr itr(int i_): i(i_) { }
    constexpr void operator ++ () { --i; }
    constexpr int operator * () const { return i; }
    constexpr bool operator != (itr x) const { return i != x.i; }
  };
  const itr r, l;
  constexpr revrange(int l_, int r_): l(l_ - 1), r(std::max(l_, r_) - 1) { }
  constexpr itr begin() const { return r; }
  constexpr itr end() const { return l; }
};

int main() {
  long long N, A, B;
  std::cin >> N >> A >> B;
  long long Q = N / (A + B), R = N % (A + B);
  if (R > A) {
    std::cout << Q * A + A << '\n';
  }
  else {
    std::cout << Q * A + R << '\n';
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void){
  int n, t[100], m, p, x;
  int i, sum = 0;
  cin >> n;
  for(i = 0; i < n; i++){
    cin >> t[i];
    sum = sum + t[i];
  }
  
  cin >> m;
  for(i = 0; i < m; i++){
    cin >> p >> x;
    cout << sum - t[p - 1] + x << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
n=int(input())
ans=[0 for _ in range(n+1)]
for x in range(1,int(n**0.5)+1):
  for y in range(1,int(n**0.5)+1):
    for z in range(1,int(n**0.5)+1):
      a=x*x+y*y+z*z+x*y+y*z+z*x
      if a<=n:
        ans[a]+=1
for i in range(1,n+1):
  print(ans[i])

Measured memory_bytes: 9532
n = gets.chomp.to_i
a, b = gets.chomp.split.map(&:to_i)
probs = gets.chomp.split.map(&:to_i).sort

count1 = probs.select{|prob| prob <= a}.count
count2 = probs.select{|prob| a < prob && prob <= b}.count
count3 = probs.select{|prob| b < prob}.count

puts [count1, count2, count3].min


Measured memory_bytes: 1788
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int read()
{
	char ch=getchar();int f=0;
	while(ch<'0'|ch>'9') ch=getchar();
	while(ch>='0'&&ch<='9') {f=f*10+ch-'0';ch=getchar();}
	return f;
}
int main()
{
	int x=read(),a=read(),b=read();
	if(b<=a)
	printf("delicious");
	else if(b<=a+x)
	printf("safe");
	else printf("dangerous");
}

Measured memory_bytes: 256
s = input()
n = len(s)
ans = 0

for i in range(2**(n-1)):#+入るかどうか2**n-1通りある
    #文字列としてevalで処理する
    e = ""
    for j in range(n-1):
        if (i >> j)& 1 == 1:
            e += s[j] + '+'
        else:
            e += s[j]
    e += s[-1]
    ans += eval(e)
print(ans)

Measured memory_bytes: 39152
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int a, b;
  cin >> a >> b;

  int ans = 0;
  rep(i, a, b + 1) {
    string x = to_string(i);
    string xrev = x;
    reverse(x.begin(), x.end());
    if (x == xrev)
      ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<fstream>
#include<string>
#include<vector>
#include<list>
#include<math.h>
using namespace std;

typedef int Digit;
const int N = 12;

inline int Q(int n)
{
	if (1 <= n && n <= 6)
	{
		return n + 1;
	}
	else
	{
		return n - 5;
	}
}
bool check(vector<Digit> & P)
{
	int sum = 0;
	for (int i = 1; i <= 11; ++i)
	{
		sum += P[i] * Q(i);
	}
	sum %= 11;
	int ans;
	if (sum <= 1)
	{
		ans = 0;
	}
	else
	{
		ans = 11 - sum;
	}
	return ans == P[0];
}
void checkDigit(vector<Digit> & P, int question_index, list<int> & matchs)
{
	for (int i = 0; i <= 9; ++i)
	{
		P[question_index] = i;
		if (check(P) == true)
		{
			matchs.push_back(i);
		}
	}
}


int main(){
	std::istream & c_in = cin;
	string inp;
	c_in >> inp;
	vector<Digit> P(N);
	int question_index;
	for (int i = 0; i < N; ++i)
	{
		if (inp[i] == '?')
		{
			question_index = N - i - 1;
			P[N - i - 1] = -1;
		}
		else
		{
			P[N-i-1] = inp[i]-'0';
		}
	}
	list<int> matchs;
	checkDigit(P, question_index, matchs);
	if (matchs.size() >= 2)
	{
		cout << "MULTIPLE";
	}
	else //if (matchs.size() == 1)
	{
		int k = matchs.front();
		cout << k;
	}
	cout << endl; 
}

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

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
        return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

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

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

        cout << max(n - c, -1) << endl;

        return 0;
}


Measured memory_bytes: 3636
void main() {
  problem();
}

void problem() {
  auto a = scan!long;

  long solve() {
    auto mod = a % 1000;
    return mod == 0 ? 0 : 1000 - mod;
  }

  solve().writeln;
}

// ----------------------------------------------

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");

// -----------------------------------------------


Measured memory_bytes: 2740
import java.util.Scanner;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if(a>=b) System.out.println("No");
        else{
            if(b>=c) System.out.println("No");
            else     System.out.println("Yes");
        }
    }
}


Measured memory_bytes: 26248
import sys

S = sys.stdin.readline().strip()
if len(S) % 2:
    print("No")
    sys.exit()

for i, s in enumerate(S):
   if i % 2 == 0 and s == "h":
       continue
   elif i % 2 == 1 and s == "i":
       continue
   else:
       print("No")
       sys.exit()

print("Yes")

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

#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define print(v) for(auto it=(v).begin();it!=(v).end();it++) {cout<<*it<<" ";}
#define ll long long
#define w(t) ll t;cin>>t;while(t--)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
using namespace std;

int main()
{
    string s;
    cin>>s;
    if(s=="ABC")
        cout<<"ARC\n";
    else
        cout<<"ABC\n";
    return 0;
}


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

static const int N = 100;

int main() {
    int n, p[N + 1], m[N + 1][N + 1];
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> p[i - 1] >> p[i];
    }

    for (int i = 1; i <= n; i++) m[i][i] = 0;
    for (int l = 2; l <= n; l++) {
        for (int i = 1; i <= n - l + 1; i++) {
            int j = i + l - 1;
            m[i][j] = (1 << 21);
            for (int k = i; k <= j - 1; k++) {
                m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j]);
            }
        }
    }

    cout << m[1][n] << endl;

    return 0;
}


Measured memory_bytes: 3116
#include <iostream>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
const int MAX=1e5+2;
const int INF=1e9+15;

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

int main(){
	int N,X;
	cin>>N>>X;
	int x[MAX];
	rep(i,N){
		cin>>x[i];
		x[i]=abs(X-x[i]);
	}
	int D=x[0];
	if(N==1)cout<<D;
	else{
		rep1(i,N-1){
			D=gcd(D,x[i]);
		}
      cout<<D;
	}
}

Measured memory_bytes: 640
use std::io;
     
    fn main() {
        let mut text = String::new();
        io::stdin().read_line(&mut text).expect("");
        let mut split = text.split_whitespace();
        let a = split.next().unwrap().parse::<u32>().unwrap();
        let b = split.next().unwrap().parse::<u32>().unwrap();
        let c = split.next().unwrap().parse::<u32>().unwrap();
        if a == b && b == c {
            println!("1");
        } else if a == b || b == c || c == a{
            println!("2");
        } else {
            println!("3");
        }
    }

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


using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,s) for (auto i = begin(s); i != end(s); ++i)
#define itrepd(i,s) for (auto i = rbegin(s); i != rend(s); ++i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
#define rall(f,x,...) [&](decltype(x)& whole) { return (f)(rbegin(whole), rend(whole), ##__VA_ARGS__); }(x)
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e17;
ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) { return os.put(os.widen('\n')); }
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr T mins(T& a, Args... args) { return a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr T maxs(T& a, Args... args) { return a = max<T>({ a,args... }); }
template<typename A, size_t N, typename T>
void fillArray(A(&array)[N], const T& val) { std::fill((T*)array, (T*)(array + N), val); }

string s;
void solve() {
    cin >> s;

    if (s != "AAA" && s != "BBB") cout << "Yes" << endn;
    else cout << "No" << endn;

}

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


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<iomanip>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<set>
#include<map>
#include<queue>
#include<math.h>
using namespace std ;
using ll = long long ;
using vi = vector<int> ;
using vii = vector<vi> ;
using pii = pair<ll,ll> ;

int main(){
	ll n,k ;
	cin >> n >> k ;
	ll ans = 0 ;
	ll sub = 1 ;
	while(1){
		if(sub>n) break ;
		else{
			ans++ ;
			sub *= k ;
		}
	}
	cout << ans << endl ;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
const int N = 3e5 + 10;
using namespace std;
vector<int> adj[N];
int arr[N];
void dfs(int start, int par, int sum){
	arr[start] += sum;
	sum = arr[start];
	for(auto v : adj[start]){
		if(v != par){
			dfs(v, start, sum);
		}
	}
}
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n, q;
	cin >> n >> q;
	for(int i = 0; i < n - 1; i++){
		int a, b;
		cin >> a >> b;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	while(q--){
		int node, val;
		cin >> node >> val;
		arr[node] += val;
	}
	dfs(1, 0, 0);
	for(int i = 1; i <= n; i++){
		cout << arr[i] << " ";
	}
}

Measured memory_bytes: 26880
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>
#include <iomanip>
#include <tuple>

using namespace std;
long long d[210][210];
const long long INF=1LL<<60;

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

   for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
         d[i][j]=INF;
         if(i==j)d[i][j]=0;
      }
   }
   vector<long long> r(R),a(m),b(m),c(m);
   for(int i=0;i<R;i++){
      cin>>r[i];
      r[i]--;
   }
   for(int i=0;i<m;i++){
      cin>>a[i]>>b[i]>>c[i];
      a[i]--;b[i]--;
      d[a[i]][b[i]]=c[i];
      d[b[i]][a[i]]=c[i];
   }


   for(int k=0;k<n;k++){
      for(int i=0;i<n;i++){
         for(int j=0;j<n;j++)d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
      }
   }

   long long ans=INF;
   sort(r.begin(),r.end());
   do{
      long long sum=0;
      for(int i=0;i<R-1;i++){
         sum+=d[r[i]][r[i+1]];
      }
      if(ans>sum)ans=sum;
   }while(next_permutation(r.begin(),r.end()));

   cout<<ans<<endl;
}

   


Measured memory_bytes: 1528
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

def mycmb(n,r,p):
    r = min(r,n-r)
    if r == 0:
        return 1
    over = reduce(lambda x,y:x*y%p,range(n,n-r,-1))
    under = reduce(lambda x,y:x*y%p,range(1,r+1))
    return (over * pow(under,p-2,p))%p

x, y = MAP()
a = 2*x - y
b = 2*y - x

if a >= 0 and b >= 0 and a % 3 == 0 and b % 3 == 0:
    a //= 3
    b //= 3
    ans = mycmb(a+b, a, 10**9+7)
else:
    ans = 0

print(ans)

Measured memory_bytes: 10252
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main(){
    int N;
    vector<int> p;

    cin >> N;

    for(int i = 0; i < N; i++){
        int data;
        cin >> data;
        p.push_back(data);
    }

    int ans = accumulate(p.begin(), p.end(), 0) - *max_element(p.begin(), p.end())/2;
    cout << ans << endl;
}


Measured memory_bytes: 256