akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n;
    cin>>n;
    vl as(n);
    cin>>as;
    ll odd = 0;
    ll cur = 0;
    rep(i, n) {
        cur += as[i];
        if (i % 2 && cur <= 0) {
            odd += -cur + 1;
            cur = 1;
        }
        if (i % 2 == 0 && cur >= 0) {
            odd += cur + 1;
            cur = -1;
        }
    }
    ll even = 0;
    cur = 0;
    rep(i, n) {
        cur += as[i];
        if (i % 2 && cur >= 0) {
            even += cur + 1;
            cur = -1;
        }
        if (i % 2 == 0 && cur <= 0) {
            even += -cur + 1;
            cur = 1;
        }
    }
    cout<<min(odd, even)<<endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int dp[1005][1005];
int main(){
  int n,m;
  int mod = 1e9+7;
  cin>>n>>m;
  vector<string> maze(n);
  for(int i=0;i<n;++i)cin>>maze[i];
  for(int i=0;i<1005;++i){
    dp[i][0] = 0;
    dp[0][i] = 0;
  }
  dp[1][1] = maze[0][0]=='.' ? 1:0;
  
  for(int i=0;i<n;++i){
    for(int j=0;j<m;++j){
      if(i==0&&j==0)
        continue;
      if(maze[i][j]=='#'){
        dp[i+1][j+1] = 0;
      }else{
        dp[i+1][j+1] = (dp[i][j+1]+dp[i+1][j]) % mod;
      }
    }
  }
  cout<<dp[n][m]<<endl;
  return 0;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int(v.size())
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep2(i, n, m) for (ll i = n; i <= (m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (m); --i)

template<class T, class U> bool chmax(T &a, U b) { if (a < b) a = b; return true; }
template<class T, class U> bool chmin(T &a, U b) { if (b < a) a = b; return true; }

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  string s; cin >> s;
  int k; cin >> k;

  vector<string> ans;

  rep(i, si(s)) {
    rep2(j, 1, k) {
      if (i + j - 1 >= si(s)) continue;

      string t = s.substr(i, j);
      ans.eb(t);
    }
  }

  sort(all(ans));
  ans.erase(unique(all(ans)),ans.end());

  cout << ans[k-1] << endl;
  
  return (0);
}

Measured memory_bytes: 4304
import java.util.Scanner;
public class Main {
	int as,kl,o,n,m,hun,p;
	String op,targetStr;
	Scanner sc = new Scanner(System.in);
	public void solve() {
		n=sc.nextInt();
		m=sc.nextInt();
		as=sc.nextInt();
		hun=m*as;
		if(hun<n) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
	}
	public static void main(String[] args) {
		new Main().solve();
	}
}


Measured memory_bytes: 35644
// {{{
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
// }}}

using ll = long long;

int M1, D1, M2, D2;

int main() {
    cin >> M1 >> D1 >> M2 >> D2;
    cout << (M1 != M2 ? 1 : 0) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,x); REP(i,sizeof(a)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}

int main(){
  ll N,K; cin>>N>>K;
  N = N%K;
  cout << min(N,K-N) <<"\n";
}



Measured memory_bytes: 256
import math
A,B,H,M=map(int,input().split())

pi=math.pi
ta=(H/12+M/720)*2*pi
tb=M/60*2*pi
if ta>=tb:
    t=ta-tb
else:
    t=tb-ta
if t>pi:
    t=2*pi-t

if t==0:
    print(abs(A-B))
elif t==pi:
    print(A+B)
else:
    ret=A**2+B**2-2*A*B*math.cos(t)
    ret=math.sqrt(ret)
    print(ret)

Measured memory_bytes: 9460
#include<stdio.h>

main()
{
	int a[11],i,x=0,y=0,z=0,n;
	
	
	for(i=1;i<=10;i++){
		
		scanf("%d",&a[i]);
		
		if(x<=a[i]){
			z=y;
			y=x;
			x=a[i];
		}
		
		else if(y<=a[i]){
			z=y;
			y=a[i];
		}
		
		else if(z<=a[i]){
			z=a[i];
		}
		
	}
	
	
	printf("%d\n%d\n%d\n",x,y,z);
	
	return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Aoj0001
{
    static void Main()
    {
        for (int i = 1; i < 10; i++)
        {
            for (int j = 1; j < 10; j++)
            {
                Console.WriteLine(i + "x" + j + "=" + i * j);
            }
        }
    }
}

Measured memory_bytes: 5564
N=int(input())
h=[0]

hh=list(map(int,input().split(" ")))
h.extend(hh)
  
#print (h)

F=[0]*(N+1)
F[2]=abs(h[2]-h[1])
for i in range(3,N+1):
  F[i]=min(F[i-1]+abs(h[i]-h[i-1]), F[i-2]+abs(h[i]-h[i-2]))

print(F[N])

Measured memory_bytes: 13928
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a,b,c,d,ans;
    cin>>a>>b>>c>>d;
    ans=a*c;
    ans=max(ans,b*d);
    ans=max(ans,a*d);
    ans=max(ans,b*c);
    cout<<ans<<endl;

}

Measured memory_bytes: 3640
#include <iostream>
#include <sstream>
#include <string>
#include <cstdlib>
using namespace std;

void reset_stringstream(stringstream& ss)
{
  ss.str("");
  ss.clear(stringstream::goodbit);   
}

int main() {
  int n,count = 1,p = 0;
  string str;
  int r,a,x[100000];
  int size;
  stringstream ss;
  string newstr;

  while(cin >> n) {
    if(n == 0) break;
    cin >> str;
    for(int i=0;i<n;i++) {
      newstr = "";
      size = str.size();
      count = 1;
      x[0] = atoi(str.substr(0,1).c_str());
      for(int k=1;k<size;k++) {
	x[k] = atoi(str.substr(k,1).c_str());
	if(x[k] == x[k-1]) {
	  count++;
	  if(k == size-1) {
	    r = count;
	    a = x[k-1];
	    // cout << r << " " << a;ok
	    ss << r << a;
	    newstr += ss.str();
	    reset_stringstream(ss); 
	    str = newstr;
	    count = 1;
	  }
	}
	else {
	  //	  cout << count << " " << x[k-1] << endl;
	  r = count;
	  a = x[k-1];
	  ss << r << a;
	  newstr += ss.str();
	  reset_stringstream(ss);
	  count = 1;
	  if(k == size-1) {
	    r = 1;
	    a = x[k];
	    ss << r << a;
	    newstr += ss.str();
	    reset_stringstream(ss);
	    str = newstr;
	  }
	  
	}
      }
      count = 1;
    }
     cout << str << endl;
  }
  return 0;
}

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

using namespace std;

#define endl '\n'

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

    int N, M;
    cin >> N >> M;

    vector<int> V;
    vector<int> W;

    for (int i = 0; i < N; ++i){
    	int vi, wi, mi;
    	cin >> vi >> wi >> mi;
    	int p = 1;
    	while (p < mi){
    		V.push_back(vi * p);
    		W.push_back(wi * p);
    		mi -= p;
    		p = p << 1;
    	}
    	V.push_back(vi * mi);
		W.push_back(wi * mi);
    }

    N = V.size();
    vector<vector<int>> dp(N + 1, vector<int>(M + 1, 0));

    for (int i = N - 1; i >= 0; --i){
    	for (int j = 0; j <= M; ++j)
    		dp[i][j] = max(dp[i + 1][j], (j >= W[i]) * (dp[i + 1][max(0, j - W[i])] + V[i]));
    }

    cout << dp[0][M] << endl;
}



Measured memory_bytes: 57676
#include <iostream>
#include <string>
using namespace std;
#define mod 1000000007
int main() {
    string k;
    int d;
    cin >> k >> d;
    int dp[k.size() + 1][d + 1], extra[k.size() + 1][d + 1];
    for (int i = 0; i <= k.size(); i ++) {
        for (int j = 0; j <= d; j ++) {
            dp[i][j] = 0;
            extra[i][j] = 0;
        }
    }
    extra[0][0] = 1;
    for (int i = 0; i < k.size(); i ++) {
        for (int j = 0; j < d; j ++) {
            for (int h = 0; h < 10; h ++) {
                dp[i + 1][(j + h) % d] =
                        (dp[i + 1][(j + h) % d] + dp[i][j]) % mod;
                if (h < (k[i] - '0')) {
                    dp[i + 1][(j + h) % d] =
                            (dp[i + 1][(j + h) % d] + extra[i][j]) % mod;
                }
            }
            extra[i + 1][(j + (k[i] - '0')) % d] =
                    (extra[i + 1][(j + (k[i] - '0')) % d] + extra[i][j]) % mod;
        }
    }
    cout << (dp[k.size()][0] + extra[k.size()][0] - 1 + mod) % mod;
    return 0;
}


Measured memory_bytes: 8192
#include <bits/stdc++.h>
using namespace std;
#define all(n) begin(n), end(n)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
vint primes;
vll div(ll N)
{
    vll yakusuu;
    for (ll i = 1; i * i <= N; i++)
    {
        if (N % i == 0)
        {
            yakusuu.push_back(i);
            if (i * i != N)
                yakusuu.push_back(N / i);
        }
    }
    return yakusuu;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vint A(N);
    set<int> s;
    map<int,int> cnt;
    for (size_t i = 0; i < N; i++)
    {
        cin >> A[i];
        s.insert(A[i]);
        cnt[A[i]]++;
    }
    int ans = N;
    for (size_t i = 0; i < A.size(); i++)
    {
        if(cnt[A[i]]>=2)
        {
            ans--;
            continue;
        }
        auto divs = div(A[i]);
        for (auto &&j : divs)
        {
            if(j != A[i] and s.count(j) == 1)
            {
                ans--;
                break;
            }
        }
    }
    cout<<ans;
    return 0;
}


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

int main() {
  int a, b, c;
  int x = 0;
  cin >> a >> b >> c;
  for(int i = a; i <= b; i++) {
    if(i % c == 0) {
      x++;
    }
  }
  cout << x << endl;
}

Measured memory_bytes: 3632
#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
lis=LI()
cou1=0
cou2=0
cou4=0
for i in range(n):
    if lis[i]%4==0:
        cou4+=1
    elif lis[i]%2==0:
        cou2+=1
    else:
        cou1+=1
if cou4>=cou1:
    print("Yes")
elif cou4+1==cou1 and cou2==0:
    print("Yes")
else:
    print("No")
        

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

void dfs(string s, int digit) {
	if (3 <= digit) {
		bool exist3 = false;
		bool exist5 = false;
		bool exist7 = false;
		for (int i = 0; i < s.size(); i++) {
			if (s[i] == '3') exist3 = true;
			if (s[i] == '5') exist5 = true;
			if (s[i] == '7') exist7 = true;
		}
		if(exist3 && exist5 && exist7) c357num.push_back(stoll(s));
	}
	if (digit == 9) {
		return;
	}
	digit++;
	for (int i = 0; i < 3; i++) {

		if (i == 0) {
			s += "3";
			dfs(s, digit);
			s.pop_back();
		}
		else if (i == 1) {
			s += "5";
			dfs(s, digit);
			s.pop_back();

		}
		else { // i == 2
			s += "7";
			dfs(s, digit);
			s.pop_back();
		}

	}
}

int main() {

	ll n; cin >> n;
	if (n <= 356) {
		cout << 0 << endl;
		return 0;
	}
	string s = "";
	int d = 0;
	dfs(s, d);
	sort(c357num.begin(), c357num.end());
	ll ans = 0;
	for (int i = 0; i < c357num.size(); i++) {
		if (c357num[i] <= n) ans++;
		else break;
	}
	cout << ans << endl;
	return 0;
}

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

int main()
{
  int X;
  cin >> X;
  for (; ; ++X)
  {
    int i = 2;
    const int _i = static_cast<int>(sqrt(X));
    for (; i <= _i; ++i)
      if (0 == X%i)
        break;
    if (_i < i)
      break;
  }
  cout << X;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#define ma make_pair
#define pu push_back
#define INF (1e9)
#define N 100
using namespace std;
typedef pair<int,int> P;
int dijkstra(int,int);
int n,m,a,b,w,ans;
bool visited[N];
vector<P> edge[N];
map<int,int> s;
 
int main(){
  while(1){
    cin>>n>>m;
    ans=INF;
    if(!n&&!m) break;
    for(int i=0;i<m;i++){
      cin>>a>>b>>w,edge[a-1].pu(P(b-1,w)),edge[b-1].pu(P(a-1,w));
      if(s.find(w)==s.end()) s.insert(ma(w,a-1));
    }
    for(map<int,int>::iterator i=s.begin();i!=s.end();i++){
      for(int j=0;j<N;j++) visited[j]=false;
      int r=dijkstra((*i).first,(*i).second);
      ans=min(ans,r);
    }
    if(ans!=INF) cout<<ans<<endl;
    else cout<<-1<<endl;
    for(int i=0;i<N;i++) edge[i].clear();
    s.clear();
  }
  return 0;
}
 
int dijkstra(int base,int sn){
  int maxv,cnt=0;;
  priority_queue<P,vector<P>,greater<P> > q;
  maxv=base;
  q.push(P(base,sn));
  while(!q.empty()){
    P t=q.top(); q.pop();
    int x=t.second;
    if(visited[x]) continue;
    visited[x]=true;
    cnt++;
    maxv=max(maxv,t.first);
    for(int i=0;i<edge[x].size();i++)
      if(edge[x][i].second>=base)
    q.push(P(edge[x][i].second,edge[x][i].first));
  }
  if(cnt==n) return maxv-base;
  return INF;
}

Measured memory_bytes: 1504
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int H_up,M_up,H_dw,M_dw,K;
	
	cin >> H_up >> M_up >> H_dw >> M_dw >> K;
	
	int Time = (H_dw * 60 + M_dw) - (H_up * 60 + M_up);
	cout << Time - K << endl;
}


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

int main()
{
    int h, w;
    char s[52][52]{};
    scanf("%d%d", &h, &w);
    for (int i = 1; i <= h; i++)
    {
        scanf("%s", s[i] + 1);
    }
    for (int i = 1; i <= h; i++)
    {
        for (int j = 1; j <= w; j++)
        {
            if (s[i][j] == '#') continue;
            s[i][j] = '0';
            for (int k = -1; k <= 1; k++)
            {
                for (int l = -1; l <= 1; l++)
                {
                    if(k == 0 && l == 0) continue;
                    s[i][j] += s[i+k][j+l] == '#';
                }
            }
        }
    }
    for (int i = 1; i <= h; i++)
    {
        for (int j = 1; j <= w; j++)
            printf("%c", s[i][j]);
        printf("\n");
    }
}

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

char tictactoe(char x[]) {
  for(int i=0;i<7;i = i+3) { //yoko
    if( (x[i] == x[i+1]) && (x[i+1] == x[i+2]) ) {
      if((x[i] == 'o')||(x[i] == 'x'))
        return x[i];
    }
  }

  for(int i=0;i<3;i++)  { //tate
    if((x[i] == x[i+3]) && (x[i+3] == x[i+6])) {
      if((x[i] == 'o')||(x[i] == 'x'))
        return x[i];
    }
  }
  if((x[0] == x[4]) && (x[4] == x[8])) {
    if((x[0] == 'o')||(x[0] == 'x'))
      return x[0];
  }
  if((x[2] == x[4]) && (x[4] == x[6])) {
    if((x[2] == 'o')||(x[2] == 'x'))
      return x[2];
  }
  return 'd';
}

  int main() {
    string str;
    while(cin >> str) {
      char x[9] = {};
      for(int i=0;i<9;i++) {
        x[i] = *str.substr(i,1).c_str();
      }
      cout << tictactoe(x) << endl;
    }
  }

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <math.h>
#include <numeric>

using namespace std;

int main() {
	vector<int> N(4);
	int temp;

	for (int i = 0; i < 4; i++) {
		cin >> temp;

		if(temp == 1){
			N[0]++;
		}
		else if(temp == 9){
			N[1]++;
		}
		else if(temp == 7){
			N[2]++;
		}
		else if(temp == 4){
			N[3]++;
		}
	}

	if(N[0] == 1 && N[1] == 1 && N[2] == 1 && N[3] == 1){
		cout << "YES" << endl;
	}
	else{
		cout << "NO" << endl;
	}



}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;
use std::cmp;
use std::collections::HashMap;
use std::collections::HashSet;
use std::char;
use std::cmp::{min, max};
use itertools::{Itertools, enumerate};
use std::ops::{Add, AddAssign};
use num_integer::{Integer, gcd, lcm};
use std::collections::VecDeque;
use smallvec::alloc::collections::LinkedList;
use regex::internal::Char;
use std::iter::once;

fn read<T: FromStr>(stdin: &mut StdinLock) -> T {
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn read_tuple2<T: FromStr, S: FromStr>(stdin: &mut StdinLock) -> (T, S) {
    let a = read(stdin);
    let b = read(stdin);
    (a, b)
}

fn read_tuple3<T: FromStr, S: FromStr, R: FromStr>(stdin: &mut StdinLock) -> (T, S, R) {
    let a = read(stdin);
    let b = read(stdin);
    let c = read(stdin);
    (a, b, c)
}

fn lower_bound<T: Copy, F>(v: &Vec<T>, f: F) -> Option<usize> where
    F: Fn(T) -> bool
{
    let mut left = 0;
    let mut right = v.len() - 1;
    if !f(v[left]) {
        return None;
    }
    if f(v[right]) {
        return Some(right);
    }
    loop {
        if right - left == 1 {
            return Some(left);
        }
        let mid = (left + right) / 2;
        if f(v[mid]) {
            left = mid;
        } else {
            right = mid;
        }
    }
}


fn main() {
    // template
    let stdin = stdin();
    let mut stdin = stdin.lock();
    let out = stdout();
    let mut out = BufWriter::new(out.lock());
    // template ends
    let n:u32 = read(&mut stdin);
    let xyz_max = (n as f32).sqrt() as u32;
    let mut counter = HashMap::new();
    for x in 1..xyz_max {
        let x_pow = x.pow(2);
        for y in 1..xyz_max {
            let y_pow = y.pow(2);
            for z in 1..xyz_max {
                let num = x_pow + y_pow + z.pow(2) + x * y + y * z + z * x;
                let mut ent = counter.entry(num).or_insert(0);
                *ent += 1;
            }
        }
    }
    for i in 1..n+1 {
        let num = counter.get(&i).unwrap_or(&0);
        writeln!(out, "{}", num);
    }
}



Measured memory_bytes: 3036
let parrot () =
  let s = ref "" in
  let i = ref 1 in
  while (s := read_line (); !s <> "0")
  do
    print_string ("Case " ^ (string_of_int !i) ^ ": ");
    print_endline !s;
    i := !i + 1
  done ;;
  parrot () ;;


Measured memory_bytes: 3368
/*
██╗  ██╗ █████╗ ██████╗ ███████╗███████╗███╗   ███╗        ██╗  ██╗██╗  ██╗ █████╗ ██╗     ███████╗██████╗
██║ ██╔╝██╔══██╗██╔══██╗██╔════╝██╔════╝████╗ ████║        ██║ ██╔╝██║  ██║██╔══██╗██║     ██╔════╝██╔══██╗
█████╔╝ ███████║██████╔╝█████╗  █████╗  ██╔████╔██║        █████╔╝ ███████║███████║██║     █████╗  ██║  ██║
██╔═██╗ ██╔══██║██╔══██╗██╔══╝  ██╔══╝  ██║╚██╔╝██║        ██╔═██╗ ██╔══██║██╔══██║██║     ██╔══╝  ██║  ██║
██║  ██╗██║  ██║██║  ██║███████╗███████╗██║ ╚═╝ ██║███████╗██║  ██╗██║  ██║██║  ██║███████╗███████╗██████╔╝
╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═╝     ╚═╝╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚═════╝
Believe in yourself ,( try and try and then try ), You can do it 
*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#define endl "\n"
#define Ceil(x,y) ((x+y-1)/y)
#define clr(arr, x) memset(arr, x, sizeof arr)
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define rt(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
#define OO 0x3f3f3f3f3f3f3f3fLL
const int oo = 0x3f3f3f3f, mod = 1e9 + 7;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//x = xDegrees*3.14159265 / 180;
//ef1tn=(( (n / 2)*( (n / 2) + 1) / 2) * 2);
//of1tn=(n * (n + 1) / 2 - 2 * ((n / 2) * (n / 2 + 1) / 2));
int dx[] { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] { 0, 0, 1, -1, 1, -1, 1, -1 };
void K_K(){
#ifndef ONLINE_JUDGE
//	freopen("in.txt", "r", stdin);
//	freopen("out.txt", "w", stdout);
#endif  !ONLINEJUDGE
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}
ll gcd(ll a, ll b) {
	return b == 0 ? abs(a) : gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
int n;
vector<int>a, b, c;
ll dp[100005][5];
ll sol(int idx, int pre){
	if (idx == n)
		return 0;
	ll& ret = dp[idx][pre];
	if (~ret)
		return ret;
	ll ch1 = 0, ch2 = 0, ch3 = 0;
	if (pre != 1)
		ch1 = sol(idx + 1, 1) + a[idx];
	if (pre != 2)
		ch2 = sol(idx + 1, 2) + b[idx];
	if (pre != 3)
		ch3 = sol(idx + 1, 3) + c[idx];
	return ret = max({ ch1, ch2, ch3 });
}
int main(){
	K_K();
	cin >> n;
	a.resize(n);
	b.resize(n);
	c.resize(n);
	clr(dp, -1);
	for (int i = 0; i < n; i++)
		cin >> a[i] >> b[i] >> c[i];
	cout << sol(0, 0);
}

Measured memory_bytes: 11648
import itertools
import math
from collections import deque
N = int(input())
adj = [[] for _ in range(N+1)]

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

def bfs(S):
    dist = [N]*(N+1)
    dist[S] = 0
    q = deque([S])
    while q:
        u=q.pop()
        for v in adj[u]:
            if dist[v] == N:
                dist[v] = dist[u]+1
                q.appendleft(v)
    return dist
df = bfs(1)
ds = bfs(N)

if sum(df[i] > ds[i] for i in range(1,N+1)) >= N/2:
    print("Snuke")
else:
    print("Fennec")

Measured memory_bytes: 63648
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int ch(int a)
{
	int r=0;
	while(a>0)
	{
		r+=a%10;
		a=a/10;
	}
	return r;
}


int main()
{
	int n,a,b,c=0;
	cin>>n>>a>>b;
	for(int i=1;i<=n;i++)
	{
		int p=ch(i);
		if(a<=p&&p<=b)c+=i;
	}
	cout<<c<<endl;
}


Measured memory_bytes: 256
<?php

//ガウス・ジョルダン法というのを使うらしい
//http://www.isc.meiji.ac.jp/~re00108/ch07/index.html

while (($line = trim(fgets(STDIN))) !== '') {
    sscanf($line, '%f %f %f %f %f %f', $a, $b, $c, $d, $e, $f);
    $arr = array(array($a, $b, $c), array($d, $e, $f));
    for ($i = 0; $i < 2; $i++) {
        //ピボット
        $n = $arr[$i][$i];
        foreach ($arr[$i] as $j => $m) {
            $arr[$i][$j] /= $n;
        }
        for ($j = 0; $j < 2; $j++) {
            //ピボットの行は既に計算済み
            if ($i === $j) {
                continue;
            }

            $m = $arr[$j][$i];
            foreach ($arr[$j] as $k => $l) {
                $arr[$j][$k] -= $arr[$i][$k] * $m;
            }
        }
    }

    $c = round($arr[0][2] * 1000) / 1000;
    $f = round($arr[1][2] * 1000) / 1000;
    printf("%.3f %.3f\n", $c, $f);
}

Measured memory_bytes: 6684
N = int(input())
L = [int(i) for i in input().split()]

ret = 0
for i in range(N) :
  for j in range(i + 1, N) :
    for k in range(j + 1, N) :
      a, b, c = L[i], L[j], L[k]
      if a + b > c and b + c > a and c + a > b and a != b and b != c and c != a:
        ret += 1

print(ret)

Measured memory_bytes: 68204
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

typedef pair<int, int> P;
typedef pair<string, int> SP;
typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n;
ll t[101];

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

ll lcm(ll a, ll b) {
  if(a < b) swap(a, b);
  return a / gcd(a, b) * b;
}

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

  cin >> n;
  REP(i, n) {
    cin >> t[i];
  }

  ll ans = 1LL;
  REP(i, n) {
    ans = lcm(ans, t[i]);
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(){
  vector<int> p;
  int n,a;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a;
    p.push_back(a-1);
  }
  int b = 2;
  bool h = true;
  for(int i=0;i<n;i++){
    if(p[i]!=i){
      if(b!=0){
        b--;
        if(p[p[i]]!=i){
          h = false;
          break;
        }
      }else{
        h = false;
        break;
      }
    }
  }
  if(h) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <set>

int N;
std::vector<std::pair<int, int>> p;

int main(int argc, char const* argv[])
{
    int tx, ty;
    std::cin >> N;
    while (std::cin >> tx >> ty) {
        p.emplace_back(tx, ty);
    }

    std::multiset<std::pair<int, int>> counter;
    for (int i = 0; i < N; i++) {
        for (int j = i+1; j < N; j++) {
            counter.emplace(p[i].first-p[j].first, p[i].second-p[j].second);
            counter.emplace(p[j].first-p[i].first, p[j].second-p[i].second);
        }
    }

    int max = 0;
    for (const auto& e : counter) {
        max = std::max(int(counter.count(e)), max);
    }
    std::cout << 1+(N-1-max) << std::endl;
    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<cmath>
#include<cstdio>
#include<math.h>
#include<complex>
using namespace std;
typedef complex<double> xy_t;
xy_t P[110];
int main()
{
    double a,b,c,z,S;
    int N=0;
    double x,y;
    while(scanf("%lf,%lf",&x,&y)!=EOF)
    {
        P[N++]=xy_t(x,y);
    }
    double sum=0.0;
    for (int i=0;i<N-2;i++)
    {
        xy_t m=P[0],n=P[i+1],k=P[i+2];
        a=sqrt((m.real()-n.real())*(m.real()-n.real())+(m.imag()-n.imag())*(m.imag()-n.imag()));
        b=sqrt((m.real()-k.real())*(m.real()-k.real())+(m.imag()-k.imag())*(m.imag()-k.imag()));
        c=sqrt((k.real()-n.real())*(k.real()-n.real())+(k.imag()-n.imag())*(k.imag()-n.imag()));
        z=(a+b+c)/2.0;
        S=sqrt(z*(z-a)*(z-b)*(z-c));
        sum+=S;
    }
    printf("%.6f\n",abs(sum));
    return 0;
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

	ll N=in(),K=in<ll>();
	vector<pair<int,ll>> P(N);
	REP(i,N){
		P[i].first=in();
		P[i].second=in();
	}
	sort(ALL(P),PAIRCOMP(first,<));

	ll sum=0;
	REP(i,N){
		if(sum+P[i].second>=K){
			out(P[i].first);
			break;
		}
		sum += P[i].second;
	}
	
	return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main() {
  int x, y, z, temp;
  scanf("%d %d %d", &x, &y, &z);
  temp = x;
  x = y; 
  y = temp;
  temp = x;
  x = z;
  z = temp;
  printf("%d %d %d", x, y, z);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define INF 1<<30
#define endl '\n'
#define maxn 100005
#define tc printf("Case %d: ", cs)
#define tcn printf("Case %d:\n", cs);
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
const double PI = acos(-1.0);

#define dbg1(x) cerr << #x << " = " << x << endl;
#define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl;
#define dbg3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;
#define dbg4(w,x, y, z) cerr << #w << " = " << w << ", " <<#x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
  return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
  os << "{";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if ( it != v.begin() ) os << ", ";
    os << *it;
  }
  return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
  os << "[";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if ( it != v.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
  os << "[";
  for (auto it = v.begin(); it != v.end(); ++it) {
    if ( it != v.begin() ) os << ", ";
    os << it -> first << " = " << it -> second ;
  }
  return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

clock_t tStart = clock();
#define timeStamp dbg("Execution Time: ", (double)(clock() - tStart)/CLOCKS_PER_SEC)

void faltu () { cerr << endl; }

template <typename T>
void faltu( T a[], int n ) {
  for (int i = 0; i < n; ++i) cerr << a[i] << ' ';
  cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest) { cerr << arg << ' '; faltu(rest...); }
// Program showing a policy-based data structure.
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp>
#include <functional> // for less 
#include <iostream>
using namespace __gnu_pbds;
using namespace std;
// GNU link : https://goo.gl/WVDL6g
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
        tree_order_statistics_node_update>
        new_data_set;

/**___________________________________________________**/



int main()
{
  FASTIO
  /*
#ifndef ONLINE_JUDGE
  freopen("in.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
  freopen("error.txt", "w", stderr);
#endif
//*/
  int T;
  //scanf("%d", &T);
  T = 1;
  for (int cs = 1; cs <= T; cs++) {
    map<string, int> ans;
    ans["SAT"] = 1;
    ans["SUN"] = 7;
    ans["MON"] = 6;
    ans["TUE"] = 5;
    ans["WED"] = 4;
    ans["THU"] = 3;
    ans["FRI"] = 2;
    string s;
    cin >> s;
    cout << ans[s] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <array>
#include <vector>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>

using namespace std;

typedef  pair<int,int> P;
typedef long long LL;
typedef vector<LL> VEC;

const LL INF=1<<30;
const LL MOD=1000000007;






int main(){
    string c1,c2;
    cin>>c1>>c2;
    for(int i=0;i<3;++i){
        if(c1[i]!=c2[2-i]){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mem(a) memset(a,0,sizeof(a))
#define ll long long
bool sf[100010]={0};//0可以，1不可以 
int hei[100010];
int main()
{
	int n,m,a,b,i,s=0;
	cin>>n>>m;
	for(i=1;i<=n;i++)scanf("%d",&hei[i]);
	for(i=0;i<m;i++)
	{
		scanf("%d%d",&a,&b);
		if(hei[a]>hei[b])sf[b]=1;
		else if(hei[a]<hei[b]) sf[a]=1;
		else sf[a]=sf[b]=1;
	}
	for(i=1;i<=n;i++)
	{
		//printf("sf[%d]=%d,",i,sf[i]);cout<<endl;//************
		if(!sf[i])s++;
	}
	cout<<s;
	return 0;
}

Measured memory_bytes: 4140
#![allow(unused_imports)]
#![allow(dead_code)]
use std::io::prelude::*;
use std::cmp::{max, min};

const MOD: i64 = 1e9 as i64 + 7; 

fn main(){
    let s: Vec<char> = read::<String>().chars().collect();
    let n: usize = s.len();
    let mut dp: Vec<Vec<i64>> = vec![vec![0; 14]; n + 1];
    dp[0][0] = 1;
    for i in 0..n{
        for j in 0..14{
            if s[i] == '?'{
                for k in 0..10{
                    dp[i + 1][(j * 10 + k) % 13] += dp[i][j];
                    dp[i + 1][(j * 10 + k) % 13] %= MOD;
                }
            }else{
                let t: usize = (j * 10 + s[i] as usize - '0' as usize) % 13;
                dp[i + 1][t] += dp[i][j];
                dp[i + 1][t] %= MOD;
            }
        }
    }
    println!("{}", dp[n][5]);
}

fn upper_bound(a: &Vec<i32>, x: &i32) -> Option<usize>
{
    let mut ok: isize = a.len() as isize;
    let mut ng: isize = -1;
    if ok == 0 || a[ok as usize - 1] <= *x{
        None
    }else{
        while (ng - ok).abs() > 1{
            let mid = (ok + ng) / 2;
            if a[mid as usize] > *x{
                ok = mid;
            }else{
                ng = mid;
            }
        }
        Some(ok as usize)
    }
}

fn read<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


Measured memory_bytes: 18684
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline ostream& operator << (ostream& out, const vector<T>& v) {
	if (v.empty())return out;
	constexpr bool is_vector_v = is_vector<T>::value;
	if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
	else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
	return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }

int main(){
	string s,t;
  	cin >> s >> t;
  	cout << t << s << endl;
  	return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
    int r;
    const char *contest;

    std::cin >> r;

    if (r < 1200) {
        contest = "ABC";
    } else if (r < 2800) {
        contest = "ARC";
    } else {
        contest = "AGC";
    }

    std::cout << contest << std::endl;

    return 0;
}


Measured memory_bytes: 256
import numpy as np
# import random
def d2():
    n = int(input())
    s = input()
    l = [ 1 if x=='(' else -1 for x in s[:] ]
    mt = np.cumsum(l) # mountain
    mi = min(0, np.amin(mt))
    left = ''; right = ''
    if mi < 0:
        left = '('*(mi*-1)
    if mt[-1]-mi > 0:
        right = ')'*(mt[-1]-mi)
    # print(mt, mi)
    print(left + s + right)

d2()


Measured memory_bytes: 13452
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <climits>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define no {cout << 0; return;}
#define mkp make_pair
#define mkt make_tuple
#define cerr if(0) cerr

void solve() {
    int a, b;
    cin >> a >> b;
    cout << a * b / __gcd(a, b);
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 3652
a = int(raw_input())
b = int(raw_input())
c = int(raw_input())
x = int(raw_input())

def dfs(x, i, a, b , c):
  	if x < 0:
  		return 0
  	if x == 0:
  		return 1
  	
  	if i == 3:
  		return 1 if x == 0 else 0
  	r = 0
  	m = {0:a,1:b,2:c}
  	v = {0:500,1:100,2:50}

  	for k in range(0, m[i] + 1):
  		r += dfs(x - k * v[i], i+1, a,b,c)
  	return r

print dfs(x,0,a,b,c)


Measured memory_bytes: 77972
import java.util.Arrays;
import java.util.Scanner;

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

        int[] h = new int[10];
        for (int i=0;i<10;i++) {
            h[i] = sc.nextInt();
        }

        Arrays.sort(h);

        for (int i=9;i>6;i--) {
            System.out.println(h[i]);
        }
    }
}


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

using namespace std;

#define all(v)   v.begin(), v.end()
#define pb       push_back
#define sz(x)    (int) (x.size())
#define endl "\n"
#define isOdd(n)    (n&1)
#define pow(n, m) (ll)powl(n, m)
#define clr(x, val)    memset(x, val, sizeof(x)) //be careful of value and TLE

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


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

    int l, r, d; cin >> l >> r >> d;
    int c = 0;
    for(int i = l; i <=r ; i++){
        if(i%d==0) c++;
    }
    cout << c;
    return 0;
}


Measured memory_bytes: 3608
import java.util.Scanner;

/**
 *
 * @author lenovo
 */
public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int seconds = scanner.nextInt();

        int hour = seconds / 3600;
        int minute = (seconds - hour * 3600) / 60;
        int second = (seconds - hour * 3600 - minute * 60);

        System.out.println(hour + ":" + minute + ":" + second);

    }
}

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

int main(){
  
  int a,b,c;
  cin >> a >> b >> c;
  int ans;
  
  if(b / a >= c){
  	ans = c;
  }else{
   	ans = b/a; 
  }
  
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#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 fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

string s;
bool used[100001];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int k;
	cin>>k>>s;
	int n = int(s.length());
	int d = (n/(k+1)); int u = d + 1;
	int rem = n%(k+1); //rem times of u
	//cerr<<n<<'\n';
	if(rem == 0)
	{
		string ans;
		for(int j = 0; j < d; j++)
		{
			int tmp = 1;
			for(int i = 0; i < n; i += d)
			{
				if(used[i]) continue;
				if(s[i+j]-'0'>tmp)
				{
					tmp=s[i+j]-'0';
				}
			}
			for(int i = 0; i < n; i += d)
			{
				if(used[i]) continue;
				if(s[i+j]-'0'<tmp)
				{
					used[i]=true;
				}
			}
			ans+=char(tmp+'0');
		}
		cout<<ans<<'\n';
		return 0;
	}
	string ans;
	for(int i = 0; i < u; i++) //BS each digit
	{
		int lo = 1; int hi = 9;
		int an = 0;
		while(lo<=hi)
		{
			int mid = (lo+hi)>>1;
			int j = 0; int cnt = rem;
			//cerr<<cnt<<' '<<u<<'\n';
			while(cnt>0&&j<n)
			{
				//cerr<<j<<' '<<cnt<<' '<<mid<<'\n';
				if(j+u>n) break;
				bool pos = true;
				for(int k = j; k < j + u; k++)
				{
					if(k-j>i)
					{
						break;
					}
					else if(k-j==i)
					{
						if(s[k]-'0'<=mid)
						{
							break;
						}
						else
						{
							pos=false;
							break;
						}
					}
					else
					{
						if(s[k]>ans[k-j])
						{
							pos=false;
							break;
						}
						else if(s[k]<ans[k-j])
						{
							break;
						}
					}
				}
				if(pos)
				{
					cnt--;
					j+=u;
				}
				else
				{
					j+=d;
				}
			}
			//cerr<<i<<' '<<mid<<' '<<cnt<<'\n';
			if(cnt==0)
			{
				an=mid;
				hi=mid-1;
			}
			else
			{
				lo=mid+1;
			}
		}
		ans += char(an+'0');
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 720
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define int long long

void solve() {
	int n, x; cin >> n >> x;
    vector<int> a(n);
    vector<int> sum(n + 1, 0);
    rep(i, n) {
        cin >> a[i];
    }
    sort(all(a));
    rep(i, n) {
        sum[i + 1] = sum[i] + a[i];
    }
    if(sum[n] == x) {
        cout << n << endl;
    } else if(sum[n] < x) {
        cout << n - 1 << endl;
    } else {
        int ans = 0;
        rep(i, n + 1) if(sum[i] <= x) ans = i;
        cout << ans << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 256
from sys import stdin
S = list(str(stdin.readline().rstrip()))
ans = 0
for i in range(1,len(S)):
    if S[i-1] == S[i]:
        ans+=1
        if S[i-1] == "0":
            S[i] = "1"
        if S[i-1] == "1":
            S[i] = "0"
print(ans)

Measured memory_bytes: 3956
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>

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)

signed main(){
    int n,l;cin>>n>>l;
    vector<int> a(n);
    rep(i,n)cin>>a[i];
    bool flag=false;
    int two=a[0];
    int index=0;
    rep1(i,n-1){
        two=a[i]+a[i-1];
        if(two>=l){
            index=i;
            flag=true;
            break;
        }
    }
    vector<int> res;
    rep1(i,index-1){
        res.push_back(i);
    }
    for(int i=n-1;i>=index;i--){
        res.push_back(i);
    }
    if(!flag){
        cout<<"Impossible"<<endl;
    }
    else{
        cout<<"Possible"<<endl;
        rep(i,res.size()){
            cout<<res[i]<<endl;
        }
    }
    //cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 2548
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n; 
  cin  >> n;
  int sum = 0, maxL = 0;
  for(int i = 0; i < n; ++i) {
    int L; 
    cin  >> L;
    sum += L;
    maxL = max(maxL , L);
  }
  if(maxL < sum - maxL) {
    cout  <<"Yes"<< endl;
  }else{
    cout  <<"No"<< endl;
  }
  return 0;
}

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


#define FAST_INPUT ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
using namespace std;


int n, k;
vector<int> nums;

bool ok(int max_size) {
    ll total_cuts=0;
    for(int i=0; i<n; i++){
        int val=nums[i];
        total_cuts+=(val/max_size+(val%max_size!=0)-1);
    }
    return total_cuts<=k;

}

void solve() {
    cin >> n >> k;
    nums=vector<int>(n);
    int mx=0;
    for (int i=0; i<n; i++) {
        cin >> nums[i];
        mx=max(mx, nums[i]);
    }
    
    int l=1, r=mx;
    int ans = INT_MAX;
    while (l<=r) {
        int mid=l+(r-l)/2;

        if(ok(mid)){
            ans=min(ans, mid);
            r=mid-1;
        } else {
            l=mid+1;
        }
    }

    cout << ans << endl;
}

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


Measured memory_bytes: 3992