akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS

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

typedef unsigned int uint;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef map<int, int> mii;
typedef pair<int, ii> edge;


#define sc(x)  scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mem(arr,val) memset(arr,val,sizeof arr)
#define sz(v) (int)v.size()
#define rsz(v) v.resize
#define clr(v) v.clear()
#define rev(v) reverse(all(v))
#define lop(i,end) for(int i=0; i<end; i++)
#define rlop(i,start) for(int i=start-1; i>=0; i--)
#define loop(i,start,end) for(int i=start; i<end; i++)
#define rloop(i,start,end) for(int i=start-1; i>=end; i--)
#define PB push_back
#define pb pop_back
#define mP make_pair
#define f first
#define s second

const ll OO = (ll)(4e18) + 9;
const int MOD = (int)(1e9) + 7;
const int oo = 2147483647;
const double EPS = 1e-8;
const double PI = acos(-1.0);

//enum dir { D, R, U, L , dr, ur, dl, ul };
int dx[] = { 1, 0, -1, 0, 1, -1, 1, -1 };
int dy[] = { 0, 1, 0, -1, 1, 1, -1, -1 };

string abc = "abcdefghijklmnopqrstuvwxyz";
string vowels = "aeiouy"; //and sometimes "aeiouy"

template<typename X, typename Y> bool ckmin(X& a, Y b) { return a > b ? a = b, true : false; }
template<typename X, typename Y> bool ckmax(X& a, Y b) { return a < b ? a = b, true : false; }
bool cklex(string &a, string b) {
	if (b == "") return false;
	if (a == "") return a = b, true;
	if (sz(a) < sz(b)) return false;
	if (sz(b) < sz(a)) return a = b, true;
	if (a < b) return false;
	return a = b, true;
}

int dcmp(ld d1, ld d2) { return fabs(d1 - d2) <= EPS ? 0 : d1 > d2 ? 1 : -1; } //Compare Double Numbers
ll gcd(ll x, ll y) { return !y ? x : gcd(y, x%y); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
int conv_2_1(int r, int c, int nCol) { return (nCol*r) + c + 1; } //convert index from 2D array to 1D array. (Zero-indexed)
ii conv_1_2(int n, int nCol) { return{ n / nCol, n % nCol }; } //convert index from 1D array to 2D array (row, col). (Zero-indexed)
template<typename T> void inter(T X) { cout << X << endl; fflush(stdout); }



int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int t = 1, tt=1;
	//cin >> t;
	while (t--) {
		string t, s;
		cin >> s >> t;
		int ans = sz(t);
		for (int i = 0; i <= sz(s) - sz(t); i++) {
			int cnt = 0;
			for (int j = i; j < i + sz(t); j++) cnt += s[j] != t[j - i];
			ckmin(ans, cnt);
		}
		cout << ans << endl;
	}


	return 0;
}


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

vector<ll> tree;





int main(){
    ll h;
    cin>>h;
    tree.resize(h+1);
    for(int i=0;i<h;i++){
        cin>>tree[i+1];
    }
    for(int i=1;i<tree.size();i++){
        ll p=i/2;
        ll l=i*2;
        ll r=i*2+1;
        cout<<"node "<<i<<": key = "<<tree[i]<<", ";
        if(p>=1){
            cout<<"parent key = "<<tree[p]<<", ";
        }
        if(l<tree.size()){
            cout<<"left key = "<<tree[l]<<", ";
        }
        if(r<tree.size()){
            cout<<"right key = "<<tree[r]<<", ";
        }
        cout<<endl;
    }
    
    
    return 0;
}




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

int main()
{
  i64 n;
  string s, t;
  cin >> n >> s >> t;
  for (i64 i = 0; i < n; i++)
    cout << s[i] << t[i];
  cout << endl;
  return 0;
}


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

int a[101]={0};

int main()
{
	int n,x;
	cin>>n;
	
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		a[x]=1;
	}
	
	int s=0;
	
	for(int i=1;i<=100;i++)
	{
		if(a[i]==1) s++;
	}
	
	cout<<s;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  //A:T, C:G

  char b;
  cin >> b;

  if(b == 'A')
    cout << "T" << endl;
  else if (b == 'T')
    cout << "A" << endl;
  else if (b == 'C')
    cout << "G" << endl;
  else if (b == 'G')
    cout << "C" << endl;
  
//  cout << std::setprecision(20);
}


Measured memory_bytes: 256
import numpy as np
N, M, C = list(map(int, input().split()))
Bs = list(map(int, input().split()))

def is_correct(As):
  return np.inner(As, Bs) + C > 0

As = list(map(int, input().split()))
n = 0
while As:
  if is_correct(As):
    n += 1
  try:
    As = list(map(int, input().split()))
  except:
    break
  
print(n)



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

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

using namespace std;

typedef long long ll;

int n;

bool debug = 0;

int main(){
  cin >> n;
  vector<ll> vec(n);
  rep(i,n) cin >> vec[i];
  ll ans = 0;
  ll border = 1LL;
  rep(i,n) {

    // DEBUG -->
    if( debug ) {
      cout << i << "-th ( border = " << border << " ) : ans = " << ans << endl;
      rep(j,n) {
	cout << vec[j] << " ";
      } puts("");puts("");
    }
    // DEBUG <--
    

    if( border == 1LL ) {
      ans += (vec[i]-1LL);
      vec[i] = 1LL;
      border = 2LL;
      continue;
    }
    
    if( border == vec[i] ) {
      ++border;
      continue;
    }

    if( border > vec[i] ) continue;    

    ll coef = vec[i] / border;
    if( ( vec[i] - coef * border ) == border ) {
      ans += coef;
      vec[i] = 1LL;
    } else if ( ( vec[i] - coef * border ) == 0LL ) {
      --coef;
      ans += coef;
      vec[i] = ( vec[i] - coef * border );
    } else {
      ans += coef;
      vec[i] = ( vec[i] - coef * border );
    }
  }

    // DEBUG -->
    if( debug ) {
      cout << "last ( border = " << border << ") ans = " << ans << endl;
      rep(j,n) {
	cout << vec[j] << " ";
      } puts("");puts("");
    }
    // DEBUG <--

  cout << ans << endl; 
  return 0;
}


Measured memory_bytes: 1024
import java.io.*;
import java.util.*;
public class Main {        
    public static void main(String args[]) {
        int a=II();
        int b=II();
        int c=II();
        int k=II();

        while(b<=a && k>0){
            b=b*2;
            k--;
        }
        while(c<=b && k>0){
            c=c*2;
            k--;
        }

        if(a<b && b<c)
            System.out.println("Yes");
        else 
            System.out.println("No");

    }
    
    ////////////////////////////////////
    static scan in=new scan(System.in);
    static int II() {
        return in.nextInt();
    }
    static long IL() {
        return in.nextLong();
    }
    static int[] IIA(int n) {
        int a[]=new int[n];
        for(int i=0;i<n;i++) {
            a[i]=II();
        }
        return a;
    }
    static String IS() {
        return in.next();
    }
    static char IC(){
        return in.next().charAt(0);
    }
    static String[] ISA(int n) {
        String a[]=new String[n];
        for(int i=0;i<n;i++) {
            a[i]=IS();
        }
        return a;
    }
    static char[] ICA(int n) {
        char a[]=new char[n];
        for(int i=0;i<n;i++) {
            a[i]=IC();
        }
        return a;
    }
}
class scan
{
    public static BufferedReader reader;
    public static StringTokenizer token;

    scan(InputStream str)
    {
        reader=new BufferedReader(new InputStreamReader(str));
        token=null;
    }

    static int nextInt()
    {
        while(token==null||!token.hasMoreTokens())
        {
            try { token=new StringTokenizer(reader.readLine());   }
            catch(IOException e){  throw new RuntimeException(e); }
        }
        return Integer.parseInt(token.nextToken());
    }

    static long nextLong()
    {
        while(token==null||!token.hasMoreTokens())
        {
            try { token=new StringTokenizer(reader.readLine());   }
            catch(IOException e){  throw new RuntimeException(e); }
        }
        return Long.parseLong(token.nextToken());
    }

    static String next()
    {
        while(token==null||!token.hasMoreTokens())
        {
            try { token=new StringTokenizer(reader.readLine());   }
            catch(IOException e){  throw new RuntimeException(e); }
        }
        return token.nextToken();
    }

}

Measured memory_bytes: 25128
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    int n, m;
    cin >> n >> m;

    cout << n*(n-1)/2 + m*(m-1)/2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{

	string str1 , str2;
    cin >> str1 >> str2;
    int l1 , l2 , cnt , ct = 0;
    l1 = str1.length();
    l2 = str2.length();
    cnt = l1 + l2;
     int i = 0;
     int j = 0;
     for( i ; i < str1.size() ; ++i){
     	cout<<str1[i];
     	if(i < str2.size())
     	cout<<str2[i];
     }
     cout<<endl;
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define DVSORT(v) sort(v.begin(), v.end(),greater<int>())
#define SORT(v, n) sort(v, v+n)
#define DSORT(v,n) sort(v, v+n,greater<int>())
#define vi vector<int>
#define pb push_back
#define P pair<int,int>


template <class T> void chmin(T&a, const T&b) { a = min(a,b); }
template <class T> void chmax(T&a, const T&b) { a = max(a,b); }

const double EPS =1e-9;
const long INF =999999999;
const long MOD =1000000007; //10^9+7
#define PI 3.14159265258979

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

int main(void){
	int n,number[100001]={},result=0;

	cin>>n;
	REP(i,n) cin>>number[i];

	REP(i,n){
		if(number[i]==i+1){ 
			swap(number[i],number[(i+1)%n]);
			result++;
		}
	}
	printf("%d\n",result);
	return 0;
}



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

using namespace std;

#define inf 1<<30
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef long long llong;
typedef unsigned long long ullong;
typedef pair<int, int> P;


int main(){
	llong N, A;
	map<llong, bool> m;
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> A;
		if(m.find(A) == m.end())
			m[A]++;
		else
			m.erase(A);
	}
	cout << m.size() << endl;

	return 0;
}

Measured memory_bytes: 6528
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>

#define CK(N,A,B) (A<=N&&N<B)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define RREP(i,a,b) for(int i=(b-1);a<=i;i--)
#define F first
#define S second
#define ll long long

const int INF = 1e9;
const long long  LLINF = 1e18;

using namespace std;

int t[105];

int main(){

  int A,B,C,D;
  int ans = 0;
  cin>>A>>B>>C>>D;

  REP(i,A,B){
    t[i]++;
  }
  REP(i,C,D){
    t[i]++;
    if(t[i] == 2) ans++;
  }

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = (int)1e9 + 7;

signed main() {
  int N;
  cin >> N;
  vector<int> C(N);
  for(int i=0; i<N; i++) cin >> C[i];
  sort(C.begin(),C.end());


  vector<int> b(N+1);
  b[0] = 1;
  for(int i=1; i<=N; i++) b[i] = (b[i-1]*2) % MOD;

  int ans = 0;
  for(int i=0; i<N; i++) ans = (ans + (C[N-1-i] * (i+2))) % MOD;
  ans = (ans * ((b[N-1] * b[N-1]) % MOD)) % MOD;
  cout << ans << endl;
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
int main(){
string N;
  cin>>N;
  int sum=0;
 for(int i=0;i<N.size();i++){
   if(N.at(i)=='9'){
     sum++;
   }
 }
  
  if(sum>0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

     
  

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
//ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
int main() {
	int N, M;
	ll s = 0;
	cin >> N >> M;
	vector<int>a(N);
	rep(i, 0, N)cin >> a[i], s += a[i];
	r_sort(a);
	puts((ll)a[M - 1] * 4 * M >= s ? "Yes" : "No");
	return 0;
}


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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back

using namespace std;

// #define DEBUG_IS_VALID

#ifdef DEBUG_IS_VALID
#define DEB 1 
#else
#define DEB 0
#endif
#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline void chmax(T& a,T const& b){a=max(a,b);}
template<class T> inline void chmin(T& a,T const& b){a=min(a,b);}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<60; 

string s[302];
bool ok[604];

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N; cin >> N;
  rep(i,N) cin >> s[i];
  int ans = 0;
  rep(i,N){
    // from (i,0)
    fill(ok,ok+604,true);
    // ok := i行はokか
    rep(k,N-1) REP(l,k+1,N){
      ok[(i+k)] &= (s[(i+k)%N][l] == s[(i+l)%N][k]);
    }
    rep(j,N-i){
      // (i+j, j)
      if(j!=0){
        rep(k,N-1){
          // 追加判定
          ok[(i+j+k)] &= (s[(i+j+k)%N][(j+N-1)%N] == s[(i+j+N-1)%N][(j+k)%N]);
        }
      }
      bool is_ok = true;
      rep(k,N-1){
        is_ok &= ok[i+j+k];
      }
      if(is_ok) ans++;
    }
  }
  REP(i,1,N){
    // from (0,i)
    fill(ok,ok+604,true);
    // ok := i行はokか
    rep(k,N-1) REP(l,k+1,N){
      ok[k] &= (s[k][(i+l)%N] == s[l][(i+k)%N]);
    }
    rep(j,N-i){
      // (j, i+j)
      if(j!=0){
        rep(k,N-1){
          // 追加判定
          ok[(j+k)] &= (s[(j+k)%N][(i+j+N-1)%N] == s[(j+N-1)%N][(i+j+k)%N]);
          // dump(i+j+k,ok[i+j+k]);
        }
      }
      bool is_ok = true;
      rep(k,N-1){
        is_ok &= ok[j+k];
      }
      if(is_ok) ans++;
      dump(j,ans);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  char S;
  bool y_flag = false;
   
  cin >> N;

  for (int i = 0; i < N; i++) {
    cin >> S;

    if (S == 'Y') {
      y_flag = true;
      break;
    }
  }

  if (y_flag) {
    cout << "Four" << endl;
  }
  else {
    cout << "Three" << endl;
  }
}

Measured memory_bytes: 3608
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC172D
{
    class Program
    {
        static void Main(string[] args)
        {
            long N = int.Parse(Console.ReadLine());
            long ans = 0;
            for(long X = 1; X <= N; X++)
            {
                long Y = N / X;
                //Console.WriteLine(Y);
                ans +=( Y * (Y + 1) / 2 )* X;
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 27496
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>
using ll = long long ;
using namespace std;
int main(){
    int n,z,w;
    cin >> n >> z >> w;
    vector<int> vec(n);
    for(int i=0;i<n;i++){
        cin >> vec[i];
    }
   // cout<<vec[n-1]-vec[n-2]<<endl;
   if(n==1)cout<<abs(vec[0]-w);
   else{
    cout<<max(abs(vec[n-2]-vec[n-1]),abs(vec[n-1]-w))<<endl;
}
}


Measured memory_bytes: 256
"use strict";
    
const main = arg => {
    const S = arg.split("\n")[0].split(" ").map(n=>n.toUpperCase());
    console.log(S[0].split("")[0] + S[1].split("")[0] + S[2].split("")[0]);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21064
#include<iostream>

using namespace std;

int xy[9][9];
int n,m;
int dfs(int k, int x, int y){
  int ans = 0;

  if(k == n*(n-1) - 2*m){
    int t = 0;
    for(int i = 0; i < n; i++){
      int s = 0;
      if(i == 0) for(int j = 0; j < n; j++) t += xy[i][j];
      else{
        for(int j = 0; j < n; j++){
          s += xy[i][j];
        }
        if(s != t) return 0;
      }
    }
    return 1;
  }
  for(int i = 0; i < x ; i++){
    int cnt = 0;
    for(int j = 0; j < n; j++){
      if(xy[i][j] == 1) cnt++;
    }
    if(cnt != (n-1)/2 ) return 0;
  }
  for(int i = x; i < n; i++){
    for(int j = x ; j < n ; j++){
      if(i == x && j < y) j = y;
      if(i == j || xy[i][j] != 0 || j >= n) continue;
      xy[i][j] = 1;
      xy[j][i] = -1;
      ans += dfs(k+2, i, j);
      xy[i][j] = -1;
      xy[j][i] = 1;
      ans += dfs(k+2, i, j);
      xy[i][j] = 0;
      xy[j][i] = 0;
      return ans;
    }
  }
  return ans;
}

int main(){
  while(cin >> n&& n != 0){
    cin >> m;
    for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) xy[i][j] = 0;
    for(int i = 0; i < m ; i++){
      int x,y;
      cin >> x >> y;
      x--;
      y--;
      xy[x][y] = 1;
      xy[y][x] = -1;
    }
    cout << dfs(0, 0, 0) << endl;
  }
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define int long long
#define debug(...) fprintf(stderr, __VA_ARGS__)

using namespace std;
typedef long long ll;
const int N = 10005;

inline int input() {
	int x; char ch; while (!isdigit(ch = getchar()));
	for (x = ch ^ 48; isdigit(ch = getchar()); x = x * 10 + (ch ^ 48));
	return x;
}

inline void chkmin(int &x, int y) { x = x < y ? x : y; }
template <class T> T sqr(T x) { return x * x; }

int n;
int x[N], y[N];
int d[1000];
bool flag;

int dis(int xa, int ya, int xb, int yb) {
	return abs(xa - xb) + abs(ya - yb);
}

signed main() {
#ifdef local
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
//	freopen("log", "w", stderr);
#endif
	ios::sync_with_stdio(false);

	cin >> n; 
	for (int i = 1; i <= n; ++i)
		cin >> x[i] >> y[i];
	flag = abs(x[1] + y[1]) & 1;

	for (int i = 1; i <= n; ++i)
		if ((abs(x[i] + y[i]) & 1) != flag)
			return puts("-1"), 0;

	puts(flag ? "31" : "32");
	for (int i = 1; i <= 31; ++i)
		printf("%lld ", d[i] = 1 << (31 - i));
	if (!flag) printf("%lld\n", d[32] = 1);
	else putchar('\n');

	for (int i = 1; i <= n; ++i) {
		int xd = 0, yd = 0;
		if (!flag) xd = 1;
		for (int j = 1; j <= 31; ++j) {
			char ch; int Dis = LLONG_MAX;
			if (dis(xd + d[j], yd, x[i], y[i]) < Dis)
				Dis = dis(xd + d[j], yd, x[i], y[i]), ch = 'R';
			if (dis(xd - d[j], yd, x[i], y[i]) < Dis)
			   	Dis = dis(xd - d[j], yd, x[i], y[i]), ch = 'L';
			if (dis(xd, yd + d[j], x[i], y[i]) < Dis)
				Dis = dis(xd, yd + d[j], x[i], y[i]), ch = 'U';
			if (dis(xd, yd - d[j], x[i], y[i]) < Dis)
				Dis = dis(xd, yd - d[j], x[i], y[i]), ch = 'D';
			if (ch == 'R') xd += d[j];
			if (ch == 'L') xd -= d[j];
			if (ch == 'U') yd += d[j];
			if (ch == 'D') yd -= d[j];
			putchar(ch);
		}
		if (xd != x[i] || yd != y[i]) return 1;
		if (!flag) putchar('R');
		putchar('\n');
	}

	return 0;
}

Measured memory_bytes: 384
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int count = 0;
        int[] a = new int[n];
        int[] b = new int[n];
        boolean[] success = new boolean[n];
        Arrays.fill(success, false);
        for(int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
        }
        if(a[0] == b[0]){
        success[0] = true;
        count++;
        }

        for(int i = 1; i < n; i++) {
            if(count == 3) {
                System.out.println("Yes");
                System.exit(0);
            }
            if(a[i] == b[i] && (count == 0 || success[i - 1])){
            count++;
            success[i] = true;
            }
            else if(a[i] == b[i]) {
                success[i] = true;
            }
            else if(a[i] != b[i]) {
                count = 0;
            }
            if (count == 3) {
                System.out.println("Yes");
                System.exit(0);
            }
        }
        System.out.println("No");
    }
}

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

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

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

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

using tl = tuple<ll, ll, ll>;

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

    ll n, m;
    cin>>n>>m;
    vector<vector<tl>> to(n);
    rep(i, m) {
        ll a, b, c;
        cin>>a>>b>>c; a--; b--;
        to[a].emplace_back(b, c, i);
        to[b].emplace_back(a, c, i);
    }

    vector<bool> used(m);
    rep(i, n) {
        vector<ll> visited(n, LINF);
        priority_queue<tl, vector<tl>, greater<tl>> q;
        q.emplace(0, i, -1);
        while (!q.empty()) {
            tl t = q.top(); q.pop();
            ll d = get<0>(t);
            ll v = get<1>(t);
            ll e = get<2>(t);
            if (visited[v] != LINF) {
                if (visited[v] == d && e != -1) {
                    used[e] = true;
                }
                continue;
            }

            visited[v] = d;
            if (e != -1) used[e] = true;
            for (auto nt : to[v]) {
                ll nv = get<0>(nt);
                ll nd = get<1>(nt) + d;
                ll ne = get<2>(nt);
                q.emplace(nd, nv, ne);
            }
        }
    }
    ll ans = 0;
    rep(i, m) if(!used[i]) ans++;
    cout<<ans<<endl;
}

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

int main() {

	int N;
	int num[1000];

	int cow = 0;
	int jud = 0;

	string str = "DENIED";

	cin >> N;

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

	for (int i = 0; i < N; i++) {
		if (num[i] % 2 == 0) {
			cow++;
			if (num[i] % 3 == 0 || num[i] % 5 == 0) {
				jud++;
			}
		}
	}

	if (cow == jud) {
		str = "APPROVED";
	}

	cout << str << endl;
}

Measured memory_bytes: 256
//url:
//problem name: Brick Break

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    int N,K; cin >> N >> K;
    vector<double> p(N);
    REP(i,N) cin >> p[i];
    vector<double> s(N+1);
    REP(i,N) s[i+1] = s[i] + (p[i]+1)/2;

    double ans = 0;
    REP(i,N-K+1) chmax(ans,s[i+K]-s[i]);

    printf("%.10f\n",ans);
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}
int N, M;
vector<int> E[101010];
int C[101010];
int num[2];

void dfs(int cur, int col) {
    if(C[cur] != -1) {
        if(C[cur] != col) {
            //二部グラフではない
            // cout << cur << C[cur] << col << endl;
            cout << 1LL * N * (N - 1) / 2 - M << endl;
            exit(0);
        }
    } else if(C[cur] == -1) {
        C[cur] = col;
        num[col]++;
        for(auto e : E[cur]) {
            dfs(e, col ^ 1);
        }
    }
}
int main() {
    cin >> N >> M;
    vector<int> A(M), B(M);
    REP(i, M) {
        cin >> A[i] >> B[i];
        A[i]--;
        B[i]--;
    }
    memset(C, -1, sizeof(C));
    REP(i, 101010) C[i] = -1;
    REP(i, M) {
        E[A[i]].push_back(B[i]);
        E[B[i]].push_back(A[i]);
    }
    dfs(0, 0);
    // cout << "hoge" << endl;
    cout << 1LL * num[0] * num[1] - M << endl;
}
// http://kmjp.hatenablog.jp/entry/2017/10/09/0900

Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;


void solve(){

    int n,m;
    cin >> n >> m;
    cout << n*(n-1)/2 + m*(m-1)/2 << endl;

}

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


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int m[4] = {0};
    int msub = 0;
    int mm;
    int ms;
    for(int i = 0;i < 4;i++){
        cin >> m[i];
        msub+=m[i];
    }
    mm = msub / 60;
    ms = msub % 60;
    cout << mm << endl << ms << 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.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;

class Main{	
	
	
	
	public static void main(String[] args) throws IOException   {		
		
		Map<Integer, TreeSet<Integer>> map = new HashMap<Integer, TreeSet<Integer>>();
		
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		
		int cs = Integer.parseInt((bf.readLine().split(" ")[1]));
	
		int[][] ya = new int[cs][2];
		
		for(int i = 0; i < cs; i++ ) {	
			String[] line = bf.readLine().split(" ");
			int pt =  Integer.parseInt(line[0]);
			int ys =  Integer.parseInt(line[1]);
			ya[i][0] = pt;
			ya[i][1] = ys;
			setData(pt, ys, map);
		}	
		
		Map <Integer,  Map<Integer, Integer>> retMap = createSequMap(map);
		
		for(int i = 0; i < cs; i++) {
			int pt = ya[i][0];
			int ys = ya[i][1];
			
			System.out.println(getFullNumber(pt) + getFullNumber(retMap.get(pt).get(ys)));
			
		}
	
		
	}		
	

	
	private static Map<Integer, Map<Integer, Integer>> createSequMap(Map<Integer, TreeSet<Integer>> map){
		Set<Integer> keys = map.keySet();
		Map<Integer,  Map<Integer, Integer>> retMap = new HashMap<Integer,  Map<Integer, Integer>> ();
		for(int pt:keys) {
			Map<Integer, Integer> seqMap = new HashMap<Integer, Integer>();
			TreeSet<Integer>  tset = (TreeSet<Integer> ) map.get(pt);	
			Iterator<Integer> iterator = tset.iterator();
			int seq = 0;
			while(iterator.hasNext()) {
				seqMap.put(iterator.next(), ++seq);
			}
			
			retMap.put(pt, seqMap);
		}
		return retMap;
	}

	private static void setData(int pt, int ys, Map<Integer, TreeSet<Integer>> map) {
		TreeSet<Integer> tset = (TreeSet<Integer>) map.get(pt);		
		if(tset == null) {
			tset = new TreeSet<Integer>();			
			map.put(pt, tset);
		}
		tset.add(ys);
	}
	


	private static String getFullNumber(int number) {
		String n = String.valueOf(number);
		int len = 6 - n.length();
		for(int i = 0; i < len; i++) {
			n = "0" + n;
		}
		return n;
	}

}

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

int main() {
    int X, A, B, C;
    cin >> A >> B >> C >> X;
    long long ans = 0;
    for(int i = 0; i <= C; i++) {
        for(int j = 0; j <= B; j++) {
            for(int k = 0; k <= A; k++) {
                if(i + j + k < 1) continue;
                if(500 * k + 100 * j + 50 * i == X) ans++;
            }
        }
    }

    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


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

  bool ans = true;
  
  if(N/2*2 == N){
    rep(i, N/2){
    if(S.at(i) != S.at(i + N/2)){
      ans = false;
      break;
    }
  }
  if(ans){
    cout <<"Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
    
  }
  else{
    cout << "No" << endl;
  }

  
  
}

Measured memory_bytes: 256
/* Coached by Dukkha */
#include <stdio.h>

int main() {
	int a, b, c;
	int d, e, f;
	int g, h, i;

	scanf("%d%d%d", &a, &b, &c);
	scanf("%d%d%d", &d, &e, &f);
	scanf("%d%d%d", &g, &h, &i);
	if (a - d == b - e && b - e == c - f
			&& d - g == e - h && e - h == f - i
			&& a - b == d - e && d - e == g - h
			&& b - c == e - f && e - f == h - i)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;
#include <string>
typedef long long int ll;
#include <algorithm>
#include <stack>
#include <vector>
#include <array>
#include <queue>

bool reverse(int x,int y){
  if(-x<-y){
    return y>x;
  }else{
    return x>y;
  }
}
int main(){

  int A,B,C;
  cin >> A>> B >> C;
  //int x = min(A-B,C);
  int utusu = min(A-B,C);
  cout << C-utusu;

  return 0;

}


Measured memory_bytes: 256
n,a,b=map(int,input().split())
N=2*10**5+1
mod=10**9+7
inv_l=[0,1]
for i in range(2,N):
    inv_l+=[inv_l[mod%i]*(mod-int(mod/i))%mod]
def nCr(n,r):
    ret=1
    for i in range(r):
        ret=ret*(n-i)%mod*inv_l[i+1]%mod
    return ret
ans=1
double=2
n_=n
while n_:
    if n_%2==1:
        ans=ans*double%mod
    n_//=2
    double=double*double%mod
ans=(ans-nCr(n,a)-nCr(n,b)-1)%mod
print(ans)

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

int main(){
    int x, y;
    string ans = "No";
    cin >> x >> y;
    for(int t = 0; t < x + 1; t++){
        if(2 * t + 4 * (x - t) == y){
            ans = "Yes";
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3564
#include <iostream>

using namespace std;
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  int ans = 0;
  for(int i=1;i<n;i++) ans = ans^a[i];
  cout << ans << " ";
  for(int i = 1; i < n;i++){
    ans = ans^a[i-1];
    ans = ans^a[i];
    cout << ans;
    if(i < n-1) cout << " ";
    else cout << endl;
  }

  return 0;
}


Measured memory_bytes: 3940
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#include <vector>
#include <numeric>
#include <map>
#include <cmath>
#include <iomanip>
using ll =long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;

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

    char c;

    for(int i=0; i<S.size(); i++){
        if(S.at(i) != S.at(S.size()-i-1)){
            cout << "No" << endl;
            return 0;
        }
    }
    for(int i=0; i<S.size()/2; i++){
        if(S.at(i) != S.at(S.size()/2-i-1)){
            cout << "No" << endl;
            return 0;
        }
    }
    for(int i=S.size()/2 + 1; i<S.size(); i++){
        if(S.at(i) != S.at(S.size()-i-1)){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

}

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

const int MAX_N = 1e5+12;
int n;
int a[MAX_N];

void solve()
{
	int ans = 0;
	for(int i=1;i<=n;++i){
		if(a[i] == i){
			if(i + 1 <= n){
				swap(a[i],a[i+1]);
				ans++;
			}else{
				ans++;
			}
		}
	}
	cout<<ans<<'\n';
}

int main()
{
	cin >> n;
	for(int i=1;i<=n;++i) cin >> a[i];
	solve();
	return 0;
}

Measured memory_bytes: 3940
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<string>
#include<bitset>
#include<cfloat>
#include<iomanip>
#include<numeric>

//#define int long long
#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second

using namespace std;
using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>void put_double(T a){if(cout.precision()!=12)cout<<setprecision(12);cout<<a<<endl;}
template<class T>void print(T a){cout << a << endl;}
//lambda: [](int x, int y){return x<y;}

signed main(void) {
    string t; cin >> t;
    set<char> s;
    rfor(c, t) {
        s.insert(c);
    }
    if(s.size() == t.size()) {
        print("yes");
    } else {
        print("no");
    }

    return 0;
}


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

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

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

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  vll a(n);
  rep(i,n) cin>>a[i];
  ll ans=0;
  rep(i,n-1){
    if(a[i]==a[i+1]){
      a[i+1]=-1;
      ans++;
    }
  }
  cout<<ans<<endl;
}

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

int main(){
  ll A,B,C;
  cin >> A >> B >> C;
  ll all = A*B*C;
  if(!(A%2)||!(B%2)||!(C%2)){
    cout << "0" << endl;
  }else{
    cout << min(A*B,min(B*C,C*A)) << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;

int main(int argc, char *argv[]) {

	//int D = 365;
	int D; cin >> D;

	vector<int> c(26,0);
	vector<vector<int>> s(D,vector<int>(26,0));
	vector<int> t(D,0);

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

	for (int i = 0; i < D; i++) {
		for (int j = 0; j < 26; j++) {
			cin >> s[i][j];	
		}
	}

	//for (int i = 0; i < D; i++) {
	//	cin >> t[i];
	//}

	//int M; cin >> M;
	//int cnt = 1;
	//for (int k = 0; k < M; k++) {
	//	cin >> d[k] >> q[k];
	//	vector<int> last(26,0);
	//	int d,q; cin >> d >> q;
	//	t[d-1] = q;
	//	int ans = 0;
	//	for (int i = 0; i < D; i++) {
	//		ans += s[i][t[i]-1];	
	//		last[t[i]-1] = i+1;
	//		for (int j = 0; j < 26; j++) {
	//			ans -=	c[j] * ((i+1) - last[j]) ;
	//		}
	//	}
	//	cout << ans << endl;
	//}

	vector<int> MAX(D,0);
	vector<int> last(26,0);
	for (int i = 0; i < D; i++) {
		int ans =0;
		int idx = 0;

		for (int j = 0; j < 26; j++) {
			if (MAX[i] < s[i][j]) {
				MAX[i] = s[i][j];	
				idx = j;	
			}
		}
		cout << idx + 1 << endl;
	}

	return 0;
}


Measured memory_bytes: 3676
fn main() {
    let mut v: Vec<Vec<char>>  = vec![Vec::new(); 2];
    for i in 0..2 {
        let s: String = read();
        v[i] = (s.chars().collect());
    }
    if v[0][0] == v[1][2] && v[0][1] == v[1][1] && v[0][2] == v[1][0] {
        println!("YES");
    } else {
        println!("NO");
    }

}

// 以下関数

use std::io::*;
use std::str::FromStr;
pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

pub const MOD: u64 = 10e9 as u64 + 7;

pub fn is_prime(n: i32) -> bool {
    if n < 2 {
        return false;
    } else if n == 2 {
        return true;
    }
    let mut i = 2;
    while i * i < n {
        if n % i == 0 {
            return false;
        } else {
            i += 1;
            continue;
        }
    }
    true
}

pub fn lcm(mut n: i32, mut m: i32) -> i32 {
    n = if n > m { m } else { n };
    m = if n > m { n } else { m };
    let mut i = n;
    while i % m != 0 {
        i += n;
    }
    i
}


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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    int n;
    cin >> n;
    n = ((n+110)/111)*111;
    cout << n << endl;
    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

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

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


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

using namespace std;

int main(int argc, char *argv[]) {
    int n;
    cin >> n;
    vector<int64_t> arr;
    int64_t cur;
    for (int64_t i = 0; i < n; i++) {
        cin >> cur;
        arr.push_back(cur);
    }

    vector<int64_t> arr1;
    deque<int64_t> q;
    for (int j = 0; j < n; ) {
        if (j == 0) {
            q.push_back(arr[j]);
            j++;
        } else {
            if (j < n) {
                if (n % 2 == 1) {
                    q.push_back(arr[j]);
                } else {
                    q.push_front(arr[j]);
                }
                j++;
            } else {
                break;
            }
            if (j < n) {
                if (n % 2 == 1) {
                    q.push_front(arr[j]);
                } else {
                    q.push_back(arr[j]);
                }
                j++;
            }
        }
    }

    for (auto& var: q) {
        cout << var << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 5360
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define PI 3.141592653589793
#define MOD 1000000007
//#define DEBUG



//qsort用、昇順
int compare_int(const void *a, const void *b)
{
	return *(int*)a-*(int*)b;
}
//qsort(array, 10, sizeof(int), compare_int)



int main(){
	int n;
	scanf("%d", &n);
	
	long long int nine=1, eight=1, seven=1;
	for(int i=0; i<n; i++){
		nine *= 10;
		eight *= 9;
		seven *= 8;
		nine = nine%MOD;
		eight = eight%MOD;
		seven = seven%MOD;
	}
	eight = eight*2;
	eight = eight%MOD;
	long long int x = nine - eight + seven;
	if(x<0) x += MOD;
	x = x%MOD;

	printf("%lld\n", x);
	
	return 0;
}


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

class Main
{
  	public static void main(String[] args)
    {
		Scanner s = new Scanner(System.in);
      	int n = s.nextInt();
      	int[] a = new int[n];
      	int[] b = new int[n];
      	for(int i = 0 ; i<n ; i++)a[i] = s.nextInt();
      	for(int i = 0 ; i<n ; i++)b[i] = s.nextInt();
      	int sum = 0;
      	for(int i = 0 ;  i<n ;i++)
        {
          	if(a[i]>b[i])sum+=(a[i]-b[i]);
        }
      	System.out.println(sum);
    }
}

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

int main() {
    int n,a,b;
    cin >> n >> a >> b;
    string s;
    cin >> s;
    
    int total = a+b;
    int frn = b;
    for(int i=0; i<s.size(); i++) {
        if(s[i] == 'a') {
            if(total > 0) {
                cout << "Yes" << endl;
                total--;
            } else {
                cout << "No" << endl;
            }
        } else if(s[i] == 'b') {
            if(total > 0 && frn > 0) {
                cout << "Yes" << endl;
                total--;
                frn--;
            } else {
                cout << "No" << endl;
            }
        } else {
            cout << "No" << endl;     
        }
    }
    return 0; 
}

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

using namespace std;

int main()
{
    int n,k,x,y;
    scanf("%d%d%d%d", &n, &k, &x, &y);
    long long ans = 0;
    for (int i = 1; i <= n; ++i) {
        if (i <= k) ans += x;
        else ans += y;
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
    int n,x[100];
    int p,sum=0,min=10000000;

    cin >> n;
    for (int i=0; i<n; i++){
        cin >> x[i];
    }
    for(int p=0; p<=100; p++){
        sum = 0;
        for(int i=0; i<n; i++){
            sum += (x[i] - p)*(x[i] - p);
        }
        if (sum < min) min = sum;
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 384
using System;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int w = int.Parse(s[0]);
            int h = int.Parse(s[1]);
            int x = int.Parse(s[2]);
            int y = int.Parse(s[3]);
            int r = int.Parse(s[4]);

            if ((x - r) < 0)
            {
                Console.WriteLine("No");
                return;
            }

            if ((x + r) > w)
            {
                Console.WriteLine("No");
                return;
            }

            if ((y - r) < 0)
            {
                Console.WriteLine("No");
                return;
            }

            if ((y + r) > h)
            {
                Console.WriteLine("No");
                return;
            }

            Console.WriteLine("Yes");
        }
    }
}

Measured memory_bytes: 8976
#include <cstdio>

void trace(int a[], int n) {
    for (int i = 0; i < n; i++) {
        if (i > 0) printf(" ");
        printf("%d", a[i]);
    }
    printf("\n");
}

void insertionSort(int a[], int n) {
    for (int i = 1; i < n; i++) {
        int value = a[i];
        int j = i - 1;
        while (j >= 0 && a[j] > value) {
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = value;
        trace(a, n);
    }
}

int main() {
    int n;
    scanf("%d", &n);

    int a[n];
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    trace(a, n);
    insertionSort(a, n);
    return 0;
}


Measured memory_bytes: 2684