akhauriyash/Code-Regression huggingface dataset:
//2020.2.1
//s1270188 xxxmk2
//alds1_13c

#include<stdio.h>
#include<stdlib.h>
#define N 4
#define D 100

//struct
struct node{
  int data[N][N];
  struct node *p;
};
struct xy{
  int x;
  int y;
};

//global
struct node root;
int mv[4][2]={0,1,0,-1,-1,0,1,0};//上下左右 xy

//function
int man(int n,int x,int y){
  int nx, ny;

  nx=(n-1)%N;
  ny=(n-1)/N;
  
  x=x-nx;
  if(x<0) x*=-1;

  y=y-ny;
  if(y<0) y*=-1;
  
  return x+y;
}

int judge(struct node *n){
  int i, j=0;

  if(n==NULL) return -1;
  
  for(i=0;i<N*N;i++){
    if(n->data[i%N][i/N]==0) continue;
    if(n->data[i%N][i/N]!=i+1) j+=man(n->data[i%N][i/N],i%N,i/N);
  }

  return j;
}

struct xy blank(struct node *n){
  struct xy ddd;
  int i;

  for(i=0;i<N*N;i++)
    if(n->data[i%N][i/N]==0) break;

  ddd.x=i%N;
  ddd.y=i/N;
  
  return ddd;
}

struct node *mk(struct node *n,struct xy b, struct xy m){
  struct node *aaa;
  int i;
  
  aaa=malloc(sizeof(struct node));

  for(i=0;i<N*N;i++) aaa->data[i%N][i/N]=n->data[i%N][i/N];
  
  aaa->data[b.x][b.y]=aaa->data[m.x][m.y];
  aaa->data[m.x][m.y]=0;
  aaa->p=n;

  return aaa;
}


int puzzle(struct node *n,struct node *bp, int g,int d){
  int h=judge(n), i, j;
  struct xy bl, m;
  struct node *mm;
  
  if(h==0) return g;

  if(g+h>d) return -1;
  
  bl=blank(n);
  
  for(i=0;i<4;i++){
    m.x=bl.x+mv[i][0];
    m.y=bl.y+mv[i][1];

    if(m.x<0 || m.y<0 || m.x==N || m.y==N ) continue;
    
    mm=mk(n,bl,m);
    if(bp!=NULL){
      for(j=0;j<N*N;j++)
	if(mm->data[j%N][j/N]!=bp->data[j%N][j/N]) break;
      if(j==N*N){
	free(mm);
	continue;
      }
    }
    
    j=puzzle(mm,mm->p,g+1,d);
    if(j>0) return j;
  }

  if(n!=&root) free(n);
  return -1;
}

int main(){
  int i, ans;
  struct node *n, *m;
  
  //input
  for(i=0;i<N*N;i++) scanf("%d",&root.data[i%N][i/N]);
  root.p=NULL;
  
  for(i=judge(&root);i<=D;i++){
    ans=puzzle(&root,NULL,0,i);

    if(ans>0) break;
  }
  
  //output
  printf("%d\n",ans);

  return 0;
}



Measured memory_bytes: 193916
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  ll ans1 = ll(max_element(a.begin(), a.end()) - a.begin());
  ll half = a[ans1] / 2;
  ll ans2 = 0;
  if (ans1 == 0) ans2 = 1;
  for (int i = 0; i < n; i++) {
    if (abs(half - a[i]) < abs(half - a[ans2]) && i != ans1)
      ans2 = i;
    else if (abs(half + 1 - a[i]) < abs(half + 1 - a[ans2]) && n % 2 == 1 &&
             i != ans1)
      ans2 = i;
  }

  cout << a[ans1] << ' ' << a[ans2] << endl;
}

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

using namespace std;
int main(){

int a,b,c,d,k;
cin>>a>>b>>c>>k;
if(k<=a)cout<<k;
else if(k>a &&k<=b+a)cout<<a;
else if(k>a+b&&k<=a+b+c)cout<<a-(k-a-b);
else cout<<a-c;

}


Measured memory_bytes: 3624
#include<stdio.h>

int main(void)
{
	int a, b, c;
	int i;
	int count=0;
	scanf("%d %d %d", &a, &b, &c);
	
	for(i=a; i<b+1;i++)
	{
		if(c%i == 0)
		{
			count++;
		}
	}
	printf("%d\n", count);
	return 0;
}


Measured memory_bytes: 2108
#include <stdio.h>

int a[100100]; long long p[200100], q[200100], e[200100], r;

int main()
{
	int n, m;
	scanf("%d %d", &n, &m);
	for (int i=0;i<n;i++){
		scanf("%d", &a[i]); a[i]--;
	}

	for (int i=1;i<n;i++){
		int v = (a[i] - a[i-1] + m) % m;
		r += v;
		if (v >= 2){
			int s = (a[i-1] + 2) % m;
			int e = a[i] + 1;
			if (e < s) e += m;
			p[s]--; p[e]++;
			q[e] += (e - s);
		}
	}

	{
		long long v=0, u=0;
		for (int i=0;i<2*m;i++){
			v += p[i];
			u += v;
			u += q[i];
			e[i] = u;
		}
	}

	long long ans = 0;
	for (int i=0;i<m;i++){
		long long u = e[i] + e[i+m];
		if (ans > u)
			ans = u;
	}
	printf("%lld\n", r+ans);

	return 0;
}

Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define PI acos(-1)
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
const int MOD = 1e9+ 7;
const int INF = numeric_limits<int>::max() - (int)1e8;
const ll INFLL = numeric_limits<ll>::max() - (ll)1e17;

int main() {
    ll N, K;
    cin >> N >> K;
    vector<int> A(N + 1);
    for (int i = 1; i <= N; i++) {
        cin >> A[i];
    }
    vector<int> beforeIdx(N + 1, -1);
    vector<int> idxto(N + 10, -1);
    int now = 1;
    ll base, loop;
    int idx = 0;
    while (true) {
        if (beforeIdx[now] == -1) {
            beforeIdx[now] = idx;
            idxto[idx] = now;
            now = A[now];
        } else {
            base = beforeIdx[now];
            loop = idx - beforeIdx[now];
            break;
        }
        idx++;
    }
    if (K <= base) {
        cout << idxto[K] << endl;
    } else {
        K -= base;
        K %= loop;
        cout << idxto[base + K] << endl;
    }
}

Measured memory_bytes: 5632
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
 
    public static final int BIG_NUM  = 2000000000;
    public static final int MOD  = 1000000007;
 
    public static void main(String[] args) {
 
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int table[] = new int[128];
        String work[] = new String[2];
        String outPut[] = {"S","H","C","D"};
 
        table['S'] = 0;
        table['H'] = 1;
        table['C'] = 2;
        table['D'] = 3;
 
        boolean check[][] = new boolean[4][14];
        for(int row = 0; row < 4; row++){
            for(int col = 1; col <= 13; col++)check[row][col] = false;
        }
 
        try {
            int N = Integer.parseInt(br.readLine());
 
            for(int loop = 0; loop < N; loop++){
                work = br.readLine().split("\\s+");
                check[table[work[0].charAt(0)]][Integer.parseInt(work[1])] = true;
            }
 
            for(int row = 0; row < 4; row++){
                for(int col = 1; col <= 13; col++){
                    if(!check[row][col]){
                        System.out.printf("%s %d\n", outPut[row],col);
                    }
                }
            }
 
        } catch (NumberFormatException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


Measured memory_bytes: 24784
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
// dfmt on

void main()
{
    string L = sread();
    auto dp = new long[][](L.length + 1, 2); // 確定桁数, a+b<L確定
    dp[0][0] = 1;
    dp[0][1] = 0;
    foreach (i; 0 .. L.length)
    {
        if (L[i] == '1')
        {
            dp[i + 1][0] = dp[i][0] * 2 % MOD;
            dp[i + 1][1] = (dp[i][0] + dp[i][1] * 3) % MOD;
        }
        else
        {
            dp[i + 1][0] = dp[i][0];
            dp[i + 1][1] = dp[i][1] * 3 % MOD;
        }
    }
    writeln(dp[L.length].sum() % MOD);
}


Measured memory_bytes: 8600
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define fi first
#define se second
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; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;
vector<vector<ll>> G(10);
vector<ll> memo(10);
ll N;

ll dfs(ll v, ll p){
    ll res = 0;
    bool flag = false;
    rep(i,N){
        if(memo[i] == 0){
            flag = true;
            break;
        }
    }
    if(!flag){
        return 1;
    }
    for(auto& u:G[v]){
        if(u == p) continue;
        if(memo[u] != 0) continue;
        memo[u] = 1;
        res += dfs(u,v);
        memo[u] = 0;
    }
    return res;
}
int main(){
    ll M;
    cin >> N >> M;
    ll a,b;
    rep(i,M){
        cin >> a >> b;
        a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    memo[0] = 1;
    cout << dfs(0,-1) << endl;
}


Measured memory_bytes: 3632
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
signed main() {
    int N; cin >> N;
    vector<int> v(N);
    for(int i=0; i<N; i++) {
        cin >> v[i];
    }

    sort(v.begin(), v.end());
    int sum = 0;
    for(int i=0; i<N-1; i++) {
        sum += v[i];
    }

    if(v[N-1] < sum) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
// {{{
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(ll i = static_cast<ll>(a); i < static_cast<ll>(b); i++)
#define FORR(i, a, b) for(ll i = static_cast<ll>(a); i >= static_cast<ll>(b); i--)
#define REP(i, n) for(ll i = 0ll; i < static_cast<ll>(n); i++)
#define REPR(i, n) for(ll i = static_cast<ll>(n); i >= 0ll; i--)
#define ALL(x) (x).begin(), (x).end()

#define DBG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using IP = pair<int, P>;
using LLP = pair<ll, LP>;

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

constexpr int INF = 100000000;
constexpr ll LINF = 10000000000000000ll;
constexpr int MOD = static_cast<int>(1e9 + 7);
constexpr double EPS = 1e-9;

// template specialization of std::hash for std::pair
namespace std {
template<typename T, typename U>
struct hash<pair<T, U> > {
    size_t operator()(const pair<T, U> &key) const noexcept {
        size_t h1 = hash<T>()(key.first);
        size_t h2 = hash<U>()(key.second);
        return h1 ^ (h2 << 1);
    }
};
} // namespace std

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    size_t sz = v.size();
    os << "[";
    for (size_t i = 0; i < sz-1; i++) {
        os << v[i] << ", ";
    }
    os << v[sz-1] <<  "]";
    return os;
}

template<typename T>
void printArray(T *arr, size_t sz) {
    cerr << "[";
    for (size_t i = 0; i < sz-1; i++) {
        cerr << arr[i] << ",";
    }
    cerr << arr[sz-1] <<  "]" << endl;
}

static inline ll mod(ll x, ll m)
{
    ll y = x % m;
    return (y >= 0 ? y : y+m);
}

struct Compare {
    //vector<ll> &x_, &y_;
    //Compare(vector<ll> &x, vector<ll> &y): x_(x), y_(y) {}
    //bool operator()(const P &lhs, const P &rhs) {
    //    return x_[lhs.fi]+y_[lhs.se] < x_[rhs.fi]+y_[rhs.se];
    //}
    bool operator()(const int x, const int y) {
        return x < y;
    }
};

// print floating-point number
// cout << fixed << setprecision(12) <<

// }}}

string s;

void solve()
{
    REP (i, s.size()) {
        s[i] = 'x';
    }
    cout << s << endl;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> s;
    solve();
    return 0;
}

// vim:set foldmethod=marker:


Measured memory_bytes: 256
//author:luckYrat(twitter:@luckYrat_)
//#include <bits/stdc++.h>

//def
#include <iostream>

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

//array
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <utility>
#include <climits>



using namespace std;

using ll = long long;
using P = pair<ll,ll>;

#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define MAX 1000000000
const int mod = 1000000007;
#define EPS (1e-10)

#define pb push_back
#define fir first
#define scn second
#define ednl endl

#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")


P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる
vector.unique()は隣接した同じ要素を削除するので先にソートをする

計算量は変わらないが楽できるシリーズ
C++11以降でmin({a,b,c...})で複数個のmic,maxを処理できる
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる

*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main(){
  string s;cin>>s;
  for(int i = 0; s.size() > i; i++){
    if(i == 5 || i == 13)cout << " ";
    else cout << s[i];
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;

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

bool isPrime(ll n){
  if(n == 1) return false;
  if(n == 2) return true;
  if(n%2 == 0) return false;

  for(int i=3;i<=sqrt(n);i+=2){
    if(n%i == 0) return false;
  }
  return true;
}

map<ll,int> prime_factors(ll n){
  map<ll,int> res;
  if(n == 1){
    res[n] = 1;
    return res;
  }
  ll _n = n;
  while(n%2 == 0){
    res[2]++;
    n /= 2;
  }
  for(int i=3;i<=sqrt(_n);i+=2){
    while(n%i==0){
      res[i]++;
      n /= i;
    }
  }
  if(n != 1) res[n] = 1;
  return res;
}

int main(){
  ll a,b;
  cin >> a >> b;

  ll g = gcd(a,b);

  int ans = 0;
  if(isPrime(g)){
    ans = 2;
  }else{
    map<ll,int> res = prime_factors(g);
    res[1] = 1;
    for(auto itr = res.begin();itr != res.end();itr++){
      ans++;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n, k;
    string s, ss;

    cin >> n >> s >> k;

    for (int i=0; i<n; i++)
    {
        if (s[k-1] != s[i])
            ss += "*";
        else
            ss += s[i];
    } 

    cout << ss << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{

int N;
const int cakes = 4;
const int donuts = 7;

scanf("%d", &N);


for(size_t i=0; i<N; i++)
{
	if( (i%cakes==0 && (N-i)%donuts==0) || (i%donuts==0 && (N-i)%cakes==0) )
  	{
		printf("Yes\n");
		return 0;
	} 
}



printf("No\n");

return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int n,m,cx,cy,h;
bool used[12][12];
int f[12][12];
int dfs(int x,int y,int k)
{
	int res=0;
	if(k==0)
	{
		if(x==cx||y==cy)return 1;
		else return 0;
	}
	for(int nx=x+1;nx<m;nx++)
	{
		if(!used[nx][y]&&f[nx][y]==1)
		{
			used[nx][y]=true;
			res+=dfs(nx,y,k-1);
			used[nx][y]=false;
			break;
		}
	}
	for(int nx=x-1;nx>=0;nx--)
	{
		if(!used[nx][y]&&f[nx][y]==1)
		{
			used[nx][y]=true;
			res+=dfs(nx,y,k-1);
			used[nx][y]=false;
			break;
		}
	}
	for(int ny=y+1;ny<n;ny++)
	{
		if(!used[x][ny]&&f[x][ny]==1)
		{
			used[x][ny]=true;
			res+=dfs(x,ny,k-1);
			used[x][ny]=false;
			break;
		}
	}
	for(int ny=y-1;ny>=0;ny--)
	{
		if(!used[x][ny]&&f[x][ny]==1)
		{
			used[x][ny]=true;
			res+=dfs(x,ny,k-1);
			used[x][ny]=false;
			break;
		}
	}
	return res;
}
int main()
{
	while(1)
	{
		memset(f,0,sizeof(f));
		memset(used,0,sizeof(used));
		h=0;
		cin >> n >> m;
		if(n==0&&m==0)break;
		for(int i=0;i<m;i++)
		{
			for(int j=0;j<n;j++)
			{
				cin >> f[i][j];
				if(f[i][j]==2)
				{

					cx=i,cy=j;
					f[i][j]=0;
				}
				else if(f[i][j]==1)h++;
			}
		}
		cout << dfs(cx,cy,h) << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  if(N < 105)
    cout << 0;
  else if(N < 135)
    cout << 1;
  else if(N < 165)
    cout << 2;
  else if(N < 189)
    cout << 3;
  else if(N < 195)
    cout << 4;
  else if(N < 201)
    cout << 5;
}

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

using namespace std;

#define REP(i,n)	for(int i=0;i<(n);++i)
#define REPS(i,s,t)	for(int i=(s);i<(t);++i)
#define SUMV(v)		(accumulate(v.begin(),v.end(),0.0))

#define INF 		2000000007
#define MOD			998244353

#define MAX 		100005

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int ll;

//uint dp[MAX];


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

	int ans=0;
	for(char t:S)
		if(t=='+')ans++;
		else ans--;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

K = INT()

many_gcd = lambda numbers: reduce(gcd, numbers)

ans = 0
for i in range(1, K+1):
	for j in range(1, K+1):
		for k in range(1, K+1):
			ans += many_gcd([i, j, k])
print(ans)


Measured memory_bytes: 70432
var lines = [];
var result = 0;

var readline = require('readline');
var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

rl.on('line', function (x) {
    lines.push(x);
});

rl.on('close', function () {
    var A = Number(lines[0].split(" ")[0]);
    var B = Number(lines[0].split(" ")[1]);
    var T = Number(lines[0].split(" ")[2]);

    for (var i = 1; i <= T; i++) {
        if (i % A === 0) { result += B; }
    }

    console.log(result);
});

Measured memory_bytes: 21320
#include <iostream>
#include <string>

using namespace std;

int main() {

  string str;

  
  getline(cin,str);

  if(str.empty()) return 0;

  while(str.find("apple")!=string::npos) {

    str.replace(str.find("apple"),5,"_APE_");

  }

  while(str.find("peach")!=string::npos) {

    str.replace(str.find("peach"),5,"_PAH_");

  }

  while(str.find("_APE_")!=string::npos) {

    str.replace(str.find("_APE_"),5,"peach");

  }

  while(str.find("_PAH_")!=string::npos) {

    str.replace(str.find("_PAH_"),5,"apple");

  }

  cout << str << endl;

  return 0;

}

Measured memory_bytes: 0
#include<vector>
#include<queue>
#include<stdio.h>
#include<map>
#include<set>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<math.h>
#define mp make_pair
using namespace std;
typedef long long ll;
inline ll in()
{
    ll res=0,p=1;
    char c=getchar();
    while(c<'0'||c>'9') {if(c=='-') p=-1; c=getchar();}
    while(c>='0'&&c<='9') res=res*10+c-48,c=getchar();
    return p*res;
}
void out(ll x)
{
    if (x>9) out(x/10);
    putchar(x%10+48);
}
void outn(ll x)
{
    if (x<0){
        putchar('-');
        out(-x);
    }else out(x);
    putchar(10);
}
const double eps = 1e-6;
const int mod = 1e9 + 7, inf = 0x3f3f3f3f;
//const double pi = acos(-1.0);
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int dx[4] = {0, 0, -1, 1}, dy[4] = {1, -1, 0, 0};

ll gcd(ll a, ll b){return b == 0 ? a : gcd(b, a % b);}
ll quickpow(ll x, ll k)
{
    ll res = 1;
    while(k){
        if(k & 1) res = (res * x) % mod;
        k >>= 1, x = (x * x) % mod;
    }
    return res;
}
//ll C(int n, int m){return (fac[n] * quickpow((fac[m] * fac[n - m]) % mod, mod - 2)) % mod;}
const int maxn = 1e5 + 5;

vector<int> g[maxn];
ll ans = 1;
int k;

void dfs(int u, int p, int num)
{
    ans = ans * num % mod;

    num = (p == 0 ? k - 1 : k - 2);

    for (int v : g[u]){
        if (v != p){
            dfs(v, u, num);
            --num;
        }
    }
}

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

    int n;
    cin >> n >> k;
    for (int i = 1; i < n; ++i){
        int x, y;
        cin >> x >> y;
        g[x].push_back(y);
        g[y].push_back(x);
    }

    dfs(1, 0, k);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef vector<int> vec1;
typedef vector<string> vec2;
typedef vector<double> vec3;

int main() {

  int n;
  cin >> n;
  
  int x = 111;
  for(int i = 0; i < 10; i++) {
    if(x < n) {
      x = x + 111;
    } else {
      cout << x << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 256
import java.util.*;
import java.math.*;
import java.lang.*;
import java.io.*;
 
public class Main{
  public static void main(String args[]) throws IOException{
    Scanner s=new Scanner(System.in);
   
    int n=s.nextInt();
   
   int a[]=new int[n];
    for(int i=0;i<n;i++){
      a[i]=s.nextInt();
    }
    int c=0;
    int max=-1;
    for(int i=0;i<n-1;i++){
      if(a[i]>=a[i+1])
      {  c++;
      if(c>max)
        max=c;
      }
      else
        c=0;
      
      }
    System.out.println(Math.max(max,0));
    }
    
}

Measured memory_bytes: 50604
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
#define fore(i,x,y) for(long long i=x;i<y;i++)
typedef long long ll;
using namespace std;
int main()
{
	string s,ANS="#";
	cin >> s;
	while(ANS=="#"){
		s.pop_back();
		if(s.size()%2==0){
			string a,b;
			for(int i=0;i<s.size()/2;i++){
				a.push_back(s[i]);
			}
			for(int i=s.size()/2;i<s.size();i++){
				b.push_back(s[i]);
			}
			if(a==b){
				ANS=s;
			}
		}
	}
	cout << ANS.size() << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define rep(i,a,b) for(int i=a;i<b;i+=1)
#define reps(i,a,b) for(int i=a;i>=b;i-=1)
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define pi pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define in1(x) int x; cin>>x;
#define in2(x, y) int x, y; cin>>x>>y;
#define in3(x, y, z) int x, y, z; cin>>x>>y>>z;
#define in4(x, y, z, w) int x, y, z, w; cin>>x>>y>>z>>w;
#define mi unordered_map<int,int>
#define mem(x) memset(x, 0, sizeof(x))
#define IOS ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define mod 1000000007
using namespace std;
bool primes[1000001];vi prime; void seive(); int gcd(int a, int b); int power(int x, int y);

int32_t main(void){
	IOS;
	in1(k);
	int num = 0;
	int ans = 0;
	bool res = false;
	while(true)
	{
		ans += 1;
		num *= 10;
		num += 7;
		num %= k;
		if(num == 0)
		{
		    res = true;
		    break;
		}
		if(ans == 1000001) break;
	}
	if(res) cout<<ans<<endl;
	else cout<<-1<<endl;
}

void seive(){memset(primes, true, sizeof(primes));primes[0] = primes[1] = false;for(int i = 2; i*i<=1000000;i += 1){
if(primes[i]){for(int j = i*i; j <= 1000000;j += i) primes[j] = false;}}rep(i, 2, 1000001){if(primes[i]) prime.pb(i);}}
int gcd(int a, int b){return b==0 ? a : gcd(b, a%b);}
int power(int x, int y){ int res = 1;x = x % mod; if (x == 0) return 0;
while (y > 0){ if(y & 1) res = (res*x) % mod; y = y>>1; x = (x*x) % mod;} return res;}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 int main() {
long long A, B;
  cin>>A>>B;
 if(A%2!=B%2){
 cout << "IMPOSSIBLE" << endl;
 }else{
cout << (A + B) / 2 << endl;
 }
 return 0;
 }

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

//
// # Examples
//
// # integers
// input! { n: usize, m: usize, ... }
//
// # array
// input! { n: usize, v: [i32; n], }
//
// # matrix
// input! { n: usize, m: usize, mat: [[]] }
//
// # string
// input! { s: chars }
//
// 3 4
// ####
// #..#
// .#.#
//
// input!{
//     h: usize,
//     w: usize,
//     board: [chars; h],
// }

// https://practice.contest.atcoder.jp/tasks/practice_1
//fn main() {
//    input!{
//        a: usize, b: usize, c: usize,
//        foo: chars,
//    }
//    let s: String = foo.into_iter().collect();
//    println!("{} {}", a+b+c, s);
//}
fn main() {
    input! {
        a: i32, b: i32, k: i32
    }
    let mut a = a;
    let mut b = b;
    let mut k = k;
    let mut is_a = true;
    while k > 0 {
        if is_a {
            if a%2==1 {
                a -= 1
            }
            a /= 2;
            b += a;
            is_a = false;
        } else {
            if b%2==1 {
                b -= 1
            }
            b /= 2;
            a += b;
            is_a = true;
        }
        k -= 1;
    }
    println!("{} {}", a, b);
}

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

using namespace std;

using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FORE(i, a, b) for(int i=(a);i<=(b);++i)
#define rep(i, n) for(ll i=0;i<(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define SP cout<<fixed<<setprecision(10)
typedef pair<int, int> P;
const int INF = (int) 1e9;
const int MOD = (int) 1e9 + 7;

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

ll lcm(ll m, ll n) {
	// 引数に０がある場合は０を返す
	if ((0 == m) || (0 == n))
		return 0;
	
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n, m;
	cin >> n >> m;
	string s, t;
	cin >> s >> t;
	
	if (s[0] != t[0]) {
		cout << -1 << endl;
		return 0;
	}
	
	ll ans = lcm(n, m);
	map<ll, char> map1;
	rep(i, n) {
		map1[(i * ans / n) + 1] = s[i];
	}
	
	bool ok = true;
	rep(i, m) {
		if (map1.find((i * ans / m) + 1) != map1.end() && map1[(i * ans / m) + 1] != t[i]) {
			ok = false;
			break;
		}
	}
	
	if (ok) cout << ans << endl;
	else cout << -1 << endl;
	
	return 0;
}

Measured memory_bytes: 6144
s = input()
cnt = 0

t = "01"*(-((-1)*len(s)//2))

cnt_1 = 0
cnt_2 = 0

for i in range(len(s)):
    if s[i] == t[i]:
        cnt_1 += 1

    else:
        cnt_2 += 1

print(min(cnt_1,cnt_2))

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

using namespace std;
#define ll long long
#define ld long double

#define endl '\n'
#define FAST                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int MAXN = 1e5 + 5;
ll fastPow(ll x, ll b)
{
    if (b == 0)
        return 1;
    else if (!(b & 1))
    {
        return fastPow(x * x, b / 2);
    }
    else
        return x * fastPow(x * x, (b - 1) / 2);
}
//__builtin_popcount ();
int main()
{
    FAST 
ll n,a,b;
cin>>n>>a>>b;
ll arr[n];
for (int i = 0;i<n;i++)
    cin >> arr[i];
ll sum = 0;
for (int i = 1; i < n;i++)
{
    sum += min((arr[i] - arr[i - 1]) * a, b);
}
cout << sum << endl;
return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>

using namespace std;

int main(void){
    int r,D,x_2000;
    int i,x_new;

    cin>>r>>D>>x_2000;

    x_new=x_2000;
    for(i=0;i<10;i++){
        x_new=r*x_new-D;
        cout<<x_new<<endl;
    }


    return 0;
}

Measured memory_bytes: 256
// スタックサイズ: 100MB

#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define all(v) (v).begin(), (v).end()
ll pw(ll x, ll y) { ll r = 1;  rep(i, y) { r *= x; }; return r; }


int main() {
	
	ll N, K;
	cin >> N >> K;
	string s;
	cin >> s;
	vll u, v;
	
	ll counter = 0;
	ll flag = s[0] - '0';
	if (s[0] == '0') u.push_back(0);
	rep(i, N) {
		if (flag == s[i] - '0') ++counter;
		else {
			if (flag) u.push_back(counter);
			else v.push_back(counter);
			counter = 1;
			flag = !flag;
		}
	}
	if (flag) u.push_back(counter);
	else v.push_back(counter);
	if (s.back() == '0') u.push_back(0);

	if (K < v.size()){
		ll ans = 0;
		rep(i, v.size() - K + 1) {
			ll tmp = accumulate(u.begin() + i, u.begin() + i + K + 1, 0) + accumulate(v.begin() + i, v.begin() + i + K, 0);
			ans = max(ans, tmp);
		}
		cout << ans << endl;
	}
	else cout << s.size() << endl;
}

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

struct solver{
    int xl, yl, xr, yr; //無毒の土地の右端および左端のx座標とy座標

    int fromsafe(int x, int y){//引数は最初にいるマスの座標
        int dx, dy; //最初にいるマスと無毒な土地の距離
        if(x < xl) dx = xl - x; //最初にいるマスが無毒の土地の左側にある場合
        else if(x > xr) dx = x - xr; //最初にいるマスが無毒の土地の右側にある場合
        else dx = 0; //最初にいるマスが無毒の土地上にある場合
        if(y < yl) dy = yl - y;//最初にいるマスが無毒の土地の左側にある場合
        else if(y > yr) dy = y - yr;//最初にいるマスが無毒の土地の右側にある場合
        else dy = 0;//最初にいるマスが無毒の土地上にある場合
        
        return dx + dy;
    }

    int solve(int n){//引数は目的地の数
        int x, y;
        cin >> xl >> yl >> xr >> yr >> x >> y; //無毒の土地の左上と右下のマスの座標と最初にいるマスの座標

        int ans = 0;
        for(int i = 0; i < n; i++){
            int nx, ny; //目的地のマスの座標
            cin >> nx >> ny;

            int d =  abs(x - nx) + abs(y - ny);
            int t = max(fromsafe(x, y) - 1, 0); //最初にいるマスから無毒の土地までの距離
            int u = fromsafe(nx, ny); //目的地から無毒な土地までの距離
            ans += min(d, t + u);

            //目的地到着後、そのマスを最初にいるマスとして繰り返す
            x = nx;
            y = ny;
        }
        return ans;
    }
};

int main(void){
    int n;
    while(cin >> n && n){
        cout << solver().solve(n) << endl;
    }
}



Measured memory_bytes: 3104
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#define debug(x) cerr << __LINE__ << ' ' << #x << ':' << x << '\n'
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

constexpr ll mod = 1000000007;

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

	int n;
	cin >> n;
	vector<P> p(n);
	rep(i, n) cin >> p[i].first >> p[i].second;
	sort(all(p));
	vector<int> tmp(n);
	rep(i, n) tmp[i] = p[i].second;
	sort(all(tmp));
	vector<int> v(n);
	rep(i, n) v[i] = lower_bound(all(tmp), p[i].second) - tmp.begin();
	vector<P> ok(n);
	rep(i, n) {
		int pre = 0;
		if (i) pre = ok[i - 1].second;
		chmax(pre, v[i]);
		ok[i].second = pre;
	}
	for (int i = n - 1; i >= 0; i--) {
		int pre = n;
		if (i != n - 1) pre = ok[i + 1].first;
		chmin(pre, v[i]);
		ok[i].first = pre;
	}
	rep(i, n) {
		ok[i].first++;
		ok[i].second++;
	}
	vector<ll> dp(n + 1), sum(n + 2);
	dp[0] = 1;
	rep(i, ok[0].second + 1) sum[i] = 1;
	rep(i, n) {
		ll val = sum[ok[i].second];
		if (ok[i].first > 1) val += mod - sum[ok[i].first - 2];
		if (val >= mod) val -= mod;
		dp[ok[i].second] += val;
		if (dp[ok[i].second] >= mod) dp[ok[i].second] -= mod;
		sum[ok[i].second] += val;
		if (sum[ok[i].second] >= mod) sum[ok[i].second] -= mod;
		if (i != n - 1) {
			for (int j = ok[i].second; j < ok[i + 1].second; j++) {
				sum[j + 1] = sum[j];
			}
		}
	}
	cout << dp[n] << '\n';
}

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

using namespace std;

int main()
{
    int A,B,C,D,ans;
    cin>>A>>B>>C>>D;
    int x=max(A,C);
    int y=min(B,D);
    ans = y -x;
    if (ans<0){
        cout<<0;
        }
        else if (ans >=0){
            cout<<ans;

        }

    return 0;
}

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

int main () {
  int a, b, c;
  cin >> a >> b >> c;
  
  string answer;
  if (a+b==c) {
    answer = "Yes";
  }
  else if (a+c==b) {
    answer = "Yes";
  }
  else if (b+c==a) {
    answer = "Yes";
  }
  else {
    answer = "No";
  }
  cout << answer << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int a[] = new int[n];
    int leftc = 0;
    int rightc =0;
    int answer =0;
    for(int i=0;i<n;i++){
      a[i] = sc.nextInt();
      if(a[i]==1){
        leftc=i;
        rightc = n -i-1;
      } 
    }
    if(leftc%(k-1)==0){
      answer = (leftc/(k-1));
    }else{
      answer = (leftc/(k-1))+1;
      rightc = rightc-((k-1)-(leftc%(k-1)));
    }
    if(rightc<0){
      answer = answer;
    }else{
    answer =answer +( rightc%(k-1)==0?(rightc/(k-1)):(rightc/(k-1))+1);
    }
      System.out.println(answer);
    
    
    
    
  }
  

  
}

Measured memory_bytes: 50484
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<list>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
#define MK make_pair
const ll E=1e18+7;
const ll MOD=1000000007;





int main(){
    ll n,m,q;
    cin>>n>>m>>q;
    ll dp[600][600]={};
    for(int i=0;i<m;i++){
        ll s,t;
        cin>>s>>t;
        s--; t--;
        dp[s][t]++;
    }
    for(int i=0;i<n-1;i++){
        dp[i][i+1]+=dp[i][i]+dp[i+1][i+1];
    }
    for(int i=2;i<=500;i++){
        for(int t=0;t+i<n;t++){
            ll s=t;
            ll g=t+i;
            dp[s][g]+=dp[s][g-1]+dp[s+1][g];
            dp[s][g]-=dp[s+1][g-1];
        }
    }
    while(q--){
        ll l,r;
        cin>>l>>r;
        l--; r--;
        cout<<dp[l][r]<<endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 3712
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

N = int(input())
A = list(map(int, input().split()))
count = 0

while(True):
    for i in range(len(A)):
        if A[i] % 2 == 1:
            print(count)
            sys.exit()
        A[i] /= 2
    count += 1


Measured memory_bytes: 2940
def main():
    import sys
    input = sys.stdin.buffer.readline
    N = int(input())
    XY = [[int(i) for i in input().split()] for j in range(N)]
    X = sorted([(xy[0], xy[1], i) for i, xy in enumerate(XY)])
    Y = sorted(X, key=lambda p: p[1])
    edges = []
    for i in range(N-1):
        (x1, y1, a) = X[i]
        (x2, y2, b) = X[i+1]
        cost = min(abs(x1-x2), abs(y1-y2))
        edges.append((cost, a, b))

    for i in range(N-1):
        (x1, y1, a) = Y[i]
        (x2, y2, b) = Y[i+1]
        cost = min(abs(x1-x2), abs(y1-y2))
        edges.append((cost, a, b))

    par = [i for i in range(N)]
    rank = [1 for i in range(N)]

    def find_root(x):
        if par[x] == x:
            return x
        else:
            par[x] = find_root(par[x])
            return par[x]

    def is_same_group(x, y):
        return find_root(x) == find_root(y)

    def unite(x, y):
        x = find_root(x)
        y = find_root(y)
        if x == y:
            return
        if rank[x] < rank[y]:
            x, y = y, x
        rank[x] += rank[y]
        par[y] = x

    def size(x):
        return rank[find_root(x)]

    edges.sort()

    ans = 0
    for (c, a, b) in edges:
        if find_root(a) != find_root(b):
            ans += c
            unite(a, b)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 142064
object Main {
  def main (args: Array[String]) {
    val input =  scala.io.StdIn.readLine().split(" ").map(_.toInt)
    val a:Int = input(0)
    val b:Int = input(1)

    a match{
      case i if i >  b => println("a > b")
      case i if i <  b => println("a < b")
      case i if i == b => println("a == b")
      case _ => println("????")
    }
  }
}

Measured memory_bytes: 43660
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000

int main(){
	
	/*
	int N;
	cin>>N;
	vector<int> t(N*2);
	
	for(int i=0;i<2*N;i++)t[i]=10+i;
	
	do{
		vector<int> x;
		for(int i=0;i<2*N;i+=2)x.push_back(t[i]+t[i+1]);
		auto y = x;
		sort(x.begin(),x.end());
		if(x!=y)continue;
		bool f = true;
		for(int i=1;i<N;i++){
			if(x[i-1]==x[i])f=false;
		}
		if(!f)continue;
		if(x.back()-x[0]==N){
			for(int i=0;i<2*N;i++){
				cout<<t[i]<<',';
			}
			cout<<endl;
		}
	}
	while(next_permutation(t.begin(),t.end()));
	*/
	
	int N,K;
	cin>>N>>K;
	
	vector<int> c(N);
	for(int i=0;i<N;i++)c[i] = K+2*N+i;
	vector<int> a,b;
	int l=0,r=(2*N-1-N/2);
	for(int i=0;i<N;i++){
		if(l>=r){
			l = 1;
			r = 2*N-1;
		}
		a.push_back(K+l);
		b.push_back(K+r);
		l+=2;
		r--;
	}
	
	for(int i=0;i<N;i++){
		if(a[i]+b[i]>c[i]){
			cout<<-1<<endl;
			return 0;
		}
	}
	
	for(int i=0;i<N;i++){
		cout<<a[i]<<' '<<b[i]<<' '<<c[i]<<endl;
	}
	
	
	
	
	return 0;
}

Measured memory_bytes: 4656
import sys
from collections import deque
def input(): return sys.stdin.readline().strip()


def main():
    N, M, K = map(int, input().split())
    A = deque(map(int, input().split()))
    B = deque(map(int, input().split()))
    time = 0
    idxA = N
    idxB = M

    time = 0
    for i in range(N):
        time += A[i]
        if time > K:
            idxA = i
            break
    if time > K: time -= A[idxA]
    for j in range(M):
        time += B[j]
        if time > K:
            idxB = j
            break
    if time > K: time -= B[idxB]

    if idxA == N and idxB == M:
        print(N + M)
        return

    ans = idxA + idxB
    for i in range(idxA - 1, -1, -1):
        time -= A[i]
        while time <= K and idxB < M:
            time += B[idxB]
            idxB += 1
        if time > K:
            idxB -= 1
            time -= B[idxB]
        #print(i, idxB)
        ans = max(ans, i + idxB)
    print(ans)


if __name__ == "__main__":
    main()


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

using namespace std;
#define rep(i, n) for(int i = 0 ; i < (int)(n) ; i++)
typedef long long ll;
typedef long double Double;

#ifndef INPUTS_DIR
#define INPUTS_DIR "./"
#endif


int connect(int a, int b, int l, int r) {
    return min(r, b) - max(a, l) > 0;
}


void solve(ll N, vector<ll> a, vector<ll> b) {
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    for (int i = 0; i < N; i++) {
        if (a[i] > b[i]) swap(a[i], b[i]);
    }
    int r = 0;
    long long ans = 1;
    for (int i = 0; i < N; i++) {
        while (r < N && connect(a[i], b[i], a[r], b[r])) r++;
        ans *= r - i;
        ans %= 1000000007;
    }
    cout << ans << endl;
}


void main_(istream &cin) {
    ll N;
    cin >> N;
    vector<ll> a(N - 1 + 1);
    vector<ll> b(N - 1 + 1);
    for (int i = 0; i <= N - 1; i++) {
        cin >> a[i];
    }
    for (int i = 0; i <= N - 1; i++) {
        cin >> b[i];
    }
    solve(N, a, b);
}

int main() {
#ifdef INTELLIJ
    ifstream ifs(string(INPUTS_DIR) + "in_1.txt");
    if (ifs.is_open()) {
        main_(ifs);
        ifs.close();
    } else {
        cerr << "Error: no input." << endl;
    }
#else
    ios::sync_with_stdio(false);
    cin.tie(0);
    main_(cin);
#endif
}





Measured memory_bytes: 3456
N = int(input())
A = list(map(int, input().split()))
alice, bob = 0, 0
while(True):
    alice += max(A)
    A.remove(max(A))
    if not A: break
    bob += max(A)
    A.remove(max(A))
    if not A: break
print(alice - bob)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define co(n) cout << n << endl
using namespace std;
int main(){
  int n,k,x,y;
  cin >>n>>k>>x>>y;
  if(n<k) k=n;
  co(k*x+(n-k)*y);
  
  return 0;
}

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

double E(int x){
  return (x+1)/2.0;
}

int main(){
  int N,K;
  cin>>N>>K;
  vector<double> P(N);
  for(int i=0;i<N;i++){
    cin>>P.at(i);
  }
  double ans=-1;
  double sum=0;
  for(int i=0;i<K;i++){
    sum+=E(P.at(i));
  }
  ans=sum;
  for(int i=0;i<N-K;i++){
    sum+=E(P.at(i+K));
    sum-=E(P.at(i));
    ans=max(ans,sum);
  }
  cout<<fixed<<setprecision(6)<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define range(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, b) for (int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x) cerr << #x << " = " << (x) << endl;
#define int long long
using namespace std;

template <typename X, typename T>
auto vectors(X x, T a) {
	return vector<T>(x, a);
}
template <typename X, typename Y, typename Z, typename... Zs>
auto vectors(X x, Y y, Z z, Zs... zs) {
	auto cont = vectors(y, z, zs...);
	return vector<decltype(cont)>(x, cont);
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
	rep(i, v.size()) { os << v[i] << (i == v.size() - 1 ? "" : " "); }
	return os;
}
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S>& p) {
	os << '(' << p.first << ',' << p.second << ')';
	return os;
}
template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
	for (T& x : v) { is >> x; }
	return is;
}

string solve(string& s, string& t) {
	vector<vector<int>> dp(s.size() + 1, vector<int>(t.size() + 1, 0));
	vector<vector<pair<int, int>>> pre(s.size() + 1, vector<pair<int, int>>(t.size() + 1, make_pair(-1, -1)));


	rep(i, s.size()) {
		rep(j, t.size()) {
			if (s[i] == t[j]) {
				dp[i + 1][j + 1] = dp[i][j] + 1;
				pre[i + 1][j + 1] = make_pair(i,j);
			} else { //$BO"B3$7$?ItJ,J8;zNs$N>l9g$O$3$3$r>C$7!"(Bdp$B$N(Bmax$B$rJV$9(B
				if(dp[i][j + 1] < dp[i + 1][j]){
					dp[i + 1][j + 1] = dp[i + 1][j];
					pre[i + 1][j + 1] = make_pair(i + 1,j);
				}else{
					dp[i + 1][j + 1] = dp[i][j + 1];
					pre[i + 1][j + 1] = make_pair(i,j + 1);
				}
			}
		}
	}

	string r;
	pair<int, int> c=pre.back().back();
	while(c.first != -1){
		if(s[c.first] == t[c.second]) r += s[c.first];
		c = pre[c.first][c.second];
	}

	r = "";
	int y = t.size(), x = s.size();
	int len = dp.back().back();
	while(len and (x > 0 or y > 0)){
		if(s[x - 1]==t[y - 1]){
			r+=s[x - 1];
			x--;
			y--;
			len--;
		}else{
			if(x > 0 and len==dp[x - 1][y]){
				x--;
			}else if(y > 0 and len == dp[x][y - 1]){
				y--;
			}
		}
	}
	reverse(all(r));
	return r;
}

signed main() {
	string s, t;
	cin >> s >> t;
	cout << solve(s, t) << endl;

}


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

//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3", "Ofast", "unroll-loops", "fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


#define int long long
#define endl '\n'

using namespace std;

signed main(){
    //ios_base::sync_with_stdio(false);
    //cin.tie(0);
    int i, j, k, n;
    cin >> n;
    int ans = 0;
    for (i = 1; i <= n; i++){
        for (j = 1; j <= n; j++){
            for (k = 1; k <= n; k++){
                ans += __gcd(__gcd(i, j), k);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rei register int
#define int long long
using namespace std;
int n;
int d[1000010];
signed main(){
	cin >> n; int ans(0);
	for(rei i = 1;i <= n - 1;++i){
		for(rei j = 1;i * j <= n - 1;++j)
		++ans;
	} cout << ans << endl; return 0;
}

Measured memory_bytes: 3636