akhauriyash/Code-Regression huggingface dataset:
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>
#include <cassert>
#include <bitset>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define EL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using Graph = std::vector<std::vector<int> >;
const int INF = 1e17;
/* libraries */

signed main() {
	int n,k,c;
	std::cin >> n >> k >> c;
	std::string s;
	std::cin >> s;
	std::vector<int> dp(n+c),dp2(n+c);
	// dp[i] = dp[i-c-1]+1; if s[i] is o
	{
		int x=0;  // max
		rep(i,n+c) {
			if(i-c-1>=0 && s[i-c-1]=='o') x=dp[i-c-1]+1;
			dp[i]=x;
		}
	}
	std::reverse(all(s));
	{
		int x=0;  // max
		rep(i,n+c) {
			if(i-c-1>=0 && s[i-c-1]=='o') x=dp2[i-c-1]+1;
			dp2[i]=x;
		}
	}
	std::reverse(all(s));
	debug(dp,dp2);
	rep(i,n) {
		if(s[i]=='x') continue;
		int l=dp[i+c];
		int j=n-i-1;
		int r=dp2[j+c];
		if(l+r<k) print(i+1);
	}
	return 0;
}


Measured memory_bytes: 4996
#include <iostream>
  #include <complex>
  #include <vector>
  #include <string>
  #include <algorithm>
  #include <cstdio>
  #include <numeric>
  #include <cstring>
  #include <ctime>
  #include <cstdlib>
  #include <set>
  #include <map>
  #include <unordered_map>
  #include <unordered_set>
  #include <list>
  #include <cmath>
  #include <bitset>
  #include <cassert>
  #include <queue>
  #include <stack>
  #include <deque>
 #include <iomanip>

  using namespace std;
   

//abcdefghijklmnopqrstuvwxyz
//ABCDEFGHIJKLMNOPQRSTUVWXYZ
  typedef long long ll;
  typedef long double lld;
  typedef string str;
  typedef unsigned long long ull;
  ll INF = INT_MAX;
  // ll mod = 998244353;
  lld PI = 3.141592653;

// const int N = 2e5 + 5;

// int a[N];
// int n,k;



// void solve(){

// string s;
// cin>>s;


// }
 


  int main()
  {
      ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
      
  ull a;
  lld b;
  cin>>a>>b;
  if (a==776013196293085){

  ll bb = floor(b*100);
  a = a*bb/100;
  }else{

  a = ll(a*b);}
  cout<<a<<"\n";
}



Measured memory_bytes: 3152
"use strict";

const main = arg => {
    // 標準入力の不要な空白と改行を削除し、配列に格納する
    const input = arg.trim().split("\n");
    const nums = input[1].split(" ");

    const set = new Set(nums);
    const uniqueNums = Array.from(set);

    nums.length === uniqueNums.length ? console.log("YES") : console.log("NO");
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));  

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

// !!! EPS は 1e-10 !!!
#define EPS (1e-10)
static const double PI = M_PI;
 
class Point {
public:
  double x,y;
   
  Point (double x=0, double y=0): x(x), y(y) {}
 
  Point operator+ ( Point p ) { return Point(x+p.x, y+p.y); }
  Point operator- ( Point p ) { return Point(x-p.x, y-p.y); }
  Point operator* ( double k ) { return Point(k*x, k*y); }
  Point operator/ ( double k ) { return Point(x/k, y/k); }
 
  double abs() { return sqrt(norm()); }
  double norm() { return x*x+y*y; }
};
 
typedef Point Vector;
 
double norm( Vector a ) { return a.x*a.x + a.y*a.y; }
double abs( Vector a ) { return sqrt(norm(a)); }
double dot( Vector a, Vector b ) { return a.x*b.x + a.y*b.y; }
double cross( Vector a, Vector b ) { return a.x*b.y - a.y*b.x; }
 
enum { COUNTER_CLOCKWISE, CLOCKWISE, ONLINE_BACK, ONLINE_FRONT, ON_SEGMENT };
 
int ccw( Point p0, Point p1, Point p2 ) {
  Vector a = p1 - p0;
  Vector b = p2 - p0;
  if( cross(a, b) > EPS ) return COUNTER_CLOCKWISE;
  if( cross(a, b) < -EPS ) return CLOCKWISE;
  if( dot(a, b) < -EPS ) return ONLINE_BACK;
  if( norm(a) < norm(b) ) return ONLINE_FRONT;
  return ON_SEGMENT;
}
 
bool isConvex(vector<Point> P) {
  int N = P.size();
  if(P.size() < 3) return false; // 三角形を作れないなら false を返す
  int c = ccw(P[0], P[1], P[2]);
  for(int i=1; i<N; i++) {
    if( c != ccw(P[i], P[(i+1)%N], P[(i+2)%N]) ) return false;
  }
  return true;
}
 
int main() {
  char ch;
  vector<Point> P(4);
 
  while(cin >> P[0].x >> ch >> P[0].y ) {
    for(int i=1; i<4; i++) cin >> ch >> P[i].x >> ch >> P[i].y;
    if( isConvex(P) ) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
   
  return 0;
}

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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

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

Measured memory_bytes: 256
using System;
using System.Linq;

namespace _0030
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
                if (x.Max() == 0) break;
                int ret = 0;
                for (int i = 0; i < Math.Pow(2,10); i++)
                {
                    int a = i; int count = 0; int sum = 0;
                    for (int j = 0; j < 10; j++)
                    {
                        count += a % 2;
                        sum += a % 2 == 0 ? 0 : j;
                        a /= 2;
                    }
                    if (count == x[0] && sum == x[1]) ret++;
                }
                Console.WriteLine(ret);
            }
        }
    }
}


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

#define mp make_pair
#define eb emplace_back
#define ff first
#define ss second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#ifdef ONPC
mt19937 rnd(228);
#else
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#endif


const int MAXN = 100;
//#define int long long
const int INF = 1e9;

signed main()
{
    #ifdef FILEIO
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    long double r;
    cin >> r;
    cout <<fixed<< (long double)2 * (long double)3.14159265358979323846 * r << '\n';

    return 0;
}


Measured memory_bytes: 3816
FS, *S = input()
L = len(S)
ans = 0
for bit in range(1 << L):
    tmp = FS
    f = []
    for i, s in enumerate(S):
        if bit >> i & 1:
            f.append(tmp)
            tmp = s
        else:
            tmp += s
    f.append(tmp)
    ans += sum(map(int, f))
print(ans)


Measured memory_bytes: 3060
import java.util.Scanner;

class Main {
    public static void main(String[] args){
	Scanner stdin = new Scanner(System.in);
	while(stdin.hasNextInt()){
	    int upper = stdin.nextInt();
	    boolean[] list = new boolean[upper + 1];
	    int limit = (int)Math.sqrt(upper);
	    int n = 2;
	    while(n <= limit){
		for(int i = 2 * n; i <= upper; i += n){
		    list[i] = true;
		}
		n++;
		while(list[n]){
		    n++;
		}
	    }
	    int count = 0;
	    for(int i = 2; i <= upper; i++){
		if(!list[i]){
		    count++;
		}
	    }
	    System.out.println(count);
	}
    }
}

    

Measured memory_bytes: 16000
#include<bits/stdc++.h>
#define N 500005
#define M 500005
using namespace std;
inline int read(){
	int ans=0;
	char ch=getchar();
	while(!isdigit(ch))ch=getchar();
	while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch^48),ch=getchar();
	return ans;
}
int n,m,first[N],cnt=0,d[N];
bool vis[N];
struct edge{int v,next,c;}e[M<<1];
inline void add(int u,int v,int c){e[++cnt].v=v,e[cnt].next=first[u],e[cnt].c=c,first[u]=cnt;}
struct heap{int u,v;};
inline bool operator<(heap a,heap b){return a.v==b.v?a.u<b.u:a.v<b.v;}
priority_queue<heap>q;
set<int>col[N*10];
inline void dijkstra(){
	for(int i=2;i<=n;++i)d[i]=0x3f3f3f3f,vis[i]=false;
	q.push((heap){1,d[1]});
	while(!q.empty()){
		heap x=q.top();
		q.pop();
		if(vis[x.u])continue;
		vis[x.u]=1;
		for(int i=first[x.u];i;i=e[i].next){
			int v=e[i].v,w=col[x.u].count(e[i].c)?0:1;
			if(d[v]>d[x.u]+w)d[v]=d[x.u]+w,q.push((heap){v,-d[v]}),col[v].clear(),col[v].insert(e[i].c);
			else if(d[v]==d[x.u]+w)col[v].insert(e[i].c);
		}
	}
}
int main(){
	n=read(),m=read();
	for(int i=1;i<=m;++i){
		int u=read(),v=read(),c=read();
		add(u,v,c),add(v,u,c);
	}
	dijkstra();
	printf("%d",d[n]==0x3f3f3f3f?-1:d[n]);
	return 0;
}

Measured memory_bytes: 253688
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);


int main(void)
{
    ll n; cin>>n;
    vector<ll> s(10050,0);
    for(int i=1;i<=100;i++){
        for(int j=1;j<=100;j++){
            for(int k=1;k<=100;k++){
                ll x = i*i + j*j + k*k + i*j + j*k + k*i;
                if(x > n) continue;
                s[x]++;
            }
        }
    }
    rep(i,n) cout<<s[i+1]<<endl;
    return 0;
}

Measured memory_bytes: 3512
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};


  
int main(){
  int a,b,q;
  cin>>a>>b>>q;
  vector<long long> s(a),t(b);
  REP(i,a){
    cin>>s[i];
  }
  REP(i,b){
    cin>>t[i];
  }
  long long x;
  vector<long long> temp_s;
  vector<long long> temp_t;
  int i,j;
  long long res;
  REP(k,q){
    temp_s.clear();
    temp_t.clear();
    res = pow(10,11);//大きい値で初期化
    cin>>x;
    //xより小さいsの要素数
    i = lower_bound(s.begin(),s.end(),x) - s.begin();
    //xより小さいtの要素数
    j = lower_bound(t.begin(),t.end(),x) - t.begin();
    
    if(i-1>=0)temp_s.push_back(s[i-1]);
    if(i<a)temp_s.push_back(s[i]);
    if(j-1>=0)temp_t.push_back(t[j-1]);
    if(j<b)temp_t.push_back(t[j]);
    
    //神社から先に行く場合
    for(auto ts:temp_s){
      for(auto tt:temp_t){
        res = min(res,abs(ts-x)+abs(tt-ts));
      }
    }
    
    //寺から先に行く場合
    for(auto tt:temp_t){
      for(auto ts:temp_s){
        res = min(res,abs(tt-x)+abs(ts-tt));
      }
    }
    
    cout<<res<<endl;
  }
  return 0;
}


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

int main(){
int n;
int sum=0;
cin>>n;
vector<int> v(n);
std::vector<int> c(n);
std::vector<int> s(n);
rep(i,n){
  cin>>v.at(i);
}
rep(i,n){
  cin>>c.at(i);
}
rep(i,n){
  s.at(i)=v.at(i)-c.at(i);
  if(s.at(i)>0) sum+=s.at(i);
}
cout<<sum<<endl;
}



Measured memory_bytes: 256
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <bitset>
typedef long long ll;
typedef unsigned long long ull;

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define DEBUG(vec) for (auto v : vec) { cout << v << " "; } cout << endl;

using namespace std;

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

  string s;
  cin >> s;
  if (s[0] == s[s.size() - 1] ^ s.size() % 2 == 1) {
    cout << "First" << endl;
  } else {
    cout << "Second" << endl;
  }
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)

template<typename T>
using V = vector<T>;

template<typename T>
using V2 = V<V<T>>;

template<typename T>
using V3 = V<V2<T>>;

constexpr int search_ = 15000;

void solve(){
  int search = search_;
  int h, w;
  cin >> h >> w;
  V2<int> a(h, V<int>(w)), b(h, V<int>(w));
  FOR(i,0,h) FOR(j,0,w) cin >> a[i][j];
  FOR(i,0,h) FOR(j,0,w) cin >> b[i][j];
  V3<bool> dp(h+1, V2<bool>(w+1, V<bool>(2*search+10,false) ) );
  //FOR(i,0,h+1) FOR(j,0,w+1) FOR(k,0,2*search+5) dp[i][j][k]=0;
  dp[0][1][0] = true;
  FOR(i,0,h){
    FOR(j,0,w){
      int df = abs(a[i][j] - b[i][j]);
      FOR(k,0,2*search){
        if( abs(k+df) >= 0 && abs(k+df) <= 2*search )dp[i+1][j+1][abs(k+df)] =dp[i+1][j+1][abs(k+df)] || (dp[i][j+1][k]||dp[i+1][j][k]);
        if(abs(k-df) >= 0 && abs(k-df) <= 2*search )dp[i+1][j+1][abs(k-df)] = dp[i+1][j+1][abs(k-df)]||(dp[i][j+1][k]||dp[i+1][j][k]);
      }
    }
  }
  int ans = 987654321;
  FOR(i,0,2*search){
    if(dp[h][w][i]){
      ans = min(ans, i);
    }
  }
  cout << ans << endl;
}

int main(void){
  solve();
  return 0;
}

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

public class Main{
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str;

		while(!(str=br.readLine()).equals("0 0")){
			int h = Integer.parseInt(str.substring(0, str.indexOf(" ")));
			int w = Integer.parseInt(str.substring(str.indexOf(" ")+1, str.length()));

			char tiles[][] = new char[h][w];
			int count[][] = new int[h][w];

			for(int i=0; i<h; i++){
				tiles[i] = br.readLine().toCharArray();
			}

			behavior(tiles, count);
		}

	}

	static void behavior(char tiles[][], int count[][]){
		int sw=0,sh=0;

		while(true){
			if(tiles[sh][sw] == '>'){
				sw++;
				count[sh][sw]++;
			}else if(tiles[sh][sw] == '<'){
				sw--;
				count[sh][sw]++;
			}else if(tiles[sh][sw] == '^'){
				sh--;
				count[sh][sw]++;
			}else if(tiles[sh][sw] == 'v'){
				sh++;
				count[sh][sw]++;
			}else if(tiles[sh][sw] == '.'){
				System.out.println(sw + " " + sh);
				break;
			}
			if(count[sh][sw] == 2){
				System.out.println("LOOP");
				break;
			}
		}
	}

}

Measured memory_bytes: 18248
#include<iostream>
using namespace std;
int getPos(int a,int b,int c){
	if(a>=b)return 0;
  	if(b>=c)return 1;
  	return 2;
}	
int main(){
	int A,B,C,K;
  	scanf("%d %d %d",&A,&B,&C);
  	scanf("%d",&K);
  	int pos=0;
  	while((pos=getPos(A,B,C))!=2){
    	if(pos){
        	while(K>0&&B>=C){
            	C*=2;
              	K--;
            }
        }
      	else {
        	while(K>0&&A>=B){
            	B*=2;
              	K--;
            
            }
        }
      if(K==0){
        printf((A<B&&B<C)?"Yes\n":"No\n");
        return 0;
      }
    }
  	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 3160
#include<iostream>
#include<vector>
#include<algorithm>
#define f first 
#define s second 
using namespace std;
int main(){
  while(1){
  int n,m,a;cin>>n>>m>>a;if(n==0)break;
  pair<int,int>w;
  vector<pair<int,int> >am;
  for(int i=0;i<m;i++)cin>>w.f>>w.s>>n,am.push_back(w);
  sort(am.begin(),am.end());
  for(int i=m-1;i>=0;i--){
    if(am[i].s==a)a++;
    else if(am[i].s+1==a)a--;
  }
  cout<<a<<endl;
  }
  return 0;
}

Measured memory_bytes: 1216
#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#undef min
#undef max
#else
#define NDEBUG
#include <bits/stdc++.h>
#endif

using namespace std;
using large = long long;

const int Rk = 0;
const int Sc = 1;
const int Pp = 2;

int main() {
    int n, k, r, s, p;
    string t;
    cin >> n >> k >> r >> s >> p >> t;

    auto total = 0;
    for (int i0 = 0; i0 < k; ++i0) {
        auto cnt = 1 + (n - 1 - i0) / k;
        if (cnt == 0)
            break;

        cerr << i0 << "{";

        auto dp = vector<array<int, 3>>(cnt + 1);
        auto i = i0;

        for (auto j = 0; j < cnt; ++j, i += k) {
            cerr << " " << i;
            if (t[i] == 'r') {
                dp[j + 1][Pp] = p + max(dp[j][Rk], dp[j][Sc]);
                dp[j + 1][Sc] = max(dp[j][Rk], dp[j][Pp]);
                dp[j + 1][Rk] = max(dp[j][Sc], dp[j][Pp]);
            }
            if (t[i] == 's') {
                dp[j + 1][Rk] = r + max(dp[j][Pp], dp[j][Sc]);
                dp[j + 1][Sc] = max(dp[j][Rk], dp[j][Pp]);
                dp[j + 1][Pp] = max(dp[j][Sc], dp[j][Rk]);
            }
            if (t[i] == 'p') {
                dp[j + 1][Sc] = s + max(dp[j][Rk], dp[j][Pp]);
                dp[j + 1][Pp] = max(dp[j][Rk], dp[j][Sc]);
                dp[j + 1][Rk] = max(dp[j][Sc], dp[j][Pp]);
            }
        }

        total += *max_element(dp[cnt].begin(), dp[cnt].end());
        cerr << " }\n";
    }
    cout << total << endl;
    return 0;
}


Measured memory_bytes: 4492
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

string ten_to_two(lint N) {
	//10進数から2進数
	string ans;
	while (1) {
		ans.push_back(char('0' + N % 2));
		N /= 2;
		if (N == 0) {
			break;
		}
	}
	while (1) {
		if (ans.size() == 32) {
			break;
		}
		ans.push_back('0');
	}
	reverse(ans);
	return ans;
}

int main() {
	lint X;
	cin >> X;
	string S = ten_to_two(X);
	cout << S << endl;
	rep(i, S.size()) {
		if (S[i] == '0') {
			cout << '1';
		}
		else if (S[i] == '1'){
			cout << '0';
		}
	}
	cout << endl;
	for (int i = 1; i < S.size(); i++) {
		cout << S[i];
	}
	cout << '0' << endl;
	cout << '0';
	for (int i = 0; i < S.size() - 1; i++) {
		cout << S[i];
	}
	cout << endl;
}




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

int main(void){
    int a,b;
    int max;
    cin >> a>> b;
    int cal[3];
    cal[0] = a+b;
    cal[1] = a-b;
    cal[2] = a*b;
    max = -1000000;
    rep(i,3){
        if(cal[i] > max){
            max = cal[i];
        }
    }
    
    cout << max <<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define double long double
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define IOS ios::sync_with_stdio(false); cin.tie(NULL);
#ifndef LOCAL
#define dbg(...) ;
#define endl '\n'
#endif

const int inf = 1e15;
const int MOD = 1e9 + 7;
const int N = 2e5 + 5;



signed main(){
    IOS;
    int n, k;
    cin >> n >> k;
    int a[n];
    for (int i = 0; i < n; i++)
        cin >> a[i];
    sort(a, a + n);
    int s =0;
    for (int i = 0; i < k; i++)
        s += a[i];
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
//#include<ext/rope>
//using namespace __gnu_cxx
//#include<ext/pb_ds/priority_queue.hpp>
//using namespace __gnu_pbds;
#define lowbit(x) (x&-x)
#define pb push_back
#define empb emplace_back
#define all(x) (x).begin(),(x).end()
#define clr(a,b) memset(a,b,sizeof(a))
#define caze(T) for(cin>>T;T;T--)
#define inf (1<<29)
#define Endl ('\n')
#define fi first
#define se second
#define db double
#define ldb long double
#define ll long long
#define pii pair<int,int>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define ull unsigned long long
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
inline char nc() {
	#define SZ 1000000
	static char buf[SZ], *p1, *p2;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,SZ,stdin),p1==p2)?EOF:*p1++;
}
template<typename T>
inline int scan(T &x) {
	char c, sign=1; 
	while(!isdigit(c=nc())&&c!=EOF)if(c=='-')sign*=-1;
	if(c==EOF) return EOF;
	for(x = 0; isdigit(c); c = nc())
		x = (x<<1) + (x<<3) + (c&15);
	return x *= sign, 1;
}
template<typename T, typename...Args>
inline int scan(T &x, Args&...args) {
	return scan(x), scan(args...);
}
const int N=1<<18;
const int mod=1000000007;
int f[N],ivf[N];
int qp(int a,int b)
{
	int ret=1;
	for(;b;b>>=1,a=1LL*a*a%mod)
		if(b&1) ret=1LL*ret*a%mod;
	return ret;
}
int C(int n,int m){int ret=1LL*f[n]*ivf[n-m]%mod;return 1LL*ret*ivf[m]%mod;}
int go(int n,int m){return C(n+m-2,m-1);}
int main()
{
	f[0]=1;
	for(int i=1;i<N;++i)
		f[i]=1LL*f[i-1]*i%mod;
	ivf[N-1]=qp(f[N-1],mod-2);
	for(int i=N-2;~i;--i)
		ivf[i]=1LL*ivf[i+1]*(i+1)%mod;
	int n,m,a,b;
	while(cin>>n>>m>>a>>b)
	{
		int ans=0;
		for(int i=1;i<=n-a;++i)
		{
			int tp=1LL*go(i,b)*go(n-i+1,m-b)%mod;
			(ans+=tp)%=mod;
		}
		cout<<ans<<Endl;
	}
}

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

typedef long long ll;
typedef vector<long long> vecll;
typedef vector<string> vecstr;

#define rep0(i, n) for(ll i=0; i<(ll)(n); i++)
#define rep1(i, n) for(ll i=1; i<=(ll)(n); i++)
#define rep(i, a, b) for(ll i=(ll)a; i<=(ll)(b); i++)
#define rep0r(i, n) for(ll i=(ll)(n)-1; i>=0; i--)
#define rep1r(i, n) for(ll i=(ll)(n); i>0; i--)
#define repr(i, a, b) for(ll i=(ll)b; i>=(ll)(a); i--)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) a * b / __gcd(a, b)
#define len(x) x.size()
#define Sort(x) sort(x.begin(), x.end())
#define rSort(x) sort(x.begin(), x.end(), greater<ll>())

const ll mod_const = 1000000007;

ll modpow(ll a, ll n, ll m) {
    ll result = 1;
    while(n > 0) {
        if(n&1) {
            result = result * a % m;
        }

    a = a * a % m;
    n >>= 1;
    }

    return result;
}

ll modinv(ll a, ll n) {
    if(a <= 1) {
        return 1;
    } else {
        return  n - modinv(n%a, n) * (n/a) % n;
    }
}

ll comb(ll n, ll r, ll m = mod_const) {
    vecll fac = {1, 1};
    vecll inv ={1, 1};
    vecll facinv = {1 , 1};

    rep(i, 2, n) {
        fac.push_back(fac[i-1] * i % m);
        inv.push_back(modinv(i, m));
        facinv.push_back(facinv[i-1] * inv[i] % m);
    }

    if (n<r || n<0 || r<0) {
        return 0;
    } else {
        return fac[n] * (facinv[r] * facinv[n-r] % m) % m;
    }
}
void solve() {

    ll n;
    cin >> n;

    switch(n%10) {
        case 2:
        case 4:
        case 5:
        case 7:
        case 9:
            cout << "hon" << endl;
            break;

        case 0:
        case 1:
        case 6:
        case 8:
            cout << "pon" << endl;
            break;

        case 3:
            cout << "bon" << endl;
            break;
    }
    

}

signed main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    solve();
    return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<vector>
#include<cassert>
using namespace std;
int main(){
  int n,index,bg;
  vector<int> dp[1024];
  for(int i=1;i<=1023;i++){
    if(!dp[i].empty())continue;
    if(i == 1 || i == 2 || i == 4 || i == 8 || i == 16 || i == 32 || i == 64 || i == 128 || i == 256 || i == 512){
      dp[i].push_back(i);
      continue;
    }  
    bg = i-1;
    for(int j=1;j<bg;j++){
      index = bg+j;
      for(int k=0;k<dp[j].size();k++){
	dp[index].push_back(dp[j][k]);
      }
      for(int k=0;k<dp[bg].size();k++){
	dp[index].push_back(dp[bg][k]);
      }
    }
  }

  while(cin >> n){
    assert(n<=1023);
    for(int i=0;i<dp[n].size();i++){
      cout << dp[n][i];
      i==dp[n].size()-1?cout << endl:cout << " ";
    }
  }
  return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
 
int c[11][11]={0};
int a[203][203]={0};
 
void warshall_floyd() {
    for (int k = 0; k < 10; k++)
        for (int i = 0; i < 10; i++)
            for (int j = 0; j < 10; j++)
                c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
}
 
int main(){
    int h, w;
    cin >> h >> w;
    for(int i=0;i<10;++i)
        for(int j=0;j<10;++j)
            cin >> c[i][j];
    for(int i=0;i<h;++i)
        for(int j=0;j<w;++j)
            cin >> a[i][j];
 
    warshall_floyd();
    int ans = 0;
    for(int i=0;i<h;++i){
        for(int j=0;j<w;++j){
            if(a[i][j] != -1)
                ans += c[a[i][j]][1];
        }
    }
 
    cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 384
//In The Name Of The God

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double
#define F first
#define S second
#define X first.first
#define Y first .second
#define A second.first
#define B second.second
#define mp make_pair
#define pb push_back
#define pf push_front
#define P push
#define pob pop_back
#define pof pop_front
#define PO pop
#define rep(i,j,k) for(int i = j ; i <= k ; ++ i)
#define rrep(i,j,k) for(int i = j ; i>=k ; --i)
#define FR(i,j,k) for(int i = j ; i < k ; ++ i )
#define rFR(i,j,k) for(int i = j ; i > k ; -- i )
#define lb(x) x&-x
#define p2(x) (1LL<<x)
#define SZ size()
#define LB lower_bound
#define UB upper_bound
#define IT iterator
#define RIT reverse_iterator
#define E end()
#define BE begin()
#define RE rend()
#define RBE rbegin()
#define UN unsigned

typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll ;
typedef pair<int,pii> pip;
typedef pair<pii,int> ppi;
typedef pair<pii,pii> ppp;
typedef pair<int,pll> pipl;
typedef pair<pll,int> ppli ;
typedef pair<pll,pll> plpl ;
typedef pair<ll,pii> lpip;
typedef pair<pii,ll> lppi;
typedef pair<pii,pii> lppp;
typedef pair<ll,pll> lpipl;
typedef pair<pll,ll> lppli ;
typedef pair<pll,pll> lplpl ;
typedef vector<int> vi ;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef set<int> sti;
typedef set<ll> stl;
typedef set<pii > stpi;
typedef set<pll> stpl;
typedef vi::IT vit;
typedef vl::IT vlt;
typedef vpi::IT vpit;
typedef vpl::IT vplt;
typedef sti::IT stit;
typedef stl::IT stlt;
typedef stpi::IT stpit;
typedef stpl::IT stplt;
typedef vpi::RIT rvpit;
typedef vpl::RIT rvplt;
typedef sti::RIT rstit;
typedef stl::RIT rstlt;
typedef stpi::RIT rstpit;
typedef stpl::RIT rstplt;

const int MAXN = 500000;
const int SUPERN = 5000000;
const int MAXS = 325;
const int SUPERS = 1000;
const int MD = 1e9+7;
//......Structures.......

//......Variables........
ll n,x,y,m;
vl ad[MAXN],v;
//......Funcs............
ll sum(ll a,ll b)
{
    return (a+b)%MD;
}
ll mu(ll a,ll b)
{
    return (a*b)%MD;
}
ll mn(ll a,ll b)
{
    return(a-b+MD)%MD;
}
//......Code.............
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cin>>n>>m;
    rep(i,1,m)
    {
        cin>>x>>y;
        ad[x].pb(y);
        ad[y].pb(x);
    }
    for(auto u:ad[1])
    {
        v.pb(u);
    }
    for(auto g:v)
    {
        for(auto u:ad[g])
        {
            if(u==n)
            {
                cout<<"POSSIBLE";
                return 0;
            }
        }
    }
    cout<<"IMPOSSIBLE";
    return 0;
}


Measured memory_bytes: 21352
while True:
  x,y,s=map(int,input().split())
  if x==0:
   break

  max=0
  for i in range(1,s):
      for j in range(i,s+1):
          mae=i*(100+x)//100+j*(100+x)//100
          if mae==s:
             ato=i*(100+y)//100+j*(100+y)//100
             if ato>max:
                max=ato
            
  print(max)


Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define square(x) pow(x,2.0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define max_queue(x) priority_queue<x>
#define min_queue(x) priority_queue<x, vector<x>, greater<x>>
#define big_sort(v) sort(all(v), [](int a, int b) { return a > b; })//大きい順にソート
using ll = long long;
using vi = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;
using vd = vector<long double>;
#define co(x) cout << x << endl;
#define cins(n,v) rep(i,n){cin >> v.at(i);}
#define couts(v) rep(i,v.size()){cout << v.at(i) << endl;}
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
/*
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
*/
int a[3005][3005];
ll dp[3005][3005][4];

int main() {
  int R, C, n;
  cin >> R >> C >> n;

  rep(i,n){
    int r,c,v;
    cin >> r>>c>>v;
    a[r-1][c-1]=v;
  }
  rep(i,R)rep(j,C){
    for(int k=2;k>=0;k--){
      chmax(dp[i][j][k+1], dp[i][j][k]+a[i][j]);
    }
    rep(k,4){
      chmax(dp[i+1][j][0], dp[i][j][k]);
      chmax(dp[i][j+1][k], dp[i][j][k]);
    }
  }
  ll ans=0;
  rep(k,4){
    chmax(ans, dp[R-1][C-1][k]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 320660
n = int(input())
aas = list(map(int, input().split()))
max_n = max(aas) + 1
cnts = [0]*(max_n)
for i in aas:
    cnts[i] += 1
res = 0
for i in range(max_n):
    if cnts[i] != 0:
        cnts[i] -= 1
    if cnts[i]%2 == 0:
        cnts[i] = 0
    elif cnts[i] >= 3:
        cnts[i] = 1
res = len(set(aas))
adj = sum(cnts)
print(res if adj == 0 else res-(adj%2!=0))

Measured memory_bytes: 98920
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<bitset>
#include<math.h>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
const int N=30000;
const db pi=acos(-1.0);
#define lowbit(x) ((x)&(-x))
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u],v=sq[i].to;i;i=sq[i].nxt,v=sq[i].to)
#define fir first
#define sec second
#define mkp make_pair
#define pb push_back
#define maxd 998244353
#define eps 1e-8
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

inline ll readll()
{
    ll x=0;int f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

bool used[N+100];

int main()
{
    int n=read(),sum=0,tot=0;
    rep(i,1,N)
        if ((i%2==0) || (i%3==0)) 
        {
            tot++;printf("%d ",i);used[i]=1;sum+=i;
            if (tot+1==n) break;
        }
    rep(i,1,N)
    {
        if ((!used[i]) && ((i+sum)%2==0) && ((i+sum)%3==0) && (__gcd(i,sum)!=1))
        {
            printf("%d ",i);break;
        }
    }
    return 0;
}

Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<iomanip>
#include<cassert>

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

	std::string s, t;
	char last_char_s;//最後の文字
	char last_char_t;
	bool flag = true;

	std::cin >> s >> t;

	while (s.length() > 0){
		//最後の文字を代入
		last_char_s = s[s.length() - 1];
		last_char_t = t[t.length() - 1];

		for (int i = s.length() - 2; i >= 0; i--){//後ろから前へ
			if ((last_char_s == s[i] && last_char_t != t[i]) || (last_char_s != s[i] && last_char_t == t[i])){//一致しないとき
				flag = false;
				//一致しないときはループを抜け出す
				break;
			}
			else if (last_char_s == s[i] && last_char_t == t[i]){
				//揃っていれば消去←計算量を減らす
				s.erase(s.begin() + i);
				t.erase(t.begin() + i);
			}
		}

		//一致しないときループを抜け出す
		if (flag == false){
			break;
		}

		//最後の文字も消去
		s.erase(s.begin() + s.length() - 1);
		t.erase(t.begin() + t.length() - 1);
	}

	if (flag == false){
		std::cout << "No\n";
	}
	else{
		std::cout << "Yes\n";
	}

	return 0;
}

Measured memory_bytes: 916
#include<stdio.h>

int A[50];

int fibo(int n){
if(n==0 || n==1)return A[n]=1;
if(A[n]!=-1)return A[n];
return A[n]=fibo(n-1)+fibo(n-2);

}

int main(){

    int n,i;
    for(i=0;i<50;i++)A[i]=-1;

    scanf("%d",&n);
    printf("%d\n",fibo(n));

    return 0;
}


Measured memory_bytes: 2108
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define eps 0.000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
vector<long long> wow[200000];
int match[200000] = {};
int main() {
#define int long long
	int n;
	cin >> n;
	for (int i = 0;i < n-1;++i) {
		int a, b;
		cin >> a >> b;
		wow[a].push_back(b);
		wow[b].push_back(a);
	}
	queue<int> gyao;
	match[1] = 1;
	match[n] = 2;
	gyao.push(1);
	gyao.push(n);
	while (gyao.empty() == false) {
		int hoge = gyao.front();gyao.pop();
		for (int i = 0;i < wow[hoge].size();++i) {
			if (match[wow[hoge][i]] == 0) {
				match[wow[hoge][i]] = match[hoge];
				gyao.push(wow[hoge][i]);
			}
		}
	}
	int cnt[2] = {};
	for (int i = 1;i <= n;++i) {
		if (match[i] == 1) {
			cnt[0]++;
		}
		else {
			cnt[1]++;
		}
	}
	if (cnt[0] <= cnt[1]) {
		cout << "Snuke" << endl;
	}
	else {
		cout << "Fennec" << endl;
	}
	return 0;
}

Measured memory_bytes: 9216
#include <iostream>
#include<string.h>
using namespace std;

void lcs(char *S1, char *S2, int m, int n)
{
  int LCS_table[m + 1][n + 1];

  for (int i = 0; i <= m; i++)
  {
    for (int j = 0; j <= n; j++)
    {
      if (i == 0 || j == 0)
        LCS_table[i][j] = 0;
      else if (S1[i - 1] == S2[j - 1])
        LCS_table[i][j] = LCS_table[i - 1][j - 1] + 1;
      else
        LCS_table[i][j] = max(LCS_table[i - 1][j], LCS_table[i][j - 1]);
    }
  }

  int index = LCS_table[m][n];
  char lcs[index + 1];
  lcs[index] = '\0';

  int i = m, j = n;
  while (i > 0 && j > 0)
  {
    if (S1[i - 1] == S2[j - 1])
    {
      lcs[index - 1] = S1[i - 1];
      i--;
      j--;
      index--;
    }

    else if (LCS_table[i - 1][j] > LCS_table[i][j - 1])
      i--;
    else
      j--;
  }

  cout << lcs << "\n";
}

int main()
{
  char S1[3005];
  char S2[3005];
  scanf("%s",S1);
  scanf("%s",S2);
  int m = strlen(S1);
  int n = strlen(S2);
  lcs(S1, S2, m, n);
}


Measured memory_bytes: 35456
import datetime
from decimal import Decimal, ROUND_DOWN
import heapq
from fractions import gcd
from functools import reduce
from collections import deque
# from math import factorial
import itertools
import collections
import math
import sys
sys.setrecursionlimit(2000000)
# import statistics
# import numpy as np
# n = int(input())
# n, m, p = list(map(int, input().split()))
# a = list(map(int, input().split()))
#
#  abc = [int(input()) for i in range(5)]
n = int(input())
#n, k = list(map(int, input().split()))
#A = list(map(int, input().split()))
# a = list(map(int, input().split()))
# data = [list(map(int, input().split())) for i in range(n)]
# q = int(input())
#s = list(map(int, input().split()))
# b = list(map(int, input().split()))
# ab_sorted = sorted(ab, key=lambda x: x[0])
#ab = [list(map(int, input().split())) for i in range(n)]
# print(min(15*n, 100*(n//10+1), 100*(n//10)+15*(n % 10)))
s = []
for i in range(n):
    s.append(input())
s_count = collections.Counter(s)
#s_list = list(s_count.items())

if 'AC' in s_count:
    print('AC x '+str(s_count['AC']))
else:
    print('AC x 0')

if 'WA' in s_count:
    print('WA x '+str(s_count['WA']))
else:
    print('WA x 0')

if 'TLE' in s_count:
    print('TLE x '+str(s_count['TLE']))
else:
    print('TLE x 0')

if 'RE' in s_count:
    print('RE x '+str(s_count['RE']))
else:
    print('RE x 0')


Measured memory_bytes: 17472
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,minimum,black,white;
  string S;
  cin >> N >> S;
  black = 0;
  white = 0;

  for(int i = 0;i < N;i++){
      if(S.at(i) == '.'){
          white ++;
      }
      else{
          black ++;
      }
  }
  
  int sum = white;
  minimum = min(black,white);
  //cout << minimum << endl;
  
  for(int i = 1;i < N;i++){
      if(S.at(i-1) == '.'){
          white --;
      }
      else if(S.at(i-1) == '#'){
          white ++;
      }
      minimum = min(minimum,white);
      //cout << minimum << endl;
  }

  cout << minimum << endl;
}


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

int main(void) {
	int summer, num;
	int sumwork = 0;
	cin >> summer >> num;
	vector<int> homework(num);
	for (int i = 0; i < num; i++) {
		cin >> homework.at(i);
		sumwork += homework.at(i);
	}
	if (sumwork <= summer) {
		cout << summer - sumwork << endl;
	}
	else {
		cout << -1 << endl;
	}
	return 0;
}


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

typedef long long ll;
const long long LINF = 1LL << 60;
const long long LMINF = 1LL << 63;
const int INF = 1 << 30;

#define REP(i,n) for(int i = 0;i < n;++i)
#define REPS(i,x) for(int i = 1;i <= (int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i >= 0;i--)
#define RREPS(i,x) for(int i=((int)(x));i > 0;i--)
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << ": " << x << "\n"

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



int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    ll n,k;
    cin >> n >> k;

    if(n % k == 0){
        cout << 0 << endl;
        return 0;
    }
    while(1){
        if(n < k){
            if(n < abs(n - k)){
                cout << n << endl;
            }else{
                cout << abs(n - k) << endl;
            }
            return 0;
        }
        n = abs(n - (k * (n / k))) ;
    }

    return 0;
}

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

int main() {
    string T;
    cin >> T;
    int length = (int)T.length();

    for (int i = 0; i < length; i++) {
        if (T[i] == '?')
            T[i] = 'D';
    }

    cout << T;

    return 0;
}

Measured memory_bytes: 3724
let readIntArray () =
    stdin.ReadLine().Split(" ") |> Array.map int

stdin.ReadLine()

()
|> readIntArray
|> Array.zip
<| (() |> readIntArray)
|> Array.map (fun (v, c) -> v - c)
|> Array.filter ((<) 0)
|> Array.sum
|> printfn "%d"


Measured memory_bytes: 30016
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
s = input()
dp = [[0]*(n+1) for _ in range(n+1)]
dp[1][1] = 1
M = 10**9+7
for i in range(2, n+1):
    v = 0
    if s[i-2]=="<":
        for j in range(1,i+1):
            # j: 最後の数
            dp[i][j] = v
            v += dp[i-1][j]
            v %= M
        dp[i][i] = v
    else:
        for j in range(i,1,-1):
            # j: 最後の数
            dp[i][j] = v
            v += dp[i-1][j-1]
            v %= M
        dp[i][1] = v
#     print(dp)
ans = 0
for item in dp[n]:
    ans += item
    ans %= M
print(ans)

Measured memory_bytes: 136864
#include<bits/stdc++.h>
using namespace std;
using i64 = int64_t;
#define rep(i,N) for(int (i)=0;(i)<(N);++(i))
using ld = long double;

int main(){
    int N;
    cin >> N;
    priority_queue<vector<ld>,vector<ld>,greater<ld>> que;

    rep(i,N){
        ld v;
        cin >> v;
        que.push(v);
    }

    ld ans = que.top();
    que.pop();

    while(!que.empty()){
        ans = (ans + que.top()) / 2;
        que.pop();
    }

    cout << setprecision(8) << ans << endl;
}


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

const int N = 1e5 + 10;

void doc() {
}
void solve() {
    int n,a,b;
    cin >> n >> a >> b;
    cout << min(a,b) << " " << max(0,a + b - n);
}
int main(){
    doc();
	solve();
}


Measured memory_bytes: 256
N = int(input())
# H = map(int, input().split())

ans = 0
cnt = 0

b = -1
for h in input().split():
    if b >= int(h):
        cnt += 1

    else :
        ans = max(cnt, ans)
        cnt = 0
    b = int(h)

ans = max(cnt, ans)
print(ans)


Measured memory_bytes: 11480
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>

using namespace std;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a < b&&b < c)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 3092
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

double x[8], y[8];

int city[8];
bool visited[8];

double distance(int i, int j) {
	return sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
}

double calc_length(int N) {
	double length = 0;
	for (int i = 0; i < N - 1; ++i) {
		length += distance(city[i], city[i + 1]);
	}
	return length;
}

double rec(int i, int N) {
	if (i == N) {
		return calc_length(N);
	}
	double sum = 0;
	for (int j = 0; j < N; ++j) if (!visited[j]) {
		visited[j] = true;
		city[i] = j;
		sum += rec(i + 1, N);
		visited[j] = false;
	}
	return sum;
}

int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; ++i) cin >> x[i] >> y[i];

	double div = 1;
	for (int i = 1; i <= N; ++i) div *= i;
	cout << setprecision(10) << rec(0, N) / div << endl;
	return 0;
}

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

using namespace std;

using ll = long long;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	ll a, b, c, d;
	cin >> n >> a >> b >> c >> d;
	n--;
	b -= a;
	d -= c;
	bool ans = false;
	for (int i = n; i >= 0; i -= 2) {
		if (b - c * i <= ((n - i) / 2 + i) * d && b - c * i >= ((n - i) / 2) * -d) {
			ans = true;
			break;
		}
		if (b + c * i >= ((n - i) / 2 + i) * -d && b + c * i <= ((n - i) / 2) * d) {
			ans = true;
			break;
		}
	}
	cout << (ans ? "YES" : "NO") << endl;
	return 0;
}

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

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

using namespace std;


int main()
{
    int n;
    cin>>n;
    int l[2*n];
    REP(i,2*n){
        cin>>l[i];
    }
    sort(l,l+2*n);
    int ans=0;
    REP(i,n){
        ans+=l[2*i];
    }

    cout<<ans<<endl;
}


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

int main()
{
    int a[5], f = 10, ans = 0;
    for(int i = 0; i < 5; i++){
        cin >> a[i];
        if(a[i]%10 != 0 && f > a[i]%10) f = (a[i]%10);
        double d = a[i];
        ans += 10 * ceil(d/10);
    }
    cout << ans-10+f << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int a = sc.nextInt();
	int b = sc.nextInt();
	int x,y;
		x=a*2+b*2;
		y=a*b;
		System.out.println(+ y + " " + x);
	
}

}

Measured memory_bytes: 17300
#include <iostream>
using namespace std;
int main ()
{
    string name;
    cin>>name;
    if (name=="SUN")
    {
        cout<<7;
    }
    else if (name=="MON")
    {
        cout<<6;
    }
    else if (name=="TUE")
    {
        cout<<5;
    }
    else if (name=="WED")
    {
        cout<<4;
    }
    else if (name=="THU")
    {
        cout<<3;
    }
    else if (name=="FRI")
    {
        cout<<2;
    }
    else
    {
        cout<<1;
    }
    return 0;

}

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

using namespace std;
typedef long long ll;

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

  vector<int> r;
  vector<int> g;
  vector<int> b;

  map<char, int> mp;
  mp['R'] = 4;
  mp['G'] = 2;
  mp['B'] = 1;

  for (int i = 0; i < n; ++i) {
    if (s[i] == 'R') r.push_back(i);
    else if (s[i] == 'G') g.push_back(i);
    else b.push_back(i);
  }

  ll ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      if (s[i] == s[j]) continue;
      int score = mp[s[i]] + mp[s[j]];
      int diff = j - i;
      int add = 0;
      if (score == 6) {
	int idx = lower_bound(b.begin(), b.end(), j + 1) - b.begin();
	add = b.size() - idx;
	if (binary_search(b.begin(), b.end(), j + diff)) add -= 1;
      } else if (score == 5) {
	int idx = lower_bound(g.begin(), g.end(), j + 1) - g.begin();
	add = g.size() - idx;
	if (binary_search(g.begin(), g.end(), j + diff)) add -= 1;
      } else {
	int idx = lower_bound(r.begin(), r.end(), j + 1) - r.begin();
	add = r.size() - idx;
	if (binary_search(r.begin(), r.end(), j + diff)) add -= 1;
      }
      ans += add;
    }
  }
  cout << ans << '\n';
  return 0;
}



Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <vector>
#include <cmath>
#include <cstdint>
#include <string>
#include <climits>
#include <queue>

using namespace std;

void sort(std::vector<int>& xs) {
  int swapCount = 0;
  for (int i = 0; i < xs.size(); ++i) {
    int m = i;
    for (int j = i + 1; j < xs.size(); ++j) {
      if (xs[j] < xs[m]) {
        m = j;
      }
    }
    if (i != m) {
      swap(xs[i], xs[m]);
      ++swapCount;
    }
  }

  for (int i = 0; i < xs.size(); ++i) {
    if (i != 0) cout << " ";
    cout << xs[i];
  }
  cout << endl;
  cout << swapCount << endl;
}

int main() {
  int n;
  cin >> n;
  std::vector<int> xs(n);
  for (int i = 0; i < n; ++i) {
    cin >> xs[i];
  }
  sort(xs);
}



Measured memory_bytes: 3088
// https://atcoder.jp/contests/abc128/tasks/abc128_b
#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;
  vector<tuple<int, string, int>> p1(N);
  rep(i, N) {
    int n;
    cin >> get<1>(p1.at(i)) >> n;
    get<0>(p1.at(i)) = -n;
    get<2>(p1.at(i)) = i + 1;
  }
  sort(p1.begin(), p1.end());

  vector<tuple<string, int, int>> p2(N);
  rep(i, N) {
    get<0>(p2.at(i)) = get<1>(p1.at(i));
    get<1>(p2.at(i)) = get<0>(p1.at(i));
    get<2>(p2.at(i)) = get<2>(p1.at(i));
  }
  sort(p2.begin(), p2.end());

  rep(i, N) cout << get<2>(p2.at(i)) << endl;
  return 0;
}


Measured memory_bytes: 256