akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <sstream>

#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <deque>
#include <queue>
#include <stack>

#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>

#include <chrono>
#include <random>

using namespace std;
using i64 = int_fast64_t;
using ui64 = uint_fast64_t;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<i64>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pii = pair<int, int>;
using pll = pair<i64, i64>;

//////////////////////////////////////////////////

int main(){
    i64 N;
    cin >> N;
    i64 ret = 0LL;
    for(i64 i=1; i*i <= N;i++){
        i64 k = (N - i) / i;
        if(k == 0)continue;
        if(N / k == N % k)ret += k;
    }
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int main() {
  int n, dp[100001] = {};
  scanf("%d", &n);
  dp[101] = dp[102] = dp[103] = dp[104] = dp[105] = dp[100] = 1;
  for (int i = 106; i <= 100000; i++) {
    for (int j = 100; j <= 105; j++) {
      if (dp[i - j]) {
        dp[i] = 1;
      }
    }
  }
  printf("%d\n", dp[n]);
}

Measured memory_bytes: 512
#include <algorithm>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using namespace std;

using lint=int64_t;
using uint=uint32_t;
using ulint=uint64_t;

template<class T>
using vector2d=vector<vector<T>>;

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

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

template <class T>
void OutVec(const vector<T>& vec){
  for(int i = 0; i < vec.size() - 1; ++i){
    cout<<vec[i]<<" ";
  }
  cout<<vec.back()<<endl;
}

template <class T>
void OutVec2d(const vector2d<T>& vec){
  for(auto v:vec){
    OutVec(v);
  }
}



int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  int n,m,q;
  cin>>n>>m>>q;
  vector<int> a(q),b(q),c(q),d(q);
  for(int i=0;i<q;i++){
    cin>>a[i]>>b[i]>>c[i]>>d[i];
    a[i]--;
    b[i]--;
  }

  stack<vector<int>> stk;
  for(int i=1;i<=m;i++){
    vector<int> vec;
    vec.push_back(i);
    stk.push(vec);
  }

  lint result=0;
  while(!stk.empty()){
    vector<int> curr=stk.top();
    stk.pop();
    if(curr.size()==n){
      lint tmp_res=0;
      for(int i=0;i<q;i++){
        if(curr[b[i]]-curr[a[i]]==c[i]){
          tmp_res+=d[i];
        }
      }
      UpdateMax(result,tmp_res);
      continue;
    }

    for(int i=curr.back();i<=m;i++){
      vector<int> next=curr;
      next.push_back(i);
      stk.push(next);
    }
  }
  cout<<result<<endl;


  return 0;
}




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

int main() {
  int N;
  int K;
  cin >> N >> K;
  
  int A = N + 1;
  int B = 0;
  int temp = 0;
 
  for (int i = 0; i <= N; i++){
    A = A - 1;
    B = N - A;
    int den = 1;
    
  	for (int j = 0; j < A; j++){
      den = den * 2;
    }
    for (int n = 0; n < B; n++){
      den = den + K;
    }
     
    if (temp == 0){
      temp = den;
    }
    else if(temp > den){
      temp = den;
    }
  }
  cout << temp << endl;
}



Measured memory_bytes: 256
import java.util.*;

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

        long a = sc.nextInt();
        long b = sc.nextInt();

        long tmp;

        long c = a;
        c *= b;

        while ((tmp=a%b)!=0){
            a = b;
            b = tmp;
        }

        System.out.println(c/b);

    }

}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define mk(a,b) make_pair(a,b)
#define pii pair<int,int>
using namespace std;
inline int read() {
    int X=0,w=1; char c=getchar();
    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
    while (c>='0'&&c<='9') X=(X<<3)+(X<<1)+c-'0',c=getchar();
    return X*w;
}
typedef long long ll;
const int N = 1e5+5;
int main(){
    int a,b;
    a=read();b=read();
    if(b%a==0){
        cout<<a+b;
    } else
        cout<<b-a;

}

Measured memory_bytes: 256
sx, sy, tx, ty = map(int, input().split())
x = tx - sx
y = ty - sy
L = []
L.append('R' * x)
L.append('U' * y)
L.append('L' * x)
L.append('D' * (y + 1))
L.append('R' * (x + 1))
L.append('U' * (y + 1))
L.append('LU')
L.append('L' * (x + 1))
L.append('D' * (y + 1))
L.append('R')
print(*L, sep='')


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
#define sz 100002
int a,b,test,i,j;
using namespace std;
int main()
{
    int n,ara[101];
    cin>>n;
    for(int i=0;i<n;i++)cin>>ara[i];
  ll  int mn=4676433467;
    for(int i=-100;i<=100;i++)
    {
        ll int s=0;
        for(int j=0;j<n;j++)
        {
            s+=(ara[j]-i)*(ara[j]-i);
        }
        mn=min(mn,s);

    }
    cout<<mn<<endl;

}


Measured memory_bytes: 256
using System;
using System.Linq;
class Program
{
	static void Main(string[] args)
	{
		// 整数の入力
		long n = long.Parse(Console.ReadLine());
		String name = "";
      	
      	for(;n>0;){
        	n -= 1;
          	name += Convert.ToString((char)(n%26+97));
          	n /= 26;
        }
		//出力
		Console.WriteLine(name.Reverse().ToArray());
	}
}

Measured memory_bytes: 18572
#include <bits/stdc++.h>
using namespace std;
namespace mint {
  int md = 1e9 + 7;
  inline void add (int &a, int b) {
    assert(0 <= a && a < md && 0 <= b && b < md);
    a += b; if (a >= md) a -= md;
  }
  inline void sub (int &a, int b) {
    assert(0 <= a && a < md && 0 <= b && b < md);
    a -= b; if (a < 0) a += md;
  }
  inline int sum (int a, int b) {
    assert(0 <= a && a < md && 0 <= b && b < md);
    add(a, b); return a;
  }
  inline int dif (int a, int b) {
    assert(0 <= a && a < md && 0 <= b && b < md);
    sub(a, b); return a;
  }
  template<class... A>
  inline int prod (A... args) {
    long long ret = 1;
    for (int a :	initializer_list<int>{args...}) {
      assert(0 <= a && a < md);
      ret *= a;
      ret %= md;
    }
    return (int)(ret % md);
  }
  inline void mul (int &a, int b) {
    assert(0 <= a && a < md && 0 <= b && b < md);
    a = prod(a, b);
  }
  inline int inv (int a) {
    assert(0 <= a && a < md);
    a %= md;
    if(a < 0) a += md;
    int b = md, u = 0, v = 1;
    while (a) {
      int t = b / a;
      b -= a * t; swap(a, b);
      u -= v * t; swap(u, v);
    }
    assert(b == 1);
    if(u < 0) u += md;
    return u;
  }
  inline int quot (int a, int b) {
    assert(0 <= a && a < md && 0 <= b && b < md);
    return prod(a, inv(b));
  }
  inline void div (int& a, int b) {
    assert(0 <= a && a < md && 0 <= b && b < md);
    a = quot(a, b);
  }
  inline int pow (int a, long long b) {
    assert(0 <= a && a < md);
    int res = 1;
    for (; b; b >>= 1) {
      if (b & 1) mul(res, a);
      mul(a, a);
    }
    return res;
  }
  namespace factorials {
    int sz;
    vector<int> fact, finv;
    void init (int n) {
      sz = n;
      fact.resize(n); finv.resize(n);
      fact[0] = 1;
      for (int i = 1; i < n; i++) fact[i] = prod(fact[i - 1], i);
      finv[n - 1] = inv(fact[n - 1]);
      for (int i = n - 2; i >= 0; i--) finv[i] = prod(finv[i + 1], i + 1);
    }
  }
  inline int fct (int i) {
    using namespace factorials;
    assert(0 <= i && i < sz);
    return fact[i];
  }
  inline int fnv (int i) {
    using namespace factorials;
    assert(0 <= i && i < sz);
    return finv[i];
  }
  inline int binom (int n, int k) {
    using namespace factorials;
    assert(0 <= n && n < sz);
    if (k <  0 || n < k) return 0;
    return prod(fact[n], finv[k], finv[n - k]);
  }
}
int main() {
  cin.tie(0); cin.sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  mint::factorials::init(2 * n + 1);
  auto cmb = [&] (int n, int k) {
    return mint::binom(n + k - 1, k - 1);
  };
  auto cal = [&] (int i) {
    return mint::prod(
      cmb(k - i, i),
      cmb(n - k - i + 1, i + 1)
    );
  };
  for (int i = 1; i <= k; i++) {
    cout << cal(i) << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<vector>
#include<cstring>
#include<queue>
#define mp make_pair
using namespace std;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;

map<char, int> dx, dy;
int idx[4] = {1, 0, -1, 0};
int idy[4] = {0, -1, 0, 1};

int main(int argc, char *argv[]){
  dx['U'] = 0,  dy['U'] = -1;
  dx['D'] = 0,  dy['D'] = 1;
  dx['R'] = 1,  dy['R'] = 0;
  dx['L'] = -1,  dy['L'] = 0;

  int w, h, n, csx, csy, ctx, cty;
  cin >> w >> h >> n;
  cin >> csx >> csy >> ctx >> cty;
  int grid[2*h + 5][2*w + 5];
  int dp[h + 1][w + 1];
  memset(grid, 0, sizeof(grid));

  for (int i = 0; i <= h; i++) {
    for (int j = 0; j <= w; j++) {
      dp[i][j] = 1e9;
    }
  }
  
  int nx, ny , count;
  string dist;
  for (int i = 0; i < n; i++) {
    cin >> nx >> ny >> count >> dist;
    for (int j = 0; j < dist.length()*count; j++) {
      char d = dist[j%dist.length()];
      if(0 <= ny + dy[d] && ny + dy[d] < h &&
         0 <= nx + dx[d] && nx + dx[d] < w){
        grid[2*ny + dy[d] + 1][2*nx + dx[d] + 1]++;
        ny += dy[d], nx += dx[d];
      }
    }
  }
  dp[csy][csx] = 0;
  priority_queue<piii ,vector<piii>, greater<piii> > que;
  que.push(mp(0, mp(csx, csy)));
  while(!que.empty()){
    piii v = que.top();que.pop();
    int x, y, c;
    c = v.first;
    x = v.second.first;
    y = v.second.second;
    for (int i = 0; i < 4; i++) {
      int nx = x + idx[i], ny = y + idy[i];
      if(0 <= nx && nx <= w &&
         0 <= ny && ny <= h &&
         dp[ny][nx] > c + grid[2*y + idy[i]][2*x + idx[i]]){
        dp[ny][nx] = c + grid[2*y + idy[i]][2*x + idx[i]];
        que.push(mp(dp[ny][nx], mp(nx, ny)));
      }
    }
  }

  // std::cout << "grid:" << std::endl;
  // for (int i = 0; i <= 2*h; i++) {
  //   for (int j = 0; j <= 2*w; j++) {
  //     std::cout << grid[i][j] << " ";
  //   }
  //   std::cout << std::endl;
  // }
  // std::cout << "dp:" << std::endl;
  // for (int i = 0; i <= h; i++) {
  //   for (int j = 0; j <= w; j++) {
  //     std::cout << dp[i][j] << " ";
  //   }
  //   std::cout << std::endl;
  // }
  
  std::cout << dp[cty][ctx] << std::endl;
  return 0;
}

Measured memory_bytes: 9104
#include <iostream>
#include <vector>
#include <cmath>


using namespace std;

int main(){
  double minv;
  while(cin >> minv){
    double y = 4.9*pow((minv/9.8), 2.0);
    int N = 1;
    while(true){
      if(y <= 5*N-5){
	break;
      }
      N++;
    }
    cout << N << endl;
  }
}
      

Measured memory_bytes: 1224
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<map>
#include<set>
using namespace std;
string s, t;
set<string> S;
 
void Work()
{
    int lens = s.size();
    int lent = t.size();
    for(int i = 0; i < lens; i++)
    {
        if(s[i] == '?' || s[i] == t[0])//如果字符相等
        {
            string tmp = s;              //构造判断子串之前的字符
            for(int j = 0; j < i; j++)
                if(tmp[j] == '?')
                    tmp[j] ='a';    
            bool can = false;
            for(int j = 0; j < lent; j++)    //判断是否为子串
            {
 
                if(tmp[i+j]!= '?' && tmp[i+j] != t[j])  //字符匹配
                    break;
                tmp[i+j] = t[j];
                if(j == lent - 1) can = true;
            }
            if(can)
            {
                for(int j = i + lent; j < lens; j++) if(tmp[j] == '?') tmp[j] = 'a';//处理匹配后的字符
                S.insert(tmp);  //压入容器
            }
        }
    }
    if(S.size() == 0) cout << "UNRESTORABLE" << endl;
    else cout << *S.begin() << endl;
}
int main()
{
    cin >> s >> t;
    Work();
}

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

int main() {
    int A, B, K;
  cin >> A >> B;
  K = 0;
  for (int i = 1; i <= max(A, B); i++) {
    if (abs(A - i) == abs (B - i)) {
      K = i;
      break;
    }
  }
   if (K) cout << K << endl;
  else cout << "IMPOSSIBLE" << endl;
}

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

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

int main(){
    int H, N;
    cin >> H >> N;
    int sum = 0;
    rep(i, N){
        int a;
        cin >> a;
        sum += a;
    }
    if(sum >= H) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();

        int fore = Integer.valueOf(s.substring(0, 2));
        int latt = Integer.valueOf(s.substring(2, 4));

        boolean isyymm = false;
        boolean ismmyy = false;

        if (fore >= 1 && fore <= 12) {
            ismmyy = true;
        }

        if (latt >= 1 && latt <= 12) {
            isyymm = true;
        }

        if (ismmyy && isyymm) {
            System.out.println("AMBIGUOUS");
        } else if (ismmyy) {
            System.out.println("MMYY");
        } else if (isyymm) {
            System.out.println("YYMM");
        } else {
            System.out.println("NA");
        }
    }
}


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

int main(){
	int N;
	cin>>N;
	
	for(int i=0;i<N;i++){
		int x,y,b,p;
		cin>>x>>y>>b>>p;

		int f1=x*b+y*p;
	
		if(b<5){
			b=5;
		}
		if(p<2){
			p=2;
		}
		
		int f2=(x*b+y*p)*4/5;

		if(f1<f2){
			cout<<f1<<endl;
		}
		else{
			cout<<f2<<endl;
		}
	}

		return 0;
}

Measured memory_bytes: 3100
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <set>
#define PB push_back
#define MP make_pair
#define PII pair<int,int>
#define FIR first
#define SEC second
#define ll long long
using namespace std;
template <class T>
inline void rd(T &x) {
	x=0; char c=getchar(); int f=1;
	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }
	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
const int N=2e5+10;
int P[N],a[N],n;
ll ans;
struct item {
    int a,b,id;
    item(int x=-1,int id=0): a(x==0),b(x==1),id(id) {}
    friend bool operator <(item A,item B) { if(A.b*(ll)B.a==B.b*(ll)A.a) return A.id<B.id; return A.b*(ll)B.a<B.b*(ll)A.a; }
    friend item operator +(item A,item B) {
        item C; C.id=A.id,C.a=A.a+B.a,C.b=A.b+B.b;
        ans+=A.b*(ll)B.a;
        return C;
    }
}b[N];
multiset<item> S;
int fa[N];
int find(int x) { return fa[x]==x?x:fa[x]=find(fa[x]); }
int main() {
    rd(n);
    for(int i=2;i<=n;++i) rd(P[i]);
    for(int i=1;i<=n;++i) rd(a[i]);

    for(int i=1;i<=n;++i) {
        fa[i]=i;
        b[i]=item(a[i],i);
        S.insert(b[i]);
    }
    while(!S.empty()) {
        int u=S.begin()->id; S.erase(S.begin());
        int f=find(P[u]);
        fa[u]=f;
        if(f) S.erase(S.find(b[f]));
        b[f]=b[f]+b[u];
        if(f) S.insert(b[f]);
        // cout<<u<<' '<<ans<<endl;
    }
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 17408
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n) ; ++i)
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define emb emplace_back
#define fcout cout << fixed << setprecision(15)

using namespace std;
using ll = long long;
using P = pair<int,int>;

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

ll dp[100005][102];

int main() {
int n,W;
cin >> n >> W;
vector<ll> w(n),v(n);
rep(i,n) cin >> w.at(i) >> v.at(i);

rep(wtot,W+1) rep(i,n) {
  dp[wtot][i+1] = max(dp[wtot][i+1],dp[wtot][i]);
  if(wtot+w.at(i) > W) continue;
  dp[wtot+w.at(i)][i+1] = max(dp[wtot+w.at(i)][i+1],dp[wtot][i]+v.at(i));
}

cout << dp[W][n] << endl;
  return 0;
}


Measured memory_bytes: 79872
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<ll>
#define pb push_back

int main()
{

    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	ll t,i,s,j,m,x,y,n,z,p,k,T;string s1,s2,s3;x=1;
    ll a,b,c;
    cin>>a>>b>>c;
    if(b>=c)cout<<b+c<<"\n";
    else{
    	p=0;p+=(2*b);c-=b;
    	if(c==0)cout<<p<<"\n";
    	else cout<<p+min(a+1,c)<<"\n";
    }


	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f first
#define s second
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
/*bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
} */
int main()
{
     ll n,sum=0,kk;
     cin>>n;
     for(ll i=1;i<=n;i++)
      {
          for(ll j=1;j<=n;j++)

           {
               for(ll k=1;k<=n;k++)
     {
               kk=__gcd(i,j);
               kk=__gcd(kk,k);
               sum+=kk;

     }}}
     cout<<sum<<endl;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll inf = 3e18;
const char sp = ' ';

struct treap {
	treap *lch, *rch;
	int val, min, pri, cnt;
	treap() {};
	treap(int v, int p) {
		val = min = v;
		pri = p;
		lch = rch = NULL;
		cnt = 1;
	}
};

int count(treap *t) {
	if (!t)return 0;
	return t->cnt;
}

int minimum(treap *t) {
	if (!t)return 200000000;
	return t->min;
}

treap* update(treap* t) {
	t->min = min({ t->val,minimum(t->lch),minimum(t->rch) });
	t->cnt = count(t->lch) + count(t->rch) + 1;
	return t;
}

treap* merge(treap* l, treap* r) {
	if (!l)return r;
	if (!r)return l;
	if (l->pri > r->pri) {
		l->rch = merge(l->rch, r);
		return update(l);
	}
	else {
		r->lch = merge(l, r->lch);
		return update(r);
	}
}

pair<treap*, treap*> split(treap* t, int c) {
	//[t,t+c)
	if (!t) {
		return { NULL,NULL };
	}
	if (count(t->lch) >= c) {
		auto p = split(t->lch, c);
		t->lch = p.second;
		return { p.first,update(t) };
	}
	else {
		auto p = split(t->rch, c - count(t->lch) - 1);
		t->rch = p.first;
		return { update(t),p.second };
	}
}

treap* insert(treap* t, treap* u,int c) {
	// [0,c)
	auto p = split(t, c);
	return merge(merge(p.first, u), p.second);
}

pair<treap*, treap*> erase(treap* t, int c) {
	//[0,c)[c,N)
	auto p = split(t, c);
	//[c,c+1),[c+1,N)
	auto q = split(p.second, 1);
	return { merge(p.first,q.second),q.first };
}

int n, q, a;
treap tree[200000];
mt19937 mt(869120);

int main() {
	cin >> n >> q;
	for (int i = 0; i < n; i++) {
		cin >> a;
		tree[i] = treap(a, uniform_int_distribution<>(0, 2000000000)(mt));
	}
	treap *root = tree;
	for (int i = 1; i < n; i++) {
		root = merge(root, tree + i);
	}
	for (int i = 0; i < q; i++) {
		int x, y, z;
		cin >> x >> y >> z;
		if (x == 0) {
			auto p = erase(root, z);
			root = insert(p.first, p.second, y);
		}
		else if (x == 1) {
			auto p = split(root, z + 1);
			auto q = split(p.first, y);
			cout << q.second->min << endl;
			root = merge(merge(q.first, q.second), p.second);
		}
		else {
			auto p = erase(root, y);
			p.second->val = z;
			update(p.second);
			root = insert(p.first, p.second, y);
		}
	}
}


Measured memory_bytes: 9372
#include <bits/stdc++.h>
#define lli long long int
#define inf 2147483647
#define infll LLONG_MAX
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define YES() cout << "YES" << endl
#define NO() cout << "NO" << endl
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    int a, b;
    cin >> a >> b;
    for(int i=10; i<1010; i++){
        if(floor(i*0.08) == a && floor(i*0.1) == b){
            cout << i << endl;
            return 0;
        }
    }
    cout << "-1" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<cmath>
#define pb push_back
#define ld double
#define mp make_pair
#define vl vector<ll> 
#define ll long long int
#define pl pair<ll, ll>
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define all(a) a.begin(), a.end()
#define forr(i, n) for(ll i=0; i<n; i++) 
#define forr1(i, n) for(ll i=1; i<=n; i++)
using namespace std;
const ld PI =3.1415926535897923846;
const ll MOD = 1e9+7;
ll fact[(ll)(1e6+100)];
ll a, b, n;
ll power(ll a, ll b)
{
    if(b==0)
    return 1%MOD;
    if(b%2==1)
    return a*(power(a, b-1))%MOD;
    ll pow2=power(a, b/2);
    return pow2*pow2%MOD;
}
void solve()
{
    string s1, s2, ans;
    cin>>s1>>s2;
    ll m=s1.length(), n=s2.length();
    int L[m+1][n+1];
    for(ll i=0; i<=m; i++)
    {
        for(int j=0; j<=n; j++)
        {
            if(i==0||j==0)
            L[i][j]=0;
            else if(s1[i-1]==s2[j-1])
            L[i][j]=L[i-1][j-1]+1;
            else 
            L[i][j]=max(L[i-1][j], L[i][j-1]);
        }
    }
    ll index=L[m][n];
    char lcs[index+1];
    lcs[index]='\0';
    ll i=m, j=n;
    while(i>0&&j>0)
    {
        if(s1[i-1]==s2[j-1])
        {
            lcs[index-1]=s1[i-1];
            i--;
            j--;
            index--;
        }
        else if(L[i-1][j]>L[i][j-1])
        i--;
        else j--;
    }
    cout<<lcs;
}
int main()
{
    ll test=1;
    //cin>>test;
    while(test--)
        solve();
}

Measured memory_bytes: 35456
// Author: Sayantanu
#include <bits/stdc++.h>

using namespace std;

#define ll long long int
const int mod = 1e9 + 7;
#define INF INT_MAX

int main() {
    //code
    int n;
    cin>>n;
    vector<int> arr(n);
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    vector<int> dp(n,INF);
    dp[0] = 0;
    for(int i=1;i<n;i++){
        if((i-1)>=0){
            dp[i] = min(dp[i],(abs(arr[i]-arr[i-1])+dp[i-1]));
        }
        if((i-2)>=0){
            dp[i] = min(dp[i],(abs(arr[i]-arr[i-2])+dp[i-2]));
        }
    }
    cout<<dp[n-1];
    return 0;
}

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

void trace(int A[], int N) {
    for (int i = 0; i < N; i++) {
        if (i > 0) { cout << " "; }
        cout << A[i];
    }
    cout << endl;
}

int bubbleSort(int A[], int N) {
    int count = 0;

    bool flag = true;
    while (flag) {
        flag = false;
        for (int j = N - 1; j >= 1; j--) {
            if (A[j] < A[j - 1]) {
                int tmp = A[j];
                A[j] = A[j - 1];
                A[j - 1] = tmp;

                flag = true;
                count++;
            }
        }
    }

    trace(A, N);
    return count;
}

int main() {
    int N;
    int A[100];

    cin >> N;
    for (int i = 0; i < N; i++) { cin >> A[i]; }

    int count = bubbleSort(A, N);
    cout << count << endl;

    return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define debug(var) do{cout << #var << " : "; view(var);}while(0)
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
template<class T> void view(T e) {cout << e << endl;}
template<class T> void view(const vector<T> &v) {for(const auto &e : v){cout << e << " ";} cout << endl;}
template<class T> void view(const vector<vector<T>> &vv) {for(const auto &v : vv){view(v);}}
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n; cin >> n;
    cout << (n-2)*180 << endl;
}

Measured memory_bytes: 3592
#[macro_use]
mod input {

    use std;
    use std::io;

    const SPLIT_DELIMITER: char = ' ';

    #[macro_export]
    #[allow(unused_macros)]
    macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

    #[allow(dead_code)]
    pub fn input_line_str() -> String {
        let mut s = String::new();
        io::stdin().read_line(&mut s).unwrap();
        s.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn p<T>(t: T)
    where
        T: std::fmt::Display,
    {
        println!("{}", t);
    }

    #[allow(dead_code)]
    pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<Vec<T>> = Vec::new();

        for _ in 0..line {
            let vec_line = input_vector();
            v.push(vec_line);
        }
        v
    }

    #[allow(dead_code)]
    pub fn input_vector<T>() -> Vec<T>
    where
        T: std::str::FromStr,
    {
        let mut v: Vec<T> = Vec::new();

        let s = input_line_str();
        let split_result = s.split(SPLIT_DELIMITER);
        for z in split_result {
            let buf = match z.parse() {
                Ok(r) => r,
                Err(_) => panic!("Parse Error"),
            };
            v.push(buf);
        }
        v
    }

    #[allow(dead_code)]
    pub fn str2vec(s: &str) -> Vec<char> {
        let mut v: Vec<char> = Vec::new();
        for c in s.chars() {
            v.push(c);
        }
        v
    }
}

use input::*;

fn dfs(v: &mut Vec<usize>, graph: &Vec<Vec<usize>>, k: usize, visit: &mut Vec<bool>) {
    let buf = v[k];
    visit[k] = true;
    for z in &graph[k] {
        if visit[*z] {
            continue;
        }
        v[*z] += buf;
        dfs(v, graph, *z, visit);
    }
}

fn main() {
    let (n, q): (usize, usize);
    input!(n, q);
    let mut v = vec![0; n];
    let mut graph = vec![vec![]; n];
    let mut visit = vec![false; n];
    for _ in 1..n {
        let (a, b): (usize, usize);
        input!(a, b);
        graph[a - 1].push(b - 1);
        graph[b - 1].push(a - 1);
    }
    for _ in 0..q {
        let (p, x): (usize, usize);
        input!(p, x);
        v[p - 1] += x;
    }
    dfs(&mut v, &graph, 0, &mut visit);
    for z in v {
        print!("{} ", z);
    }
    println!("");
}

Measured memory_bytes: 33276
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        // AGC 008 Simple Calculator
        Scanner sc = new Scanner(System.in);
        long now = 1;
        int k = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (b - a <= 2 || k <= a) {
            System.out.println(k + now);
            return;
        }
        if (now < a) {
            k -= a - now;
            now = a;
        }
        if (k % 2 == 1) {
            k--;
            now++;
        }
        long count = k / 2;
        now += count * (b - a);

        System.out.println(now);
    }
}

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

using namespace std;
using ll = long long;


int main()
{
	ll a, b, c, k; cin >> a >> b >> c >> k; k %= 2;
	ll sum = (a + b + c)/ 2;

	cout << (k ? (sum - a) - (sum - b) : (a - b)) << endl;
}

Measured memory_bytes: 256
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int64_t, int64_t>;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int64_t a, b, x;
  cin >> a >> b >> x;
  const int64_t temp_1 = (a * a * b - x) * 2;
  const int64_t temp_2 = a * a * a;
  const double tan_theta = static_cast<double>(temp_1) / static_cast<double>(temp_2);
  double result = atan2(static_cast<double>(temp_1), static_cast<double>(temp_2)) / M_PI * 180.0;
  if (a * tan_theta > static_cast<double>(b)) {
    const int64_t temp_3 = b * b * a;
    const int64_t temp_4 = 2 * x;
    result = atan2(static_cast<double>(temp_3), static_cast<double>(temp_4)) / M_PI * 180.0;
  }

  cout << std::setprecision(20) << result << endl;

  return 0;
}


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

using namespace std;

#define DIM 200009
#define INF ((long long)1e18+9ll)
#define pairll pair<long long,long long>
#define fi first
#define se second
#define ld long double
#define endl '\n'
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define amen exit(0)

long long i,j,k,l,n,m,sz,C;

vector<long long>a[DIM];

long long dp[DIM];

long long dfs(long long i){
    if(dp[i]!=-1)return dp[i];
    if(a[i].size()==0){
        dp[i]=1;
        return 1;
    }

    for(auto to:a[i]){
        dp[i]=max(dp[i],dfs(to)+1);
    }
    k=max(k,dp[i]);
    return dp[i];
}

int main()
{
    fast;

    cin>>n>>m;
    for(i=1;i<=m;i++){
        cin>>k>>l;
        a[l].push_back(k);
    }

    memset(dp,-1,sizeof(dp));

    k=1;

    for(i=1;i<=n;i++){
        if(dp[i]!=-1)continue;
        dfs(i);
    }

    cout<<k-1<<endl;

    amen;
}



Measured memory_bytes: 12672
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
ll a,b,c,x,y,ans;
int main()
{
	cin>>a>>b>>c>>x>>y;
	int t=min(x,y);
	if(c*2<=a+b)
	{
		ans+=c*2*t;
		x-=t;
		y-=t;
		if(x)
		{
			if(a<c*2)
				ans+=a*x;
			else
				ans+=x*c*2;
		}
		else if(y)
		{
			if(b<c*2)
				ans+=b*y;
			else
				ans+=y*c*2;
		}
	}
	else
	{
		ans+=x*a;
		ans+=y*b;
	}
	cout<<ans<<endl;
	return 0;
}

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

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String[] str = in.readLine().split(" ");
    int a = Integer.parseInt(str[0]);
    int b = Integer.parseInt(str[1]);
    System.out.println(a+b>=24?a+b-24:a+b);
  }
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;

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

int main() {
    ll N, L;
    cin >> N >> L;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    int j = -1;
    for (int i = 0; i < N - 1; i++) {
        if (A[i + 1] + A[i] >= L) {
            j = i;
        }
    }
    if (j == -1) {
        cout << "Impossible" << endl;
        return 0;
    }
    cout << "Possible" << endl;
    for(int k = N - 2; k >= j + 1; k--) {
        cout << k + 1 << endl;
    }
    for (int k = 0; k < j; k++) {
        cout << k + 1 << endl;
    }
    cout << j + 1;

    return 0;
}


Measured memory_bytes: 1664
n = int(input())
a = []
lrg = 2000000
for i in range(n):
    tmp = list(map(int, input().split( )))
    for j in range(n):
        if tmp[j] == -1:
            tmp[j] = lrg
    a.append(tmp)
#for i in range(n):
#    print(*a[i])
V = [0]
T = []
weight = 0

while len(V)<n:
    mn = lrg-1###forの外
    tmp = -1###forの外
    for v in V:
        for i in range(n):
            if i not in V and mn>a[v][i]:
                mn = a[v][i]
                tmp = i
    weight += mn
    #print(v,[v,tmp])
    V.append(tmp)
    #print(*V)

print(weight)


Measured memory_bytes: 5888
loop do
    n = gets.to_i   
    break if n == 0
    rules = (1..n).map { gets.chomp.split }
    start = gets.chomp
    goal = gets.chomp

    queue = [start]
    k = 0 
    ok = false
    catch(:exit) do
        loop do
            next_queue = []
            until queue.empty?
                s = queue.pop
                if s == goal
                    ok = true
                    throw :exit
                end 
                next if s.size >= goal.size
                rules.each do |from, to|
                    if s =~ /#{from}/
                        next_queue << s.gsub(from, to) 
                    end
                end
            end 
            queue = next_queue
            break if queue.empty?
            k += 1
        end 
    end 
    puts ok ? k : -1
end

Measured memory_bytes: 11708
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define INF 100000000
const int MOD = 1000000007;

long long modpow(long long a,long long n,long long p)
{
    if(n==1)
    {
        return a%p;
    }
    if(n%2==1)
    {
         return a*modpow(a,n-1,p)%p;
    }
    long long t = modpow(a,n/2,p);
    return t*t%p;
}
int comb( int N, int K ){
    int X = 1; //分子
    int Y = 1; //分母
    for( int i = N; i > N-K; i-- ){
        X = (X*i)%MOD;
    }
    for( int i = 1; i <= K; i++ ){
        Y = (Y*i)%MOD;
    }
    return X * modpow(Y, MOD-2, MOD)%MOD;
}
int main()
{
    int n;
    cin>>n;
    vector <string> s(n);
    unordered_map <string,ll> mp;   //ハッシュテーブル
    for(int i=0;i<n;i++) 
    {
        cin>>s[i];
        sort(s[i].begin(),s[i].end());
        mp[s[i]]++;
    }

    ll ans = 0;
    for(auto p:mp)
    {
        ans += p.second*(p.second-1)/2;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 13416
#define rep(i, a, b) for(int i = a; i < (int)(b); i++)
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;
template<class T> inline void chmax(T &a, const T &b) {if(a < b) a = b;}
template<class T> inline void chmin(T &a, const T &b) {if(a > b) a = b;}
const long long INF = 1LL<<60;
const long long MOD = (ll)1e9+7;
const long long MAX = (ll)1e5+100;


int main(void) {
   ll N;
   cin>>N;
   vector<ll> A(N+2);
   A[0] = 0;
   rep(i,0,N) cin>>A[i+1];
   A[N+1] = 0;
   ll ans = 0;
   rep(i,0,N+1) ans += abs(A[i+1] - A[i]);
   // cout<<ans<<endl;

   rep(i,0,N) {
      cout<<ans-abs(A[i+1] - A[i]) - abs(A[i+2] - A[i+1]) + abs(A[i+2]-A[i])<<endl;
   }

   return 0;
}

Measured memory_bytes: 2048
#ifndef CLASS_MODINT
#define CLASS_MODINT

#include <cstdint>

template<std::uint32_t mod>
class modint {
private:
	std::uint32_t n;
public:
	modint() : n(0) {};
	modint(std::int64_t n_) : n((n_ >= 0 ? n_ : mod - (-n_) % mod) % mod) {};
	static constexpr std::uint32_t get_mod() { return mod; }
	std::uint32_t get() const { return n; }
	bool operator==(const modint& m) const { return n == m.n; }
	bool operator!=(const modint& m) const { return n != m.n; }
	modint& operator+=(const modint& m) { n += m.n; n = (n < mod ? n : n - mod); return *this; }
	modint& operator-=(const modint& m) { n += mod - m.n; n = (n < mod ? n : n - mod); return *this; }
	modint& operator*=(const modint& m) { n = std::uint64_t(n) * m.n % mod; return *this; }
	modint operator+(const modint& m) const { return modint(*this) += m; }
	modint operator-(const modint& m) const { return modint(*this) -= m; }
	modint operator*(const modint& m) const { return modint(*this) *= m; }
	modint inv() const { return (*this).pow(mod - 2); }
	modint pow(std::uint64_t b) const {
		modint ans = 1, m = modint(*this);
		while (b) {
			if (b & 1) ans *= m;
			m *= m;
			b >>= 1;
		}
		return ans;
	}
};

#endif // CLASS_MODINT

#include <vector>
#include <iostream>
using namespace std;
using modulo = modint<1000000007>;
int main() {
	int N, M;
	cin >> N >> M;
	vector<modulo> dp0(N, modulo(1)), dp1(N, modulo(0));
	dp0[0] = modulo(0); dp1[0] = modulo(1);
	for (int i = 1; i < M; ++i) {
		vector<modulo> ndp0(N), ndp1(N);
		ndp1[0] = (dp0[0] + dp1[0]) * 2;
		if (N >= 2) ndp1[0] += (dp0[1] + dp1[1]);
		for (int j = 1; j < N; ++j) {
			ndp0[j] = dp0[j - 1] + dp0[j] * 2 + (j + 1 != N ? dp0[j + 1] : 0);
			ndp1[j] = dp1[j - 1] + dp1[j] * 2 + (j + 1 != N ? dp1[j + 1] : 0);
		}
		dp0 = ndp0, dp1 = ndp1;
	}
	modulo ans = 0;
	for (int i = 0; i < N; ++i) ans += dp1[i];
	cout << (ans * 4).get() << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
  int N, K;
  cin>>N>>K;
  long long int arr[N];
  int i;
  long long int sum = 0;
  for(i=0;i<N;i++)
    cin>>arr[i];
  sort(arr, arr+N);
  
    for(i=0;i<(N-K); i++)
    {
      sum = sum + arr[i];
    }
  cout<<sum<<endl;
  return 0;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];
vp factorize(ll n) {
    vp res;
    for (ll i = 2; i * i <= n; i++) {
        if (n % i != 0) continue;
        res.emplace_back(i,0);
        while (n % i == 0) {
            n /= i;
            res.back().second++;
        } 
    }
    if (n != 1) res.emplace_back(n,1);
    return res;
}
int main(){
  ll n,ans=1;cin>>n;
  vll res(1001);
  rep(i,2,n+1){
    vp t=factorize(i);
    for(auto u:t){
      res[u.first]+=u.second;
    }
  }
  
  rep(i,0,res.size()){
    ans*=(res[i]+1)%MOD;
    ans%=MOD;
  }
  cout<<ans<<endl;

}



Measured memory_bytes: 3524
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        TreeMap<Integer, Integer> map = new TreeMap<>();
        for(int i = 0; i < n; i++) {
            int a = sc.nextInt();
            map.put(a, map.getOrDefault(a, 0) + 1);
        }
        for(int i = 0; i < m; i++) {
            int b = sc.nextInt();
            int c = sc.nextInt();
            while(!map.isEmpty()) {
                Map.Entry<Integer, Integer> entry = map.firstEntry();
                int minKey = entry.getKey();
                if(minKey >= c) break;
                int minvalueCount = entry.getValue();
                if(b < minvalueCount) {
                    map.put(entry.getKey(), minvalueCount - b);
                    map.put(c, map.getOrDefault(c, 0) + b);
                    break;
                }
                if(b == minvalueCount) {
                    map.remove(entry.getKey());
                    map.put(c, map.getOrDefault(c, 0) + b);
                    break;
                }
                map.remove(entry.getKey());
                map.put(c, map.getOrDefault(c, 0) + minvalueCount);
                b -= minvalueCount;
            }
        }
        long sum = 0;
        for(Map.Entry<Integer, Integer> entry: map.entrySet()) {
            long key = entry.getKey();
            long value = entry.getValue();
            sum += (key * value);
        }
        System.out.println(sum);
    }
}



Measured memory_bytes: 102632
#include "iostream"
using namespace std;

int main()
{
	int n;
	cin >> n;
	for (size_t z = 1; z <= n; z++)
	{
		int i = z;
		if (i % 3 == 0) {
			cout << " " << i;
		}
		else {
			do {
				if (i % 10 == 3) {
					cout << " " <<z;
					break;
				}
			} while (i /= 10);
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3072
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

public class Main
{

	public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	public static void main(String[] args) throws IOException
	{
		// TODO 自動生成されたメソッド・スタブ

		/*
		String str[] = input(2);
		System.out.println(GCD(Integer.parseInt(str[0]), Integer.parseInt(str[1])));
		//*/


		String str1[] = input(1);
		String str2[] = input(Integer.parseInt(str1[0]));
		String str3[] = input(1);
		String str4[] = input(Integer.parseInt(str3[0]));

		int ai[] = new int[Integer.parseInt(str1[0])];
		int bi[] = new int[Integer.parseInt(str3[0])];

		for(int i = 0; i < ai.length; i++)
		{
			ai[i] = Integer.parseInt(str2[i]);
		}

		for(int i = 0; i < bi.length; i++)
		{
			bi[i] = Integer.parseInt(str4[i]);
		}

		//boolean DP[][] = new boolean[][];

		//System.out.println(bi.length);

		Map<Integer, Boolean> map = new HashMap<>();

		//for(int i = 0; i < bi.length; i++)
		{
			boolean b = false;
			for(int j = 0; j < Math.pow(2, ai.length); j++)
			{
				//System.out.println("J    : " + Integer.toBinaryString(j));
				int sum = 0;
				for(int k = 0; k < ai.length; k++)
				{
					//System.out.println("J>>>K: " + ((j>>>k) & 0x1));
					if(((j >>> k) & 0x1) == 0x1)
					{
						//if(ai[k] > bi[i]) break;
						sum += ai[k];
					}
				}
				map.put(sum, true);
			}
		}

		for(int i = 0; i < bi.length; i++)
		{
			try
			{
				if(map.get(bi[i])) System.out.println("yes");
			}
			catch (NullPointerException e)
			{
				System.out.println("no");
			}
		}
		//*/
	}

	public static int GCD(int x, int y)
	{
		int z = Math.max(x, y) % Math.min(x, y);
		if(z == 0) return Math.min(x, y);
		return GCD(z, Math.min(y, x));
	}

	public static String[] input(int Num) throws IOException
	{
		String str[] = new String[Num];
		String str2 = br.readLine();
		int j = 0;
		for(int i = 0; i < Num; i++)
		{
			if(i < Num - 1)
			{
				str[i] = str2.substring(j, str2.indexOf(" ", j));
				j = str2.indexOf(" ", j) + 1;
			}
			else
			{
				str[i] = str2.substring(j);
			}
		}
		return str;
	}

}



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

using namespace std;


#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define ll long long
#define MOD 1000000007

#define IMIN INT_MIN;
#define IMAX INT_MAX;


int main(){
    string S;
    cin >> S;
    int n = S.size();
    int cnt = 0;
    rep(i, n/2) if (S[i] != S[n-1-i]) cnt++;
    cout << cnt << endl;


	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int n,k;
	int m;

	while(1){
		scanf("%d\n",&n);
		if(!n)break;
		k=0;
		while(n){
			m=n;
			while(!(m%5)){
				k++;
				m/=5;
			}
			n--;
		}
		printf("%d\n",k);
	}

	return 0;
}

Measured memory_bytes: 604
import java.util.*

fun main() {
    val sc = Scanner(System.`in`)

    val n = sc.nextInt()
    val m = sc.nextInt()
    val k = sc.nextInt()
    val mod = 998244353L
    val facto = LongArray(n+1)
    val cache = HashMap<Pair<Int,Int>, Long>()
    val ex = LongArray(n+1){0L}

    ex[0] = 1L

    for(i in 1..n) {
        ex[i] = ex[i-1] * (m-1).toLong()
        ex[i] %= mod
    }

    facto[0] = 1L
    facto[1] = 1L

    for(i in 2..n) {
        facto[i] = (facto[i-1] * i) % mod
    }

    fun modInv(a:Long, m:Long = mod): Long {
        fun mInv(a:Long, m:Long): Long {
            if(m == 0L) return 1L
            if(m == 1L) return a
            var result = mInv(a, m / 2) % mod
            result = (result * result) % mod
            if(m % 2 != 0L) {
                result = (result * a) % mod
            }
            return result
        }
        return mInv(a, m - 2)
    }

    fun comb(n:Int, r:Int) : Long {
        val a = facto[n]
        val b = (facto[r] * facto[n-r]) % mod
        val ret = (a*modInv(b)) % mod
        return ret
    }

    var ans = 0L
    for(i in 0..k) {
        var v = comb(n - 1, i) * m.toLong()
        v %= mod
        v *= ex[n - 1 - i]
        v %= mod
        //println(v)
        ans += (v + mod) % mod
        ans %= mod
    }
    print(ans)


}

Measured memory_bytes: 45164
s = gets.chomp
n = s.length

e = (s.length-1)/2
(0...e).each do |i|
    if s[i] != s[e * 2 - i]
        puts 'No'
        exit
    end
end

e = (n-1)/2
(0...e).each do |i|
    if s[i] != s[e-1-i]
        puts 'No'
        exit
    end
end

puts 'Yes'


Measured memory_bytes: 1788
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
// clang-format on

ll A, B;

int main(void)
{
  cin >> A >> B;
  if (A < B) swap(A, B);

  int K;
  if (ceil((double)(A + B) / 2) == floor((double)(A + B) / 2)) {
    K = (A + B) / 2;
    cout << K << endl;
  }
  else {
    cout << "IMPOSSIBLE" << endl;
    return 0;
  }

  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 N = sc.nextInt();
		int M = sc.nextInt();
		int a[] = new int[M];
		int b[] = new int[M];
		boolean flag[] = new boolean[N];
		Arrays.fill(flag, false);
		for(int i = 0; i < M; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			if(a[i] == N) {
				flag[b[i]] = true;
			}
			if(b[i] == N) {
				flag[a[i]] = true;
			}
		}
		
		for(int i = 0; i < M; i++) {
			if(a[i] == 1 && flag[b[i]]) {
				System.out.println("POSSIBLE");
				return;
			}
			if(b[i] == 1 && flag[a[i]]) {
				System.out.println("POSSIBLE");
				return;
			}
		}
		System.out.println("IMPOSSIBLE");
	}
}


Measured memory_bytes: 98192
#include <iostream>
#include <vector>
#include <map>
#include <numeric>
#include <queue>
#define INFL 1000000000000000

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pl;

vector< vector<ll> > from;

vector<ll> dijkstra(ll s, vector< map<ll, ll> > e) {
    ll n = e.size();
    vector<ll> minD(n, INFL);
    minD.at(s) = 0;
    priority_queue< pl, vector<pl>, greater<pl> > q;
    q.push(pl(0, s));
    while (!q.empty()) {
        pl now = q.top();
        q.pop();
        ll c = now.first, v = now.second;
        if (minD.at(v) < c) continue;
        for (auto i = e.at(v).begin(); i != e.at(v).end(); ++i) {
            ll nv = i -> first, nc = i -> second;
            if (minD.at(nv) > minD.at(v) + nc) {
                minD.at(nv) = minD.at(v) + nc;
                from.at(s).at(nv) = v;
                q.push(pl(minD.at(nv), nv));
            }
        }
    }
    return minD;
}

int main() {
    ios::sync_with_stdio(false);
    int n, m, a, b, c;
    cin >> n >> m;
    vector< map<ll, ll> > e(n + 1);
    from = vector< vector<ll> >(n + 1, vector<ll>(n + 1));
    for (int i = 0; i < m; ++i) cin >> a >> b >> c, e.at(a)[b] = c, e.at(b)[a] = c;
    for (int i = 1; i <= n; ++i) dijkstra(i, e);
    for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) e.at(from.at(i).at(j)).erase(j);
    cout << (accumulate(e.begin(), e.end(), 0LL, [](ll i, map<ll, ll> j) {
        return i += j.size();
    }) / 2) << endl;
    return 0;
}


Measured memory_bytes: 640
use std::io::stdin;

fn main() {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    let s = String::from(s.trim());
    let g = (1 << (s.len() - 1)) - 1;
    let mut ans: i64 = 0;

    for div in 0..g+1 {
        let mut head = 0;
        for i in 0..s.len() {
            if div >> i & 1 > 0 {
                ans += (&s[head..i + 1]).parse().unwrap();
                head = i + 1;
            }
        }

        ans += (&s[head..]).parse().unwrap();
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352