akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        
        System.out.println(lcm(a, b));
    }
    
    static long gcd(long a, long b){
        
        if(b == 0){
            return a;
        }else{
            return gcd(b, a % b);
        }
    }
    
    static long lcm(long a, long b){
        
        return (a / gcd(a, b)) * b;
    }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
const int maxm=1e5+5;
int n,m,ans=0;
bitset<505>state[505],tmp;
int x[maxm],y[maxm];
bool fuckit[505];
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++){
		scanf("%d%d",&x[i],&y[i]);
	}
	for (int i=1;i<=n;i++)
	{
	  state[i][i]=1;
	  for (int j=m;j>=1;j--){
	  	int a=state[i][x[j]],b=state[i][y[j]];
	  	if (a&b){fuckit[i]=1;break;}
	  	if (a)state[i][y[j]]=1;
		if (b)state[i][x[j]]=1;
	  }
	}
	for (int i=1;i<=n;i++)
	{
	if (fuckit[i])continue;
	  for (int j=i+1;j<=n;j++)
	  {
	  	if (fuckit[j])continue;
	  	tmp=(state[i]&state[j]);
	  	if (!(tmp.any()))ans++;
	  }
	}
	printf("%d\n",ans);
	return 0;
}

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

int main() {
  vector<int> A(5);
  for (int i = 0; i < 5; i++) {
    cin >> A.at(i);
  }
  int k;
  cin >> k;
  
  bool ans = true;
  
  for (int i = 0; i < 4; i++) {
    for (int j = i+1; j < 5; j++) {
      int r = A.at(j) - A.at(i);
      if (r > k) {
        ans = false;
      }
    }
  }
  
  if (ans) {
    cout << "Yay!" << endl;
  }
  else {
    cout << ":(" << endl;
  }
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) std::cerr<< #x <<": "<<x<<"\n"
#define debug2(x,y) std::cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<"\n"
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

// cout vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size(); s << "\n";
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  s << "\n"; return s;
}

// cout 2-dimentional vector
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) { s << vv[i]; }
  return s;
}

int main() {
  int n;
  cin >> n;
  int ans = 0;
  FOR (i, 1, n+1) {
    if (i % 2 == 0) {
      continue;
    }
    int cnt = 0;
    FOR (j, 1, i+1) {
      if (i % j == 0) {
        cnt += 1;
      }
    }
    if (cnt == 8) {
      ans += 1;
    }
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 888
#include<stdio.h>

int mod=1000000007;
long long fun(int a,int b,int mod)
{
	long long d=1,t=a;
	while(b)
	{
		if(b&1)
			d=(d*t)%mod;
		b/=2;
		t=(t*t)%mod;
	}
	return d;
}


int main()
{
	int n,i,f;
	long long sum;
	int a[100005],m[100000];
	scanf("%d",&n);
	f=0;
	for(i=0;i<n;i++)
	{
		m[i]=0;
		scanf("%d",&a[i]);
	}
	for(i=0;i<n;i++)
		m[a[i]]++;
	if(n%2==1)
	{
		if(m[0]!=1)
			f=1;
		for(i=2;i<n;i+=2)
			if(m[i]!=2)
				f=1;
	}
	else
	{
		for(i=1;i<n;i+=2)
			if(m[i]!=2)
				f=1;
	}
	sum=fun(2,n/2,mod);
	if(n%2)
	{
		if(f)
			printf("0\n");
		else
			printf("%lld\n",sum);
	}
	else
	{
		if(f)
			printf("0\n");
		else
			printf("%lld\n",sum);
	}
	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef unsigned long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,A,B;
string S;
string alpha = "abcdefghijklmnopqrstuvwxyz";
string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main(){
    cin>>N;
    vec x(3,0), y(3,0);
    ll sq = sqrt(N+0.1);
    //cout<<sq<<endl;
    if(N == (ll)(1e+18)){
        x[1] = 1e+9;
        y[2] = 1e+9;
        rep(i,3) cout<<x[i]<<' '<<y[i]<<' ';
        cout<<endl;
        return 0;
    }
    if(N <sq*sq) --sq;
    //cout<<sq<<endl;
    if(N - sq*sq == 0){
        x[1] = y[2] = sq;
        rep(i,3) cout<<x[i]<<' '<<y[i]<<' ';
        cout<<endl;
        return 0;
    }
    ++sq;
    x[1] = y[2] = sq;
    ll mi = sq*sq - N;
    if(mi >= sq){
        mi -= sq;
        --x[1];
    }
    if(mi == 0){
        rep(i,3) cout<<x[i]<<' '<<y[i]<<' ';
        cout<<endl;
        return 0;
    }
    reps(i,1,mi+1){
        if((mi%i == 0) && (mi/i <= 1e+9)){//多分後半いらない
            x[2] = i;
            y[1] = mi/i;
            rep(i,3) cout<<x[i]<<' '<<y[i]<<' ';
            cout<<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
//
//ARC 096
//C
//

#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <functional>
#include <cassert>
#include <bitset>

using namespace std;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define SIZE(x) (int)(x).size()
#define SIZEL(x) (ll)(x).size()
#define MSG(a) cout << #a << " " << a << endl;

using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;

const double PI = 3.14159265358979323846;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }    //最大公約数
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }            //最小公倍数

int main()
{
    int a,b,c,x,y;
    cin >> a >> b >> c >> x >> y;

    int pay = a*x + b*y;
    int payHA = 2*x*c + ((x>=y) ? 0 : (y-x)*b);
    int payHB = 2*y*c + ((y>=x) ? 0 : (x-y)*a);

    pay = min(pay, payHA);
    pay = min(pay, payHB);

    cout << pay << endl;
    return 0;
}


Measured memory_bytes: 3640
until (n=gets.to_i)==0
  l1=gets.split.map(&:to_i)
  l2=Array.new(n)
  count=0
  loop do
    l1.each.with_index do |num,id|
      l2[id]=l1.count{|item| item==num}
    end
    break if l1==l2
    count+=1
    l1=l2.dup
  end
  puts "#{count}\n#{l1.join(" ")}"
end

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

int main(){
	int a1,a2,a3,b1,b2,b3;
	int x[4][4];
	
	for(int i=1; i<=3; i++){
		for(int j=1; j<=3; j++){
			cin>>x[i][j];
		}
	}
	
	a1=0;
	b1=x[1][1]-a1;
	b2=x[1][2]-a1;
	b3=x[1][3]-a1;
	
	a2=x[2][1]-b1;
	a3=x[3][1]-b1;
	
	if(a2+b2==x[2][2] && a2+b3==x[2][3] && \
	   a3+b2==x[3][2] && a3+b3==x[3][3]){
		 cout<<"Yes"<<endl;
		 return 0;
	}
	
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int sum = a + b;
    if(a % 3 == 0 || b % 3 == 0 || sum % 3 == 0){
      System.out.println("Possible");
    }else{
      System.out.println("Impossible");
    }
  }
}


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

using namespace std;

int main ()
{
    int n, m;
    cin >> n >> m;
    vector<int> A(n);
    int total_votes = 0;
    for (int i=0; i<n; i++) {
        cin >> A[i];
        total_votes += A[i];
    }
    double min_val = ((double)total_votes)/(4*m);
    sort(A.begin(), A.end(), greater<int>());
    int i=0;
    for (i=0; i<n; i++) {
        if ((double)A[i] < min_val) break;
    }
    if (i >= m) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	char c;
	cin >> c;
	if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
	{
		cout << "vowel" << endl;
	}
	else
	{
		cout << "consonant" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define endl '\n'
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1000000007;
const int N=1e5+9;
int main()
{
    FASTINOUT;
    ll x,k;
    cin>>x>>k;
    ll y[x];
    for (int i=0; i<x; i++)
    {
        cin>>y[i];
    }
    ll ans=0,mx=0,dif=-1;
    for (int i=x-1; i>=0; i--)
    {
        mx=max(mx,y[i]);
        if (mx-y[i]>dif)
        {
            dif=mx-y[i];
            ans=1;
        }
        else if (mx-y[i]==dif)
            ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define DEBUG(x) cerr << #x << " = " << x << endl
signed main() {
  ios::sync_with_stdio(false);
  int N, M; cin >> N >> M;
  vector<int> lower(N), upper(N);
  REP(i,N) {
    upper[i] = lower[i] = i;
  }
  vector<pair<int, int>> B;
  REP(i,M) {
    int a, b; cin >> a >> b;
    b--;
    B.emplace_back(a, b);
  }
  sort(B.begin(), B.end());
  for(const auto &item : B) {
    int k = item.second;
    upper[k] = upper[k + 1] = max(upper[k], upper[k + 1]);
    lower[k] = lower[k + 1] = min(lower[k], lower[k + 1]);
  }
  REP(i,N) {
    if(i > 0) cout << ' ';
    cout << upper[i] - lower[i] + 1;
  }
  cout << endl;
}

Measured memory_bytes: 8080
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(){

    ll N, K;
    cin >> N >> K;
    string s;
    cin >> s;
    s += '2';
    vector<int>color;
    vector<int>length;
    for(int c = 1, l = 0, i = 0; i < s.size(); i++){
        if(s[i] - '0' != c){
            color.push_back(c);
            length.push_back(l);
            c = s[i] - '0';
            l = 0;
        }
        l++;
    }
    if(color[color.size() - 1] == 0){
        color.push_back(1);
        length.push_back(0);
    }
    int mx = 1 + 2 * K;
    // cout << "mx : " << mx << endl;
    // for(int i = 0; i < color.size(); i++){
    //     cout << color[i] << " : " << length[i] << endl;
    // }
    int ans = 0;
    for(int l = 0, r = 0, sum = length[0]; l < length.size(); ){
        while(r + 1 < length.size() && r + 1 - l + 1 <= mx){
            r++;
            sum+=length[r];
        }
        ans = max(ans, sum);
        sum -= length[l];
        l++;
        sum -= length[l];
        l++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1404
#include "stdio.h"

char A[110] = {};
char B[110] = {};
bool flag = false;

int main() {
	scanf("%s", A);
	scanf("%s", B);
	for (int i = 0; i < 110; i++) {
		if (A[i] == NULL && B[i]!=NULL) {
			printf("LESS");
			flag = true;
			break;
		}
		if (A[i] != NULL && B[i] == NULL) {
			printf("GREATER");
			flag = true;
			break;
		}
	}
	if (!flag) {
		for (int i = 0; i < 110; i++) {
			if (A[i] > B[i]) {
				printf("GREATER");
				flag = true;
				break;
			}
			else if (A[i] < B[i]) {
				printf("LESS");
				flag = true;
				break;
			}
		}
	}
	if (!flag)printf("EQUAL");
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>

#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007

using namespace std;

int main(void) {
	long long int n, m;
	long long int count = 0;

	cin >> n >> m;

	if (n * 2 > m) {
		count += m / 2;
	}
	else if (n * 2 == m) {
		count = n;
	}
	else if (n * 2 < m) {
		count += n;
		m -= n * 2;
		n = 0;
		count += m / 4;
	}
	cout << count << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define int long long
#define mp make_pair
#define inf 998244353
#define LINF 1000000000000000007LL
#define ll long long
using namespace std;
vector<int> nex[1140];
int dis[1140],prv[1140];
signed main(){
	int n,m;
	cin>>n>>m;
	for(int i=0;i<m;i++){
		int x,y;
		cin>>x>>y;
		nex[x].pb(y);
	}
	int ans = inf;
	int good = -1;
	for(int i=1;i<=n;i++){
		queue<int> que;
		int mloop = inf;
		for(int j=1;j<=n;j++){
			dis[j] = inf;
		}
		dis[i] = 0;
		que.push(i);
		while( !que.empty() ){
			int cur = que.front(); que.pop();
			for(int j=0;j<nex[cur].size();j++){
				int nx = nex[cur][j];
				if( dis[nx] == inf ){
					dis[nx] = dis[cur] + 1;
					que.push(nx);
				}
				if( nx == i && dis[cur] + 1 < mloop){
					mloop = dis[cur] + 1;
				}
			}
		}
		if( mloop < ans ){
			ans = mloop;
			good = i;
		}
	}
	if( good == -1 ){
		cout<<-1<<endl;
		return 0;
	}
	queue<int> que;
	int mloop = inf;
	for(int j=1;j<=n;j++){
		dis[j] = inf;
		prv[j] = 0;
	}
	dis[good] = 0;
	que.push(good);
	while( !que.empty() ){
		int cur = que.front(); que.pop();
		for(int j=0;j<nex[cur].size();j++){
			int nx = nex[cur][j];
			if( dis[nx] == inf ){
				dis[nx] = dis[cur] + 1;
				prv[nx] = cur;
				que.push(nx);
			}
			if( nx == good && dis[cur] + 1 < mloop){
				mloop = dis[cur] + 1;
				prv[good] = cur;
			}
		}
	}
	cout<<mloop<<endl;
	int cid = good;
	for(int i=1;i<=mloop;i++){
		cout<<cid<<endl;
		cid = prv[cid];
	}
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<list>
#include<string>
#include<cstring>
#include<cstdlib>
#include<cstdio>
//#include<cmath>
using namespace std;

int main(void)
{
	vector<int> S, T;
	int n, q, m, p, sum = 0, left, right, mid;
	bool ok = false;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> m;
		S.push_back(m);
	}
	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> p;
		T.push_back(p);
	}
	for (int i = 0; i < q; i++) {
		left = 0;
		right = n;
		ok = false;
		while (left < right) {
			mid = (left + right) / 2;
			if (S[mid] == T[i]) {
				ok = true;
				break;
			}
			else if (S[mid] > T[i]) {
				right = mid;
			}
			else
				left = mid + 1;
		}
		if (ok)
			sum++;
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 3580
function Main(input){
	input = input.split(" ").map(a=>~~a);
  var A = input.shift();
  var B = input.shift();
  var C = input.shift();
  return Math.min(C,Math.floor(B/A))
}

// If you are interested in the algorithms I used, 
// there is no need to read down from this line.

((b,c,d)=>"undefined"!=typeof require?console.log(Main(require("fs").readFileSync("/dev/stdin","utf8"))):[b=b.split("\n").slice(1,-1).join("\n"),c=function(){try{return Main(b)}catch(f){return f.stack||f.message}}(),d=typeof c,"string"==d||(c=JSON.stringify(c)),$("<form>").append([[10,b],0,[1,d],0,[10,c]].map(f=>$(f?"<textarea>":"<br>",f&&{rows:f[0],cols:40,text:f[1]}))).appendTo("body")])(`
3 9 5
`);

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(cnt,e) for(ll cnt=0;cnt<e;cnt++ )
#define allsort(X) sort(X.begin(),X.end())

typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const ll INF = INT64_MAX;






ll i,j,k;


int main(){
    ll A,B,V,W,T;
    cin>>A>>V;
    cin>>B>>W;
    cin>>T;

    ll dist=abs(A-B);
    ll oikoshi=T*(V-W);
    if(dist<=oikoshi)cout<<"YES";
    else cout<<"NO";
    cout<<endl;
}

Measured memory_bytes: 3624
/* --- author: dxm --- */
#include<bits/stdc++.h>
using namespace std;

#define INF 1e9
#define Inf 1e18
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
typedef long long ll;
inline void Fail(){printf("0");exit(0);}
inline void debug(int x){cerr<<"debug: "<<x<<"\n";}
inline void debug(int n,int x[]){cerr<<"debug "<<"\n";rep(i,n)cerr<<x[i]<<" ";cerr<<"\n";}
inline void debug(string x){cerr<<"debug: "<<x<<"\n";}

const int maxn=105;
int n;
int a[2][maxn];
int dp[2][maxn];

int main(){
	scanf("%d",&n);
	REP(i,2)REP(j,n)scanf("%d",&a[i][j]);
	REP(i,2)REP(j,n)dp[i][j]=max(dp[i-1][j],dp[i][j-1])+a[i][j];
	printf("%d",dp[2][n]);
	return 0;
}

/*
Input:
-----------------
Output:
*/

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <stack>
#include <queue>
#include <bitset>
#include <numeric>
#include <cassert>
#ifdef DEBUG
#include "./Lib/debug.hpp"
#else
#define dump(...)
template<class T>inline auto d_val(T a, T b) { return a; }
#endif

/* (=＾o＾=) */
#define int ll

/* macro */
#define FOR(i, b, e) for(ll i = (ll)(b); i < (ll)(e); ++i)
#define RFOR(i, b, e) for(ll i = (ll)(e-1); i >= (ll)(b); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define REPI2(it,b,e) for(auto it = (b); it != (e); ++it)
#define REPI(it,c) REPI2(it, (c).begin(), (c).end())
#define RREPI(it,c) REPI2(it, (c).rbegin(), (c).rend())
#define REPI_ERACE2(it, b, e) for(auto it = (b); it != (e);)
#define REPI_ERACE(it, c) REPI_ERACE2(it, (c).begin(), (c).end())
#define ALL(x) (x).begin(),(x).end()
#define cauto const auto&
/* macro func */
#define SORT(x) do{sort(ALL(x));}while(false)
#define RSORT(x) do{sort((x).rbegin(),(x).rend());}while(false)
#define UNIQUE(v) do{v.erase( unique(v.begin(), v.end()), v.end() );}while(false)
#define MAX(x,y) do{x = std::max(x,y);}while(false)
#define MIN(x,y) do{x = std::min(x,y);}while(false)
#define BR do{cout<<"\n";}while(false)

/* type define */
using ll = long long;
using PAIR = std::pair<ll, ll>;
using VS = std::vector<std::string>;
using VL = std::vector<long long>;
using VVL = std::vector<VL>;
using VVVL = std::vector<VVL>;
using VD = std::vector<double>;
template<class T>
using V = std::vector<T>;

/* using std */
using std::cout;
constexpr char endl = '\n';
using std::cin;
using std::sort;
using std::pair;
using std::string;
using std::stack;
using std::queue;
using std::vector;
using std::list;
using std::map;
using std::unordered_map;
using std::multimap;
using std::unordered_multimap;
using std::set;
using std::unordered_set;
using std::unordered_multiset;
using std::multiset;
using std::bitset;
using std::priority_queue;

/* constant value */
constexpr ll MOD = 1000000007;
//constexpr ll MOD = 998244353;

/* Initial processing  */
struct Preprocessing { Preprocessing() { std::cin.tie(0); std::ios::sync_with_stdio(0); }; }_Preprocessing;

/* Remove the source of the bug */
signed pow(signed, signed) { assert(false); return -1; }

/* define hash */
namespace std { template <>	class hash<std::pair<ll, ll>> { public:	size_t operator()(const std::pair<ll, ll>& x) const { return hash<ll>()(1000000000 * x.first + x.second); } }; }

/* input */
template<class T> std::istream& operator >> (std::istream& is, vector<T>& vec) { for (T& x : vec) is >> x; return is; }

//=============================================================================================

signed main() {
	ll n, a, b;
	cin >> n >> a >> b;
	cout << ((b - a - 1) & 1 ? "Alice" : "Borys") << endl;
}

Measured memory_bytes: 256
<?php
$S = str_split(trim(fgets(STDIN)));
$count = count($S);
$C =0;
if($S[0] !== 'A'){
echo 'WA';
exit;

}
for ($i = 1;$i<=$count-1;$i++){
  if (ctype_upper($S[$i]) == TRUE){
      if($S[$i]='C' and $i!==1 and $i!==$count-1 and $C==0){
      $C++;
      }else{
        echo 'WA';
        exit;
      }
    }
  }
if($C==0){
  echo 'WA';
}else{
  echo 'AC';
}


Measured memory_bytes: 3576
<?php

fscanf(STDIN, "%d%d", $a,$b);

fscanf(STDIN, "%s", $s);
$s_array = str_split($s);


if(($s_array[$a]=='-')&&
        (count($s_array)==$a+$b+1)){
    
    $cnt=0;
    foreach ($s_array as $value) {
        if($value=='-'){
            $cnt++;
        }
        if($cnt>=2){
            echo 'No';
            return;
        }
    }
    
    echo 'Yes';
}else{
    echo 'No';
}

Measured memory_bytes: 4856
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;

ll n,m;
vector<ll> a;

bool solve(ll x)
{
  ll cnt = 0;
  REP(i,n){
    ll pos = lower_bound(ALL(a), x-a[i]) - a.begin();
    cnt += (n - pos);
  }
  return cnt < m;
}

int main()
{
  cin >> n >> m;
  a.resize(n);
  REP(i,n) cin >> a[i];
  sort(ALL(a));

  ll ok = 9e18;
  ll ng = 0;
  while((ok-ng)>1){
    ll mid = (ok+ng)/2;
    if(solve(mid)) ok = mid;
    else ng = mid;
  }

  ll ans = 0;
  vector<ll> sum(n+1, 0);
  REP(i,n) sum[i+1] = sum[i] + a[i];
  REP(i,n){
    ll pos = upper_bound(ALL(a), ng - a[i]) - a.begin();
    ll cnt = n - pos;
    ans += cnt * a[i] + (sum[n] - sum[pos]);
    m -= cnt;
  }
  ans += m * ng;
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <string.h>
 
int main(void) {
    char n[200];
    int m,h,l,i,s;
    while(scanf("%s",n)!=EOF  &&  strcmp(n,"-")){
        l=strlen(n);
        scanf("%d",&m);
        for(s=0;m;m--){
            scanf("%d",&h);
            s+=h;
        }
        s%=l;
        for(i=0;i<l;i++){
            printf("%c",n[(s+i)%l]);
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2056
def main():
    n = int(input())
    a = [list(map(int, input().split())) for _ in range(n)]

    dp = [[0] * 3 for _ in range(n)]
    dp[0] = a[0]

    for i in range(n - 1):
        dp[i + 1][0] = a[i + 1][0] + max(dp[i][1], dp[i][2])
        dp[i + 1][1] = a[i + 1][1] + max(dp[i][2], dp[i][0])
        dp[i + 1][2] = a[i + 1][2] + max(dp[i][0], dp[i][1])
    print(max(dp[-1]))

if __name__ == '__main__':
    main()
    

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

int main()
{
  vector<int> a = {1,3,5,7,8,10,12};
  vector<int> b = {4,6,9,11};
  int x,y;
  cin >> x >> y;
  int flag = 0;
  for(int i = 0;i < a.size();i++){
    if(x == a[i]) flag += 1;
    if(y == a[i]) flag += 1;
  }
  for(int i = 0;i < b.size();i++){
    if(x == b[i]) flag += 3;
    if(y == b[i]) flag += 3;
  }
  if(flag == 2 || flag == 6) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
parseInt(x) = parse(Int, x)

function power(n)
	k = 1
	while k <= n
		k*=2
	end
	k
end

function bsearch(a,x)
	l,r = 1, length(a)
	while l <= r
		m = l+div(r-l,2)
		if a[m] < x
			l = m+1
		else
			r = m-1
		end
	end
	return(l-1)
end

function main()
	n = readline() |> parseInt
	a = map(parseInt, split(readline()))
	a = sort(a)
	k = 0
	while length(a) > 1
		m = length(a)
		z = power(a[m])-a[m]
		index = bsearch(a,z)+1
		if 0 < index < m
			if a[index] == z
				deleteat!(a,index)
				k += 1
			end
		end
		pop!(a)
	end
	print(k)
end

main()

Measured memory_bytes: 153468
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define MOD (1000000007)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()

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; }

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

const ll INF = 1LL << 60;

int main(){
  int n; cin >> n;
  int MAX = 2000;
  vi L(n); rep(i, n) cin >> L[i];
  vi C(MAX); rep(i, n) C[L[i]]++;
  vi S(MAX+1); rep(i, MAX) S[i+1] = S[i] + C[i];

  ll ans = 0;
  rep(a, n) rep(b, n){
    if(a == b) continue;
    int right = L[a]+L[b];
    int left = abs(L[a]-L[b]) + 1;
    int cnt = S[right] - S[left];
    if(left <= L[a] && L[a] < right) cnt--;
    if(left <= L[b] && L[b] < right) cnt--;

    ans += max(cnt,0);
  }
  std::cout << ans/6 << '\n';
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
using ll = long long;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

int main() {
  int k;
  string s;
  cin >> k >> s;

  if (s.length() <= k)
    cout << s << '\n';
  else {
    s = s.substr(0, k);
    s += "...";
    cout << s << '\n';
  }
  return 0;
}


Measured memory_bytes: 3600
N = int(input())
print(0)
res = input()
if res == "Vacant":
    exit(0)

print(N-1)
res2 = input()
if res2 == "Vacant":
    exit(0)
seat = [""]*N
seat[0] = res
seat[N-1] = res

first = 0
last = N-1

for i in range(18):
    ret = (first + last) // 2
    if ret == first:
        ret += 1
    print(ret)
    res = input()
    seat[ret] = res
    if res == "Vacant":
        exit(0)
    else:
        if (res == seat[first] and (ret - first) % 2 == 0) or (res != seat[first] and (ret - first) % 2 == 1):
            first = ret
        else:
            last = ret-1


Measured memory_bytes: 4424
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

    string s;
    cin >> s;

    int res[112345];
    fill(res, res + s.size(), 0);

    for (int i = 0; i < s.size() - 1; i++)
    {
        if (s[i] == 'R' && s[i + 1] == 'L')
        {
            const int r = i;
            const int l = i + 1;

            //r側探索
            int j = i;
            while (j >= 0 && s[j] == 'R')
            {
                if ((j - i) % 2 == 0)
                    res[r]++;
                else
                    res[l]++;

                j--;
            }

            //l
            j = i + 1;
            while (j < s.size() && s[j] == 'L')
            {
                if ((j - i) % 2 == 0)
                    res[r]++;
                else
                    res[l]++;

                j++;
            }
        }
    }

    REP(i, s.size())
    cout << res[i] << (i < s.size() - 1 ? " " : "\n");

    return 0;
}

Measured memory_bytes: 1104
//Name: When Can We Meet?
//Level: 2
//Category: やるだけ
//Note:

/*
 * それぞれの日について、参加可能な人数をmapで保持しておく。
 *
 * オーダーは O(NM)。
 */
#include <iostream>
#include <unordered_map>

using namespace std;

bool solve() {
    int N, Q;
    if(!(cin >> N >> Q)) return false;
    if(!N && !Q) return false;

    unordered_map<int,int> m;
    for(int i = 0; i < N; ++i) {
        int M;
        cin >> M;
        for (int j = 0; j < M; ++j) {
            int v;
            cin >> v;
            m[v]++;
        }
    }

    int ans = 0;
    int ans_cnt = 0;
    for (auto e : m) {
        if(e.second >= Q && e.second >= ans_cnt) {
            if(ans == 0 || e.second > ans_cnt || e.first < ans) {
                ans = e.first;
                ans_cnt = e.second;
            }
        }
    }
    cout << ans << endl;
    return true;
}

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

    while(solve()) ;
    return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define LINF 1e18
#define INF 1e9
using namespace std;

int main(){
    ll n,k;
    cin >> n >> k;
    ll cnt[n] = {};
    ll d;
    rep(i,0,k){
        cin >> d;
        rep(j,0,d){
            ll a;
            cin >> a;
            cnt[a-1]++;
        }
    }

    ll ans = 0;
    rep(i,0,n) if(!cnt[i]) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3576
//#define _GLIBCXX_DEBUG

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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2>&p){
  return os << p.first << " " << p.second;
}
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n,k;cin>>n>>k;
  vector<ll>a(n);
  rep(i,0,n)cin>>a[i],a[i]--;
  ll now=0;
  ll cnt=0;
  vector<ll>v(1,now);
  vector<bool>used(n);
  used[0]=true;
  while(1){
    now=a[now];
    if(used[now])break;
    used[now]=true;
    v.PB(now);
  }
  ll st,len;
  rep(i,0,v.size()){
    if(now==v[i]){
      st=i;
      len=(ll)v.size()-i;
      break;
    }
  }
  if(k<st)cout<<v[k]+1<<endl;
  else cout<<v[st+(k-st)%len]+1<<endl;
  return 0;
}

Measured memory_bytes: 6920
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N = I()
ans = 0
for i in range(31625):
    if i*i > N:
        break
    else:
        ans = i*i
print(ans)

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

using ll = long long;

#define for_(i, a, b) for(int i = (a);i < (b);++i)
#define rfor_(i, a, b) for(int i = (b)-1;i >= (a);--i)
#define rep(i, n) for_(i, 0, n)
#define rrep(i, n) rfor_(i, 0, n)

int N;

ll X, x[100005];

ll D;

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

int main() {
  cin.tie(0);cout.tie(0);
  ios_base::sync_with_stdio(false);
  
  cin>>N>>X;
  rep(i, N)cin>>x[i];
  
  D = abs(x[0] - X);
  for_(i, 1, N)D = gcd(D, abs(x[i] - X));
  
  cout<<D<<endl;
  
  return 0;
}


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
class Ho{
  static void Main(){
    var a =int.Parse(Console.ReadLine());
    if(a%10 == 7){
      Console.WriteLine("Yes");
    }
    else if(a >=700 && a<=799) {
      Console.WriteLine("Yes");
    }
    else if(a%100 >=70 &&a%100 <= 79){
      Console.WriteLine("Yes");
    }
    else{
     Console.WriteLine("No");
    }
  }
}

Measured memory_bytes: 17644
import java.util.*;
class Main {
	public static int j;
	public static int y;
	public static ArrayList<Long> list = new ArrayList<Long>();
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		while(stdIn.hasNext()) {
			String tmp = stdIn.nextLine();
			stdIn.useDelimiter(".");
			solv(tmp);
			
		}
	}
	public static void solv(String tmp) {
		String tmpX = "";
		for(int i = 0; i < tmp.length(); i++) {
			tmpX += String.valueOf(tmp.charAt(i));
		}
		while(true) {
			String tmpCX = "";
			for(int i = 0; i < tmpX.length(); i++) {
				if(tmpX.charAt(i) == ' ') {
					tmpCX += " ";
				}
				else if(tmpX.charAt(i) == '.') {
					tmpCX += ".";
				}
				else if(tmpX.charAt(i) == 'z') {
					tmpCX += "a";
				}
				else {
					char tmpC = tmpX.charAt(i);
					tmpC++;
					tmpCX += String.valueOf(tmpC);
				}
			}
			if(tmpCX.contains("the") || tmpCX.contains("that") || tmpCX.contains("this")) {
				System.out.println(tmpCX);
				break;
			}
			tmpX = tmpCX; 
		}
	}
}

Measured memory_bytes: 22184
import java.util.Scanner;
public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		int h = S/3600;
		int m = (S-(3600*h))/60;
		int s = S%60;
		System.out.println(h+":"+m+":"+s);
	}
}

Measured memory_bytes: 26352
class Item:
    def __init__(self, v, w):
        self.v = v
        self.w = w

n, w = map(int, input().split())
items = {i: Item(*map(int, input().split())) for i in range(1, n+1)}
dp = [[i for i in range(w+1)] for j in range(n+1)]
for i in range(n+1):
    dp[i][0] = 0
for i in range(w+1):
    dp[0][i] = 0
for j in range(1, n+1):
    for k in range(1, w+1):
        if 0 <= k - items[j].w:
            dp[j][k] = max(dp[j-1][k], dp[j-1][k-items[j].w] + items[j].v)
        else:
            dp[j][k] = dp[j-1][k]
print(dp[-1][-1])


Measured memory_bytes: 45192
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int main(){
  string s;
  string t;
  cin>>s>>t;
  sort(t.begin(),t.end());
  sort(s.begin(),s.end());
  reverse(t.begin(),t.end());
  if(s<t){
    cout<<"Yes";
  }else{
    cout<<"No";
  }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = null;
		try{
			scan = new Scanner(System.in);
			while(true){
				int h,w;
				h = scan.nextInt();
				w = scan.nextInt();
				if(h == 0 && w == 0)break;
				for(int i = 0 ;i < h;i++){
					for(int j = 0 ; j < w;j++){
						System.out.printf("#");
					}
					System.out.println();
				}
				System.out.println();
			}
		}finally{
			if(scan != null)scan.close();
		}
	}
}

Measured memory_bytes: 44576
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <set>
#include <numeric>

#include <map>
#include <math.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <bitset>
#include <math.h>

#define INF 100100100

typedef long long int llint;

using namespace std;

typedef pair<int, int>Pii;

#define pi 3.141592653589793
#define mod 1000000007

int main() {
	string s;
	cin >> s;
	string s1 = s.substr(1, s.size() - 2);
	cout << s[0] << s1.size() << s[s.size() - 1] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

ll X;

bool is_lower(ll time)
{
  ll res = (1 + time) * time / 2;
  return res <= X;
}

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

  std::cin >> X;

  ll ok = 0;
  ll ng = 1e9 + 1;
  while (ng - ok > 1) {
    ll mid = (ok + ng) / 2;
    if (is_lower(mid)) {
      ok = mid;
    } else {
      ng = mid;
    }
  }

  ll dist = (1 + ok) * ok / 2;
  ll ans = (dist == X) ? ok : ok + 1;

  print(ans);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  int a,b;
  cin >> a >> b;
  cout << (a-1)*(b-1) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }

vector<ll> SIX(11), NINE(11), DP(100001);
/*
ll dfs(ll N){
    if(N == 0) return 0;
    auto itr9 = upper_bound(NINE.begin(), NINE.end(), N);
    auto itr6 = upper_bound(SIX.begin(), SIX.end(), N);
    
    return min(1 + dfs(N - *(itr9-1)), 1 + dfs(N - *(itr6-1)));
}*/

int main(){
    ll N;
    cin >> N;
    SIX[0] = 1;
    NINE[0] = 1;
    rep(i,10){
        SIX[i+1] = SIX[i]*6;
        NINE[i+1] = NINE[i]*9;
    }
    rep(i,100000){
        DP[i+1] = i+1;
    }
    rep(i,100000){
        rep(j,10){
            if(i+1 - SIX[j+1] < 0) continue;
            cmin(DP[i+1], DP[i+1 - SIX[j+1]]+1);
        }
        rep(j,10){
            if(i+1 - NINE[j+1] < 0) continue;
            cmin(DP[i+1], DP[i+1 - NINE[j+1]]+1);
        }
    }
    cout << DP[N] << endl;
    //cout << dfs(N) << endl;
    /*
    ll cnt = 0;
    while(N > 0){
        auto itr9 = upper_bound(NINE.begin(), NINE.end(), N);
        auto itr6 = upper_bound(SIX.begin(), SIX.end(), N);
        /*if(itr9 == NINE.end() && itr6 == SIX.end()){
            N--;
            cnt++;
            continue;
        }else if(itr9 == NINE.end()){
            N -= *(itr6-1);
            cnt++;
        }else if(itr6 == SIX.end()){
            N -= *(itr9-1);
            cnt++;
        }else{*/
        //N -= max(*(itr6-1), *(itr9-1));
        //cnt++;
        //}
    //}
    //cout << cnt << endl; 
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  int n;
  ll l[87] = {};
  cin >> n;
  l[0] = 2;
  l[1] = 1;
  for(int i=2;i<=n;i++){
    l[i] = l[i-1] + l[i-2];
  }
  cout << l[n] << endl;
}

Measured memory_bytes: 256
import heapq

N, M = map(int, input().split())
H = [int(h) for h in input().split()]
AB = [tuple(map(int, input().split())) for _ in range(M)]

neighbor_heights = [[] for _ in range(N)]
for i in range(N):
    heapq.heapify(neighbor_heights[i])

for a, b in AB:
    heapq.heappush(neighbor_heights[a - 1], -H[b - 1])
    heapq.heappush(neighbor_heights[b - 1], -H[a - 1])

good = 0
for i, a in enumerate(neighbor_heights):
    if len(a) == 0 or H[i] > -heapq.heappop(a):
        good += 1

print(good)

Measured memory_bytes: 105148
#include<bits/stdc++.h>
using namespace std;
int main(){
  double a, b, R; cin >> a >> b >> R;
  double A = R / a;
  double x = A / b * 2;
  double res;
  if(x <= a){
    res = atan(b / x) / M_PI * 180;
  }else{
    double l = b - R / (a * a * b) * b;
    res = atan(l / (a / 2)) / M_PI * 180;
  }
  cout << fixed << setprecision(10);
  cout << res << endl;
}


Measured memory_bytes: 512
// بِسمِ اللہِ  الرَّحم?نِ  الرَّ حِیم
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define MOD 1000000007
#define ll long long
#define pb push_back
#define all(v) v.begin(),v.end()
#define INF 1e18
#define N 100100
#define PI 3.141592653589793238
typedef pair<ll,ll> pll;
ll power(ll a,ll b)
{
    if(b==1)return a;
    if(b==0)return 1;
    ll temp=power(a,b/2);
    ll ans=temp*temp;
    if(b&1)
        ans*=a;
    return ans;
}
ll power(ll a,ll b,ll p)
{
    a=a%p;
    if(b==1)return a;
    if(b==0)return 1;

    ll temp=power(a,b/2,p);
    ll ans=(temp*temp)%p;
    if(b&1)
        ans=(a*ans)%p;
    return ans%p;
}
ll inv(ll a,ll m)
{
    return power(a,m-2,m);
}
//code begins
void solve(){
    ll x,n;cin>>x>>n;
    ll a[n];
    map<ll,ll> m;
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
        m[a[i]]=1;
    }
    ll diff=INF,no;
    for(ll i=-1000;i<=1000;i++)
    {
        if(!m.count(i))
        {
            if(abs(i-x)<diff)
            {
                diff=abs(i-x);
                no=i;
            }
        }
    }
    cout<<no<<endl;
}
signed main()
{
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);

//    cin.tie(NULL);cout.tie(NULL);
//    ll t;cin>>t;while(t--)
    solve();
    return 0;
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,m; cin>>n>>m;
  vpll ab(n);
  rep(i,n){
    ll a,b; cin>>a>>b;
    ab[i]={a,b};
  }
  vpll cd(m);
  rep(i,m){
    ll c,d; cin>>c>>d;
    cd[i]={c,d};
  }
  
  rep(i,n){
    ll a=ab[i].first, b=ab[i].second;
    ll dist=LINF;
    ll idx;
    rep(j,m){
      ll c=cd[j].first, d=cd[j].second;
      if(chmin(dist,abs(a-c)+abs(b-d))){
        idx=j+1;
      }
    }
    cout<<idx<<endl;
    
  }
  
}

Measured memory_bytes: 256
n , m = map(int,input().split())
ans = 1
for i in range(1,int(m**0.5)+1):
    if m % i == 0:
        x = m//i
        if x >= n:
            ans = max(ans,i)
        if i >= n:
            ans = max(ans,x)
print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <vector> 
#include <cmath>
#include <algorithm>
#include <set>
#include <string>
#include <map>
#include <cerrno>
#include <stdio.h>
#include <stdlib.h>
#include <cfenv>
#include <stack>
#include <math.h>
#include <iomanip>
#include <limits>
#include <queue>
#define ll long long int
#define pb push_back
#define mp make_pair

using namespace std;

int main(){
    int N,D;
    cin >> N >> D;
    if(N%(2*D+1) != 0){
        cout << N/(2*D+1)+1 << endl;
    }
    else{
        cout << N/(2*D+1) << endl;
    }
    return 0;
}

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

int main() {
    string s, p;

    cin >> s >> p;

    string t = s+s;

    bool flag = false;

    for(int i = 0; i < t.size()-p.size(); i++) {
      //	cout << t.substr(i, p.size()) << endl;
        if(t.substr(i, p.size()) == p) {
            cout << "Yes" << endl;
            flag = true;
        }
        if(flag == true) break;
    }

    if(flag == false) cout << "No" << endl;
}


Measured memory_bytes: 3152
#include <stdio.h>
int main (void){
 char a[100];
 scanf("%s%s%s%s",&a[0],&a[1],&a[2],&a[3]);
 if(a[0]==a[1]){
     if(a[2]==a[3]&&a[0]!=a[2]){
         printf("Yes");
     }else {
         printf("No");
     }
     
 }else if(a[0]==a[2]){
     if(a[1]==a[3]&&a[0]!=a[1]){
         printf("Yes");
     }else{
         printf("No");
     }
 }else if(a[0]==a[3]){
     if(a[1]==a[2]&&a[0]!=a[1]){
         printf("Yes");
     }else{
         printf("No");
     }
 }else{
     printf("No");
 }
}

Measured memory_bytes: 128
fun main(args: Array<String>) {
    val (h, w) = readLine()!!.split(" ").map(String::toInt)

    val map = mutableListOf<String>()

    for (i in 1..h) {
        readLine()!!.let {
            if (it.any { c -> c == '#' }) {
                map.add(it)
            }
        }
    }

    val printRows = mutableListOf<Int>()
    for (i in 0 until w) {
        var dotOnly = true
        for (line in map) {
            if (line.substring(i, i+1) == "#") {
                dotOnly = false
            }
        }
        if (dotOnly) {
            printRows.add(i)
        }
    }

    for (line in map) {
        for ((index, c) in line.withIndex()) {
            if (!printRows.contains(index)) {
                print(c)
            }
        }
        println()
    }

}

Measured memory_bytes: 38692