akhauriyash/Code-Regression huggingface dataset:
// ######      ###      #######    #######    ##     #     #####        ###     ##### //
// #     #    #   #          #        #       # #    #    #     #      #   #     ###  //
// #     #   #     #        #         #       #  #   #   #       #    #     #    ###  //
// ######   #########      #          #       #   #  #   #           #########    #   //
// #     #  #       #     #           #       #    # #   #    ####   #       #    #   //
// #     #  #       #    #            #       #     ##   #    #  #   #       #        //
// ######   #       #   #######    #######    #      #    #####  #   #       #    #   //

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define ain(a,n) for(ll i=0;i<(n);++i)	cin>>(a)[i];
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define loop(i,n) for(ll i=0;i<(n);++i)
#define FOR(i,a,b) for(ll i=(a);i<=(b);++i)
#define FORD(i,a,b) for(ll i=(a);i>=(b);--i)
#define cases ll T=0;cin>>T;while(T--)
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define END "\n"
#define pb push_back
#define go(c,itr) for(auto itr=(c).begin(); itr!=(c).end(); ++itr)
#define back(c,itr) for(auto itr=(c).rbegin(); itr!=(c).rend(); ++itr)
#define PI 3.14159265359
#define inf 9e18
#define MOD 1000000007
#define MODU 998244353
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define MAXN 10005
const string alpha = "abcdefghijklmnopqrstuvwxyz";
const ll N = 1e9;
ll binexp(ll a, ll b, ll m) {
	a %= m;
	ll res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return res;
}
void task(bool flag)
{
	if (flag)
		cout << "YES\n";
	else
		cout << "NO\n";
}
ll lcm(ll a, ll b)
{
	return ((1LL * a * b) / (__gcd(a, b)));
}

signed main() {
	fast
	// cases
	{
		ll n, m;
		cin >> n >> m;
		vector<vector<char>> a(n, vector<char>(m));
		loop(i, n)
		{
			loop(j, m)
			{
				cin >> a[i][j];
			}
		}
		vvl dp(n, vl(m, 0));
		FOR(i, 0, n - 1)
		{
			FOR(j, 0, m - 1)
			{
				if (a[i][j] != '#')
				{
					if (i > 0 && j > 0)
						dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
					else if (i > 0)
						dp[i][j] += dp[i - 1][j];
					else if (j > 0)
						dp[i][j] += dp[i][j - 1];
					else
						dp[i][j] = 1;
				}
			}
		}
		cout << dp[n - 1][m - 1] << END;
	}


	return 0;
}

Measured memory_bytes: 12104
n=int(input())
S=input()
ans=0
A=["0","1","2","3","4","5","6","7","8","9"]
for i in range(n-2):
  if len(A)==0:
    break
  elif S[i] in A:
    A.remove(S[i])
  else:
    continue
  B=["0","1","2","3","4","5","6","7","8","9"]
  for j in range(i+1,n-1):
    if len(B)==0:
      break
    elif S[j] in B:
      B.remove(S[j])
    else:
      continue
    C=["0","1","2","3","4","5","6","7","8","9"]
    for k in range(j+1,n):
      if len(C)==0:
        break
      elif S[k] in C:
        C.remove(S[k])
        ans=ans+1
      else:
        continue
print(ans)

Measured memory_bytes: 3188
#include <stdio.h>

int main(void){
    int n, c[200000];
    int i, j;
    int sub, maxv, minv;
    scanf("%d", &n);
    for (i=0; i <= n; i++){
        scanf("%d", &c[i]);
    } 
    
    maxv = 1 - 1000000000; //10^9
    minv = c[0];
    
    /*
    for (j=1; j <= n-1; j++){
        for (i=0; i <= j-1; i++){
            sub = c[j] - c[i];
            if (sub > maxv){
                maxv = sub;
            }
        }
    }
    */
    for (j=1; j <= n-1; j++){
        sub = c[j] - minv;
        if (maxv < sub){
            maxv = sub;
        }
        if (minv > c[j]){
            minv = c[j];
        }
    }
    
    printf("%d\n", maxv);
    return 0;
}

Measured memory_bytes: 1376
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
l=[]
ans=[]
cnt=0
for i in range(n):
	a=list(map(int,input().split()))
	l.append(a)
for i in range(n):
	sum=0
	for j in range(m):
		sum+=b[j]*l[i][j]
		if j==(m-1):
			sum+=c
			ans.append(sum)
for i in ans:
	if i>0:
		cnt+=1
print(cnt)


Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		int[] time = new int[N+1];		// 時間 t
		int[] x = new int[N+1];			// 場所 x
		int[] y = new int[N+1];			// 場所 y
		int[] point = new int[N+1];		// x + y の和

		int[] timeDiff = new int[N];	// tのi+1とiの差分
		int[] pointDiff = new int[N];	// x + y の和のi+1とiの差分の絶対値


		for (int i = 1; i <= N; i++) {
			time[i] = sc.nextInt();
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
			point[i] = x[i] + y[i];
		}

		for (int i = 0; i < N; i++) {
			timeDiff[i] = time[i+1] - time[i];
			pointDiff[i] = Math.abs(point[i+1] - point[i]);
		}

		for (int i = 0; i < N; i++) {
			if (timeDiff[i] < pointDiff[i]) {
				System.out.println("No"); return;
			} else if ((timeDiff[i] - pointDiff[i]) % 2 != 0) {
				System.out.println("No"); return;
			}
		}
		System.out.println("Yes");
		sc.close();

	}

}

Measured memory_bytes: 94196
def main():
    from collections import Counter as ct
    n=int(input())
    a=ct(list(map(int,input().split())))
    if len(a.keys()) not in [1,2]:
        print("No")
        return 0
    if len(a.keys())==1:
        a=list(a.items())
        if a==[(n-1,n)]:
            print("Yes")
            return 0
        if 2*a[0][0]<=a[0][1]:
            print("Yes")
        else:
            print("No")
        return 0
    i=min(a.keys())
    iv=a[i]
    j=max(a.keys())
    jv=a[j]
    if j-i!=1:
        print("No")
        return 0
    if iv>i:
        print("No")
        return 0
    k=2*(i-iv+1)
    if jv>=k:
        print("Yes")
    else:
        print("No")
main()

Measured memory_bytes: 18656
/*input
20 100000
14309 -32939
-56855 100340
151364 25430
103789 -113141
147404 -136977
-37006 -30929
188810 -49557
13419 70401
-88280 165170
-196399 137941
-176527 -61904
46659 115261
-153551 114185
98784 -6820
94111 -86268
-30401 61477
-55056 7872
5901 -163796
138819 -185986
-69848 -96669
*/
 
 
 
#include <bits/stdc++.h>
using namespace std;
 
 
 
#define int long long int
#define rep(i,n) \
    for(int i = 0; i < n; i++)
#define rep2(i, a, b) \
    for(int i = a; i < b; i++)
#define all(c) \
    c.begin(), c.end()
#define init(arr, num) \
    memset(arr, num, sizeof(arr))
#define fast\
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define inputFile \
    freopen("input.txt", "r", stdin); 
#define outputFile \
    freopen("output.txt", "w", stdout);
#define modM 1000000007
#define PI 3.1415926535897932
#define F first
#define S second  
#define pb push_back  
#define INF 3e18
#ifdef gaviria
#define TRACE
#endif
#ifdef TRACE
#define trace(...) _f(#VA_ARGS, __VA_ARGS_)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cout << name << " : " << arg1 << std::endl;
 
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
 
 
typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair< ll, ll > ii;
typedef unordered_set<int> usi;
 
 
 
ll n,i,j,k,m,c;

void solve()
{
cin>>n>>k;
long double l=0;
int count=0;
for(i=0;i<n;i++)
{
    cin>>j>>m;

    l=sqrt(j*j+m*m);
    if(l<=k)
    {
        count++;

    }

}

cout<<count;

}
 
 
 
 
 
signed main()
{// inputFile;


    fast;
    int T = 1;
    // cin >> T;
    ll h=T;
    while(T--){
 
        solve();
        cout<<endl;
 
     
        
        
 
    }
    
    
    return 0;
 
}

Measured memory_bytes: 3696
using System;
using System.IO;

class Program{
    static void Main(string[] args){
        var N = int.Parse(Console.ReadLine());
        var A = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        var arr = new int[N];
        for (int i = 0; i < N; i++) arr[A[i] - 1] = i + 1;
        var answer = string.Join(" ", arr);
        var writer = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();}}

Measured memory_bytes: 36380
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

struct UnionFind {
    vector<int> par;  // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) {  //最初は全てが根であるとして初期化
        for (int i = 0; i < N; i++) par[i] = i;
    }

    int root(
        int x) {  // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {  // xとyの木を併合
        int rx = root(x);       // xの根をrx
        int ry = root(y);       // yの根をry
        if (rx == ry) return;  // xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] =
            ry;  // xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) {  // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main() {
    ll n, m;
    cin >> n >> m;
    vector<vector<P>> G(n);
    UnionFind uf(n);
    rep(i, m) {
        ll l, r, d;
        cin >> l >> r >> d;
        l--;
        r--;
        //今回は双方向でないとダメ
        G[l].push_back({r, d});
        G[r].push_back({l, -d});
        uf.unite(r, l);
    }

    vector<bool> pa(n, false);
    rep(i, n) { pa[uf.root(i)] = true; }

    queue<ll> que;
    vector<ll> dist(n, INF);

    rep(i, n) {
        if (pa[i] == true) {
            que.push(i);
            dist[i] = 0;
        }
    }

    while (que.size()) {
        ll now = que.front();
        que.pop();

        for (auto next : G[now]) {
            ll ni = next.fi;
            if (dist[ni] != INF) {  //距離が確定済の時
                if (dist[ni] != dist[now] + next.se) {  //一致しないならNo
                    // rep(i, n) cout << dist[i] << "\n";
                    cout << "No\n";
                    return 0;
                }
            } else {
                dist[ni] = dist[now] + next.se;
                que.push(ni);
            }
        }
    }

    // rep(i, n) { cout << dist[i] << "\n"; }

    cout << "Yes\n";
    return 0;
}

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

int main()
{
  long double a, b;
  cin >> a >> b;
  for (long double n = 1; n < 10000; n++)
  {
    if (floor(n * 0.08) == a && floor(n * 0.1) == b)
    {
      cout << n << endl;
      return 0;
    }
  }
  cout << -1 << endl;
}

Measured memory_bytes: 3788
length = int(input())
first = input().split(" ")
second = input().split(" ")
i = 0
sweet = 0
sugars = 0
while i < length:
    j = i
    k = 0
    while k<=i:
        sweet = sweet + int(first[k])
        k = k + 1
    while j < length:
        sweet = sweet + int(second[j])
        j = j + 1
    if sweet > sugars:
        sugars = sweet
    sweet = 0
    i = i + 1
print(sugars)


Measured memory_bytes: 3064
S = raw_input()
T = raw_input()
n = int(raw_input())
q = []
for i in range(n):
    abcd = map(int, raw_input().split())
    q.append(abcd)

toi = lambda c: 1 if c == 'A' else 2
s = [0] * (len(S)+1)
for i in range(len(S)):
    s[i+1] = s[i] + toi(S[i])

t = [0] * (len(T)+1)
for i in range(len(T)):
    t[i+1] = t[i] + toi(T[i])

for a,b,c,d in q:
    si = (s[b] - s[a-1]) % 3
    ti = (t[d] - t[c-1]) % 3
    if si == ti:
        print 'YES'
    else:
        print 'NO'


Measured memory_bytes: 34804
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

class EightyONe
{
    static void Main(string[] args)
    {
        var input = int.Parse(Console.ReadLine());

        var ans = "";
        bool flag = false;

        if (input > 81)
        {
            ans = "No";
        }
        else
        {
            for(var i = 1; i < 10; i++)
            {
                if(input % i == 0 && input / i <= 9)
                {
                    ans = "Yes";
                    flag = true;
                    break;
                }
            }

            if (!flag)
            {
                ans = "No";
            }
        }

        Console.WriteLine(ans);


    }
}

Measured memory_bytes: 13140
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iomanip>
using namespace std;
int r,d,x;
int main()
{
	cin>>r>>d>>x;
	for(int i=0;i<10;i++)
	{
		x=r*x-d;
		cout<<x<<endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

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

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

    int L=lcm(N,M);
    for(int i=0,j=0;i<N;i+=L/M,j+=L/N){
        if(s[i]!=t[j]){
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<L<<endl;
}


Measured memory_bytes: 512
// ABC059
// A - ι⊥l
#include<bits/stdc++.h>

using namespace std;

int main(){
    string s1,s2,s3;
    cin >> s1 >> s2 >> s3;
    cout << char(s1[0]+('A'-'a')) << char(s2[0]+('A'-'a')) << char(s3[0]+('A'-'a')) << endl;
    return 0;
}


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

using namespace std;

#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'

mt19937 rng((int) chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;

int main(){ _
	ll n;
	cin >> n;
	n++;
	vector<ll> a(n);
	for (ll &i : a)
		cin >> i;
	
	vector<ll> b(n+1, 0);
	for (int i = n-1; i >= 0; i--)
		b[i] = a[i] + b[i+1];

	ll leaf = 1;
	ll sum = 0;
	for (int i = 0; i < n; i++){
		leaf = min(leaf, b[i]);
		if (a[i] > leaf){
			cout << -1 << endl;
			exit(0);
		}
		sum += leaf;
		leaf -= a[i];
		leaf *= 2;
	}
	cout << sum << endl;

	exit(0);
}


Measured memory_bytes: 5192
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string str1 = Console.ReadLine();
		string str2 = Console.ReadLine();
		string s = "";
		if(str1.Substring(0,1) == str2.Substring(2,1) && str1.Substring(1,1) == str2.Substring(1,1) && str1.Substring(2,1) == str2.Substring(0,1)){
			s = "YES";
		} else {
			s = "NO";
		}
		Console.WriteLine(s);
	}
}

Measured memory_bytes: 13140
#include <stdio.h>

int main(void) {
	int k, a, b;
	
	scanf("%d", &k);
	scanf("%d%d", &a, &b);
	
	int largest = (b / k) * k;
	if (a <= largest) {
		puts("OK");
	} else {
		puts("NG");
	}
	return 0;
}


Measured memory_bytes: 2092
#include<cstdio>

const int MAX_N = 100001;
int N;
int a[MAX_N];

int dfs(int n);
int f[MAX_N] = {false};
int cnt = 0;

int main(){
	scanf("%d",&N);
	
	for(int i = 0;i < N;i ++){
		scanf("%d",&a[i]);
	}
	int a = dfs(1);
	printf("%d\n",a);
}

int dfs(int n){
	if(f[n]) return -1;
	else{
		f[n] = true;
		if(n == 2) return cnt;
		else{
			cnt++;dfs(a[n-1]);
		}
	}
}

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

using namespace std;

using ll = long long;

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

    string s;
    for (int i = 0; i < 3; ++i) {
        cin >> s;
        transform(s.begin(), s.end(), s.begin(), ::toupper);
        cout << s.front();
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30
import heapq

def main():
    s = input().strip()
    n = len(s)
    stq = set()
    k = int(input().strip())
    for i in range(n):
        for j in range(i+1, min(i+1+k+1, n+1)):
            stq.add(s[i:j])
    stq = list(stq)
    heapq.heapify(stq)
    for i in range(k):
        ans = heapq.heappop(stq)
        if i == k-1:
            print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 48092
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 1000000007;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	int LEN = (int)1e6 + 1;

	void doIt() {
		int A = sc.nextInt();
		int B = sc.nextInt();
		int ans = -1;
		for(int i = 0; i < 1000000; i++) {
			if((int)(i * 0.08) != A) continue;
			if((int)(i * 0.1) != B) continue;
			ans = i;
			break;
		}
		System.out.println(ans);
	}

	public static void main(String[] args) {
		new Main().doIt();
	}

}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 12345678901234


struct edge{ll from,to,cost; };
edge es[2020];
ll d[1010];
ll V,E;

ll bellmanford(ll s){
    for(ll i=0;i<V;i++) d[i]=INF;
    d[s]=0;
    ll cnt=0;
    while(true){
        bool update=false;
        cnt++;
        for(ll i=0;i<E;i++){
            edge e=es[i];
            if(d[e.from]!=INF && d[e.to]>d[e.from]+e.cost){
                d[e.to]=d[e.from]+e.cost;
                update=true;
                if(cnt>V) {
                    d[e.to]=-INF;
                    if(e.to==V-1) return 1;
                }
            }
        }
        //if(!update) break;
        if(cnt>2*V) break;
    }
    return 0;
}


int main(){
    ll i,j,k;
    ll n,m;
    cin>>n>>m;
    V=n;
    E=m;
    for(i=0;i<m;i++){
        ll a,b,c;
        cin>>a>>b>>c;
        a--;
        b--;
        es[i]=edge{a,b,-c};
    }
    if(bellmanford(0)==1) cout<<"inf"<<endl;
    else cout<<-d[n-1]<<endl;

   
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int n;
  cin >>n;
  
  vector<int> b(n-1);
  for(int i=0; i<n-1; i++){
    cin >> b.at(i);
  }
  
  vector<int> a(n);
  a.at(0) = b.at(0);
  a.at(n-1) = b.at(n-2);
  
  for(int i=1; i <= n-2 ; i++){
    a.at(i) = min(b.at(i-1),b.at(i));
  }      
  
  int answer = 0;
  for(int i=0; i<n; i++){
    answer += a.at(i);
  }
  cout << answer << endl;
  
  return 0;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;

bool cmp(pair<int, int> p1, pair<int, int> p2)
{
    return p1.second < p2.second;
}

int main(int argc, char *argv[])
{
    int n, res = 1;
    scanf("%d", &n);
    //    int *s = new int[n];
    //    int *t = new int[n];
    int t, s;
    vector<pair<int, int> > vec(n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d %d", &s, &t);
        vec[i].first = s;
        vec[i].second  =t;
    }

    sort(vec.begin(), vec.end(), cmp);
    int j = 0;
    for (int i = 1; i < n; i++)
    {
        if (vec[i].first > vec[j].second)
        {
            res++;
            j = i;
        }
    }
    printf("%d\n", res);

    return 0;
}



Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <array>
#include <bitset>
#include <cstring>
#include <deque>
#include <math.h>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <queue>
#include <vector>

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); --(i))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define SORT(A) std::sort((A).begin(), (A).end())
#define ALL(A) (A).begin(), (A).end()
// 座標圧縮 (for vector) : ソートしてから使うのが一般的 ; SORT(A) => COORDINATE_COMPRESSION(A)
#define COORDINATE_COMPRESSION(A) (A).erase(unique((A).begin(),(A).end()),(A).end())

using lli = long long int;
using pii = std::pair<int, int>;

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

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


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


using LLi = long long int;
inline LLi gcd(LLi a, LLi b){ while(b != 0){ a %= b; std::swap(a, b);} return a; }
// LCM(a, b) ; a, bの最小公倍数を求める関数
inline LLi lcm(LLi a, LLi b){ return (a * b) / gcd(a, b);}

int main(void){
    lli a, b; scanf("%lld%lld", &a, &b);
    printf("%lld\n", lcm(a, b));

    


    return 0;
}


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

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		final int l = 4280;

		while (!(line = br.readLine()).equals("-1")) {
			int w = Integer.parseInt(line);
			int t = 1150;

			if (w > 10)
				t += (w - 10) * 125;
			if (w > 20)
				t += (w - 20) * 15;
			if (w > 30)
				t += (w - 30) * 20;
			System.out.println(l - t);
		}
	}
}

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

typedef long long ll;

typedef pair<int, int> p;

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

    ll mod = pow(10, 9) + 7;

    ll N, M;
    cin >> N >> M;

    ll nc = 1, mc = 1;

    for(ll i = N; i > 1; i--) {
        nc *= i;
        nc %= mod;
    }

    for(ll i = M; i > 1; i--) {
        mc *= i;
        mc %= mod;
    }

    if(N != M) {
        if(abs(N - M) == 1) {
            ll ans = nc * mc;
            ans %= mod;
            cout << ans << endl;
        } else {
            cout << 0 << endl;
        }
    } else {
        ll ans = nc * mc;
        ans %= mod;
        ans *= 2LL;
        ans %= mod;
        cout << ans << endl;
    }
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
int mod = 1000000000+7;

int main(){

	int n,m,x;
	cin>>n>>m>>x;
	int c[n],a[n][m];
	rep(i,n){
		cin>>c[i];
		rep(j,m){
			cin>>a[i][j];
		}
	}

	int ans=mod;
	int cost,b[m];
	for(int bit=0;bit<(1<<n);++bit){
		cost=0;
		rep(j,m)b[j]=0;
		for(int i=0;i<n;++i){
			if(bit & (1<<i)){
				cost+=c[i];
				rep(j,m)b[j]+=a[i][j];
			}
		}
		rep(j,m)if(b[j]<x)cost=mod;
		ans=min(ans,cost);
	}

	if(ans==mod)cout<<-1<<endl;
	else cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>

using namespace std;

int main()
{
  long N;
  cin >> N;
  vector<long> sum(N, 0);
  long all = 0;
  for (long i = 0; i < N; ++i) {
    long a;
    cin >> a;
    // cerr << "input: " << a << endl;
    all += a;
    sum[i] = a;
    if (i > 0) sum[i] += sum[i - 1];
  }

  /*
  for (auto s: sum) cerr << s << endl;
  cerr << endl << all << endl;
  */

  long min = -1;
  for (long i = 0; i < N - 1; ++i) {
    long r = all - sum[i];
    // cerr << sum[i] << ", " << r << endl;
    long d = abs(r - sum[i]);
    if (min == -1 or d < min) min = d;
  }
  cout << min << endl;
  return 0;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
#include <climits>

using namespace std;
int mp = INT_MAX, N;
int l[8];
int A, B, C;
void calc(vector<int> v) {
    int a = 0,b = 0,c = 0, lmp = 0;
    for(size_t i = 0; i < N; i++)
    {
        if(v[i] == 0) {
            if(a != 0) lmp += 10;
            a += l[i];
        } else if(v[i] == 1) {
            if(b != 0) lmp += 10;
            b += l[i];
        } else if(v[i] == 2) {
            if(c != 0) lmp += 10;
            c += l[i];
        }
    }
    if(!a || !b || !c) return;
    lmp += abs(a-A) + abs(b-B) + abs(c-C);
    mp = min(mp, lmp);
}

void dfs(int d, vector<int> v) {
    if (d == N) {
        // for(size_t i = 0; i < N; i++)
        // {
        //     cout << v[i];
        // }
        // cout << endl;
        calc(v);
        return;
    }
    for(size_t i = 0; i < 4; i++)
    {
        v.push_back(i);
        dfs(d+1, v);
        v.pop_back();
    }
}

int main() {
    cin >> N >> A >> B >> C;
    for(size_t i = 0; i < N; i++)
    {
        cin >> l[i];
    }

    vector<int> v;
    dfs(0, v);
    cout << mp << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool Lets_see_who_wins(vector< int > &stones,int n,int k)
{
     vector< bool > win(k+1,false);//initially all false.
     for(int i=1;i<k+1;i++){
          for(int j=0;j<n;j++){
               if(i>=stones[j] && win[i-stones[j]] == false){
                    win[i] = true;
                    break;
               }
          }
     }
     return win[k];
}
int main()
{
     //freopen("in.txt","r",stdin);
     int n,k;
     cin >> n >> k;
     vector< int >  stones(n);
     for(int i=0;i<n;i++){
          cin >> stones[i];
     }
      bool ans = Lets_see_who_wins(stones,n,k);
      if(ans)  cout << "First" << endl;
      else     cout << "Second" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int guusuu[100005],kisuu[100005],mx1,mx2,x1,x2;
#define int long long 

signed main() {
    int n;
    cin >> n;
    int u;
    for(int i = 0; i < n; i++) {
        cin >> u;
        if(i%2 == 0) {
            guusuu[u]++;
            if(mx1 < guusuu[u]) {
                mx1 = guusuu[u];
                x1 = u;
            }
        }
        else{
            kisuu[u]++;
            if(mx2 < kisuu[u]) {
                mx2 = kisuu[u];
                x2 = u;
            }
        }
    }
    sort(guusuu,guusuu+100005);
    sort(kisuu,kisuu+100005);
    if(x1 != x2) {
        cout << n-mx1-mx2 << endl;;
    }
    else {
        cout << n-max(mx1+kisuu[100003],mx2+guusuu[100003]) << endl;
    }
}

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

#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000000000000007LL
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;

int n,m,s,c[55],d[55],ans[55],dis[55][55*55];
vector<pair<int,pii>> adj[55];
void solve(){
    cin>>n>>m>>s;
    s=min(s,2500LL);
    rep(i,0,m){
        int u,v,a,b;
        cin>>u>>v>>a>>b;
        adj[u].pb({v,{a,b}});
        adj[v].pb({u,{a,b}});
    }
    rep(i,1,n+1) cin>>c[i]>>d[i];
    memset(dis,-1,sizeof dis);
    using T=pair<int,pii>;
    priority_queue<T,vector<T>,greater<T>> pq;
    pq.push({0,{1,s}});
    while(!pq.empty()){
        auto w=pq.top();
        pq.pop();
        int node=w.y.x;
        int silver=w.y.y;
        if(dis[node][silver]!=-1) continue;
        dis[node][silver]=w.x;
        if(silver<2500) pq.push({w.x+d[node],{node,silver+c[node]}});
        for(auto i:adj[node]){
            if(i.y.x<=silver and dis[i.x][silver-i.y.x]==-1){
                pq.push({w.x+i.y.y,{i.x,silver-i.y.x}});
            }
        }
    }
    rep(i,2,n+1){
        ans[i]=hell;
        rep(j,0,2501){
            if(dis[i][j]!=-1) ans[i]=min(ans[i],dis[i][j]);
        }
        cout<<ans[i]<<endl;
    }
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

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

int main(){
    int x, a, b;
    cin >> x >> a >> b;
    if(a-b >= 0){
        cout << "delicious";
    }else if(a+x-b >= 0){
        cout << "safe";
    }else{
        cout << "dangerous";
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

ans = [0] * n

for i in reversed(range(1, n+1)):
    count = 0
    for j in range(2 * i, n + 1, i):
        count += ans[j-1]

    if count % 2 != a[i-1]:
        ans[i-1] = 1

print(sum(ans))
for i in range(n):
    if ans[i] == 1:
        print(i + 1)


Measured memory_bytes: 63712
#!/usr/bin/env python3
import sys


def solve(N: int):

    res = 0
    for i in range(1,N+1):
        if len(str(i)) % 2 == 1:
            res += 1

    print(res)



# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
import java.math.BigDecimal

fun main(args: Array<String>) {
    jsc2019qual_b()
}

fun jsc2019qual_b() {
    val (n, k) = readLine()!!.split(" ").map { it.toLong() }
    val aList = readLine()!!.split(" ").map { it.toLong() }
    val mod = BigDecimal((Math.pow(10.toDouble(), 9.toDouble()) + 7).toLong())

    val innerInversion = aList.mapIndexed { index, a ->
        BigDecimal(aList.subList(0, index).count { it > a })
    }

    val sum = BigDecimal(0)
    innerInversion.forEach { sum + it }

    var innerInversionSum = BigDecimal(0)
    innerInversion.forEach { innerInversionSum += it }
    innerInversionSum *= BigDecimal(k)
    innerInversionSum %= mod

    val outerInversion = aList.map { a ->
        BigDecimal(aList.count { it > a })
    }

    var outerInversionSum = BigDecimal(0)
    outerInversion.forEach { outerInversionSum += it }
    outerInversionSum *= BigDecimal((1 until k).sum())
    outerInversionSum %= mod

    println((innerInversionSum + outerInversionSum) % mod)
}


Measured memory_bytes: 40688
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

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

  int n, p, P;
  while(true){
	cin >> n >> p;
	if(n == 0) break;

	int idx = 0;
	P = p;
	VI has(n, 0);
	while(true){
	  if(p > 0){
		--p;
		has[idx]++;
	  }else
		if(has[idx] > 0){
		  p = has[idx];
		  has[idx] = 0;
		}

	  if(has[idx] == P) break;
	  idx = (idx+1) % n;
	}

	cout << idx << endl;
  }

  return 0;
}

Measured memory_bytes: 1196
#include<stdio.h>
int main(){
  double A,B,K;
  scanf("%lf%lf%lf",&A,&B,&K);
  if(A>=K){
    A=A-K;
    printf("%.0lf %.0lf",A,B);
   }
  else {
    K=K-A;
    B=B-K;
    if(B<=0)B=0;
    A=0;
    printf("%.0lf %.0lf",A,B);
   }
  return 0;
 }

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <functional>
#include <utility>
#include <queue>
#include <vector>
#include <string>
#include <stack>
#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;
typedef long long int ll;
const ll  MOD = 1000000007;
typedef pair<ll,ll> P;
const ll INF = 100100100100100100;

ll N,K;
ll a[200100];
ll rui[200100];
vector<P> v;

ll bit[400400];

ll ans = 0;

ll sum(int i){
  ll s = 0;
  while(i>0){
    s += bit[i];
    i -= i& -i;
  }
  return s;
}
void add(int i,ll x){
  while(i <= N*2){
    bit[i] += x;
    i += i & -i;
  }
}

int main(){
  cin >> N >> K;
  rep(i,N){
    cin >> a[i];
    rui[i+1] += (a[i]-K)+rui[i];
    v.push_back(make_pair(-rui[i+1],-(i+2)));
  }
  v.push_back(make_pair(0,-1));

  sort(v.begin(),v.end());
  rep(i,N+1){
    cerr << v[i].first << " " << -v[i].second << endl;
  }
  rep(i,N+1){
    ll tmp = -v[i].second;
    cerr << sum(N+2) << " " << sum(tmp) << endl;
    ans += (sum(N+2)-sum(tmp));
    add(tmp,1);
  }
  cout << ans << endl;
}


Measured memory_bytes: 10480
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  char x;cin>>x;
  
  if(x=='A'||x=='B'||x=='C'||x=='D'||x=='E'||x=='F'||x=='G'||x=='H'){
    cout<<'A'<<endl;
  }
  else if(x=='I'||x=='J'||x=='K'||x=='L'||x=='M'||x=='N'||x=='O'||x=='P'||x=='Q'){
    cout<<'A'<<endl;
  }
  else if(x=='R'||x=='S'||x=='T'||x=='U'||x=='V'||x=='W'||x=='X'||x=='Y'||x=='Z'){
    cout<<'A'<<endl;
  }
  else{
    cout<<'a'<<endl;
  }
}

Measured memory_bytes: 3536
# after listening explanation
h, w = gets.split.map(&:to_i)
n = h*w
s = $<.map{|l| (l.chomp.chars.map{|i|i!="#"}) }.flatten
way = [*0..(n-1)].select{|i|s[i]}
p way.map{|k|
  # bfs
  distance = Array.new(n)
  distance[k] = 0
  que = [k]
  checked = [k]
  until que==[]
    i = que.shift
    if i%w!=0 && s[i-1] && (!checked.include?(i-1))
      distance[i-1] = distance[i]+1
      que << i-1
      checked << i-1
    end
    if i%w!=w-1 && s[i+1] && (!checked.include?(i+1))
      distance[i+1] = distance[i]+1
      que << i+1
      checked << i+1
    end
    if i/w!=0 && s[i-w] && (!checked.include?(i-w))
      distance[i-w] = distance[i]+1
      que << i-w
      checked << i-w
    end
    if i/w!=h-1 && s[i+w] && (!checked.include?(i+w))
      distance[i+w] = distance[i]+1
      que << i+w
      checked << i+w
    end
  end
  distance.delete(nil)
  distance.max
}.max


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

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

int main(void)
{
	long a, b;

	while(cin >> a >> b) {
		long G, L;
		
		G = gcd(a, b);
		L = a / G * b;
		cout << G << " " << L << endl;
	}

	return 0;
}

Measured memory_bytes: 1156
use proconio::{input, marker::Usize1};
use std::collections::BTreeSet;
fn main() {
    let info = Info::read();
    input!(contest: [Usize1; info.day], query: [(Usize1, Usize1)]);
    let mut state = State::from(&info, contest);
    for (d, q) in query {
        state.update(&info, d, q);
        println!("{}", state.score);
    }
}
impl State {
    fn from(info: &Info, contest: Vec<usize>) -> Self {
        let mut date = vec![BTreeSet::new(); 26];
        for (d, &contest) in contest.iter().enumerate() {
            date[contest].insert(d + 1);
        }
        let score = info.score(&contest);
        Self { contest, date, score }
    }
    fn update(&mut self, info: &Info, date: usize, contest: usize) {
        let date1 = date + 1;
        let oldcont = self.contest[date];
        self.contest[date] = contest;
        let remove_loss = |contest: usize| {
            let &prev = self.date[contest].range(..date1).next_back().unwrap_or(&0);
            let &next = self.date[contest].range(date1 + 1..).next().unwrap_or(&(info.day + 1));
            let loss = |a, b| ((b - a) * (b - a - 1) / 2) as i32;
            let loss = loss(prev, next) - loss(prev, date1) - loss(date1, next);
            info.dec[contest] * loss
        };
        self.score -= remove_loss(oldcont) - remove_loss(contest);
        self.score += info.inc[date][contest] - info.inc[date][oldcont];
        self.date[oldcont].remove(&date1);
        self.date[contest].insert(date1);
    }
}
impl Info {
    fn read() -> Self {
        input!(day: usize, dec: [i32; 26], inc: [[i32; 26]; day]);
        Self { day, dec, inc }
    }
    fn score(&self, contest: &[usize]) -> i32 {
        let mut last = vec![0; 26];
        contest.iter().enumerate().fold(0, |score, (date, &contest)| {
            last[contest] = date + 1;
            (0..26).fold(score + self.inc[date][contest], |score, contest| {
                score - self.dec[contest] * (date + 1 - last[contest]) as i32
            })
        })
    }
}
struct State {
    contest: Vec<usize>,
    date: Vec<BTreeSet<usize>>,
    score: i32,
}
struct Info {
    day: usize,
    dec: Vec<i32>,
    inc: Vec<Vec<i32>>,
}


Measured memory_bytes: 4080
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <stack>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#include <new>
#define BIT(nr) (1ULL << (nr))
#define int long long
#define ll long long
#define double long double
#define mod 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用
#define MIN -(9223372036854775807 / 2)
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define mp make_pair
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }

using rh_type = unsigned long long;

template <rh_type MOD = 0>
struct rolling_hash {
	int n;
	rh_type base;
	std::vector<rh_type> pow, hash;

	rolling_hash() {}

	template <typename Array>
	rolling_hash(const Array &s, rh_type b_ = 10007) {
		set(s, b_);
	}

	template <typename Array>
	void set(const Array &s, rh_type b_ = 10007) {
		n = s.size();
		base = b_;
		pow.resize(n + 1);
		pow[0] = 1;
		hash.resize(n + 1);
		hash[0] = 0;
		for (int i = 0; i < n; ++i) {
			if (MOD == 0) {
				pow[i + 1] = pow[i] * base;
				hash[i + 1] = s[i] + hash[i] * base;
			}
			else {
				pow[i + 1] = pow[i] * base % MOD;
				hash[i + 1] = (s[i] + hash[i] * base) % MOD;
			}
		}
	}

	rh_type get(int r) const { return hash[r]; }

	rh_type get(int l, int r) const {
		if (MOD == 0) {
			return get(r) - get(l) * pow[r - l];
		}
		else {
			return (get(r) - get(l) * pow[r - l] % MOD + MOD) % MOD;
		}
	}
};

// 1000000007, 1000000009, 1000000021, ...
using RH = rolling_hash<1000000007>;

using namespace std;

// 汎用的な二分探索のテンプレ(めぐる式)
int binary_search(function<bool(int)> isOk, int ng, int ok) {

	/* ok と ng のどちらが大きいかわからないことを考慮 */
	while (abs(ok - ng) > 1) {
		int mid = (ok + ng) / 2;

		if (isOk(mid)) ok = mid;
		else ng = mid;
	}
	return ok;
}

signed main() {
	int N;
	cin >> N;
	string S;
	cin >> S;

	RH hs(S);
	//RH hs2(S, 1919810);

	auto isOk = [&](int len) -> bool {
		map<rh_type, vector<int>> ma;

		rep(i, N - len + 1) {
			rh_type	hash = hs.get(i, i + len);
			ma[hash].push_back(i);
		}

		for (auto p : ma) {
			int f = p.second[0];
			int l = p.second.back();

			if (f + len <= l) {
				return true;
			}
		}
		return false;
	};

	cout << binary_search(isOk, N, 0) << "\n";

	return 0;
}


Measured memory_bytes: 896
import sys
input = sys.stdin.readline

MAX = 10**6
N = int(input())
Ss = [input().rstrip() for _ in range(N)]

def calc(S):
    stack = []
    for s in S:
        if s == ")" and stack and stack[-1] == "(":
            stack.pop()
        else:
            stack.append(s)
    le = 0
    ri = 0
    for s in stack:
        if s == ")":
            le += 1
        else:
            ri += 1
    return le, ri

Ps = [[] for _ in range(MAX+1)]
Qs = [[] for _ in range(MAX+1)]
for S in Ss:
    le, ri = calc(S)
    if ri >= le:
        Ps[le].append(ri-le)
    else:
        Qs[ri].append(le-ri)

T = 0
ok = True
for le, P in enumerate(Ps):
    if P and T < le:
        ok = False
        break
    else:
        T += sum(P)

U = 0
for ri, Q in enumerate(Qs):
    if Q and U < ri:
        ok = False
        break
    else:
        U += sum(Q)

if T != U:
    ok = False
print("Yes" if ok else "No")

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

int main()
{
  
  int n; cin>>n;
  int arr[n];
  for(int i = 0 ; i < n; i++) cin>>arr[i];
  int pre[n]  = {};
  int post[n] = {};
  pre[0] = arr[0];
  post[n - 1] = arr[n - 1];
  for(int i = 1; i < n ; i++) pre[i] = max(pre[i - 1],arr[i]);
  for(int i = n - 2; i>=0; i--) post[i] = max(post[i + 1] , arr[i]);

  for(int i = 0; i < n; i++)
  {
    if(i == n - 1) cout<<pre[i - 1]<<" ";
    else if(!i) cout<<post[i + 1]<<" ";
    else cout<<max(pre[i - 1], post[i + 1])<<" ";
  }
  return 0;
}


Measured memory_bytes: 3968
#include<iostream>
#include<algorithm>
#include<string.h>
#include<string>
#include<cmath>
#include<cstdlib>
#include<vector>
#include<functional>

using namespace std;

int main() {
	int a;
	cin >> a;
	if (a == 1)cout << "Hello World" << endl;
	if (a == 2) {
		int x, y;
		cin >> x >> y;
		cout << x + y << endl;
	}
	return 0;
}

Measured memory_bytes: 256
S = list(input())
T = list(input())
if S == T:
  ans = "Yes"
else:
  for i in range(len(S) - 1):
    S.insert(0, S[-1])
    S.pop(-1)
    if S == T:
      ans = "Yes"
      break
    else:
      ans = "No"

print(ans)

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N, M;
    cin >> N >> M;
    mat G(N, vec(N, 0));
    REP(i,0,M) {
        ll x, y;
        cin >> x >> y;
        --x; --y;
        G[x][y] = 1;
        G[y][x] = 1;
    }

    ll cnt = 0;
    vec V(N-1);
    REP(i,0,N-1) V[i] = i + 1;
    do {
        ll v = 0, nv;
        bool f = true;
        REP(i,0,N-1) {
            nv = V[i];
            if(G[v][nv] == 0) {
                f = false;
                break;
            }
            v = nv;
        }
        cnt += f;
    } while(next_permutation(ALL(V)));
    PR(cnt);


    return 0;
}

/*



*/

Measured memory_bytes: 3636
#include <iostream>
#include <math.h>

int main() {
	int div = 0, count = 0;
	std::cin >> count >> div;
	
	int** points = new int*[count];
	for (int i = 0; i < count; i++) {
		int* point_element = (points[i] = new int[div]);
		for (int j = 0; j < div; j++) {
			std::cin >> point_element[j];
		} 
	}
	
	int result = 0;
	for (int step = 0; step < count - 1; step++) {
		for (int i = step + 1; i < count; i++) {
			int sum = 0;
			for (int j = 0; j < div; j++) {
				int sub_a_b = points[step][j] - points[i][j];
				sum += sub_a_b * sub_a_b; 
			}
			double sq = sqrt(sum);
			 if (ceil(sq) == floor(sq)) {
				 result++;
			 }
		}
	}
	
	std::cout << result;
	
	for (int i = 0; i < count; i++) {
		delete[] points[i];
	}
	delete[] points;
	
	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define F first
#define S second
#define f(i,s,n) for(int i=(int)s;i<=(int)n;++i)
#define Fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
void solve()
{
	ll a,b,c;
	cin>>a>>b>>c;
	ll ans=ceil((double)a/b)*c;
	cout<<ans<<'\n';
}
int main()
{	Fast;
//	int t;cin>>t;
//	while(t--)
	solve();
}

Measured memory_bytes: 3652
import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    final int n = scanner.nextInt();
    final int m = scanner.nextInt();
    final Num[] a = new Num[m];
    for (int i = 0; i < m; i++) {
      a[i] = Num.of(scanner.nextInt());
    }
    Arrays.sort(a, Comparator.<Num>comparingInt(Num::getValue).reversed());
 
    int[] positions = new int[n + 1];
    Arrays.fill(positions, -1);
    positions[0] = 0;
    
    for (int count = 2; count <= n; count++) { // match count
      int maxPositions = -1; // maximum amount of position
      for (int j = 0 ; j < m; j++) { // loop less than 10 times
        if (count - a[j].getCount() >= 0
            && positions[count - a[j].getCount()] != -1) {
          // match a[j] can append
          if (positions[count - a[j].getCount()] + 1 > maxPositions) {
            // when a[j] appended, the maximum amount of position updated
            maxPositions = positions[count - a[j].getCount()] + 1;
          }
        }
      }
      positions[count] = maxPositions;
    }
 
    int remainCount = n;
    List<Num> aCandidate = new ArrayList<>(Arrays.asList(a));
    for (int remainPosition = positions[n]; remainPosition > 0; remainPosition--) {
      List<Num> removable = new ArrayList<>();
      for (final Num num : a) {
        if (remainCount - num.getCount() >= 0
            && positions[remainCount - num.getCount()] == positions[remainCount] - 1) {
          System.out.print(num.getValue());
          remainCount -= num.getCount();
          break;
        } else {
          removable.add(num);
        }
      }
      aCandidate.removeAll(removable);
    }
 
    System.out.println();
  }
}
enum Num {
  M1(1, 2),
  M2(2, 5),
  M3(3, 5),
  M4(4, 4),
  M5(5, 5),
  M6(6, 6),
  M7(7, 3),
  M8(8, 7),
  M9(9, 6),
  ;
  private final int value;
  private final int count;
  Num(final int value, final int count) {
    this.value = value;
    this.count = count;
  }
  public int getValue() {
    return this.value;
  }
  public int getCount() {
    return this.count;
  }
  public static Num of(final int value) {
    for (Num n : values()) {
      if (n.value == value) {
        return n;
      }
    }
    throw new IllegalArgumentException("Num of value = " + value + " is not exist.");
  }
}

Measured memory_bytes: 27092
using System;
using System.Linq;

class Program
{
    static void Main(string[] args) {
        char[] chr = Console.ReadLine().ToCharArray();
        Console.WriteLine(solve(chr));
    }
    static string solve(char[] c){
        for (int i = 0; i<c.Length; i ++) {
            c[i] = c[i]== '1' ? '9':'1';
        }
        string s = new String(c);
        return s;
    }
}

Measured memory_bytes: 11092
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>

using namespace std;
//#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
const int inf=1000000007;
const int MOD=1000000007;
signed main(){
  int n;cin>>n;
  vector<int> x(n);
  rep(i,n)cin>>x[i];
  int res=inf;
  rep1(i,100){
    int buf=0;
    rep(j,n){
      buf+=(i-x[j])*(i-x[j]);
    }
    res=min(res,buf);
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 256
import numpy as np
a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = [int(input()) for i in range(n)]
a_ = np.array(a)
cond = np.full([3,3], False)
for i in b:
    cond[np.where(a_==i)] = True
naname = np.array([[cond[0,0], cond[1,1], cond[2,2]], [cond[0,2], cond[1,1], cond[2,0]]])
if True in np.all(cond==True, axis=0):
    print("Yes")
elif True in np.all(cond==True, axis=1):
    print("Yes")
elif True in np.all(naname==True, axis=1):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 12496