akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    string s, t;
    cin >> s >> t;
    vector<char> sv, tv;
    for (int i=0; i<(int)s.length(); i++) {
        sv.push_back(s[i]);
    }
    for (int i=0; i<(int)t.length(); i++) {
        tv.push_back(t[i]);
    }
    sort(sv.begin(), sv.end());
    sort(tv.begin(), tv.end(), greater<char>());
    int minlength = min((int)s.length(), (int)t.length());
    string result;
    for (int i=0; i<minlength; i++) {
        if (sv[i] != tv[i]) {
            if (sv[i] < tv[i]) {
                result = "Yes";
            } else {
                result = "No";
            }
            break;
        } else if (i == minlength-1) {
            if (s.length() < t.length()) {
                result = "Yes";
            } else {
                result = "No";
            }
        }
    }
    cout << result << endl;
}

Measured memory_bytes: 3644
#include <iostream>

using namespace std;

int main()
{
    int N;
    cin >> N;
    bool flag = false;
    for(int i=1;i<10;++i){
        for(int j=1;j<10;++j){
            if(i*j == N){
                flag = true;
                break;
            }
        }
        if(flag) break;
    }

    if(flag) cout << "Yes";
    else cout << "No";
    cout << endl;
}


Measured memory_bytes: 256
while True:
    n,x=map(int,input().split())
    if(n==0 and x==0):
        break
    ans=0
    for i in range(1,n-1):
        for j in range(i+1,n):
            for k in range(j+1,n+1):
                if(i+j+k==x):
                    ans=ans+1
    print(ans)


Measured memory_bytes: 5596
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<list>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>

using namespace std;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef pair<ll, ll> pll;

ll n = 0, m = 0, k = 0, ans = 0, sum = 0, cnt = 0, temp = 0;
string s;
bool flag;

//----------------------------------------------------------------------

#define MAX 100

int main(void) {
  vll a;
  cin >> n;

  temp = n;
  while (temp >= 1) {
	temp = temp / 10;
	cnt++;
  }

  m = n;

  RFOR(i, 0, cnt) {
	temp = powl(10, i);
	temp = m % temp;
	temp = (m - temp);
	m = m - temp;
	temp /= powl(10, i);
	a.push_back(temp);
  }

  if (cnt == 2) {
	if (a[1] != 9) {
	  ans = a[0] - 1 + 9;
	}
	else {
	  ans = a[0] + 9;
	}
	cout << ans << endl;
	return 0;
  }

  if (cnt == 1) {
	cout << a[0] << endl;
	return 0;
  }


  flag = false;

  RFOR(i, 2, cnt) {
	if (a[i] != 9) {
	  flag = true;
	  break;
	}
  }

  if (flag) {
	ans = a[0] - 1 + (cnt - 1) * 9;
	cout << ans << endl;
  }
  else {
	if (a[1] == 9) {
	  ans = a[0] +(cnt - 1) * 9;
	}
	else {
	  ans = a[0] - 1 + (cnt - 1) * 9;
	}
	cout << ans << endl;
  }

  return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,p;
  while(cin >> n >> p && n && p){
    vary(ll,v,n,0);
    ll pl = 0,P = p;
    while(1){
      if(p){
        --p;
        v[pl]++;
      }
      else{
        p += v[pl];
        v[pl] = 0;
      }
      if(v[pl] == P){
        cout << pl << endl;
        break;
      }
      ++pl;
      pl %= n;
    }
  }
  return 0;
}

Measured memory_bytes: 3224
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
#define MAX_N 105
#define MAX_C 25
#define INF (1e8)
vector<int> T[MAX_C],U[MAX_C];
int G[MAX_C][MAX_N][MAX_N];
int n,m,c,s,g;
int d[MAX_N];
 
 
void init(){
  for(int i=0;i<MAX_C;i++){
    T[i].clear();
    U[i].clear();
  }
 
  for(int i=0;i<MAX_N;i++){    
    d[i]=INF;
    for(int j=0;j<MAX_N;j++){
      for(int k=0;k<MAX_C;k++){
        if(i==j)G[k][i][j]=0;
        else G[k][i][j]=INF;
      }
    }
  }
}
 
int calc(int dist,vector<int> &t,vector<int> &u){
  int res=0;
  for(int i=0;i+1<(int)t.size();i++){
    if(t[i]<=dist&&dist<=t[i+1]){
      dist-=t[i];
      return res+dist*u[i];
    }else{
 
      res+=((t[i+1]-t[i])*u[i]);
    }
  }
  return res;
}
 
int solve(){
  priority_queue< P , vector<P> , greater<P> > Q;
  Q.push(P(0,s));
  d[s]=0;
  while(!Q.empty()){
    P p=Q.top();Q.pop();
    int pos=p.second,cost=p.first;
    //cout<<pos<<' '<<cost<<endl;
    if(pos==g)return cost;
    if(cost>d[pos])continue;
 
    for(int id=1;id<=c;id++){
      for(int to=1;to<=n;to++){
        if(G[id][pos][to]==INF)continue;
        int ncost=cost+calc(G[id][pos][to],T[id],U[id]);
        if(ncost<d[to]){
          d[to]=ncost;
          Q.push(P(d[to],to));
        }
      }
    }
  }
  return -1;
}
 
int main(){
  while(1){
    cin>>n>>m>>c>>s>>g;
    if(n==0&&m==0&&c==0&&s==0&&g==0)break;
    init();
    for(int i=0;i<m;i++){
      int x,y,d,c;
      cin>>x>>y>>d>>c;
      G[c][x][y]=min(G[c][x][y],d);
      G[c][y][x]=min(G[c][y][x],d);
    }
 
    for(int id=1;id<=c;id++){
      for(int k=1;k<=n;k++)
        for(int i=1;i<=n;i++)
          for(int j=1;j<=n;j++)
            G[id][i][j]=min(G[id][i][j],G[id][i][k]+G[id][k][j]);
      int a;
      cin>>a;
      T[id].resize(a+1);
      U[id].resize(a);
      T[id][0]=0;
      T[id][a]=INF;
    }
    for(int id=1;id<=c;id++){
      for(int i=1;i+1<(int)T[id].size();i++)cin>>T[id][i];
      for(int i=0;i<(int)U[id].size();i++)cin>>U[id][i];
    }
 
    cout<<solve()<<endl;
 
  }
  return 0;
}

Measured memory_bytes: 2400
#include<iostream>
#include<queue>

using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    priority_queue<int> que;
    int a;
    for(int i=0; i<N; i++){
        cin >> a;
        que.push(a);
    }
    for(int i=0; i<M; i++){
        int b = que.top(); que.pop();
        que.push(b/2);
    }
    long ans = 0;
    for(int i=0; i<N; i++){
        ans += que.top();
        que.pop();
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 892
#include <stdio.h>
int main(void)
{
	int H, W, i, k;
	while(scanf("%d%d", &H,&W), H!=0 || W!=0){
		for(i=0;i<H;i++){
			for(k=0;k<W;k++) printf("#");
			puts("");
		}
		puts("");
	}
	return 0;
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

//MOD
//--------------------------------------------
#define MUL(a,b) (((a) % MOD) * ((b) % MOD)) % MOD

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code

int main(int argc, char const* argv[])
{
	int n;
	cin >> n;
	VL a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	map<int,int> mp;
	for (int i = 0; i < n; i++) {
		mp[a[i]]++;
		mp[a[i]-1]++;
		mp[a[i]+1]++;
	}
	int ans = 0;
	for (int i = -1; i <= 10e5 + 1; i++) {
		ans = max(ans, mp[i]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 47872
#include <iostream>
#include <vector>

using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> di(n);
  for(int i=0; i<n; i++){
    cin >> di[i];
  }

  long long ans = 0;
  for(int i=0; i<n; i++){
    for(int j=0; j<n; j++){
      if(i != j){
        ans += di[i] * di[j];
      }
    }
  }

  cout << ans / 2 << endl;

  return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;


public class Main {

  long calc(long h) {
    if (h == 0) return 0;
    return 1 + calc(h / 2) * 2;
  }


  void solve() throws IOException {
    long h = nextLong();
    out.println(calc(h));
  }

  public static void main(String[] args) throws IOException {
    new Main().run();
  }

  void run() throws IOException {
    reader = new BufferedReader(new InputStreamReader(System.in));
//		reader = new BufferedReader(new FileReader("input.txt"));
    tokenizer = null;
    out = new PrintWriter(new OutputStreamWriter(System.out));
//		out = new PrintWriter(new FileWriter("output.txt"));
    solve();
    reader.close();
    out.flush();

  }

  BufferedReader reader;
  StringTokenizer tokenizer;
  PrintWriter out;

  int nextInt() throws IOException {
    return Integer.parseInt(nextToken());
  }

  long nextLong() throws IOException {
    return Long.parseLong(nextToken());
  }

  double nextDouble() throws IOException {
    return Double.parseDouble(nextToken());
  }

  String nextToken() throws IOException {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine());
    }
    return tokenizer.nextToken();
  }
}


Measured memory_bytes: 23252
a,b,c,x,y = map(int,input().split())
c *= 2
ans = 10 ** 16
for i in range(max(x,y)+1):
    m = 0
    m += (a*(max(0,x-i)))+(b*(max(0,y-i)))+(c*i)
    ans = min(ans,m)
print(ans)

Measured memory_bytes: 9188
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <sstream>
#include <fstream>

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)

using namespace std;

int main() {
  string N;
  cin >> N;
  int sn = 0;
  rep (i, N.size()) {
    sn += N[i] - '0';
  }
  int Ni;
  Ni = stoi(N);
  if (Ni % sn == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

int main() {
  int n, q;
  string s;
  cin >> n >> s >> q;
  vector<vector<ll>> dp(n + 1, vector<ll>(4, 0));
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 4; j++) {
      dp[i + 1][j] += dp[i][j];
      if (j < 3 && s[i] == "DMC"[j]) dp[i + 1][j + 1] += dp[i][j];
    }
  }
  vector<int> csm(n + 1, 0);
  for (int i = 0; i < n; i++) {
    csm[i + 1] = csm[i] + (s[i] == 'M');
  }
  for (int i = 0; i < q; i++) {
    int k;
    cin >> k;
    ll ans = dp[n][3];
    for (int j = k; j <= n; j++) {
      if (s[j - 1] != 'C') continue;
      ans -= dp[j - k][2];
      ans -= dp[j - k][1] * (csm[j] - csm[j - k]);
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 75396
/* Author rumoisen */
/* date 2018/10/07 */

#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
 
using namespace std;
 
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

void no(){cout<<"No"<<endl;exit(0);}
void yes(){cout<<"Yes"<<endl;exit(0);}

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;
using namespace std;
int main()
{  
    int n,k;
    cin>>n>>k;
    int number=1;
    for(int i=1;i<=n;i++){
        number=min(2*number,number+k);
    }
    cout<<number<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int hillsHight[10] = {0};
	int i = 0, j = 0;
	int temp,counter = 0;
	for(i=0;i<10;i++){
		scanf("%d",&hillsHight[i]);
	}
	i = 0;
	while(i < 10){
		for(j = i + 1; j < 10; j++){
			if(hillsHight[j] < hillsHight[i]){
				temp = hillsHight[i];
				hillsHight[i] = hillsHight[j];
				hillsHight[j] = temp;
			}
		}
		i++;
	}
	printf("%d\n%d\n%d\n",hillsHight[9],hillsHight[8],hillsHight[7]);	
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

template<typename T>
struct BellmanFord {
	struct Edge {
		const int from;
		const int to;
		const T cost;
		Edge(const int from, const int to, const T cost) :
			from(from),
			to(to),
			cost(cost)
			{}
	};
	const int V;
	vector<vector<Edge>> G;
	int start;
	const T INF = numeric_limits<T>::max();
	vector<T> dist;
	vector<int> rec;
	BellmanFord(const int V) :
		V(V),
		G(vector<vector<Edge>>(V, vector<Edge>()))
		{}
	void addEdge(const int from, const int to, const T cost) {
		G[from].emplace_back(from, to, cost);
	}
	bool build(const int start) {
		(*this).start = start;
		dist = vector<T>(V, INF);
		rec = vector<int>(V, -1);
		dist[start] = 0;
		for(int i = 0; i < V; ++i) {
			bool update = false;
			for(int from = 0; from < V; ++from) {
				if(dist[from] == INF) continue;
				for(Edge e : G[from]) {
					if(dist[e.from] + e.cost < dist[e.to]) {
						dist[e.to] = dist[e.from] + e.cost;
						rec[e.to] = e.from;
						update = true;
					}
				}
			}
			if(not update) break;
			// if(i == V - 1) return false;
		}
		T mini = dist[V - 1];
		for(int i = 0; i < V; ++i) {
			bool update = false;
			for(int from = 0; from < V; ++from) {
				if(dist[from] == INF) continue;
				for(Edge e : G[from]) {
					if(dist[e.from] + e.cost < dist[e.to]) {
						dist[e.to] = dist[e.from] + e.cost;
						rec[e.to] = e.from;
						update = true;
					}
				}
			}
			if(not update) break;
			if(dist[V - 1] < mini) return false;
		}
		return true;
	}
	T distance(const int to) {
		if(dist[to] == INF) throw "INVALID";
		cerr<<dist[to]<<endl;
		return dist[to];
	}
	vector<int> route(int to) {
		distance(to);
		vector<int> ret;
		while(to != start) {
			ret.push_back(to);
			to = rec[to];
		}
		ret.push_back(start);
		reverse(ret.begin(), ret.end());
		return ret;
	}
};

int main() {
	int n, m, p; cin>>n>>m>>p;
	BellmanFord<int64_t> bf(n);
	for(int i=0;i<m;i++){
		int a,b,c; cin>>a>>b>>c;
		a--;b--;
		bf.addEdge(a,b,-(c-p));
	}
	if(bf.build(0)) {
		cout << max<int64_t>(0, -bf.distance(n - 1)) << '\n';
	} else {
		cout << -1 << '\n';
	}
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int mod = 1e9+7;

int main()
{
    int n,m;
    cin >> n >> m;

    int ans = 1900*m+100*(n-m);
    for(int i = 0; i < m; i++) ans *= 2;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int,int> P;
#define X first
#define Y second
int dx[] = {-1,0,1,0};
int dy[] = {0,-1,0,1};

struct NODE{
	int x,y;
	int count;
	char sw;
};
bool operator<(const NODE &a,const NODE &b){
	return a.count > b.count;
}

int w,h;
bool isWrong(const NODE &n){
	if(n.x > w+1 || n.y > h+1)return true;
	if(n.x < 0 || n.y < 0)return true;
	return false;
}

bool edge(const NODE &n){
	if(n.x == 0 || n.x == w+1)return true;
	if(n.y == 0 || n.y == h+1)return true;
	return false;
}

int main(){
	string s;
	while(cin >> w >> h, w){
		char map[102][102];
		rep(i,102)rep(j,102)map[i][j] = '.';
		NODE t; t.count = 0, t.sw = '.';
		
		for(int i=1;i<=h;i++){
			for(int j=1;j<=w;j++){
				cin >> map[i][j];
				if(map[i][j] == '&')t.y = i, t.x = j , map[i][j] = '.';
			}
		}
		//cout<<t.x<<","<<t.y<<endl;
		//rep(i,h+2)rep(j,w+2)cout << map[i][j];cout << endl;
		int memo[102][102];
		rep(i,102)rep(j,102)memo[i][j] = (1<<21);
		priority_queue<NODE> Q;
		Q.push(t);
		while(Q.size()){
			NODE q = Q.top(); Q.pop();
			if(memo[q.y][q.x] <= q.count)continue;
			
			if(edge(q)){
				cout << q.count << endl;
				break;
			}
			memo[q.y][q.x] = q.count;
			rep(i,4){
				NODE nt;
				nt.x = q.x+dx[i], nt.y = q.y+dy[i], nt.count = q.count;
				if(isWrong(nt))continue;
				if( q.sw == '#' && map[nt.y][nt.x] == '.')nt.count++;
				nt.sw = map[nt.y][nt.x];
				
				Q.push(nt);		
			}
		}
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <algorithm>
#include <cstring>
#define MAX_V 101
#define MAX_E 1001
#define INF 100000000
using namespace std;
using ll = long long;

ll dis[MAX_V][MAX_V];
ll cost[MAX_V][MAX_V];

int V,E;
int a,b,c;
int res;
void floyd()
{
    for(int k = 0;k < V;k++)
        for(int i = 0;i<V;i++)
            for(int j = 0;j<V;j++)
                dis[i][j] = min(dis[i][j], dis[i][k]+dis[k][j]);
}

bool judge(int i, int j)
{
    for(int u = 0;u<V;u++)
            if(dis[u][i]+cost[i][j]==dis[u][j] || dis[u][j]+cost[i][j]==dis[u][i]){
                return true;
            }
    return false;
}
void solve()
{
    for(int i = 0;i < V;i++)
        for(int j = 0;j < V;j++){
            if(i == j)dis[i][j] = 0;
            else dis[i][j] = INF;
        }
    for(int i = 0;i < V;i++)
        for(int j = 0;j < V;j++)
            if(cost[i][j] != 0)
                dis[i][j] = min(dis[i][j],cost[i][j]);
    floyd();
    for(int i = 0;i < V;i++)
        for(int j = i+1;j<V;j++)
            if(cost[i][j]!=0 && !judge(i,j))
                res++; 

}

int main()
{
    cin>>V>>E;
    for(int i = 0;i<E;i++){
        cin>>a>>b>>c;
        cost[a-1][b-1] = c;
        cost[b-1][a-1] = c;
    }
    solve();
    cout<<res<<endl;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			int num = sc.nextInt();
			for(int i = num-1 ; i >= 0 ; i--){
				if(i != 2 && i % 2 == 0)continue;
				boolean ok = true;
				for(int j = 3 ; j <= Math.sqrt(i) ; j++){
					if(i % j == 0){
						ok = false;
						break;
					}
				}
				if(ok){
					System.out.print(i+" ");
					break;
				}
			}
			for(int i = num+1 ; ; i++){
				if(i != 2 && i % 2 == 0)continue;
				boolean ok = true;
				for(int j = 3 ; j <= Math.sqrt(i) ; j++){
					if(i % j == 0){
						ok = false;
						break;
					}
				}
				if(ok){
					System.out.println(i);
					break;
				}
			}
		}
		sc.close();
	}
}

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

const double PI = acos(0.0) * 2, hrRate = 0.5, minRate = 6.000;

double square(double X)
{
	return X * X;
}

int main()
{
	double A, B, H, M;
	scanf("%lf%lf%lf%lf", &A, &B, &H, &M);
	
	double numMins = 60 * H + M;
	
	double hrMoved = hrRate * numMins, minMoved = minRate * numMins;
	double theta = hrMoved - minMoved;
	
	double lengthSquared = square(A) + square(B) - cos(theta / 180 * PI) * A * B * 2;
	printf("%.14lf", sqrt(lengthSquared));
}


Measured memory_bytes: 4156
from bisect import bisect_left
from collections import deque

N = int(input())
A = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(N - 1)]

graph = [[] for _ in range(N)]
for u, v in X:
    graph[u - 1].append(v - 1)
    graph[v - 1].append(u - 1)
INF=float('inf')
dp = [INF] * (N + 1)
dp[0] = -INF
rb = [[] for _ in range(N)]
ans = [0] * N

# DFS
q = deque([(0, 0)])  # (current, parent)
while q:
    u, p = q.pop()

    # Roll back
    if p is None:
        i, x = rb[u].pop()
        dp[i] = x
        continue

    # Update dp
    i = bisect_left(dp, A[u])
    rb[u].append((i, dp[i]))
    dp[i] = A[u]

    # Calc ans
    ans[u] = max(i,ans[p])

    # Go to next
    q.append((u, None))
    for v in graph[u]:
        if v == p:
            continue
        q.append((v, u))

print(*ans)

Measured memory_bytes: 184296
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
constexpr int INF = 1e9+1;
ll cnt[10][10];
int main(){
  int n;
  cin >> n;
  
  for (int i = 1; i <= n; i++) {
    auto t = to_string(i);
    cnt[t.front() - '0'][t.back() - '0']++;
  }

  ll res = 0;

  for (int i = 1; i <= 9; i++) {
    for (int j = 1; j <= 9; j++) res += cnt[i][j] * cnt[j][i];
  }
  cout << res << endl;
  return 0;
} 

Measured memory_bytes: 256
# coding: utf-8
from math import sqrt

def main():
    N, D = map(int, input().split())
    ans = 0
    X = [list(map(int, input().split())) for _ in range(N)]

    for i in range(N - 1):
        for j in range(i + 1, N):
            tmp = sum([(X[i][k] - X[j][k]) ** 2 for k in range(D)])
            if tmp == int(sqrt(tmp)) ** 2:
                ans += 1

    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 9224
def main
  l, r = gets.chomp.split(' ').map(&:to_i)

  rest_num = []

  l.upto(r) do |i|
    r.downto(l) do |j|
      break if i >= j
      
      ans = (i * j) % 2019
      return 0 if ans.zero?
      
      rest_num << ans
    end
  end
  rest_num.min
end

puts main

Measured memory_bytes: 3836
#include <stdio.h>

int main()
{
    int r,D,a[15];
    scanf("%d%d%d",&r,&D,&a[0]);
    
    for(int i=1;i<=10;i++)
    {
        a[i]=r*a[i-1]-D;
    }
    
    for(int j=1;j<=10;j++)
    printf("%d\n",a[j]);

    return 0;
}


Measured memory_bytes: 1724
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();

		String ans = null;
		if (s.endsWith("s")) {
			ans = s + "es";
		} else {
			ans = s + "s";
		}

		System.out.println(ans);

	}
}


Measured memory_bytes: 38504
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(int)>
using namespace std;
#define All(v) (v).begin(),(v).end()
const long long mod = 1000000007;
const long long inf = mod*mod;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
signed main(){
    long long n,m;
    cin>>n>>m;
    if(n==1&&m==1){
        cout<<1<<endl;
    }
    else if(n==1){
        cout<<m-2<<endl;
    }
    else if(m==1){
        cout<<n-2<<endl;
    }
    else{
        cout<<(n-2)*(m-2)<<endl;
    }
}

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

signed main() {
    int n, d, ar;
    cin >> n >> d;
    
    ar = d + d + 1;
    if ( n % ar == 0 ) {
        cout << n / ar << endl;
    } else {
        cout << n / ar + 1 << endl;
    }
    return (0);
}

Measured memory_bytes: 3568
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
typedef long long ll;
using namespace std;

int dis(int a,int b){
    if(b>a)return b-a;
    else return a-b;
}

int main(){
    int n,z,w;cin>>n>>z>>w;
    int a[n];for(int i=0;i<=n-1;i++)cin>>a[i];
    if(n>=2)printf("%d",max(dis(a[n-1],a[n-2]),dis(a[n-1],w)));
    else printf("%d",dis(a[n-1],w));
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define mod 1000000007
void main(void)
{
  long long N,K;
  long long tmp1=0;
  scanf("%lld%lld",&N,&K);
  for(long long i=K;i<=(N+1);i++){
    tmp1=tmp1+i*N-i*i+i+1;
    tmp1=tmp1%mod;
  }
  printf("%lld",tmp1);
}

Measured memory_bytes: 1732
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    vector<P> v(m);
    rep(i, m){
        int b, c;
        cin >> b >> c;
        v[i] = {c, b};
    }
    sort(ALL(v), greater<P>());
    sort(ALL(a));

    int i = 0;
    int j = 0;
    int ans = 0;

    while(i < n && j < m){
        if(a[i] > v[j].first){
            ans += a[i];
            i++;
            continue;
        }

        rep(k, v[j].second){
            if(i >= n || a[i] > v[j].first){
                break;
            }
            ans += v[j].first;
            i++;
        }
        j++;
    }
    for(; i < n; i++){
        ans += a[i];
    }

    cout << ans << endl;

    return 0;
}


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

int main(){
	int a,b,A,B;
	cin>>a>>b;
	if(a==2) A=1;
	else if(a==4||a==6||a==9||a==11) A=2;
	else A=3;
	if(b==2) B=1;
	else if(b==4||b==6||b==9||b==11) B=2;
	else B=3;
	if(A==B) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <functional>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cassert>
#include <cstdio>
#include <cctype>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <set>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int, int> PII;
const ll mod = 1000000007;
ll powmod(ll a, ll b) { ll res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; }
const int iadd[] = {0, 1, 0, -1}, jadd[] = {1, 0, -1, 0};
const int inf = 0x3f3f3f3f;
const int maxn = 1e6 + 5;
int n;
ll a[maxn];

int main(){
	scanf("%d", &n);
	for(int i = 0; i < n; i++) scanf("%lld", &a[i]);
	sort(a, a + n);
	ll a1, b1;
	bool has = false;
	a1 = b1 = 0; 
	for(int i = n - 2; i >= 0; i--){
		if(a[i] == a[i + 1]){
			if(a1 == 0) {
				a1 = a[i];
				i--;
			}
			else if(b1 == 0) {
				b1 = a[i];
				has = true;
			}
			else break;
		}
	}
	if(has) printf("%lld\n", a1 * b1);
	else puts("0");
}


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

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    for (int i = 1; i <= 10009; ++i) {
        if (i * 8 / 100 == a && i * 10 / 100 == b) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ll d[200010],dp[550][550];

int main(){
  cin >> n;
  rep(i,0,n){
    cin >> s;
    if(s[0] == 'M')d[0]++;
    if(s[0] == 'A')d[1]++;
    if(s[0] == 'R')d[2]++;
    if(s[0] == 'C')d[3]++;
    if(s[0] == 'H')d[4]++;
  }
  l = 0;
  rep(i,0,5){
    rep(j,i + 1,5){
      rep(k,j + 1,5){
        l += d[i] * d[j] * d[k];
      }
    }
  }
  print(l);
  return 0;
}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using vvs = vector<vs>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    rep(i, (int)v.size()) {
        if (i)
            os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
    for (auto val : array)
        std::cout << val << ", ";
    std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

    int n; std::cin >> n;
    vi a(n); rep(i, n) std::cin >> a[i];
    vi even(n/2), odd(n/2-(~n&1));
    for (int i = 1, j = 0; i < n; i += 2, j++) {
        even[j] = a[i];
        if (i+1 < n) odd[j] = a[i+1];
    }
    if (n&1) {
        drep(i, n/2) std::cout << odd[i] << " ";
        std::cout << a[0] << " ";
        rep(i, n/2) std::cout << even[i] << (i+1 < n/2 ? " " : "\n");
    } else {
        drep(i, n/2) std::cout << even[i] << " ";
        std::cout << a[0] << " ";
        rep(i, n/2-1) std::cout << odd[i] << (i+1 < n/2-1 ? " " : "\n");
    }
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
int main(){
    string n,ans;
    cin >> n;
    for(int i= 0;i<26;i++){
        char al = 'a' + i;
        bool flag = false;
        for(int j=0;j<n.size();j++){
            if(n[j] == al){
                flag = true;
                break;
            }
        }

        if(!flag){
            ans = al;
            break;
        }

        if(i == 25){
            ans = "None";
        }

    }


    cout << ans<<endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int N,P; cin>>N>>P;
	vector<int> A(N);
	int nax= 0;
	rep(i,N){
		cin>>A[i];
		A[i] %= 2;
	}
	vector<vector<ll>> dp(N+1, vector<ll>(2, 0));
	dp[0][0] = 1; dp[0][1] = 0;
	rep(i,N){
		if(A[i]==0){
			dp[i+1][0] = dp[i][0]*2;
			dp[i+1][1] = dp[i][1]*2;
		}else{
			dp[i+1][0] = dp[i][0] + dp[i][1];
			dp[i+1][1] = dp[i][0] + dp[i][1];
		}
	}
	cout<<dp[N][P]<<endl;
	return 0;
}

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

int main() {
  long long k,a,b;
  cin>>k>>a>>b;
  long long kotae=0;
  if(b-a<=2){
    cout<<k+1<<endl;
  }else{
    kotae+=max(0LL,(k-a+1)/2)*(b-a)+a;
    if((k-a+1)%2==1)kotae++;
    cout<<kotae<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
import sys
input=sys.stdin.readline

def main():
    N,K = map(int, input().split())
    S = input().strip()
    ans = 0
    for i,c in enumerate(S):
        if c == "L":
            if i > 0 and S[i-1] == "L":
                ans += 1
        if c == "R":
            if i < N-1 and S[i+1] == "R":
                ans += 1
    ans += K*2
    if ans >= N:
        ans = N-1
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
//#include <stack>
//#include <queue>
//#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <list>
#include <iomanip>

using namespace std;

#define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define prec std::cout << std::fixed << std::setprecision(15);
#define endl "\n"
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(), z.end())
#define rsort(z) sort(z.rbegin(), z.rend())
#define eerase(z) z.erase(unique(z.begin(), z.end()), z.end())
#define ccnt(z, w) count(z.begin(), z.end(), w)
#define rep(i,a,n) for(Int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(Int (i)=(a); (i)<=(n); (i)++)
const int MAX_N = 1000000;
const Int MAX_N_Int = 1000000000000;

template <typename T>
void printV(const std::vector<T>& v, const char * const separator = " ")
{
    if(!v.empty())
    {
        std::copy(v.begin(),
                  --v.end(),
                  std::ostream_iterator<T>(std::cout, separator));
        std::cout << v.back() << "\n";
    }
}

bool isPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
Int gcd(Int a, Int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

Int lcm(Int a, Int b) {
    return a / gcd(a, b) * b;
    //a*bは64bit integer overflow
}

int Max(int a, int b, int c) {
    int temp = max(a, b);
    return max(temp, c);
}

int Min(int a, int b, int c) {
    int temp = min(a, b);
    return min(temp, c);
}

bool integer(double num) {
    return floor(num) == num;
}

Int fact(int num) {
    if (num == 0)
        return 1;
    else
        return num * fact(num - 1);
}

Int yakusu(int n) {
    int cnt = 0;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            cnt++;
            if (i * i != n) cnt++;
        }
    }
    return cnt;
}


Int fact_mod(Int n, Int mod) {
    Int f = 1; repq(i,2,n) f = f * (i % MOD) % MOD;
    return f;
}

// 繰り返し二乗法 (modの世界での累乗)
Int mod_pow(Int x, Int n, Int mod) {
    Int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return res;
}

// 組み合わせ nCr を求める
Int combination_mod(Int n, Int r, Int mod) {
    if(r > n-r) r = n-r;
    if(r == 0) return 1;
    Int a = 1;
    rep(i, 0, r) a = a * ((n-i) % mod) % mod;
    Int b = mod_pow(fact_mod(r, mod), mod-2, mod);
    return (a % mod) * (b % mod) % mod;
}

int main() {
    //COMinit();
    IOS;
    prec;
    Int a,b,c,n,m,k,x,y=0,ans=1;
    string str,s="",t,u;
    cin>>s;

    for (int i = 0; i < s.length()-1; ++i) {
        if(s[i]=='A'){
            if(s[i+1]=='C'){
                cout<<"Yes";
                return 0;
            }
        }
    }
    cout<<"No";




    cout<<endl;
    return 0;
}




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

using namespace std;
using ll=long long;

#define faster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define cint int t;cin>>t;while(t--)
#define rep(i,a,b) for(int i=a;i<b;i++)

int mod=1e9+7;

int main(){
    faster;

    char c;
    cin>>c;
    c++;
    cout<<c<<endl;
}


Measured memory_bytes: 256
s=input()
if s[-1]=='<':
  s+='>e'
else:
  s+='ee'

result=0
count=0
count2=0
pre='s'
for i in range(len(s)-1):
  count+=1
  if s[i]!=s[i+1]:
    if s[i]=='>':
      count-=1
      result+=count*count/2+count/2
      count+=1
      result+=max(count,count2)
    else:
      count-=1
      result+=count*count/2+count/2
      count2=count+1
    count=0
print(int(result))

Measured memory_bytes: 4120
n, d, a = map(int, input().split())
loans = []
bar = 0
ans = 0
xh = sorted([tuple(map(int, input().split())) for _ in range(n)])

for x, h in xh:
    while len(loans) > 0:
        xx, dd = loans[0]
        if xx < x:
            loans.pop(0)
            bar -= dd
        else:
            break

    h -= bar
    if h > 0:
        c = h // a if h % a == 0 else ((h // a) + 1)
        ans += c
        dd = c * a
        bar += dd
        loans.append((x + 2 * d, dd))

print(ans)


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

int main(void){
  int n, m, p, x, i, tmp;
  cin >> n;
  int t[n] = {};
  for(i = 0; i < n; i++) cin >> t[i];
  cin >> m;
  for(i = 0; i < m; i++){
    cin >> p >> x;
    tmp = t[p-1];
    t[p-1] = x;
    cout << accumulate(t, t+n, 0) << endl;
    t[p-1] = tmp;
  }
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func getNextLine(scanner *bufio.Reader) string {
	var buffer string
	for {
		line, isPrefix, _ := scanner.ReadLine()
		buffer += string(line)
		if isPrefix == false {
			break
		}
	}
	return buffer
}

func getIntList(scanner *bufio.Reader) []int {
	list := strings.Split(getNextLine(scanner), " ")
	l := len(list)
	result := make([]int, l)
	for i := 0; i < l; i++ {
		result[i], _ = strconv.Atoi(list[i])
	}
	return result
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := bufio.NewReader(fp)

	var n int

	fmt.Sscan(getNextLine(scanner), &n)

	if n == 0 {
		fmt.Println("0")
		return
	}

	ans := ""
	base := -2
	for i := 1; n != 0; i *= base {
		bit := (n / i) % base
		bit = (bit + 2) % 2
		ans = fmt.Sprintf("%d", bit) + ans
		n -= bit * i
	}
	fmt.Println(ans)
}


Measured memory_bytes: 640
#include <iostream>
    #include <vector>
    #include <string>
    #include <stack>
    #include <queue>
    #include <set>
    #include <map>
    #include <unordered_map>
    #include <algorithm>
    #include <functional>
    #include <numeric>
    #include <cstring>
    #include <cstdio>
    #include <cmath>
    #include <cstdlib>
    #include <cassert>
    #define bogo_sort std::sort
    #define bozo_sort std::stable_sort
    #define alles(obj) obj.begin(), obj.end()
    #define elif else if
    #define unless(flg) if(!(flg))
    #define elless(flg) else if(!(flg))
    #define echo std::cout <<
    #define read std::cin >>
    #define endl std::endl
    #define fin << '\n'
    #define bash push_back
    #define makePair std::make_pair
    #define _ << ' ' <<
    // type-define
    #define Stack std::stack
    #define Queue std::queue
    #define Set std::set
    #define PQueue std::priority_queue
    #define Vector std::vector
    #define Pair std::pair
    #define Map std::map
    #define UMap std::unordered_map
    #define Greater std::greater
    using String = std::string;
    using llong = long long;
    using boolean = bool;
    using Pii = Pair<int, int>;
    using Vi = Vector<int>;
    using Vii = Vector<Pii>;
    // utils
    constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
    constexpr int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
    constexpr int INF = 0x3f3f3f3f;
    constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;
     
    namespace {
    llong power ( llong x, llong n, llong mod ) {
    llong ans = 1;
    while ( n > 0 ) {
    if ( n & 1 ) ans = ( ans * x ) % mod;
    x = ( x * x ) % mod;
    n >>= 1;
    }
    return ans;
    }
    llong power ( llong x, llong n ) { return power( x, n, 1000000007 ); }
    llong gcd ( llong x, llong y ) { return x % y ? gcd( y, x % y ) : y; }
    llong lcm ( llong x, llong y ) { return ( x / gcd(x, y) * y ); }
    llong abs ( llong n ) { return ( n < 0 ) ? -n : n; }
    boolean chmax ( llong &a, llong b ) { return a<b ? a=b, true : false; }
    boolean chmin ( llong &a, llong b ) { return b<a ? a=b, true : false; }
    boolean isMovable ( int x, int y, int w, int h ) {
    return ( x >= 0 && y >= 0 && x < w && y < h );
    }
    }
     
    namespace Rlyeh {
     
    boolean exists[10001000];
     
    signed call_of_Cthulhu( signed datum ) {
     
    int s;
    read s;
    exists[s] = true;
    int prev = s;
    for ( int i = 1; true; i++ ) {
    if ( prev & 1 ) {
    prev = prev * 3 + 1;
    }
    else {
    prev /= 2;
    }
    if ( exists[prev] ) {
    echo i+1 fin;
    return 0;
    }
    exists[prev] = true;
    }
     
    return 0;
    }
    }
     
    signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); int main_result = Rlyeh::call_of_Cthulhu(114514); return 0;}

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

#define int long long
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for(int i=0; i<(int)n; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define COUT(x) cout << x << endl;
#define PB(x) push_back(x)
#define MP make_pair
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int INF = 1e9;
const int MOD = 1e9+7;

int n,m,k;
vector<int> itoj;

struct UnionFind
{
  // par[i]：データiが属する木の親の番号。i == par[i]のとき、データiは木の根ノードである
  vector<int> par;
  // sizes[i]：根ノードiの木に含まれるデータの数。iが根ノードでない場合は無意味な値となる
  vector<int> sizes;

  UnionFind(int n) : par(n), sizes(n, 1) {
    // 最初は全てのデータiがグループiに存在するものとして初期化
    rep(i,n) par[i] = i;
  }

  // データxが属する木の根を得る
  int find(int x) {
    if (x == par[x]) return x;
    return par[x] = find(par[x]);  // 根を張り替えながら再帰的に根ノードを探す
  }

  // 2つのデータx, yが属する木をマージする
  void unite(int x, int y) {
    // データの根ノードを得る
    x = find(x);
    y = find(y);

    // 既に同じ木に属しているならマージしない
    if (x == y) return;

    // xの木がyの木より大きくなるようにする
    if (sizes[x] < sizes[y]) swap(x, y);

    // xがyの親になるように連結する
    par[y] = x;
    sizes[x] += sizes[y];
    // sizes[y] = 0;  // sizes[y]は無意味な値となるので0を入れておいてもよい
  }

  // 2つのデータx, yが属する木が同じならtrueを返す
  bool same(int x, int y) {
    return find(x) == find(y);
  }

  // データxが含まれる木の大きさを返す
  int size(int x) {
    return sizes[find(x)];
  }
};



signed main(){
    
    cin >> n >> m >> k;
    itoj.resize(n);

    UnionFind uf(n);
    rep(i,m){
        int a,b; cin >> a >> b;
        a--; b--;
       
        itoj[a]++; itoj[b]++;
        uf.unite(a,b);
    }

    rep(i,k){
        int a,b; cin >> a >> b;
        a--; b--;
        if(uf.same(a,b)){
            itoj[a]++; itoj[b]++;
        }
    }
    rep(i,n){
        cout<<uf.size(i)-itoj[i]-1<<' ';
    }
    
    
}

Measured memory_bytes: 3200
import Control.Applicative
import System.IO

main :: IO ()
main = do
    end <- isEOF
    if end 
    then return ()
    else do
        a:b:_ <- (map read . words) <$> getLine
        print $ solve a b
        main 

solve :: Int -> Int -> Int
solve a b = length $ show (a + b)


Measured memory_bytes: 4068
#include <stdio.h>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <iostream>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <queue>
#include <cstring>
using namespace std;

int main() {
	long long N,x=0; cin >> N;
	vector<long long> a(N);
	for (int i = 0; i < N; i++) {
		long long a; cin >> a; x ^= a;
	}
	if (x)cout << "No" << endl;
	else cout << "Yes" << endl;
}





Measured memory_bytes: 1024
# -*- coding: utf-8 -*-

import sys

sys.setrecursionlimit(10 ** 9)
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()))
INF=float('inf')

N,M=MAP()
nodes=[[] for i in range(N)]
for i in range(M):
    u,v=MAP()
    nodes[u].append(v)
    nodes[v].append(u)

timer=1
prenum=[0]*(N+1)
lowest=[0]*(N+1)
ans=[]
def rec(cur, prev):
    global timer
    # curを訪問した直後の処理
    prenum[cur]=lowest[cur]=timer
    timer+=1

    for nxt in nodes[cur]:
        # 未訪問なら再帰探索する
        if not prenum[nxt]:
            rec(nxt, cur)
            # nxtの探索が終了した直後の処理
            lowest[cur]=min(lowest[cur], lowest[nxt])
            # より近い経路を含まないなら橋とする
            if lowest[nxt]==prenum[nxt]:
                # 番号の小さい方から入れる
                ans.append((min(cur, nxt), max(cur, nxt)))
        # 訪問済の場合、親への経路は無視して、他は近い経路となるか確認を取る
        elif nxt!=prev:
            lowest[cur]=min(lowest[cur], lowest[nxt])

rec(0, -1)

ans.sort()
for edge in ans:
    print(*edge)



Measured memory_bytes: 19152
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll a[2005];
ll adj[2005][2005];
ll radj[2005][2005];
ll parent[2005];
ll n;
bool bfs(){
	bool visited[2005];
	memset(visited,0,sizeof(visited));
	queue <ll> q;
	q.push(0); visited[0]=1;
	parent[0]=-1;
	
	while(!q.empty()){
		ll u=q.front(); q.pop();
		for(ll v=0; v<=n+1;v++){
			if(!visited[v] && radj[u][v]>0){
				q.push(v);
				parent[v]=u;
				visited[v]=1;
			}
		}
	}
	return (visited[n+1]==true);
}

ll maxflow(){
	for(ll u=0;u<=n+1;u++)
		for(ll v=0;v<=n+1;v++)
			radj[u][v]=adj[u][v];
			
	ll max_flow=0;
	ll u,v;
	while(bfs()){
		ll path_flow= INT_MAX;
		for(v=n+1;v!=0; v=parent[v]){
			u=parent[v];
			path_flow=min(path_flow,radj[u][v]);
		}
		for(v=n+1; v!=0; v=parent[v]){
			u=parent[v];
			radj[u][v]-= path_flow;
			radj[v][u]+= path_flow;
		}
		max_flow += path_flow;
	}
	return max_flow;
}
int main(){
	cin >> n;
	ll x=0;
	for(ll i=1;i<=n;i++){
		cin >> a[i];
		if(a[i]>0) x+=a[i];
	}
	for(ll i=1;i<=n;i++){
		if(a[i]>0) adj[i][n+1]=a[i];
		else if(a[i]<=0) adj[0][i]=-a[i];
		for(ll j=i*2;j<=n;j+=i){
			adj[i][j]=INT_MAX;
			//adj[j][i]=INT_MAX;
		}
	}
	cout << x-maxflow() << endl;
}

Measured memory_bytes: 4864