akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define mp make_pair
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define sci(x) scanf("%d",&x)
#define scs(s) scanf("%s",s)
#define scc(c) scanf("%c",c)
#define scd(d) scanf("%lf",&d)
#define scld(ld) scanf("%Lf",&ld)
#define int long long
using namespace std;

//********************************************
//Error tracking
#define show(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); }

vector<string> split(const string& s, char c) {
    vector<string> v;
    stringstream ss(s);
    string x;
    while (getline(ss, x, c))
        v.emplace_back(x);
    return move(v);
}

void err(vector<string>::iterator it) {}
template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
    cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
    err(++it, args...);
}
//********************************************

const int NMAX = 100005;

int n,k,a[NMAX],sum[NMAX];
int dp1[NMAX],dp2[NMAX];
int sol;

int32_t main()
{
   // freopen("input","r",stdin);
 //   freopen("output","w",stdout);
    cin.sync_with_stdio(false);
    
    int i;
    cin >> n >> k;
    for (i = 1; i <= n; i++) 
        {
            cin >> a[i];   
            sum[i] = sum[i - 1] + a[i];
            dp1[i] = dp1[i - 1];
            if (a[i] > 0) dp1[i] += a[i];
        }
    
    for (i = n ; i >= 1; i--)
    {
        dp2[i] = dp2[i + 1];
        if (a[i] > 0) dp2[i] += a[i];
    }

    for (i = 1; i <= (n - k + 1); i++)
    {
        int aux = dp1[i - 1] + dp2[i + k];
        aux = max(aux, aux + sum[i + k - 1] - sum[i - 1]);

        sol = max(sol, aux);
    }

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

Measured memory_bytes: 3328
from collections import deque

def main():
    n, m = map(int, input().split())
    rooms = list([] for _ in range(n))

    for _ in range(m):
        a, b = map(int, input().split())

        rooms[a-1].append(b-1)
        rooms[b-1].append(a-1)
    
    q = deque()
    q.append(0)

    dist = [False for _ in range(n)]
    dist[0] = 0

    while len(q):
        now = q.popleft()

        for nextRoom in rooms[now]:
            if dist[nextRoom] != False:
                continue
            else:
                dist[nextRoom] = now + 1
                q.append(nextRoom)
    
    if False not in dist:
        dist[0] = 'Yes'

        for i in range(len(dist)):
            if i == 0:
                print(dist[i])
            else:
                print(dist[i])
    else:
        print('No')

if __name__ == '__main__':
    main()

Measured memory_bytes: 36940
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 >& p) {
  os << "{" <<p.first << ", " << p.second << "}";
  return os;
}
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; }

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    ll N, D;
    cin >> N >> D;
    ll ans = 0;
    rep(i,N){
        ll x, y;
        cin >> x >> y;
        ans += (x*x+y*y) <= D*D;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3652
#include <iostream>

using namespace std;
int main(int argc, char *argv[]) {
	int n; cin>>n;
	for(int i=0;i<n;++i){
		int t; cin>>t;
		if((t&1)==0){
			if((t%3)!=0&&(t%5)!=0){
				cout<<"DENIED"<<endl;
				return 0;
			}
		}
	}
	cout<<"APPROVED"<<endl;
	return 0;
}

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

int main() {
  int N;
  cin >> N;
  string x;
  
  for (int i = 0; i < N; i++) {
    cin >> x;
    
    if (x == "Y") {
      cout << "Four" << endl;
      return 0;
    }
  }
  cout << "Three" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,sum;;
  sum=0;
  cin >> A >> B;
  if (A+2 <= B){
    sum = B*2-1;
  }
  else if (A >= B+2){
    sum =A*2-1;
  }
  else{
    sum = A+B;
  }
  cout << sum << endl;
}
    

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1000000000000000001
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main()
{
  ll N;
  cin >> N;
  ll T = 1, A = 1;
  for (ll i = 0; i < N; ++i)
  {
    ll a, b;
    cin >> a >> b;
    if (a >= T && b >= A)
    {
      T = a;
      A = b;
    }
    else
    {
      ll temp = (T + a - 1) / a;
      ll cost = INF;
      ll na, nb;
      if (A < temp * b)
      {
        cost = temp * a - T + temp * b - A;
        na = temp * a;
        nb = temp * b;
      }
      temp = (A + b - 1) / b;
      if (T < temp * a)
      {
        if (cost > temp * a - T + temp * b - A)
        {
          na = temp * a;
          nb = temp * b;
        }
      }
      T = na;
      A = nb;
    }
  }
  cout << T + A << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
void max_self(ll& a, ll b) {
    a = max(a, b);
}
void min_self(ll& a, ll b) {
    a = min(a, b);
}
const ll INF = 1e18L + 5;

int main() {
    int n, W;
    scanf("%d%d", &n, &W);
    vector<int> weight(n), value(n);
    for(int i = 0; i < n; ++i) {
        scanf("%d%d", &weight[i], &value[i]);
    }
    int sum_value = 0;
    for(int x : value) {
        sum_value += x;
    }
    vector<ll> dp(sum_value + 1, INF); 
    dp[0] = 0;
    
	for(int item = 0; item < n; ++item) {
        for(int value_already = sum_value - value[item]; value_already >= 0; --value_already) {
         min_self(dp[value_already+value[item]], dp[value_already] + weight[item]);
        }
    }
    ll answer = 0;
    for(int i = 0; i <= sum_value; ++i) {
        if(dp[i] <= W) {
            answer = max(answer, (ll) i);
        }
      
    }
    printf("%lld\n", answer);
}

Measured memory_bytes: 4024
//author:luckYrat(twitter:@luckYrat_)
//<ここに一言>

//せんげん！
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <bitset>

#include <cctype>
#include <utility>
#include <climits>


//なまえくーかん！
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

//てーすう！
const int mod = 1000000007;
const int inf = (1<<30)-1;
const ll linf = (1LL<<62LL)-1;
const double EPS = (1e-10);

//でふぁいん！
#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)

//みじかく！
#define pb push_back
#define fir first
#define scn second
#define ednl endl

//いぇすのー！
#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")

//きんぼーnほーこー！！
P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる

計算量は変わらないが楽できるシリーズ
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる
*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main(){
	int n;cin>>n;
	vector<long long> A(n);
	map<long long,long long> z;
	for(int i = 0; n > i; i++){
		cin>>A[i];
		z[A[i]]++;
	}
	long long ans = 0;
	for(auto x:z){
		ans += (x.second*(x.second-1))/2;
	}
	for(int i = 0; n > i; i++){
		cout << ans - z[A[i]]*(z[A[i]]-1)/2 +(z[A[i]]-1)*(z[A[i]]-2)/2 << endl;
	}
}

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

int main() {
	string s;
	cin >> s;
	int n = s.length();

	int mi=1e9, a = 0, b = 753;
	for(int i = 0; i < n; i++) {
		a = (a*10+(s[i]-'0'))%1000;
		// cout << a << endl;
		mi = min(mi, abs(a-b));
	}
	cout << mi << endl;
	return 0;
}

Measured memory_bytes: 256
#python3
from collections import deque
from collections import namedtuple

Vertex = namedtuple('Vertex', ['i', 'j'])  
INF = int(1e10)
di = [1, 0, -1, 0]
dj = [0, 1, 0, -1]

def main():
    h, w = map(int, input().split())
    maze = [input() for i in range(h)]
    ans = 0

    for si in range(h):
        for sj in range(w):
            if maze[si][sj] == '#':
                continue 
            dist = [[INF for i in range(w)] for j in range(h)]
            q = deque()

            def update(i, j, x):
                if dist[i][j] != INF:
                    return None
                dist[i][j] = x
                q.append(Vertex(i, j))


            update(si, sj, 0)
            while len(q) != 0:
                i, j = q.popleft()
                for dir in range(4):
                    ni = i+di[dir]
                    nj = j+dj[dir]
                    if (ni < 0) | (ni >= h) | (nj < 0) | (nj >= w):
                        continue

                    if maze[ni][nj] == '#':
                        continue
                    update(ni, nj, dist[i][j]+1)

            for i in range(h):
                for j in range(w):
                    if dist[i][j] == INF:
                        continue
                    ans = max(ans, dist[i][j])

    print(ans)

main()

Measured memory_bytes: 3436
import cmath,sys
input = sys.stdin.readline


"""
cdist(z1,z2) : z1とz2の距離
cInDiv(z1,z2) : z1とz2をp:qに内分する点
cOutDiv(z1,z2) : z1とz2をp:qに外分する点
"""

# z.real,z.imag
EPS = 0.000000001

def cdist(z1,z2=0):
    return abs(z1-z2)

def cInDiv(z1,z2,p,q):
    return (q*z1+p*z2)/(p+q)

def cOutDiv(z1,z2,p,q):
    return (-q*z1+p*z2)/(p-q)

"""
cInCircle(z,c,r) : 点zは中心c半径rの円の中にあるか(0:円周上,-1:円内,1:円外)
cIntersectionPnt(z1,z2,r1,r2) : 中心z1半径r1,中心z2半径r2の円の交点の数、座標1,座標2
"""

def cInCircle(z,c,r):
    d = abs(z-c)
    if abs(r-d) < EPS:
        return 0
    if r-d > 0:
        return -1
    return 1

def cIntersectionPnt(z1,z2,r1,r2):
    d = abs(z1-z2)

    if d < EPS:
        if abs(r1-r2) < EPS:
            return float("inf"),-1,-1
        else:
            return 0,-1,-1
    
    
    if abs(d - (r1+r2)) < EPS:
        diff = (z2-z1)/d
        return 1,z1+diff*r1,-1
    
    if abs(d - (r1-r2)) < EPS:
        diff = (z2-z1)/d
        return 1,z1+diff*r1,-1
    
    if abs(d - (r2-r1)) < EPS:
        diff = (z1-z2)/d
        return 1,z2+diff*r2,-1

    if d > r1+r2:
        return 0,-1,-1
    if d < abs(r1-r2):
        return 0,-1,-1


    rc = (r1*r1+d*d-r2*r2)/(2*d)
    rs = cmath.sqrt(r1*r1-rc*rc)
    diff = (z2-z1)/d
    return 2,z1+diff*rc+diff*1j*rs,z1+diff*rc+diff*(-1j)*rs


n,k = map(int,input().split())
xy = []
c = []
for i in range(n):
    xx,yy,cc = map(int,input().split())
    xy.append(xx+yy*1j)
    c.append(cc)


def judge(t):
    points = []
    for i in range(n):
        for j in range(i+1,n):
            flag,pt1,pt2 = cIntersectionPnt(xy[i],xy[j],t/c[i],t/c[j])
            if flag == 1:
                points.append(pt1)
            elif flag == 2:
                points.append(pt1)
                points.append(pt2)
    for pc in xy:
        points.append(pc)
    for z in points:
        cnt = 0
        for i in range(n):
            flag = cInCircle(z,xy[i],t/c[i])
            if flag <= 0:
                cnt += 1
        if cnt >= k:
            return True
    return False


ok = 10**10
ng = 0
while abs(ok-ng) > EPS:
    mid = (ok+ng)/2
    if judge(mid):
        ok = mid
    else:
        ng = mid

print(ok)

Measured memory_bytes: 52588
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main(){
  int n;
  cin>>n;
  char a[n+1],b[n+1];
  cin>>a;
  cin>>b;
  for(int i=0;i<n;i++){
    cout<<a[i]<<b[i];
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 256
from collections import defaultdict
N,M = map(int,input().split())
SCs = [list(map(int,input().split())) for _ in range(M) ]

if N == 1:
    bottom = 0
else:
    bottom = 10 ** (N -1)
top = 10 ** (N)
ans = -1
for i in range(bottom,top):
    str_i = str(i)
    flag =True #条件を満たしていればTrue
    for q in SCs:
        s,c = q
        if int(str_i[s - 1]) != c:
            flag = False
    if flag:
        ans = i
        break
print(ans)



Measured memory_bytes: 3316
#include<iostream>
#include<math.h>
#include<string>
#include<map>
#include<vector>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<bitset>
#include<stack>
#include<algorithm>
#include<climits>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll long long int
#define vll vector<ll>
#define mii map<ll, ll>
#define debug(x) cerr << #x << " is " << x << "\n";
#define debug1(x, y) cerr << #x << " is " << x << "\n" << #y << " is " << y << "\n";
#define w(x) ll x; cin >> x; while(x--)
#define endl "\n"
#define f first 
#define s second 
#define fo(n) for(ll i = 0LL; i < n; ++i) 
#define setbits(n) __builtin_popcount(n)
#define all(x) x.begin(), x.end()
#define sortAll(x) sort(x.begin(), x.end())
#define pb push_back
#define mk make_pair
#define PERMUTE next_permutation
#define RESET(a, b) memset(a, b, sizeof(a))
#define MOD 1000000007
using namespace std;

int main(){
    fast
    ll n, w, sum = 0;
    cin >> n >> w;
    vector<pair<ll, ll>> list; // {w, v}
    fo(n) {
        ll wi, vi;
        cin >> wi >> vi;
        sum += vi;
        list.pb(mk(wi, vi));
    }
    vll dp(sum + 1, 1e18L); // dp[i] = x :- min Weight with value i
    dp[0] = 0;
    for(ll i = 0LL; i < n; ++i) {
        for(ll val = sum - list[i].second; val >= 0; --val) {
            dp[val + list[i].second] = min(dp[val + list[i].second], list[i].first + dp[val]);
        }
    }
    ll ans = -1;
    fo(dp.size()) {
        if(dp[i] <= w)
            ans = max(ans, i);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3976
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define MOD 1000000007
#define INF (1LL<<57)
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define whoami(x) cerr<<#x<<" "<<x<<"\n";
#define mp make_pair
#define ins insert
#define sz size

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

struct h_llint {
  static uint64_t splitmix64(uint64_t x) {    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

struct h_pair{
  size_t operator()(const PLL&x)const{
    return hash<ll>()(((ll)x.ff)^(((ll)x.ss)<<32));
  }
};

typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;
//ordered_set = order_by_key(.)
//ordered_set = find_by_order(.)
typedef ordered_set<int> OSI;
typedef ordered_set<ll> OSL;
typedef ordered_multiset<int> MOSI;
typedef ordered_multiset<ll> MOSL;
typedef unordered_map<ll, int, h_llint> UMLI;
typedef unordered_map<ll, ll, h_llint> UMLL;
typedef unordered_map<PLL, int, h_pair> UMPI;
typedef unordered_map<PLL, ll, h_pair> UMPL;

int ar[MV];
ll arr[MV];

ll modexp(ll a, ll n, ll p)
{
	ll res = 1;
	while(n)
	{
		if(n & 1)
		res = ((res%p) * (a%p))%p;
		a = ((a%p) * (a%p))%p;
		n >>= 1;	
	}
	return res;
}

void solve(int T)
{
	int n,p;
	cin>>n>>p;
	string s;
	cin>>s;
	if((p == 2) || (p == 5))
	{
		ll ct = 0;
		for(int i=0;i<n;i++)
		{
			if(!((s[i] - '0') % p))
			ct += 1LL*(i+1);	
		}
		cout<<ct<<"\n";
	}
	else
	{
		arr[0]++;
		ll ct = 0;
		for(int i=0;i<n;i++)
		{
			ct = ((((10%p) * (ct%p))%p) + ((s[i] - '0')%p))%p;
			ll rs = ((ct%p) * (modexp(10, n-1-i, p)%p))%p;
			arr[rs]++;
		}
		ct = 0;
		for(int i=0;i<p;i++)
		ct += (arr[i] * (arr[i] - 1))/2;
		cout<<ct<<"\n";
	}
	return;
}

int main(void)
{
	FLASH();
	int T;
	T = 1;

// #ifndef ONLINE_JUDGE
// 	time_t time_t1, time_t2;
// 	time_t1 = clock();
// #endif

	while(T--)
	solve(T);

// #ifndef ONLINE_JUDGE
// 	time_t2 = clock();
// 	SETF();
// 	cout<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
// 	UNSETF();
// #endif

	return 0;
}

Measured memory_bytes: 720
def Int():
    return int(input())
def Ints():
    return map(int,input().split())
def IntList():
    return list(Ints())
def IntMat(N):
    return [IntList() for i in range(N)]

N,M,Q = Ints()
List = []

for i in range(Q):
    a,b,c,d = Ints()
    List.append([a,b,c,d])
    
import itertools
Num = [i for i in range(N+M-1)]
Ans = 0

for i in itertools.combinations(Num, N):
    TMP = []
    now = 1
    pre = -1
    for j in i:
        TMP.append(now+j-pre-1)
        now = now+j-pre-1
        pre = j
    #print(TMP)
    
    Tensuu = 0
    for (a,b,c,d) in List:
        if TMP[b-1]-TMP[a-1] == c:
            Tensuu += d
    Ans = max(Ans, Tensuu)
print(Ans)

Measured memory_bytes: 68160
#include <cstdint>

using namespace std;

#define ARRAY_SIZE 10000

uint32_t countings[ARRAY_SIZE];

void counting_sort_sort(uint32_t vec[], size_t size, uint32_t result[])
{
  for (uint32_t i = 0; i < ARRAY_SIZE; i++) {
    countings[i] = 0;
  }

  for (uint32_t i = 0; i < size; i++) {
    countings[vec[i]]++;
  }

  for (uint32_t i = 1; i < ARRAY_SIZE; i++) {
    countings[i] = countings[i] + countings[i - 1];
  }

  for (int32_t i = size - 1; i >= 0; i--) {
    countings[vec[i]]--;
    result[countings[vec[i]]] = vec[i];
  }
}

#if !defined(TEST)

#include <iostream>
#include <vector>

vector<uint32_t> vec;
#define SIZE 2000000
uint32_t result[SIZE];

int32_t main()
{
  uint32_t num;
  cin >> num;
  for (uint32_t i = 0; i < num; i++) {
    uint32_t val;
    cin >> val;
    vec.push_back(val);
  }

  counting_sort_sort(&vec[0], vec.size(), result);

  for (uint32_t i = 0; i < num; i++) {
    if (i != 0) cout << " ";
    cout << result[i];
  }
  cout << endl;

  return 0;
}
#endif

Measured memory_bytes: 18500
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[] a = new int[n];
        for(int i=0;i<n;i++){
            a[i] = Integer.parseInt(sc.next());
        }
        sc.close();
        int sign = 1;
        long a1 = 0;
        for(int i=0;i<n;i++){
            a1+=a[i]*sign;
            sign*=-1;
        }
        System.out.println(a1);
        a1/=2;
        for(int i=0;i<n-1;i++){
            System.out.println((a[i]-a1)*2);
            a1 = a[i]-a1;
        }
    }
}

Measured memory_bytes: 56856
import numpy as np
n,d=map(int,input().split())
x=[list(map(int,input().split())) for _ in range(n)]
square=[i**2 for i in range(127)]
# print(square)
x=np.array(x)
# print(x)
ans=0
for i in range(n-1):
    for j in range(i+1,n):
        # print(x[i],x[j],np.sum((x[i]-x[j])**2))
        if np.sum((x[i]-x[j])**2) in square:
            ans+=1
print(ans)


Measured memory_bytes: 12404
#include <bits/stdc++.h>
using namespace std;
/*---define tricks---*/
#define ALL(v) v.begin(),v.end()
#define UN(v) sort(ALL(v)),v.erase(unique(ALL(v)),v.end())
#define FILL(x,y) memset(x,y,sizeof(x))
#define EACH(v,it) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define FIO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define revsort(b,e) sort(b,e),reverse(b,e)
/*---define types---*/
typedef long long ll;
typedef unsigned int uint;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<pii> vii;
/*---define variables---*/
pii t[3];
/*---define function---*/

/*---main code---*/
int main()
{
	FIO;
	cin>>t[0].first>>t[1].first>>t[2].first;
	t[0].second=1,t[1].second=2,t[2].second=3;
	sort(t,t+3);
	cout<<t[0].first+t[1].first<<'\n';
	return 0;
}


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

int main(){
		string x;
		cin >> x;
		int s = 0;
		int ans = x.size();

		for(int i=0;i<x.size();i++) {
				if(x[i]=='S') s++;
				if(x[i]=='T') {
						if(s>0){
								ans -= 2;
								s--;
						}
				}
		}

		cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MAX_N 100000
#define MAX_M 100000
const int MAX = 10000000;
const int MOD = 1000000007;
#define vec vector<int>
#define vecll vector<ll>
#define vecllvec vector<vector<ll>>
#define vecb vector<bool>
#define vecbvecb vector<vector<bool>>
#define vecst vector<string>
#define vecch vector<char>
#define vecf vector<float>
#define vecvec vector<vector<int>>
#define vecHvec vector<vector<char>>
#define all(x) (x).begin(),(x).end()
const int INF = 1e9;
#define PI 3.141592653589793
// cout << setprecision(15) << std::fixed;

int main() {
  ll n,k;
  cin>>n>>k;
  vecll h(n+1,0);
  for(ll i=0;i<n;i++){
    cin>>h[i];
  }
  vecll dp(n+1);
  dp[0]=0;
  for(ll i=1;i<n;i++){
    dp[i]=INF;
    for(ll j=1;j<=k;j++){
      if(!(i-j<0)) dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
    }
  }
  cout<<dp[n-1]<<endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "-1" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
#define PI (acos(-1))
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll N,M; cin>>N>>M;
    vector<ll> A(N);
    rep(i,N) cin>>A[i];
    SORT(A);
    vector<ll> Asum(N+1,0);
    rep(i,N) Asum[i+1]=Asum[i]+A[i];
    map<ll,ll> mp;
    /*bis*/ ll low= -1 , high= INF2 ; // min-1, max+1
    while( abs(high-low)>1 ){ ll mid=(high+low)/2;
        bool ok=false; // mid以上の組で握手
        ll ct=0; 
        ll ans=0;
        rep(i,N){
            ll x=mid-A[i];
            ll ind=lower_bound(ALL(A), x)-A.begin();
            ct+=N-ind;
            ans+=A[i]*(N-ind);
            ans+=Asum[N]-Asum[ind];
        }
        ans-=(ct-M)*mid;
        mp[mid]=ans;
        if(ct>=M) ok=true;
        ( ok ? low : high ) = mid;
    }// if ok, okdir = mid
    cout<< mp[low] <<"\n";
}

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


Measured memory_bytes: 1792
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;


int vis[100][100];
int w,h,n;

int main()
{
	cin>>w>>h>>n;

	for(int i=0; i<n; i++)
	{
		int x,y,a;
		cin>>x>>y>>a;
		if(a==1)
		{
			for(int j=0; j<x; j++)
			{
				for (int k=0; k<h; k++)
				{
					vis[j][k]=1;
				}
			}
		}
		else
		{
			if (a==2)
			{
				for (int j=w-1; j>=x; j--)
				{
					for (int k=0; k<h; k++)
					{
						vis[j][k]=1;
					}
				}
			}
			else
			{
				if (a==3)
				{
					for (int j=0; j<y; j++)
					{
						for (int k=0; k<w; k++)
						{
							vis[k][j]=1;
						}
					}
				}
				else
				{
					if (a==4)
					{
						for (int j=h-1; j>=y; j--)
						{
							for (int k=0; k<w; k++)
							{
								vis[k][j]=1;
							}
						}
					}
				}
			}
		}
	}
	int cnt=0;
	for(int i=0; i<w; i++)
	{
		for(int j=0; j<h; j++)
		{
			if(vis[i][j]==0)
			{
				cnt++;
			}
		}
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

string s, a, b, c;

int main()
{
    a = "Sunny";
    b = "Cloudy";
    c = "Rainy";
    cin >> s;
    if (s == a) cout << b << endl;
    if (s == b) cout << c << endl;
    if (s == c) cout << a << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <string.h>
#include <string>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int A, B, M;
    cin >> A >> B >> M;
    int a[A];
    int b[B];
    int x[M], y[M], c[M];
    int tmp_a = -1, tmp_b = -1;
    for (int i=0; i<A; i++) {
        cin >> a[i];
        if (tmp_a == -1 or tmp_a > a[i]) tmp_a = a[i];
    }
    for (int i=0; i<B; i++) {
        cin >> b[i];
        if (tmp_b == -1 or tmp_b > b[i]) tmp_b = b[i];
    }
    for (int i=0; i<M; i++) cin >> x[i] >> y[i] >> c[i];
    
    int min_val = -1;
    for (int i=0; i<M; i++) {
        int amt = a[x[i]-1] + b[y[i]-1] - c[i];
        if (min_val == -1 or min_val > amt) min_val = amt;
    }
    cout << min(min_val, tmp_a + tmp_b) << '\n';
    return 0;
}

Measured memory_bytes: 5656
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N, M;
string S[510];
int A[510][510];
int B[510][510];

void show_board(int D[510][510]) {
	rep(i, 0, N) {
		rep(j, 0, M) {
			if(D[i][j] == 1) cout << '#';
			else cout << '.';
		}
		cout << "\n";
	}
}

void board_combine() {
	rep(i, 0, N) {
		rep(j, 0, M) {
			if(A[i][j] == 1 && B[i][j] == 1) cout << '#';
			else cout << '.';
		}
		cout << "\n";
	}
}

void solve() {
	cin >> N >> M;
	rep(i, 0, N) {
		cin >> S[i];
	}
	rep(j, 0, M) A[0][j] = 1;
	rep(j, 0, M) B[N - 1][j] = 1;
	for(int j = 0; j < M; j += 2) {
		rep(i, 1, N - 1) A[i][j] = 1;
		rep(i, 1, N - 1) {
			if(S[i][j + 1] == '#') {
				A[i][j + 1] = 1;
			}
		}
		rep(i, 1, N - 1) B[i][j + 1] = 1;
		rep(i, 1, N - 1) {
			if(S[i][j] == '#') {
				B[i][j] = 1;
			}
		}
	}
	show_board(A);
	cout << "\n";
	show_board(B);
	// board_combine();
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 3072
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

sys.setrecursionlimit(50000000)

def do(root,next,tree,ans):
    if root >= 0:
        ans[next]+=ans[root]
    for a in tree[next]:
        if a==root:
            continue
        do(next,a,tree,ans)

def resolve():
    readline=sys.stdin.readline
    n,q=map(int, readline().rstrip().split())
    tree=[[] for i in range(n)]
    ans=[0]*n
    for i in range(n-1):
        a,b=map(int, readline().rstrip().split())
        a-=1
        b-=1
        tree[a].append(b)
        tree[b].append(a)
    for i in range(q):
        p,x=map(int, readline().rstrip().split())
        p-=1
        ans[p]+=x
    do(-1,0,tree,ans)
    print(" ".join(map(str,ans)))

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

Measured memory_bytes: 234836
#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

int main(int argc, char *argv[])
{
  int N;
  string S;
  int e[500000], er[500000], w[500000], wr[500000];
  cin >> N;
  cin >> S;
  e[0] = er[0] = w[0] = wr[0] = 0;
  e[N + 1] = er[N + 1] = w[N + 1] = wr[N + 1] = 0;

  for (int i = 1; i <= N; i++) {
    if (S[i-1] == 'W') {
      w[i] = w[i-1] + 1;
      e[i] = e[i-1];
    } else {
      e[i] = e[i-1] + 1;
      w[i] = w[i-1];
    }
  }

  int minv = 5432100;
  for (int i = 1; i <= N; i++) {
    minv = min(minv, w[i-1] + (e[N]-e[i]));
  }

  cout << minv << endl;
  return 0;
}


Measured memory_bytes: 3844
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    int n,k,sum = 0;
    cin >> n >> k;
    vector<int> a(n);
    if(n - k <= 0){
        for(int i = 0; i < n; i++){
            cin >> a[i];
        }
    cout << 0 << endl;
    }
    else{
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        sum += a[i];
    }
    sort(a.begin(),a.end());
    for(int i = n - 1; n - k - 1 < i; i--){
        sum -= a[i];
        
    }
    cout << sum << endl;
}
}

Measured memory_bytes: 3328
n, q = io.read("*n", "*n", "*l")
s = io.read()
t = {0}
for i = 2, n do
  if s:sub(i - 1, i - 1) == "A" and s:sub(i, i) == "C" then
    t[i] = t[i - 1] + 1
  else
    t[i] = t[i - 1]
  end
end

for iq = 1, q do
  l, r = io.read("*n", "*n")
  z = t[r]
  if 1 < l then z = z - t[l] end
  print(z)
end


Measured memory_bytes: 5012
#include <stdio.h>
#include <stdlib.h>
int ac_flag(char*,int,int);
 
int main(void) {
  int n,q;
  scanf("%d %d", &n, &q);
  char *s;
  s = malloc(n);
  scanf("%s", s);
  int i,l,r;
  int count[n];
  count[0]=0;
  for (i=0;i<n-1;i++){
    if(s[i]==65){
      if(s[i+1]==67){
        count[i+1] = count[i] + 1;
        continue;
      }
    }
    count[i+1] = count[i]; 
  }
  for(i=0;i<q;i++){
    scanf("%d %d", &l, &r);
    printf("%d\n", count[r-1] - count[l-1]);
  }
  free(s);
  return 0;
}

int ac_flag(char *s, int l, int r){
  int i;
  int count = 0;
  for (i=l-1;i<r-1;i++){
    if(s[i]==65){
      if(s[i+1]==67){
        count++;
        i++;
      }
    }
  }
  return count;
}

Measured memory_bytes: 1280
n,k=map(int,input().split())
A=list(map(int,input().split()))
m=max(k,max(A))
l=len(bin(m))-2
C=[0]*l
for a in A:
    for i in range(l):
        if (a>>i)&1:
            C[-i-1]+=1
One=[] #答えを1にしたときに貰える値
Zero=[] #0にしたとき
for i in range(l):
    One.append(2**(l-i-1)*(n-C[i]))
    Zero.append(2**(l-i-1)*C[i])

b=bin(k)[2:]
lb=len(b)

cnt=0
if lb<l: #Kの左端より左は全部0
    cnt=sum(Zero[:(l-lb)])
dp1=[One[l-lb]] #i桁目までKと一致しているときの最大値
dp2=[Zero[l-lb]] #i桁目まででKより小さいときの最大値

for i in range(1,lb):
    a1=One[l-lb+i]
    a0=Zero[l-lb+i]
    if b[i]=="1":
        dp1.append(dp1[-1]+a1)
        dp2.append(max(dp1[-2]+a0,dp2[-1]+max(a1,a0)))
    else:
        dp1.append(dp1[-1]+a0)
        dp2.append(dp2[-1]+max(a1,a0))

if k==0:
    print(cnt+dp2[0])
else:
    print(cnt+max(dp1[-1],dp2[-1]))

Measured memory_bytes: 14588
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt(), B = sc.nextInt();
		if(B%A == 0)System.out.println(A+B);
		else System.out.println(B-A);
		sc.close();
	}

}

Measured memory_bytes: 22100
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
  ll a,b,c,j=0,ans;
  cin>>a>>b>>c;
  ll k=__gcd(a,b);
  for(int i=k;i>=0;i--)
  {
    if(a%i==0&&b%i==0)
    {
      j++;
      ans=i;
    }
    if(j==c)
      break;
  }
  cout<<ans;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 100

int main(void){
  int in[N];
  int data;
  int icnt;
  int i;

  icnt=0;

  while(scanf("%d",&data) != EOF){
    if(!(data)){
      icnt--;
      printf("%d\n",in[icnt]);
    } else {
      in[icnt]=data;
      icnt++;
    }
  }

  return 0;
}

Measured memory_bytes: 596
// ----- In the name of ALLAH, the Most Gracious, the Most Merciful -----

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

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define deb(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define memo(a,val) memset(a,val,sizeof(a))
#define NINJA ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define all(a) a.begin(),a.end()
#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;i<n;i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define dloop(i,n) for(int i=n-1;i>=0;i--)
#define iii tuple<int,int,int>
#define vi vector<int>
#define ii pair<int,int>
#define vii vector<ii>
#define int long long
#define ld long double
#define pb push_back
#define endl "\n"
#define setbits __builtin_popcountll
#define mp map<int,int>
#define F first
#define S second
#define sz(v) (int)v.size()
#define mod 1000000007
#define inf (int)1e18

int32_t main(){
	NINJA;

	int a[3];
	fo(i,3) cin >> a[i];

	sort(a,a+3);
	if(a[0]==5 and a[1]==5 and a[2]==7) cout << "YES" <<  endl;
	else cout << "NO" << endl;
	
	return 0;
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
char s[105],a[105][105];
bool h[105],l[105];
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++){
		scanf("%s",s+1);
		for (int j=1;j<=m;j++)
			a[i][j]=s[j];
	}
	for (int i=1;i<=n;i++)
		for (int j=1;j<=m;j++)
			if (a[i][j]=='#'){
				h[i]=true;
				l[j]=true;
			}
	for (int i=1;i<=n;i++)
		if (h[i]){
			for (int j=1;j<=m;j++)
				if (l[j]) cout<<a[i][j];
		printf("\n");
		}
}

Measured memory_bytes: 256
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
n = gets.chomp.to_i
h = Hash.new(0)
mu = 0
n.times do
  a,b = gets.chomp.split.map(&:to_i)
  if a == 0 && b == 0
    mu += 1
  elsif a == 0
    h[[0,1]] += 1
  elsif b == 0
    h[[1,0]] += 1
  else
    r = Rational(a,b)
    num = r.numerator
    den = r.denominator
    h[[num,den]] += 1
  end
end

# p h
pairs = []

h.each do |k, v|
  num, den = k
  next if den == 0
  if num == 0
    key = [1,0]
    if h.has_key? key
      pairs.push [v, h[key]]
    end
    next
  end
  next if num != den && num.abs <= den
  key = num < 0 ? [den, -num] : [-den, num]
  if h.has_key? key
    # p [[num,den], key]
    pairs.push [v, h[key]]
  end
end

remaining = n - mu - pairs.map(&:sum).sum

# p '--'
# p pairs
# p remaining

ans = 1

pairs.each do |x,y|
  xx = (1 << x) % MOD
  yy = (1 << y) % MOD
  tmp = xx + yy - 1
  ans = ans * tmp % MOD
end

ans = ans * (1 << remaining) - 1 % MOD
ans += mu
ans = (ans + MOD) % MOD
puts ans


Measured memory_bytes: 36176
/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;

clock_t time_p=clock();
void aryanc403()
{
#ifdef ARYANC403
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
#endif
}

#ifdef ARYANC403
#include "/home/priank/codes/PastCodes/header.h"
#else
    #define dbg(args...)
#endif

const lli INF = 0xFFFFFFFFFFFFFFFL;

lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli mod = 1000000007L;
// const lli maxN = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    lli m;
    string s;
    vi a;
    //priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

    cin>>n>>m;
    cout<<n*m/__gcd(n,m)<<endl;

}   aryanc403();
    return 0;
}


Measured memory_bytes: 256
def divisor(n): #nの約数を全て求める
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

A,B,K=map(int,input().split())

aa=divisor(A)
bb=divisor(B)

c=sorted(list(set(aa) & set(bb)))
#print(c)

print(c[-K])

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String args[]) {
        FastReader sc = new FastReader();
        String s = sc.next();
        int price = 700;
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (c == 'o') price += 100;
        }
        System.out.println(price);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}

Measured memory_bytes: 22484
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false), cin.tie(0)
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define ALL(x) (x).begin(), (x).end()
#define dump(x) cout << (x) << endl
#define LMAX 9223372036854775807LL
#define LMIN -9223372036854775807LL
using ll = long long;
template<typename T>
using vec = vector<T>;
using P = pair<ll, ll>;
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
	fill((T *)array, (T *)(array + N), val);
}

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//ll pas[51][52];

ll g[301][301];

int main(){
	IOS;
	ll n;
	cin >> n;
	for(int i = 0;i < n;i++){
		for(int j = 0;j < n;j++){
			cin >> g[i][j];
		}
	}	
	bool unko = true;
	ll ans = 0;
	REP(i,n)REP(j,n){
		bool ok = true;
		REP(k,n){
			if(g[i][k] + g[k][j] < g[i][j])unko = false;
			if(i != k && j != k && g[i][k] + g[k][j] == g[i][j]){
				ok = false;
			}
		}
		if(ok)ans += g[i][j];
	}
	ans /= 2;
	if(!unko){
		dump(-1);
		return 0;
	}
	dump(ans);
}

Measured memory_bytes: 1024
import Data.List

toStr:: [Int] -> String
toStr (a:[]) = show(a)
toStr (a:as) = show(a) ++ " " ++ toStr(as)

main = do
    c <- getLine
    let i = map read $ words c :: [Int]
        o = reverse $ sort i
    putStrLn $ toStr o

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a/gcd(a, b) * b;
}

int main()
{
    cout << fixed << setprecision(15);
    ll A, B;
    char s;

    cin >> A;
    cin >> s;
    cin >> B;

    if(s=='+'){
        cout << A+B << endl;
    }
    else{
        cout << A-B << endl;
    }
    return 0;
}

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

typedef long long ll;
typedef long double ld;
// use unique(x) - removec consecutive items, returns vec.begin() + number of items
// for vector: sort(all(vec)); vec.erase(unique(all(vec)), vec.end());
// use iota(all(vec), 0) for filling a vector with 0,1,2...
// use fill(all(vec), 1) for filling a vector with 1,1,1...
// use rotate(vec.begin(), vec.begin() + 1, vec.end()) to rotate a vector | middle arg becomes first
// use merge(all(vec1), all(vec2), vec3.begin()) to merge 2 vectors, use vec3.resize(vec1.size() + vec2.size()) first
// ll pos = partition_point(all(vec), pred) - vec.begin(); bool pred(ll a){return a<3};
// print number in binary -> cout << bitset<20>(n);

int main(){
	int n;cin>>n;
	cout<<(1000-n%1000)%1000<<endl;
}


Measured memory_bytes: 3592
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,a[10000],b[10000],MOD=1000000007,A,B,ans,d[1000],cnt;
map<ll,ll> mp;
vector<ll> v,so;
ll f(ll x,ll y){
    if(y==0)return 1;
    if(y%2==0)return f(x,y/2)*f(x,y/2)%MOD;
    return x*f(x,y-1)%MOD;
}
ll lcd(ll x,ll y){
    if(y==0)return x;
    return lcd(y,x%y);
}
int main(void){
    for(int i=2;i<1000;i++){
        if(d[i]==0)so.push_back(i);
        for(int j=1;j*i<1000;j++){
            d[i*j]=1;
        }
    }
    //for(auto x:so)cout<<x<<endl;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        A=a[i];
        for(auto x:so){
            if(A%x==0&&A!=x){
                cnt=0;
                while(A%x==0){
                    A/=x;
                    cnt++;
                }
                mp[x]=max(mp[x],cnt);
            }
        }
        if(A!=1)mp[A]=max(mp[A],1LL);
    }
    B=1;
    for(auto x:mp){
        B*=f(x.first,x.second);
        B%=MOD;
    }
    //cout<<B<<endl;
    for(int i=0;i<n;i++){
        ans+=B*f(a[i],MOD-2);
        ans%=MOD;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
while True:
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1:
        break

    if m == -1 or f == -1:
        print('F')
    elif 80 <= m + f:
        print('A')
    elif 65 <= m + f < 80:
        print('B')
    elif 50 <= m + f < 65:
        print('C')
    elif 30 <= m + f < 50:
        if 50 <= r:
            print('C')
        else:
            print('D')
    else:
        print('F')



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

int main(){
	while(1){
		int x, y;
		cin >> x >> y;
		if(x==0 && y==0) break;
		
		if(x>y){
			int tmp = x;
			x = y;
			y = tmp;
		}
		cout << x << " " << y <<endl;
	}
}


Measured memory_bytes: 2996
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
#include <utility>
#include <sstream>
#include <numeric>
#include <iterator>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
// #define ll long long
typedef long long ll;
typedef pair<int, int> P;

// std::vector<std::vector<long long>> v(n + 1,std::vector<long long>(n + 1, 0));

std::vector<std::vector<long>> v(2019,std::vector<long>(2019, 0));

long mod = 1000000007;

long nCr(long n, long r) {
  if (v[n][r] != 0 ){
    return v[n][r];
  }

  return v[n][r] = (nCr(n-1,r-1) + nCr(n-1,r)) % mod;
}


int main(int argc, const char * argv[]) {

  int n, a, b;
  cin >> n >> a >> b;
  if (n * a < b ){
    cout << n * a << endl;
  }else{
    cout << b << endl;
  }
    
  return 0;
}


Measured memory_bytes: 32128