akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main()
{
  string b;
  cin >> b;
  int c ;
  c =b.size();
  b= b + ' ' + ' '+ ' '+ ' ' + ' '+ ' ' + ' '+ ' '+ ' '+ ' '+ ' ';
  int i = 0;
  int flag = 0;
  while (1)
  {
    if ((b.at(i) == 'd') && (b.at(i+1) == 'r') && (b.at(i+2) == 'e') && (b.at(i+3) == 'a') && (b.at(i+4) == 'm') && (b.at(i+5) == 'e') && (b.at(i+6) == 'r') )
    {
    if ((b.at(i+5) == 'e') && (b.at(i+6) == 'r') && (b.at(i+7) == 'a') && (b.at(i+8) == 's') && (b.at(i+9) == 'e') && (b.at(i+10) == 'r'))
    {
        i=i+11;
        continue ;
    }
      else 
      {
        if  ((b.at(i+5) == 'e') && (b.at(i+6) == 'r') && (b.at(i+7) == 'a') && (b.at(i+8) == 's') && (b.at(i+9) == 'e'))
        {  
          i=i+10;
          continue ;
        }
      }
    }
    if ((b.at(i) == 'd') && (b.at(i+1) == 'r') && (b.at(i+2) == 'e') && (b.at(i+3) == 'a') && (b.at(i+4) == 'm') && (b.at(i+5)== 'e' ) && (b.at(i+6)=='r' ))
    {
      i=i+7;
      continue ;
    }



      if ((b.at(i) == 'd') && (b.at(i+1) == 'r') && (b.at(i+2) == 'e') && (b.at(i+3) == 'a') && (b.at(i+4) == 'm'))
        {
          i=i+5;
        continue;
        }
      else
      {
        if ((b.at(i) == 'e') && (b.at(i+1) == 'r') && (b.at(i+2) == 'a') && (b.at(i+3) == 's') && (b.at(i+4) == 'e') && (b.at(i+5) == 'r'))
        {
          i=i+6;
          continue;
        }
          else
          {
                  if ((b.at(i) == 'e') && (b.at(i+1) == 'r') && (b.at(i+2) == 'a') && (b.at(i+3) == 's') && (b.at(i+4) == 'e'))
                  {
                    i=i+5;
                    continue;
                  }
            else
            {
              if (c == i )
              {
                break;
              }                                       
            else
            {
              flag = 1;
              break;
            }
          }
        
      }
    }
  }
  if (flag == 0)
  {
    cout << "YES" << endl;
  }
  else
  {
    cout << "NO" <<endl;
  }
}


Measured memory_bytes: 3744
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using G = vector<vector<int>>;
    
int main(){
    int x, n;
    cin >> x >> n;
    vector<int> p(102, 0);
    rep(i,n) {
        int pi;
        cin >> pi;
        p[pi] = 1;
    }
    if(n==0 || p[x]==0) cout << x << endl;
    else {
        int ans = 1001001;
        for(int i=0; i<102; i++){
            if(p[i]==0){
                if(abs(i-x)<abs(ans-x)) ans = i;
            }
        }
        cout << ans << endl;
    }
    

    return 0;
}

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

typedef long long ll;

template <typename Head> void print(Head&& head) { std::cout << head << std::endl; }

int main()
{
  ll N, K;
  std::cin >> N >> K;
  std::vector< ll > va(N, 0LL);
  for (ll i = 0; i < N; i++) {
    std::cin >> va[i];
  }

  ll ans = ((N - 1) + (K - 1) - 1) / (K - 1);
  print(ans);

  return 0;
}


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

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

/*
 * Modint struct
 * library author : @snuke
 * */
const int mod = 1e9 + 7;
struct mint {
  long long x; // typedef long long ll;
  mint(long long x=0):x((x%mod+mod)%mod){}
  mint& operator+=(const mint a) { if((x+=a.x)>=mod)x-=mod;return *this;}
  mint& operator-=(const mint a) { if((x+=mod-a.x)>=mod)x-=mod; return *this;}
  mint& operator*=(const mint a) { (x *=a.x)%=mod; return *this;}
  mint operator+(const mint a) const { mint res(*this);return res+=a;}
  mint operator-(const mint a) const { mint res(*this);return res-=a;}
  mint operator*(const mint a) const { mint res(*this);return res*=a;}
  mint pow(ll t) const {
    if (!t) return 1;mint a = pow(t>>1);a*=a;
    if (t&1) a *= *this;return a;
  }
  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return (*this) *= a.inv();}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

struct Combination{
  const int MAX = 500050;
  vector<mint> fact,finv;
  Combination():fact(MAX),finv(MAX){
    for(int i = 0;i < MAX;i++){
      if(i == 0) fact[i] = (mint)1;
      else fact[i] = fact[i-1] * (mint)i;
    }
    finv[MAX - 1] = fact[MAX - 1].inv();
    for(int i = MAX - 2;i >= 0;i--){
      finv[i] = finv[i+1] * (mint)(i + 1);
    }
  }
  mint comb(int n,int r){
    if(n < 0 || r < 0 || n < r) return 0;
    else return fact[n] * finv[n-r] * finv[r];
  }
} C;

ll h,w,a,b;
void read(){
  cin >> h >> w >> a >> b;
}

mint ans;

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

  for(int i = 0;i <= h - a - 1;i++){
    ans += C.comb(i + b - 1 , i) * C.comb(w - b - 1 + h - i - 1,h - i - 1);
  }

  cout << ans << '\n';

  return 0;
}

Measured memory_bytes: 10964
class UnionFind:
    def __init__(self, size):
        self.parent = [-1 for i in range(size)]#非負なら親ノード，負ならグループの要素数

    def root(self, x): #root(i): $i$の根ノードを返す．
        if self.parent[x] < 0:
            return x
        else:
            self.parent[x] = self.root(self.parent[x]) #xをxの根に直接つなぐ
            return self.parent[x]

    def union(self, x, y): #union(i,j): $i$のいるグループと$j$のいるグループをまとめる
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return False
        if self.parent[x] > self.parent[y]: #xの要素数がyの要素数より「小さい」とき
            x,y=y,x
        self.parent[x] += self.parent[y] #xの要素数を更新
        self.parent[y] = x #yをxにつなぐ
        return True

    def same(self, x, y): #same(i,j): $i$と$j$ が同じグループにあるならTrue，違うならFalse
        return self.root(x) == self.root(y)
        
    def size(self,x): #size(i): $i$のいるグループの要素数を返す
        return -self.parent[self.root(x)]
#>>>>>>>>>>>>>>EhdCutHere>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

n,m = list(map(int,input().split()))
p = list(map(lambda x: int(x)-1,input().split()))

uf = UnionFind(n)
for i in range(m):
    x,y=list(map(int,input().split()))
    uf.union(x-1,y-1)

ans = 0
for i in range(n):
    if uf.same(i,p[i]):
        ans += 1

print(ans)
#print([uf.root(i) for i in range(n)])
#print([uf.parent[i] for i in range(n)])
#print([uf.size(i) for i in range(n)])



Measured memory_bytes: 15860
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <map>
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

const int N = 3e4 + 5;
char a[110];
int main(){
	int n;
	scanf("%d", &n);
		for(int i = 0; i < n; i++)
			scanf("%c", &a[i]);
		int flag = 0;
		for(int i = 0; i < n; i++){
			if(a[i] == 'Y'){
				flag++;
			}
		}
		if(flag == 0)
			printf("Three\n");
		else
			printf("Four\n");
}

Measured memory_bytes: 256
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
n = int(input())
x = list(map(int, input().split()))
# 体力総和最小値となる座標Pを求める
p = Decimal(str(sum(x)/n)).quantize(Decimal('0'), rounding=ROUND_HALF_UP)
# 座標Pの時の体力の総和を求める
ans = 0
for i in range(n):
    ans += (x[i - 1] - p) ** 2
print(ans)

Measured memory_bytes: 61712
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;

int keta(ll n) {
    int cnt = 0;
    while (n) {
        n /= 10;
        cnt++;
    }
    return cnt;
}
int main()
{
    ll N;
    cin >> N;

    int ans = 1e9;
    for (ll i = 1; i * i <= N; i++) {
        if (N % i) continue;
        chmin(ans, max(keta(i), keta(N / i)));
    }

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

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

typedef long long ll;

/* メモリ食い過ぎ注意 */
#define int ll
#define ALL(v) v.begin(), v.end()
#define _REP(i, n) for (int i = 0; i < n; i++)
#define REP(n) _REP(i, n)

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

signed main()
{
    string s;
    cin >> s;

    bool yymm = false;
    bool mmyy = false;
    int tmp = (s[0] - '0') * 10 + (s[1] - '0');
    int tmp2 = (s[2] - '0') * 10 + (s[3] - '0');

    if (tmp >= 1 && tmp <= 12)
        mmyy = true;
    if (tmp2 >= 1 && tmp2 <= 12)
        yymm = true;

    if (mmyy && yymm)
        cout << "AMBIGUOUS" << endl;
    else if (mmyy)
        cout << "MMYY" << endl;
    else if (yymm)
        cout << "YYMM" << endl;
    else
        cout << "NA" << endl;
}


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

int main() {
    int N, M;
    cin >> N >> M;
    int c1, c2;
    vector<int> ans(N, 0);

    for (int i = 0; i < M; ++i)
    {
        cin >> c1 >> c2;
        ans.at(c1-1) += 1;
        ans.at(c2-1) += 1;
    }

    for (int j = 0; j < ans.size(); ++j)
    {
        cout << ans.at(j) << endl;
    }
    
}


Measured memory_bytes: 256
#include<iostream>
typedef long long int ll;
using namespace std;
int main()
{
	ll n,k,c=0;
	cin>>n;
	for(ll i=1;i<=n;i++)
	{
		cin>>k;
		if(k%2==1&&i%2==1)
		c++;
	}
	cout<<c<<endl;
}

Measured memory_bytes: 3616
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

const long long INF = 0x3f3f3f3f3f3f3f3fLL;

long long n , s , n_s , t , rem , ans;
int tmp , cnt;

bool judge(long long b) {//判断b进制下的各位和是否等于s
    rem = n;
    t = 0;
    while(rem > 0) {
        t += rem % b;
        rem /= b;
    }
    return t == s;
}

void solve() {
    tmp = sqrt(0.0 + n);
    n_s = n - s;
    ans = (n == s ? n + 1 : INF);
    for(int i = 2 ; i <= tmp ;++i) {//枚举到sqrt(n)
        if(judge(i)) {
            ans = min(ans , (long long) i);
        }
        if(n_s % i == 0 && n_s / i + 1 > tmp && judge(n_s / i + 1)) {//枚举所有的大于sqrt(b)且是n-s的因子的数
            ans = min(ans , n_s / i + 1);
        }
    }
    if(n_s + 1 > tmp && judge(n_s + 1)) {
        ans = min(ans , n_s + 1);
    }
    printf("%lld\n" , ans == INF ? -1 : ans);
}

int main() {
    while(2 == scanf("%lld%lld", &n, &s)) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 128
// Problem : C - /\/\/\/
// Contest : AtCoder - AtCoder Beginner Contest 111
// URL : https://atcoder.jp/contests/abc111/tasks/arc103_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,b,a) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define bug(x) cout<<#x<<"="<<x<<endl; 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy
 
int main() 
{
	// && has higher precedence than ||
	ios_base::sync_with_stdio(0); cin.tie(0);    
	int N;
	cin>>N;
	map<int,int> m0,m1;
	vpi v0,v1;
	F0R(x,N)
	{
		int nb;
		cin>>nb;
		if(x%2==0)
			m0[nb]++;
		else
			m1[nb]++;
	}
	// int a0=-1,a1=-1;
	for(auto i:m0)
	{
		v0.pb({i.s,i.f});
	}
	for(auto i:m1)
	{
		v1.pb({i.s,i.f});
	}
	sort(v0.rbegin(),v0.rend());
	sort(v1.rbegin(),v1.rend());
	if(v0[0].s!=v1[0].s)
	{
		cout<<N/2-v0[0].f+N/2-v1[0].f<<nl;
	}
	else if(sz(v0)==1 && sz(v1)==1)
	{
		cout<<N/2<<nl;
		// return 0;
	}
	else if(sz(v0)==1)
	{
		cout<<N/2-v1[1].f<<nl;
		// return 0;
	}
	else if(sz(v1)==1)
	{
		cout<<N/2-v0[1].f<<nl;
		// return 0;
	}
	else
	{
		int ans=min(N/2-v0[0].f+N/2-v1[1].f,N/2-v0[1].f+N/2-v1[0].f);
		cout<<ans<<nl;
	}
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 8968
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.ascii;
void times(alias pred)(int n) {
    foreach(i; 0..n) pred();
}
auto rep(alias pred, T = typeof(pred()))(int n) {
    T[] res = new T[n];
    foreach(ref e; res) e = pred();
    return res;
}

void main() {
  int N, M;
  readf("%d %d\n", &N, &M);

  auto set = DisjointSet(N);
  int[] ary = M.rep!(() => -1);
  foreach(i; 0..N) {
    readln.split[1..$].to!(int[]).map!"a-1".each!((j) {
      if (ary[j] >=0) set.unite(ary[j], i);
      ary[j] = i;
    });
  }

  size_t[] res = N.iota.map!(i => set.findSet(i)).array;
  writeln(res.all!(a => a==res.front) ? "YES":"NO");
}

// 互いに素な集合
// UnionFindTreeによる実装
struct DisjointSet {

private:
    Vertex[] _vertices;

public:
    this(size_t size) {
        _vertices = new Vertex[size];
        foreach(i, ref v; _vertices) {
            v.index = i;
            v.parent = i;
        }
    }

    void makeSet(size_t[] indices...) {
        foreach(index; indices) {
            _vertices[index] = Vertex(index, index);
        }
    }

    void unite(size_t x, size_t y) {
        link(findSet(x), findSet(y));
    }

    void link(size_t x, size_t y) {
        if (x==y) return;
        if (_vertices[x].rank > _vertices[y].rank) {
            _vertices[y].parent = x;
        } else {
            _vertices[x].parent = y;
            if (_vertices[x].rank == _vertices[y].rank) {
                _vertices[y].rank++;
            }
        }
    }

    bool same(size_t x, size_t y) {
        return findSet(x) == findSet(y);
    }

    size_t findSet(size_t index) {
        if (_vertices[index].parent == index) {
            return index;
        } else {
            return _vertices[index].parent = findSet(_vertices[index].parent);
        }
    }

private:
    struct Vertex {
        size_t index;
        size_t parent;
        size_t rank = 1;
    }
}


Measured memory_bytes: 4732
# ABC125C - GCD on Blackboard
# Accumulative GCD
from fractions import gcd

n = int(input())
a = list(map(int, input().rstrip().split()))

left = [0] * (n + 1)
right = [0] * (n + 1)
for i in range(n):
    left[i + 1] = gcd(left[i], a[i])
    right[n - i - 1] = gcd(right[n - i], a[n - i - 1])

ans = 0
for i in range(n):
    ans = max(ans, gcd(left[i], right[i + 1]))
print(ans)

Measured memory_bytes: 16144
#include <iostream>

using namespace std;

int main()
{string s;
int c=0,cc=0,a=0;
cin>>s;
if(s[0]!='A'||s[1]=='C'){cout<<"WA"<<endl;}
else{
for(int i=2;i<s.size()-1;i++){
    if(s[i]=='C'){c++;}


}
for(int i=0;i<s.size();i++){
    if(s[i]>96&&s[i]<123){a++;}
}

if(c==0||c>1||(a!=s.size()-2)){cout<<"WA"<<endl;}
else{cout<<"AC"<<endl;}
}
    return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <set>

using namespace std;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  int pos;
  for (int i=0; i<N; i++) {
    cin >> A.at(i);
    if (A.at(i) == 1) {
      pos = i;
    }
  }
  int numRep = N-1;
  int ans;
  if (numRep%(K-1) == 0) {
    ans = numRep/(K-1);
  } else {
    ans = numRep/(K-1) + 1;
  }
  cout << ans << endl;
}

Measured memory_bytes: 768
#include <iostream>
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
int main(void)
{
	int N, M; cin >> N; vector<int>arr(1, -114514);
	vector<string> ar(1);
	for (int i = 0; i < N; i++)
	{
		string aaaa; cin >> aaaa;
		for (int j = 0; j < ar.size(); j++)
		{
			if (ar[j] == aaaa)
			{
				arr[j]++;
				break;
			}
			if (j == ar.size() - 1)
			{
				ar.push_back(aaaa);
				arr.push_back(1);
			}
		}
	}
	cin >> M;
	for (int i = 0; i < M; i++)
	{
		string aaaa; cin >> aaaa;
		for (int j = 0; j < ar.size(); j++)
		{
			if (ar[j] == aaaa)
			{
				arr[j] --;
				break;
			}
		}
	}
	int count = -114514;
	for (int i = 0; i < arr.size(); i++)
	{
		count = max(count, arr[i]);
	}
	cout << max(count-1, 0) << "\n";
}

Measured memory_bytes: 256
#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_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
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;

ll n,q;
string s;
vector<pair<char,char>> com;

//left -1 mid 0 right 1
ll where(ll w){
    if(w>=n){return 1;}
    if(w<0){return -1;}
    for(auto &I:com){
        if(s[w]==I.F){
            if(I.S=='R'){w++; if(w==n){return 1;}}
            if(I.S=='L'){w--; if(w==-1){return -1;}}
        }
    }
    return 0;
}


int main(){
    cin>>n>>q;
    cin>>s;
    com.resize(q);
    for(auto &I:com){cin>>I.F>>I.S;}
    ll l=0,r=n;
    while(r-l>3){
        ll m=l+(r-l)/2;
        if(where(m)==-1){l=m+1;}
        else{r=m+1;}
    }
    ll L=E;
    for(ll i=l;i<=r;i++){
        if(where(i)!=-1){L=i; break;}
    }
    l=-1; r=n;
    ll R=E;
    while(r-l>3){
        ll m=l+(r-l)/2;
        if(where(m)==1){r=m;}
        else{l=m;}
    }
    for(ll i=r;i>=l;i--){
        if(where(i)!=1){R=i; break;}
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        if(L<=i && i<=R){ans++;}
    }
    cout<<ans<<endl;
    
    
    return 0;
}


Measured memory_bytes: 1028
import Text.Regex
import Data.List
main = do
  s <- getLine
  putStrLn $ aux s

aux :: String -> String
aux s = intercalate " " $ map show $ sort [a,b,c]
  where
    [a,b,c] = map (\x -> read x :: Int) $ splitRegex (mkRegex " +") s

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

int main() {
	int num1, num2, num3;
	cin >> num1 >> num2 >> num3;

	if( num1 < num2 && num2 < num3 ){
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
	return 0;
}

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

int main() {
	int N;
	cin >> N;
	int ans = 30;
	for (int i=0; i<N; i++) {
		int A;
		cin >> A;
		int cnt = 0;
		while (A % 2 == 0) {
			cnt++;
			A /= 2;
		}
		ans = min(ans, cnt);
	}
	cout << ans << endl;
}


Measured memory_bytes: 3604
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue>
#include <algorithm>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef pair<int, int> P;
const int c_INF = 111111111;
const int c_mINF = -111111111;
const int c_YET = -1;
const int c_Dx[4] = { 0,0,1,-1 };
const int c_Dy[4] = { 1,-1,0,0 };
const int c_div = 1000000007; //10^9 + 7


int main() {


	char b;
	scanf("%c", &b);

	if (b == 'A')printf("T");
	else if (b == 'T')printf("A");
	else if (b == 'G')printf("C");
	else if (b == 'C')printf("G");






}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main () 
{
  string s,t;cin>>s>>t;
  ll l=s.length(),count=0;
  for (ll i=0;i<l;i++) {
      if (s[i]!=t[i]) {count++;}
  }
  cout<<count<<endl;
}

Measured memory_bytes: 3856
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;

struct point{
	double x;
	double y;	
};

void print_point(point a){
	printf("%.8f %.8f\n",a.x,a.y);
	return ;
}

void koch(int n ,point a ,point b){
	if(n==0) return ;
	point c,d,e;
	c.x=a.x+(b.x-a.x)/3;
	c.y=a.y+(b.y-a.y)/3;
	e.x=a.x+2*(b.x-a.x)/3;
	e.y=a.y+2*(b.y-a.y)/3;
	d.x=c.x+(e.x-c.x)*cos(M_PI*60/180)+(e.y-c.y)*(-sin(M_PI*60/180));
	d.y=c.y+(e.x-c.x)*sin(M_PI*60/180)+(e.y-c.y)*cos(M_PI*60/180);
	koch(n-1,a,c);
	print_point(c);
	koch(n-1,c,d);
	print_point(d);
	koch(n-1,d,e);
	print_point(e);
	koch(n-1,e,b);
	return;	
}

int main (){
	int n ;
	cin>>n;
	point a,b;
	a.x=0;a.y=0;
	b.x=100;b.y=0;
	print_point(a);
	koch(n,a,b);
	print_point(b);
	return 0;
}


Measured memory_bytes: 3184
#include <bits/stdc++.h>
using namespace std;
#define fori(i, a, b) for(int i = (int) a; i <= (int) b; ++i)
#define rofi(i, b, a) for(int i = (int) b; i >= (int) a; --i)
#define foreach(tt, a) for(auto &tt: a)
#define all(a) begin(a), end(a)
#define csz(a) (int) a.size()
#define pb push_back
#define epb emplace_back
#define mp make_pair
#define load(a, v) fill(begin(a), end(a), v)
#define load_mem(a, v) memset(a, v, sizeof(a));
#define iostream_optimize() ios::sync_with_stdio(false); cin.tie(0);
using ll = long long;
const ll MOD = 1e9+7, LINF = 1e16+1;
const int INF = 1e9+1;
const double EPS = 1e-10;
const int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, 1, 0, -1};
const ll P1 = 31, P2 = 37, M1 = 1e9+7, M2 = 1e9+9;

/* <<<<<<<<<<<<<<<<<<<<<<<<<<<< END TEMPLATE >>>>>>>>>>>>>>>>>>>>>>>>>>> */

int n;
ll ans;
string s;
map<pair<ll, ll>, int> lf_hsh[20][20];
ll modPow(ll b, ll e, ll mod) {
	if(e == 0) return 1;
	if(e == 1) return b;
	return modPow(b*b % mod, e >> 1, mod) * modPow(b, e & 1, mod) % mod;
}
int main() {
	iostream_optimize();
	cin >> n >> s;
	fori(mask, 0, (1 << n) - 1) {
		ll Rl1 = 0, Rl2 = 0, Bl1 = 0, Bl2 = 0;
		fori(i, 0, n-1) if(mask >> i & 1) {
			Rl1 = Rl1 * P1 + (s[i] - 'a' + 1);
			Rl2 = Rl2 * P2 + (s[i] - 'a' + 1);
			Rl1 %= M1;
			Rl2 %= M2;
		}
		rofi(i, n-1, 0) if(!(mask >> i & 1)) {
			Bl1 = Bl1 * P1 + (s[i] - 'a' + 1);
			Bl2 = Bl2 * P2 + (s[i] - 'a' + 1);
			Bl1 %= M1;
			Bl2 %= M2;
		}
		int Rrlen = n - __builtin_popcount(mask);
		pair<ll, ll> ins = {(Rl1 * modPow(P1, Rrlen, M1) % M1 - Bl1 + M1) % M1, (Rl2 * modPow(P2, Rrlen, M2) % M2 - Bl2 + M2) % M2};
		++lf_hsh[Rrlen][n - __builtin_popcount(mask)][ins];
		// cout << mask << ' ' << Rl1 << ' ' << Bl1 << ' ' << Rrlen << ' ' << (Rl1 * Rrlen % M1 - Bl1 + M1) % M1<< endl;
	}
	fori(mask, 0, (1 << n) - 1) {
		ll Br1 = 0, Br2 = 0, Rr1 = 0, Rr2 = 0;
		fori(i, n, 2*n-1) if(mask >> (i-n) & 1) {
			Rr1 = Rr1 * P1 + (s[i] - 'a' + 1);
			Rr2 = Rr2 * P2 + (s[i] - 'a' + 1);
			Rr1 %= M1;
			Rr2 %= M2;
		}
		rofi(i, 2*n-1, n) if(!(mask >> (i-n) & 1)) {
			Br1 = Br1 * P1 + (s[i] - 'a' + 1);
			Br2 = Br2 * P2 + (s[i] - 'a' + 1);
			Br1 %= M1;
			Br2 %= M2;
		}
		int Bllen = __builtin_popcount(mask);
		pair<ll, ll> query = {(Br1 * modPow(P1, Bllen, M1) % M1 - Rr1 + M1) % M1, (Br2 * modPow(P2, Bllen, M2) % M2 - Rr2 + M2) % M2};
		ans += lf_hsh[__builtin_popcount(mask)][Bllen][query];
		// cout << mask << ' ' << Rr1 << ' ' << Br1 << ' ' << Bllen << ' ' << lf_hsh[__builtin_popcount(mask)][Bllen][query] << endl;
	}
	cout << ans;
}


Measured memory_bytes: 33024
#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265358979323
#define ll long long int
#define vi vector <int>
#define vl vector <ll>
#define all(v) (v).begin(),(v).end()
#define pb push_back
 
ll power(ll a, ll b){//a^b
    ll res=1;
    while(b>0){
        if(b&1){res=(res*a);b--;}
        a=(a*a);
        b>>=1;
    }
    return res;
}
 
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
 
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin>>n;
	ll d=1000-(n%1000);
	if(n%1000==0)	
		cout<<"0";
	else
		cout<<d<<"\n";
}

Measured memory_bytes: 3636
#include <cstdio>
#include <algorithm>
using namespace std;
int color[10005],leng,go;
int ens(int h,int yu){
	color[h]=yu;
	int a=h,b=h;
	bool w=true;
	int s=0,u=0,ans=leng;
	while(1){
	int c=a,d=b;
	while(a>=1){
		if(color[a]==color[c]){
			s++;
			a--;
		}else{
			break;
		}
	}
	while(b<=leng){
		if(color[b]==color[d]){
			u++;
			b++;
		}else{
			break;
	}
	}
	if(w){
		if(s+u>=5){
				ans-=(s+u-1);
				s=0;
				u=0;
				w=false;
		}
		if(w){
			return ans;
			break;
		}
	}else{
		if(s+u>=4){
			if(color[c]==color[d]){
				ans-=(s+u);
				s=0;
				u=0;
			}else{
				return ans; break;
			}
	}else{
		return ans; break;
		}
	}

}
}
	int main(){
		while(1){
		int num;
		scanf("%d",&leng);
		if(leng==0) break;
		num=100000;
		for(int i=1;i<=leng;i++){
			scanf("%d",&color[i]);
		}
		color[0]=color[2];
		color[leng+1]=color[leng-1];
		for(int i=1;i<=leng;i++){
			go=color[i];
			num=min(num,ens(i,1));
			num=min(num,ens(i,2));
			num=min(num,ens(i,3));
			color[i]=go;
		}
		printf("%d\n",num);
	}
		return 0;
	}

Measured memory_bytes: 1064
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define BUF_SIZE 500

int get_int(void) {
  int num;
#ifdef BUF_SIZE
  char line[BUF_SIZE];
  if(!fgets(line, BUF_SIZE, stdin)) return 0;
  sscanf(line, "%d", &num);
#else
#error
#endif
  return num;
}

// u k v_1 v_2
int fget_array(int *arr, int* size, int *id) {
#ifdef BUF_SIZE
    char line[BUF_SIZE];
    int i;
    char *tmp;
    if(!fgets(line, BUF_SIZE, stdin)) return -1;
    tmp = strtok(line, " ");
    int u = strtol(tmp, NULL, 10);
    tmp = strtok(NULL, " ");
    int k = strtol(tmp, NULL, 10);
    for(i = 0; i < k; i++) {
        tmp = strtok(NULL, " ");
        arr[i] = strtol(tmp, NULL, 10);
    }
    *id = u; *size = k;
#else
#error
#endif
    return 0;
}

#define VERTEX_MAX 100

int passed[VERTEX_MAX+1];
int finished[VERTEX_MAX+1];
int idx = 1;
int dfs(char table[][VERTEX_MAX+1], int vs, int start) {
#ifdef DEBUG
    printf("start: %d\n", start);
#endif
    int dst;
    passed[start] = idx++;
    for(dst = 1; dst <= vs; dst++) {
        if(!table[start][dst]) continue;
        if(passed[dst]) continue;
        dfs(table, vs, dst);
    }
    finished[start] = idx++;
    return 0;
}

int main(void) {
    int vs = get_int();
    static char table[VERTEX_MAX+1][VERTEX_MAX+1];
    int i, j;
    for(i = 0; i < vs; i++) {
        int arr[VERTEX_MAX];
        int size, id;
        fget_array(arr, &size, &id);
        for(j = 0; j < size; j++) {
            table[id][arr[j]] = 1;
        }
    }
    for(i = 1; i <= vs; i++) {
        if(!passed[i]) {
#ifdef DEBUG
            printf("%d DFS\n", i);
#endif
            dfs(table, vs, i);
        }
    }
    for(i = 1; i <= vs; i++) {
        printf("%d %d %d\n", i, passed[i], finished[i]);
    }
    return 0;
}


Measured memory_bytes: 2056
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>
#include <numeric>

using namespace std;
typedef long long int ll;
typedef long double ld;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }                   // 最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); };                      // 最小公倍数
ll getDigit(ll num) { return log10(num) + 1; }                         // 桁数
ll digitSum(ll n) { return (n < 10) ? n : digitSum(n / 10) + n % 10; } // 各桁の和
#define MOD 1e9 + 7
#define pb push_back
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repn(i, n) for (ll i = 1; i <= n; i++)
#define repi(i, a, b) for (ll i = ll(a); i < ll(b); ++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265359

template <typename T>
void printVector(string name, vector<T> vec)
{
    cout << name << ": ";
    rep(i, vec.size())
    {
        cout << vec[i] << " ";
    }
    cout << endl;
}

void Main()
{
    double a, b, v, w, t;
    cin >> a >> v >> b >> w >> t;

    double d = abs(b - a);
    double s = w - v;

    if (s >= 0)
    {
        cout << "NO" << endl;
    }
    else
    {
        double u = d / s;
        if (fabs(u) <= t)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }

    return;
}

signed main(void)
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3800
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> p2;
void solve(){
	ll n,k;
	cin>>n>>k;
	cout<<min(n%k,k-n%k);
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll qc=1;
	for(ll i=1;i<=qc;i++)
	solve();
}


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

int H,W;
vec t;
map< vec , int > dp[10][10];

int mem[10][10][10][10];

bool check(int ay,int ax,int by,int bx){
  if(mem[ay][ax][by][bx]!=-1)
    return mem[ay][ax][by][bx];

  mem[ay][ax][by][bx]=false;
  for(int y=ay;y<=by;y++)
    for(int x=ax;x<=bx;x++)
      if( (t[y]>>x&1)==0 )return false;

  mem[ay][ax][by][bx]=true;
  return true;
}

int solve(vec p,int y,int x){
  if(y==H)return 0;
  
  if(x==W){
    return solve(p,y+1,0);
  }
  
  if(dp[y][x].count(p))return dp[y][x][p];
  int sum=0;
  for(int i=0;i<H;i++)sum+=p[i];
  if(sum==0)return 0;
  

  int res=1e9;
  if((p[y]>>x&1)==0)res=solve(p,y,x+1);

  for(int i=0;;i++){
    if(y+i>=H||x+i>=W)break;
    if(!check(y,x,y+i,x+i))break;
    if( y+i+1<H && x+i+1<W &&check(y,x,y+i+1,x+i+1))continue;
    int ma=(1<<(i+1))-1;
    vec next=p;
    for(int j=0;j<=i;j++){
      next[y+j]|=(ma<<x);
      next[y+j]-=(ma<<x);
    }

    if(p==next)continue;
    res=min(res,solve(next,y,x+1)+1);
  }

  return dp[y][x][p]=res;
}

int main(){
  while(1){
    cin>>W>>H;
    if(H==0&&W==0)break;
    memset( mem, -1, sizeof(mem) );
    vec si;
    for(int i=0;i<H;i++){
      int bit=0,a;
      for(int j=0;j<W;j++){
        dp[i][j].clear();
        
        cin>>a;
        if(a==1)bit|=(1<<j);
      }
      si.push_back(bit);
    }
    t=si;
    cout<<solve(si,0,0)<<endl;
  }
  return 0;
}

Measured memory_bytes: 2472
# coding:utf-8
# AAAAAAAAAAAAA

import math
import re

def main(params):
    a,p = [int(i) for i in params[0].split()]
    t = (a * 3 + p) / 2
    print t


if __name__ == "__main__":
    cnt = 1 # TODO: edit here
    params = []
    for i in range(cnt):
        param = raw_input()
        params.append(param)
    main(params)



Measured memory_bytes: 7168
#include <bits/stdc++.h>
using namespace std;
int main(){
   int a,b,c;
  cin>>a>>b>>c;
  for(int i=a;i<=min(a+c-1,b);i++) cout<<i<<endl;
  for(int i=max(b-c+1,a+c);i<=b;i++) cout<<i<<endl;
}

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

int main() {
    long N;
    cin >> N;
    if (N == 1) cout << 0 << endl;
    else {
        long num = N;
        int res = 0;
        for (long i = 2; i * i <= N; i++) {
            int cnt = 0;
            while (num % i == 0) {
                num /= i;
                ++cnt;
            }
            int j = 1;
            while (cnt - j >= 0) {
                cnt -= j;
                ++res;
                ++j;
            }
        }
        if (num != 1) ++res;
        cout << res << endl;
    }
}



Measured memory_bytes: 3592
n = int(input())
S = []
H = []
C = []
D = []
for i in range(0, n):
 x = list(input().split())
 if x[0] == 'S':
  S.append(int(x[1]))
 elif x[0] == 'H':
  H.append(int(x[1]))
 elif x[0] == 'C':
  C.append(int(x[1]))
 else:
  D.append(int(x[1]))
def pr(list, type):
 list.sort()
 for i in range(1, 14):
  if i not in list:
   print("{0} {1}".format(type, i))
pr(S, 'S')
pr(H, 'H')
pr(C, 'C')
pr(D, 'D')
 

Measured memory_bytes: 7640
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define mt make_tuple
#define MOD 1000000007
#define fo(i,a,b) for(i=a;i<b;i++)
#define foe(i,a,b) for(i=a;i<=b;i++)
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define vl vector <long long int>
#define pii pair <int,int>
#define pll pair <long long int, long long int>
#define vpii vector< pair<int,int> >
#define vpll vector < pair <long long int,long long int> >
#define boost ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int inf = 1e9 + 5;
const ll inf64 = 1e18 + 5;
int main()
{
	boost;
	int n, m, i;
	cin >> n >> m;
	int arr[m];
	fo(i, 0, m)
	cin >> arr[i];
	int sum = accumulate(arr, arr + m, 0);
	if(sum > n) cout << -1;
	else cout << n - sum;
}


Measured memory_bytes: 3608
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>

using namespace std;

// 目的の値 key の index を返すようにする (ない場合は -1)
// https://qiita.com/drken/items/97e37dd6143e33a64c8c
int binary_search(int key, vector<int>& a) {
    int left = 0, right = (int)a.size() - 1; // 配列 a の左端と右端
    while (right >= left) {
        int mid = left + (right - left) / 2; // 区間の真ん中
        if (a[mid] == key) return mid;
        else if (a[mid] > key) right = mid - 1;
        else if (a[mid] < key) left = mid + 1;
    }
    return -1;
}

void print_s(int k){
    int keta = 1;
    int p = k;
    while(p != 0){
        p /= 10;
        keta++;
    }
    while(keta < 7){
        cout << "0";
        keta++;
    }
    cout << k ;
}

int main(){
    int n,m; cin >> n >> m;
    int p, y;
    set<int> st{};
    vector<vector<int>> c;
    c = vector<vector<int>>(n + 1);
    vector<pair<int,int>> list;
    for(int i = 0; i < m; i++){
        cin >> p >> y;
        pair<int,int> pp;
        st.insert(p);
        c[p].push_back(y);
        pp.first = p;
        pp.second = y;
        list.push_back(pp);
    }
    
    // O(n * n' log n');
    for(auto itr = st.begin(); itr != st.end(); ++itr) {
        sort(c[*itr].begin(), c[*itr].end());
    }
    //for(int i = 0; i < set.szie(); i++)sort(c[i].begin(), c[i].end());
    
    // O(m* m/n)
    for(int i = 0 ;i < m; i++){
        int size = c[list[i].first].size();
        print_s(list[i].first);
        int j = binary_search(list[i].second, c[list[i].first]);
        // for(int j = 0; j < size; j++){
        //     if(list[i].second == c[list[i].first][j]){
                print_s(j+1);
                cout << "\n";
                //break;
            //}
        //}
    }
    return 0;
}


Measured memory_bytes: 12404
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
int k,x;
int read()
{
	int _=1,__=0;char ___;___=getchar();
	while(___>'9'||___<'0'){if(___=='-')_=-1;___=getchar();}
	while(___<='9'&&___>='0'){__=__*10+___-'0';___=getchar();}
	return _*__;
}
int main()
{
	k=read();x=read();
	for(int i=x-k+1;i<=x;i++)
	printf("%d ",i);
	for(int i=x+1;i<x+k;i++)
	printf("%d ",i);
	return 0;
}


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

N = int(input())
terms = [[]] # マイナス区切り
op = '+'
for x in input().rstrip().split():
    if x in '+-':
        op = x
        continue
    x = int(x)
    if op == '+':
        terms[-1].append(x)
    else:
        terms.append([x])

# 何をマイナスにするか

min_minus = 10 ** 18
first_sum = 0
for t in terms[1:]:
    x = first_sum + sum(t)
    if x < min_minus:
        min_minus = x
    first_sum += t[0]

answer = sum(sum(t) for t in terms)
if len(terms) > 1:
    answer -= 2 * min_minus

print(answer)

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

int main() {
    int n;
    cin >> n;
    vector<int> even(100001), odd(100001);
    for (int i = 0; i < n; i += 2) {
        int e, o;
        cin >> e >> o;
        even.at(e)++;
        odd.at(o)++;
    }

    vector<pair<int, int>> count_e, count_o;
    for (int i = 0; i < 100001; i++) {
        if (even.at(i) != 0) {
            count_e.push_back(make_pair(even.at(i), i));
        }
        if (odd.at(i) != 0) {
            count_o.push_back(make_pair(odd.at(i), i));
        }
    }

    sort(count_e.begin(), count_e.end());
    reverse(count_e.begin(), count_e.end());
    sort(count_o.begin(), count_o.end());
    reverse(count_o.begin(), count_o.end());

    int ans;
    if (count_e.size() == 1 && count_o.size() == 1 && count_e.at(0).second == count_o.at(0).second) {
        ans = n / 2;
    }
    else if (count_e.at(0).second != count_o.at(0).second) {
        ans = (n / 2 - count_e.at(0).first) + (n / 2 - count_o.at(0).first);
    }
    else {
        ans = min((n / 2 - count_e.at(1).first) + (n / 2 - count_o.at(0).first), (n / 2 - count_e.at(0).first) + (n / 2 - count_o.at(1).first));
    }

    cout << ans << endl;
}

Measured memory_bytes: 2044
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <vector>
using namespace std ;
string s , t ;
long long sum = 0 ; 
vector<int>c[30] ;
int main () {
    cin >> s >> t ;
    int n = s.size() ;
    int m = t.size() ;
    for(int i = 0 ; i < s.size() ; i ++) {
        c[s[i]-'a'].push_back(i+1) ;
    }
    int x = t[0] - 'a' , j ;
    if(!c[x].size()) {
        puts("-1") ;
        return 0 ;
    }
    int k = c[x][0] ;
    sum += k ;
    for(int i = 1 ; i < m ; i ++) {
        x = t[i] - 'a' ;
        if(!c[x].size()) {
            puts("-1") ;
            return 0 ;
        }
        j = upper_bound(c[x].begin() ,c[x].end(),k) - c[x].begin() ;
        if(j == c[x].end()-c[x].begin() ) {
            sum += c[x][0] + n - k ;
            k = c[x][0] ;
        }else {
            sum += c[x][j] - k ;
            k = c[x][j] ;
        }
    }
    cout << sum <<endl ; 
    return 0 ;
}

Measured memory_bytes: 1216
#include <iostream>
using namespace std;
 
int main() {
	string s;
    cin>>s;
    for(int i=0;i<s.length();i=i+1){
    	if(s[i]=='1')
    		cout<<'9';
    	else 
      		cout<<'1';
    }
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define fo(i,n) for(ll i=0;i<n;i++)
#define fok(i,k,n) for(ll i=k;i<n;i++)
#define ci(x) cin>>x
#define ci2(x,y) cin>>x>>y
#define co(x) cout<<x<<"\n"
#define co2(x,y) cout<<x<<" "<<y<<"\n"
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define PI 3.1415926535897932384626
#define deb1(x) cout<<#x<<" "<<x<<endl
#define deb2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n"
#define deb3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n"
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pll;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pll>		vpll;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
const int mod = 1000000007;	
int gcd(int a, int b){ if(a==0) return b; return gcd(b%a, a);}


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t=1;
	//ci(t);
	while(t--){
		int n;
		ci(n);
		set<string> s;
		fo(i,n){
			string tmp;
			ci(tmp);
			s.insert(tmp);
		}
		cout<<(int)s.size()<<endl;
	}
	return 0;
}



Measured memory_bytes: 19204
#include<iostream>
#include<vector>
#include<stack>
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;

int n;
vector<int> G[MAX];
int color[MAX];

void dfs(int r, int c) {
  stack<int> S;
  S.push(r);
  color[r] = c;
  while ( !S.empty() ) {
    int u = S.top() ;
    S.pop();
    for (int i = 0; i < G[u].size(); i++ ) {
      int v = G[u][i];
      if (color[v] == NIL ) {
        color[v] = c;
        S.push(v);
      }
    }
  }
}

void assignColor() {
  int id = 1;
  for (int i = 0; i < n; i++ ) color[i] = NIL;
  for (int u = 0; u < n; u++ ) {
    if (color[u] == NIL ) dfs(u, id++);
  }
}


int main() {
  int s, t, m, q;

  cin >> n >> m;

  for (int i = 0; i < m; i++) {
    cin >> s >> t;
    G[s].push_back(t);
    G[t].push_back(s);
  }

  assignColor();

  cin >> q;

  for (int i = 0; i< q; i++){
    cin >> s >> t;
    if (color[s] == color[t] ) {
      cout << "yes" << endl;
    } else {
      cout << "no" << endl;
    }
  }

  return 0;
}




Measured memory_bytes: 9008
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
for(int i=0;i<5;++i){
	cout<<s[i];
}
cout<<" ";
for(int i=6;i<13;++i){
	cout<<s[i];
}
cout<<" ";
for(int i=14;i<19;++i){
	cout<<s[i];
}

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
#define rep(i, n)for(int i=0; i<n; i++)

int main(){
  int N;
  cin >> N;
  long long A[N];
  rep(i, N)
    cin >> A[i];

  long long MAX = 1e18;

  rep(i, N){
    if(A[i] == 0){
      cout << 0 << endl;
      return 0;
    }
  }
  
  long long ans = 1;
  rep(i, N){
    if(ans <= MAX/A[i])
      ans *= A[i];
    else{
      cout << -1 << endl;
      return 0;
    }
  }

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


Measured memory_bytes: 4380
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>

using namespace std;

#define INF 1e18

int main(){
  long long n, k;
  cin >> n >> k;
  vector<long long> A(n); vector<long long> F(n);
  for(int i = 0; i < n; i++){
    cin >> A[i];
  }
  for(int i = 0; i < n; i++){
    cin >> F[i];
  }
  sort(A.begin(), A.end());
  sort(F.begin(), F.end(), greater<int>());
  long long ans;
  long long maxi = INF;
  long long mini = -1;
  long long s = 0;
  while(maxi - mini>1){
    ans = (maxi + mini)/2;
    s = 0;
    for(long long i = 0; i < n; i++){
      if(A[i]*F[i] > ans) s += (A[i]*F[i] - ans)/F[i] + ((A[i]*F[i] - ans)%F[i] != 0);
    }
    if(s > k){
      mini = ans;
    }
    else{
      maxi = ans;
    }
  }
  cout << maxi << endl;
  return 0;
}


Measured memory_bytes: 3328
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int n = saori.saori_hayami();
		int[] a = new int[n+1];
		int[] b = new int[n];
		for(int i = 0;i < n+1;i++){
			a[i] = saori.saori_hayami();
		}
		for(int i = 0;i < n;i++){
			b[i] = saori.saori_hayami();
		}
		long ans = 0;
		for(int i = 0;i < n;i++){
			if(a[i]>=b[i]){
				ans += b[i];
			} else {
				ans += a[i];
				b[i] = b[i] - a[i];
				if(a[i+1] >= b[i]){
					ans += b[i];
					a[i+1] = a[i+1] - b[i];
				} else {
					ans += a[i+1];
					a[i+1] = 0;
				}
			}
		}
		System.out.println(ans);
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}


Measured memory_bytes: 23508
import math
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
l = 1
r = 1000000000
while l < r:
  m = (l+r)//2
  cnt = 0
  for i in a:
    c = math.ceil(i/m)-1
    cnt += c
  if cnt > k:
    l = m + 1
  else:
    r = m
print(l)

Measured memory_bytes: 31216
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

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

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}

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

const int mod = INF+7;
int main(){
    int n;cin>>n;
    VEC(int,l,n);
    sort(ALL(l));
    int res = 0;
    rep(i,n){
        REP(j,i+1,n-1){
            res += (lower_bound(ALL(l),l[i]+l[j])-l.begin())-j-1;
        }
    }
    cout<<res<<endl;
}



Measured memory_bytes: 256
T[10][7],i,w,l,d;M(int*a){return*a-*1[&a];}main(n){for(;~scanf("%d",&n);){~i||n&&puts("");for(i=n;i--;*T[i]=w*30+d*10+i)scanf("%s%d%d%d\n",T[i]+1,&w,&l,&d);for(qsort(T,n,28,M);n--;)printf("%s,%d\n",T[n]+1,*T[n]/10);}}

Measured memory_bytes: 0
import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    try {
      long h = sc.nextLong();
      long w = sc.nextLong();
      System.out.println(solve(h,w));
    } finally {
      sc.close();
    }
  }

  private static long solve(long h, long w) {
    if (h == 1 || w == 1) return 1;
    long s = h * w;
    if (s % 2 == 0) return s / 2;
    return (s + 1) / 2;
  }
}

Measured memory_bytes: 35676
package main

import (
	"fmt"
)

func main() {
	var n string
	max := 0
	count := 0
	fmt.Scan(&n)

	for _, j := range n {
		if j == 'R' {
			count++
		}
		if max < count {
			max = count
		}
		if j == 'S' {
			count = 0
		}
	}

	fmt.Print(max)
}

Measured memory_bytes: 1768