akhauriyash/Code-Regression huggingface dataset:
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End

/// Graph Start
struct edge {
    int from, to;
    long long cost;
};
/// Graph End

/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

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

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

/// template


#define int long long

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

signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    Cini(n);
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    ll g = a[0];
    rep(i,n){
        g = gcd(g,a[i]);
    }
    cout << g << nn;
    return 0;
}

Measured memory_bytes: 1024
import heapq
def prim_heap():
    used = [True] * n #True:不使用
    edgelist = []
    for e in edge[0]:
        heapq.heappush(edgelist,e)
    used[0] = False
    res = 0
    while len(edgelist) != 0:
        minedge = heapq.heappop(edgelist)
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,e)
        res += minedge[0]
    return res

#########################
n = int(input())

#隣接リストの作成 edge[i]:[コスト,行先]
edge = [[] for i in range(n)]
p=[]
edge=[[] for i in range(n)]
for i in range(n):
    p.append(tuple(map(int,input().split()))+tuple([i]))
x_sorted=sorted(p,key=lambda x:x[0])
y_sorted=sorted(p,key=lambda x:x[1])
for i in range(n-1):
    edge[x_sorted[i][2]].append((x_sorted[i+1][0]-x_sorted[i][0],x_sorted[i+1][2]))
    edge[x_sorted[i+1][2]].append((x_sorted[i+1][0]-x_sorted[i][0],x_sorted[i][2]))
    edge[y_sorted[i][2]].append((y_sorted[i+1][1]-y_sorted[i][1],y_sorted[i+1][2]))
    edge[y_sorted[i+1][2]].append((y_sorted[i+1][1]-y_sorted[i][1],y_sorted[i][2]))

print(prim_heap())

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

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

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

#define ll long long

int countAB(string s) {
    int size = s.size();
    if(size < 2)return 0;
    int count = 0;
    for(int i = 1;i < size;i++) {
        if(s[i] == 'B' && s[i - 1] == 'A') {
            count++;
        }
    }
    return count;
}

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

    int ab_in_mojiretu = 0;
    int headB = 0;
    int tailA = 0;
    int headB_tailA = 0;
    for(int i = 0;i < N;i++) {
        string s;
        cin >> s;
        if(s[0] == 'B') {
            headB++;
        }
        if(s[s.size() - 1] == 'A') {
            tailA++;
            if(s[0] == 'B') {
                headB_tailA++;
            }
        }
        ab_in_mojiretu += countAB(s);
    }

    int X = headB - headB_tailA;
    int Y = headB_tailA;
    int Z = tailA - headB_tailA;

    if(X != Z) {
        cout << ab_in_mojiretu + min(X, Z) + max(Y - 1, 0) + min(abs(X - Z), (Y > 0 ? 1 : 0)) << endl;
    }else if(X == 0) {
        cout << ab_in_mojiretu + max(Y - 1, 0) << endl;
    }else{
        cout << ab_in_mojiretu + Z + Y << endl;
    }

    return 0;
}

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

int main(){
    long long n,a,b,c,d,e;
    cin >> n >> a >> b >> c >> d >> e;

    long long minmove = min({a,b,c,d,e});
    long long ans = (n + minmove - 1)/minmove + 4;

    cout <<ans << endl;

    
}

Measured memory_bytes: 256
#include<math.h>
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ll long long int
#define py printf("Yes\n")
#define pn printf("No\n")
#define in cin>>
using namespace std;
const int INF = 1001001001;

int main()
{
    int n,d,x,ans=0;
    in n>>d>>x;
    vector<int> a(n);
    rep(i,n)in a[i];
    rep(i,n)
    {
        rep(j,d)
        {
            int hako=a[i]*j+1;
            if(hako<=d)ans++;
        }
    }
    cout<<ans+x<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) (a)=max(a, b)
#define chmin(a, b) (a)=min(a, b)
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;


/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/


ll N, M;
vector<ll> g[MAX];
ll clr[MAX];
ll mem[MAX][11];

void dfs(ll u, ll de, ll cl) {
  if(mem[u][de]) return;
  mem[u][de]=1;
  
  if(de==0) {clr[u]=cl; return;}
  
  
  dfs(u, de-1, cl);
  for(auto v:g[u]) dfs(v, de-1, cl);
  
}

int main(void) {
  ll i, j, k;
  
  cin >> N >> M;
  
  for(i=0; i<M; i++) {
    ll a, b;
    cin >> a >> b;
    a--; b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  
  ll Q;
  cin >> Q;
  ll s[MAX], d[MAX], c[MAX];
  for(i=0; i<Q; i++) {
    cin >> s[i] >> d[i] >> c[i];
    s[i]--;
  }
  
  for(i=Q-1; i>=0; i--) dfs(s[i], d[i], c[i]);
  
  for(i=0; i<N; i++) pt(clr[i]);
}





Measured memory_bytes: 18676
S = input()
N = len(S)

def is_pal(X):
    ret = True
    for i in range(len(X)//2+1):
        if X[i] != X[-i-1]:
            ret = False
    return ret


if is_pal(S) and is_pal(S[:N//2]) and is_pal(S[N//2+1:]):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
typedef long long  ll;
ll power(ll a,ll b,ll mod)
{return b?power(a*a%mod,b/2,mod)*(b%2?a:1)%mod:1;}
ll cal(ll n)
{
    ll cnt=1;
    while(n)
    {
        n=n%__builtin_popcount(n);
        cnt++;
    }
    return cnt;
}
int main()
{
    ll n,cnt=0,ans1=0,ans2=0,ans;
    string s;
    cin>>n>>s;
    for(int i=0;i<n;i++)
    {
        if(s[i]=='1') cnt++;
    }
    if(cnt>1)
    {
        for(ll i=0;i<n;i++)
        {
            if(s[i]=='1') ans1=(ans1+power(2,n-i-1,cnt-1))%(cnt-1),ans2=(ans2+power(2,n-i-1,cnt+1))%(cnt+1);
        }
        for(ll i=0;i<n;i++)
        {
            if(s[i]=='0')
            {
                ans=(ans2+power(2,n-i-1,cnt+1))%(cnt+1);
                cout<<cal(ans)<<endl;
            }else
            {
                ans=(ans1+((cnt-1)-power(2,n-i-1,cnt-1)%(cnt-1))%(cnt-1))%(cnt-1);
                cout<<cal(ans)<<endl;
            }
        }
    }else if(cnt==1)
    {
        for(int i=0;i<n;i++)
        {
            if(s[i]=='1') ans2=(ans2+power(2,n-i-1,cnt+1))%(cnt+1);
        }
        for(ll i=0;i<n;i++)
        {
            if(s[i]=='0')
            {
                ans=(ans2+power(2,n-i-1,cnt+1))%(cnt+1);
                cout<<cal(ans)<<endl;
            }else
            {
                cout<<0<<endl;
            }
        }
    }else
    {
        for(int i=0;i<n;i++) cout<<1<<endl;
    }
	return 0;
}


Measured memory_bytes: 3724
def sol(a1,b1,a2,b2,a3,b3):
    return (a3-a2)*b1-(b3-b2)*a1+a2*b3-a3*b2
while 1:
    try:
        x1,y1,x2,y2,x3,y3,x4,y4=map(float,raw_input().split(','))
        if sol(x1,y1,x2,y2,x4,y4)*sol(x3,y3,x2,y2,x4,y4)<0 and sol(x4,y4,x1,y1,x3,y3)*sol(x2,y2,x1,y1,x3,y3)<0:
            print 'YES'
        else:
            print 'NO'

    except:
        break

Measured memory_bytes: 6352
using System;
class c
{
    static void Main()
    {
        var s = Console.ReadLine();
        int df = int.MaxValue;
        for (int i = 0; i < s.Length - 2; i++)
        {
            int x = int.Parse(s.Substring(i, 3));
            if (df >= Math.Abs(x - 753)) df = Math.Abs(x - 753);
        }
        Console.WriteLine(df);
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long int n,i;
    cin>>n;
    unsigned long long int p=1,c=0,z=0;
    long long int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]==0)
        z++;
    }
    if(z>0)
    {cout<<0<<endl; return 0;}
    for(i=0;i<n;i++)
    {
        if(a[i]<=1000000000000000000/p)
        p=p*a[i];
        else
        {c=1;break;}
    }
    if(c==0)
    cout<<p<<endl;
    if(c==1)
    cout<<-1;
}

Measured memory_bytes: 4372
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Object o = run();
        if (o != null)
            System.out.println(o);
    }

    static Object run() {
        try (Scanner sc = new Scanner(System.in)) {
            long result = 0;
            int r = sc.nextInt();
            int g = sc.nextInt();
            int b = sc.nextInt();
            int k = sc.nextInt();
            for (int i = 0; i < k + 2; i++) {
                if (i > k)
                    return "No";
                if (g <= r) {
                    g *= 2;
                    continue;
                }
                if (b <= g) {
                    b *= 2;
                    continue;
                }
                return "Yes";
            }
            return result;
        }
    }
}

class ChenNumberUtil {
    static Collection<Integer> getDivisors(int n) {
        ArrayList<Integer> al = new ArrayList<>();
        for (int i = 1; i * i <= n; i++) {
            if (n % i == 0) {
                al.add(i);
                if (n / i != i)
                    al.add(n / i);
            }
        }
        Collections.sort(al);
        return al;
    }
}

class ChenBitUtil {
    static int popCount(int bit) {
        return Integer.bitCount(bit);
    }

    static boolean isFlag(int bit, int i) {
        return 0 != (bit & (1 << i));
    }

    static int setTrue(int bit, int i) {
        return bit |= (1 << i);
    }

    static int setFalse(int bit, int i) {
        return bit &= ~(1 << i);
    }

    static int setReverse(int bit, int i) {
        return isFlag(bit, i) ? setFalse(bit, i) : setTrue(bit, i);
    }

    static int reverseAll(int bit) {
        return ~bit;
    }
}


Measured memory_bytes: 27068
#include "bits/stdc++.h"
#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;
constexpr int I_INF = INT_MAX;
constexpr ll L_INF = LLONG_MAX;

struct __INIT {
    __INIT() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __init;


int main(){
    map<int,int> cnt;
    for(int i = 0; i < 3; i++){
        int a;
        cin >> a;
        cnt[a]++;
    }
    cout << cnt.size() << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
    ll A,B,T,V,W,tmp,d;
    cin >> A >> V >> B >> W >> T;
    if(B>A){
        d=abs(B-A);
    }
    else{
        d=abs(A-B);
    }
    if(V*T - W*T >= d){
        cout<<"YES" << endl;
    }
    else{
        cout<<"NO"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<vector>

using namespace std;

int main()
{
    int H, W;
    int count = 0;
    vector<int> h, w;

    while(1)
    {
        cin >> H >> W;
        if(H == 0 && W == 0)
            break;
        else
        {
            h.push_back(H);
            w.push_back(W);
            count++;
        }
    }

    for(int i = 0; i < count; i++)
    {
        for(int j = 0; j < h[i]; j++)
        {
            cout << "#";
            for(int k = 1; k < w[i] - 1; k++)
            {
                if(j == 0 || j == h[i]-1)
                {
                    cout << "#";
                }
                else
                {
                    cout << ".";
                }
            }
            cout << "#" << endl;
        }
        cout << endl;
    }

    return 0;
}           

Measured memory_bytes: 1208
#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int N=1e5+5;

int n,m,fa[N];
int find(int x){
	return x==fa[x]?x:fa[x]=find(fa[x]);
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)fa[i]=i;
	for(int i=1;i<=m;i++){
		int u,v,fu,fv;
		scanf("%d%d",&u,&v);
		fu=find(u);
		fv=find(v);
		if(fu!=fv){
			fa[fu]=v;
			n--;
		}
	}
	printf("%d\n",n-1);
}

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

  const int MOD = 1000000007;

  //long long
  using ll = long long;

  //出力系
  #define print(x) cout << x << endl
  #define yes cout << "Yes" << endl
  #define YES cout << "YES" << endl
  #define no cout << "No" << endl
  #define NO cout << "NO" << endl
  
  // begin() end()
  #define all(x) (x).begin(),(x).end()

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

  //最大公約数（ll）
  ll gcd(ll x, ll y) { return y ? gcd(y,x%y) : x;}

  //素因数分解
  vector<pair<ll, int>>factorize(ll n){
    vector<pair<ll, int>> res;
    for(ll i = 2; i * i <= n; ++i){
      if(n % i) continue;
      res.emplace_back(i, 0);
      while(n % i == 0){
        n /= i;
        res.back().second++;
      }
    }
  if(n != 1) res.emplace_back(n, 1);
  return res;
  }






int main() {
	string S;
	cin >> S;
	if (S.find("KIH") == string::npos) {
		cout << "NO";
		return 0;
	}
	int count = 0;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'A') {
			S.erase(S.begin() + i);
			count++;
			if (count >= 2) {
				cout << "NO";
				return 0;
			}
          	i--;
		}
		else {
			count = 0;
		}
	}
	if (S == "KIHBR")
		cout << "YES";
	else
		cout << "NO";
	return 0;
}



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

int main(void){
    int r, D;
    int x[15];
    
    cin >> r >> D >> x[0];
    
    for (int i = 0; i < 10; i++) {
        x[i+1] = r * x[i] - D;
        cout << x[i+1] << endl;
    }

}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#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> // dequef
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower

#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define all(a) (a).begin(), (a).end()
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  string s;
  cin >> s;
  if(s == "RRR") cout << 3 << endl;
  else if(s == "SRR" || s == "RRS") cout << 2 << endl;
  else if(s == "RSR" || s == "SSR" || s == "RSS" || s == "SRS") cout << 1 << endl;
  else cout << 0 << endl;
}

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

int main()
{
  int n;
  cin >> n;
  vector<vector<int>> A(n, vector<int>(n));
  for (int i = 0; i < n; i++)
  {
    for (int j = 0; j < n; j++)
    {
      cin >> A.at(i).at(j);
    }
  }
  ll ans = 0;
  for (int i = 0; i < n; i++)
  {
    for (int j = i + 1; j < n; j++)
    {
      int cnt_1 = 0;
      int cnt_2 = 0;
      for (int k = 0; k < n; k++)
      {
        if (k == i || k == j)
        {
          continue;
        }
        if (A.at(i).at(j) > A.at(i).at(k) + A.at(k).at(j))
        {
          cnt_1++;
        }
        else if (A.at(i).at(j) == A.at(i).at(k) + A.at(k).at(j))
        {
          cnt_2++;
        }
      }
      if (cnt_1)
      {
        cout << -1 << endl;
        return 0;
      }
      else if (!cnt_2)
      {
        ans += A.at(i).at(j);
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long; 
using vpii = vector<pair<int, int>>;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define rep1(i, n) for (int i = 1; i < (int)n; i++)
ll inf = 1e9+7;

ll gcd(ll a, ll b){
  return (b != 0) ? gcd(b, a%b) : a;
}

ll lcm(ll a, ll b){
  return (a/gcd(a,b))*b;
}

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int n; ll T;
  cin >> n >> T;
  vector<ll> t(n);
  rep(i, n) cin >> t[i];
  ll ans = 0;
  rep(i, n-1){
    ans += min(T, t[i+1]-t[i]);
  }
  ans += T;
  cout << ans << "\n";
  return 0;
}   

Measured memory_bytes: 1792
void main(){
	string n = readln().chomp();
	int x = n.to!int();
	int fx;
	foreach(ch; n){
		fx += ch.to!string().to!int(); // ここもっといいやり方ない?
	}
	writeln(x%fx==0? "Yes": "No");
}

import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math;

// 1要素のみの入力
T _scan(T= int)(){
	return to!(T)( readln().chomp() );
}

// 1行に同一型の複数入力
T[] _scanln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split()){
		ln ~= elm.to!T();
	}
	return ln;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

using namespace std;
using ll = long long;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N, M; cin >> N >> M;
  priority_queue<int> q;
  rep(i, N) {
    int x; cin >> x;
    q.push(x);
  }
  while (M > 0) {
    int x = q.top(); q.pop();
    q.push(x >> 1);
    M--;
  }
  ll ans = 0;
  while (!q.empty()) {
    ans += q.top(); q.pop();
  }
  cout << ans << endl;
}


Measured memory_bytes: 892
n, m, l = map(int, input().split())
A = [[*map(int, input().split())] for i in range(n)]
B = [[*map(int, input().split())] for i in range(m)]
for i in range(n):
    for j in range(l):
        sum = 0
        for k in range(m):
            sum += A[i][k]*B[k][j]
        if j > 0:
            print(end = ' ')
        print(sum, end = '')
    print()


Measured memory_bytes: 6512
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

struct bar {
  int h;
  int p;
  int q;
};
vector<bar> vec;

void bable_sort(){
  for(int i = 0 ; i < vec.size()-1 ; i++ ){
    for(int j = vec.size()-1 ; j > i ; j-- ){
      if(vec[j-1].h < vec[j].h){
	swap(vec[j],vec[j-1]);
      }
    }
  }
}

int main(){
  int n,m,a;
  bar b;
  while( cin >> n >> m >> a){
    if(n == 0 && m == 0 && a == 0)break;
    vec.clear();
    for(int i = 0 ; i < m ; i++){
      cin >> b.h >> b.p >> b.q;
      vec.push_back(b);
    }
    bable_sort();
    for(int i = 0 ; i < vec.size() ; i++ ){
      if(vec[i].p == a){
	a = vec[i].q;
      } else if(vec[i].q == a){
	a = vec[i].p;
      }
    }
    cout << a << endl;
  }
  return 0;
}

Measured memory_bytes: 1236
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string>
using namespace std;
typedef pair<int, int> P;
#define _CRT_SECURE_NO_WARNINGS
int N;
int main() {
	char s[52] = {};
	scanf("%s",s);
	for (int i = 50; i >=0 ;i--) {
		if (s[i] == 'F') {
			for (int j = 0; j < i;j++) {
				printf("%c",s[j]);
				
			}
			return 0;
		}
	}
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define N 1000005
#define ll long long int 	
#define MP make_pair
#define pb push_back
#define ppb pop_back
#define sp " "
#define endl "\n"
#define fi first
#define se second
#define ii pair<int,int>
#define lli pair<ll,ll>
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define fast2 freopen ("kmp.in","r",stdin);freopen ("kmp.out","w",stdout);
#define mod 1000000009
#define fs(x,y) for(int i=1;i<=y;i++) cin>>x[i]
#define fo(i,x,y) for(int i=x;i<=y;i++)
using namespace std;

ll n,m,ar[N],sum;

int main()
{
	fast;
	cin>>n;
	// cin>>n;
	// m=n;
	// ll cnt=0;
	fo(i,1,n)
	{
		ll x=i;
		ll cnt=0;
		while(x)
		{
			cnt++;
			x/=10;
		}	
		if(cnt%2==1)
			sum++;
	}
	cout<<sum;



}



/*     cd onedrive\desktop\kod
cls


*/

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {


	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();

		int total = 0;

		for (int i = 1; i < N + 1; i++) {
			int sum = calSumOfDigits(i);
			if(A <= sum && sum <= B) {
				total += i;
			}
		}
		System.out.println(total);
	}

	//各桁の和を計算
	public static int calSumOfDigits(int n) {
		int sum =0;
		while(n > 0) {
			sum += n % 10;
			n /= 10;
		}
		return sum;
	}
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;typedef long long ll;typedef string str;
typedef vector<str> vst;typedef vector<ll> vll;
ll mod = 1000000007, INF = 10000000000000000;
ll gcd(ll a, ll b){if(b==0){return a;}return gcd(b, a%b);}
ll digit(ll x){ll c=0;while(x>0){x=x/10;c++;}return c;}
// for (ll i = 0; i < n; i++) {
// sort(.begin(), .end());

int main(){
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  
  ll t1,t2,t3,t4;
  
  t1=b-a+1;
  t2=b/c-(a-1)/c;
  t3=b/d-(a-1)/d;
  t4=b/(c*d/gcd(c,d))-(a-1)/(c*d/gcd(c,d));
  
  cout<<t1-t2-t3+t4<<endl;
  
}

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

int main(){
    int h,w;
    
    while(1){
        cin >> h >> w;
        if(h == 0 && w == 0) break;
        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                if(i == 0 || i == h - 1 || j == 0 || j == w - 1) cout << '#';
                if(j > 0 && j < w - 1 && i > 0 && i < h - 1) cout << '.';
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3100
#include <iostream>
using namespace std;
typedef long long int ll; 
int main(){
  ll s,c,ans=0;

  cin>>s>>c;

  ll cc = c/2;
  if (s > cc) {
    ans += cc;
    s -= cc;
    c -= 2*cc;
  } else {
    ans += s;
    c -= 2*s;
  }

  ans += c/4;

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


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
constexpr ll TEN(int n){
    return n == 0 ? 1 : TEN(n-1) * 10;
}
ll mod = 1e9+7;
struct edge{
    int to, cost;
    edge(int a = 0, int b = 0) : to(a), cost(b) {}
};
void ae(vector<vector<edge>>&g,int from, int to, int cost){
    g[from].emplace_back(to,cost);
    g[to].emplace_back(from,cost);
}
auto dijkstra(int s, vector<vector<edge>> &g){
    int n = (int)g.size();
    vector<ll> dist(n, 1LL<<60);
    using ll_i = pair<ll, int>;
    priority_queue<ll_i,vector<ll_i>,greater<ll_i>>pq;
    dist[s] = 0;
    pq.push({dist[s], s});
    while(!pq.empty()){
        auto a = pq.top();
        pq.pop();
        int v = a.second;
        if(a.first > dist[v])continue;
        for(auto &x:g[v]){
            if(dist[x.to] > dist[v] + x.cost){
                dist[x.to] = dist[v] + x.cost;
                pq.push({dist[x.to], x.to});
            }
        }
    }
    return dist;
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m, s, t;
    cin >> n >> m >> s >> t;
    s--,t--;
    vector<vector<edge>>g1, g2;
    g1.resize(n), g2.resize(n);
    while(m--){
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        u--,v--;
        ae(g1,u,v,a);
        ae(g2,u,v,b);
    }
    auto d1 = dijkstra(s,g1);
    auto d2 = dijkstra(t,g2);
    constexpr ll inf = TEN(15);
    vector<ll> ans(n);
    ans[n-1] = d1[n-1]+d2[n-1];
    rep(i,n-1)ans[n-2-i] = min(ans[n-1-i],d1[n-2-i]+d2[n-2-i]);
    rep(i,n)cout << inf - ans[i] << "\n";
}

Measured memory_bytes: 16120
#include<bits/stdc++.h>
#define rep(i,a,b) for (int i=(a); i<=(b); i++)
#define per(i,a,b) for (int i=(a); i>=(b); i--)
using namespace std;

const int maxn = 100005;
int a[maxn], b[maxn], pa[maxn], sz[maxn];
int n, ans, flag = 1, cnt;
multiset<int> s;
map<int,int> M;

inline int getpa(int x) {
	return pa[x] == x ? x : pa[x] = getpa(pa[x]);
}

int main() {
	scanf("%d", &n);
	rep (i, 1, n) {
		scanf("%d", &a[i]);
		a[n+1] ^= a[i];
	}
	rep (i, 1, n) {
		scanf("%d", &b[i]);
		b[n+1] ^= b[i];
	}
	n++;
	rep (i, 1, n) s.insert(a[i]);
	rep (i, 1, n) {
		if (s.find(b[i]) == s.end()) 
			return puts("-1"), 0;
		s.erase(s.find(b[i]));
	}
	rep (i, 1, n) if (i == n || a[i] != b[i]) {
		if (!M[a[i]]) a[i] = M[a[i]] = ++cnt;
		else a[i] = M[a[i]];
		if (!M[b[i]]) b[i] = M[b[i]] = ++cnt;
		else b[i] = M[b[i]];
		if (i < n) ans++;
	}
	else a[i] = b[i] = 0;
	rep (i, 1, cnt) pa[i] = i;
	rep (i, 1, n) if (a[i])
		pa[getpa(a[i])] = getpa(b[i]);
	rep (i, 1, cnt) if (pa[i] == i) ans++;
	printf("%d\n", ans - 1);
	return 0;
}

Measured memory_bytes: 7040
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
int main()
{
  int N;
  cin >> N;
  vector<ll> A(N);
  rep(i, N)
  {
    cin >> A[i];
  }
  int point = 0;
  while (1)
  {
    rep(i,N)
    {
      if (A[i] % 2 != 0)
      {
        cout << point << "\n";
        return 0;
      }
      A[i] = A[i] / 2;
    }
    point++;
  }
  return 0;
}

Measured memory_bytes: 256
let r()=List.map int_of_string(Str.split(Str.regexp" ")(read_line()))open Array;;match r()with[n;m;l]->(let($)s t=let a=make_matrix s t 0in for i=0to s-1do let x=of_list(r())in for j=0to t-1do a.(i).(j)<-x.(j)done done;a in let a=n$m and b=m$l in for i=0to n-1do for j=0to l-1do let c=ref 0in for k=0to m-1do c:=!c+a.(i).(k)*b.(k).(j)done;Printf.printf(if j=0then"%d"else" %d")!c done;print_newline()done)|_->()

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

typedef long long ll;

const ll mod = 2019; // faster i f const

ll modpow(ll b, ll e) {
	ll ans = 1;
	for (; e; b = b * b % mod, e /= 2)
		if (e & 1) ans = ans * b % mod;
	return ans;
}

int main(){
	string s; cin >> s;
	reverse(s.begin(), s.end());
	//cout << s << '\n';
	int n = s.size();
	ll ans=0, ps=0;
	map<ll,ll> mds;
	mds[0]=1;
	for(int i=0; i<n; i++){
		(ps += modpow(10, i) * (s[i]-'0'))%=mod;
		//cout << ps << ' ';
		mds[ps]++;
	}
	for(auto a : mds){
		//cout << a.first << ' ' << a.second << '\n';
		
		int k = a.second;
		ans+=(k*(k-1))/2;
	}
	cout << ans;
}

Measured memory_bytes: 3724
#include<stdio.h>

#define MAX_LENGTH 32

int main(void)
{
        char line[MAX_LENGTH];
        int input;

        fgets(line, sizeof(line), stdin);
        sscanf(line, "%d", &input);
        printf("%d:", input / 60 / 60 % 60);
        printf("%d:", input / 60 % 60);
        printf("%d\n", input % 60);


        return 0;
}

Measured memory_bytes: 604
/*
If you want to shine like a sun, first burn like a sun.
*/

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define v2i vector<vector<int>>
#define v2l vector<vector<ll>>
#define ppi pair<int,int>
#define vpi vector<ppi>
#define ppl pair<ll,ll>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define imx INT_MAX
#define imn INT_MIN
#define inf LONG_MAX
#define minf LONG_MIN
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 
#define pre cout<<fixed<<setprecision(10);
#define umap unordered_map
#define uset unordered_set
#define pi 3.141592653589793
const ll infinity = 9e18;

/*
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);}
ll LCM(ll a,ll b) {return (a/GCD(a,b))*b; }
*/

int main()
{
    fast

/*
    #ifndef ONLINE_JUDGE
        freopen("in.txt",  "r",  stdin);
        freopen("out.txt", "w", stdout);
    #endif
//*/

        
    int n;
    cin>>n;
        
    string s;
    cin>>s;

    int count = 0;
    char ch = ' ';
    forn(i,0,s.sze)
    {
        if(ch != s[i])
        {
            ch = s[i];
            count++;
        }
    }    

    cout<<count;










    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
int main(){
	int a,b,c,d;
	scanf("%d %d %d",&a,&b,&c);
	d=a+b;
	if (c<=d)
	{
		printf("Yes\n");
	}else if (c>d)
	{
		printf("No\n");
	}
}

Measured memory_bytes: 128
s = (input().split())
t = len(s)
cnt = 0
for i in range(t):
    if i != t - 1:
        if (s[i][-1]) == s[i + 1][0]:
            cnt += 1
    else:
        break

if cnt == t - 1:print("YES")
else:print("NO")

Measured memory_bytes: 9052
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define sort(a)         sort((a).begin(), (a).end())
#define uniq(a)         sort(a);(a).erase(unique((a).begin(), (a).end()), (a).end())
#define reverse(a)      reverse((a).begin(), (a).end())
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }

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

const ll MOD = 1000000007; // 10^9 + 7

void solve() {
  string s; cin >> s;
  string mae = "", tmp = "";
  int ans = 0;
  for (int i = 0; i < s.size(); i++) {
    tmp += s[i];
    if (mae == "" || (mae != "" && mae != tmp)) {
      ans++;
      mae = tmp;
      tmp = "";
    }
  }
  outl(ans);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 832
#include <stdio.h>

int main(void)
{
	int a, b;
	
	if(scanf("%d", &a) == 1 && scanf("%d", &b) == 1) {
		if(a == b) {
			printf("Draw");
		}
		else if(a != 1 && b != 1) {
			if(a > b) {
				printf("Alice");
			}
			else {
				printf("Bob");
			}
		}
		else {
			if(a == 1) {
				printf("Alice");
			}
			else {
				printf("Bob");
			}
		}
	}
	return 0;
}

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

fn main() {
  let mut onceNum = String::new();
  stdin().read_line(&mut onceNum).unwrap();
  let num: i32 = onceNum.trim().parse().unwrap();
  
  let a= num % 1000;
  if(a==0) {
    println!("{}", 0);
    return;
  }
  
  let count = num / 1000;
  let total = 1000 * (count + 1);
  
  println!("{}", total - num);
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG
int main() {
    int n,m;
    cin>>n>>m;
    long long x[n+1],y[n+1],z[n+1];
    long long ans=0;
    rep(i,n){
        cin>>x[i+1]>>y[i+1]>>z[i+1];
    }
    for (int i=0;i<(1<<3);i++){
        bitset<3> s(i);
        vector<long long> vec;
        for (int j=1;j<n+1;j++){
            long long ss=0;
            if (s.test(0)){
                ss+=x[j];
            }
            else{
                ss-=x[j];
            }
            if (s.test(1)){
                ss+=y[j];
            }
            else{
                ss-=y[j];
            }
            if (s.test(2)){
                ss+=z[j];
            }
            else{
                ss-=z[j];
            }
            vec.push_back(ss);
        }
        sort(all(vec));
        long long ans1=0;
        rep(j,m){
            ans1+=vec[j];
        }
        ans=max(ans,abs(ans1));
    }
    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
    let v = read_vec::<u64>();
    let (n, a, b) = (v[0], v[1], v[2]);
    let x = read_vec::<u64>();
    println!(
        "{}",
        (1..n as usize).fold(0, |sum, i| sum + min(b, a * (x[i] - x[i - 1])))
    );
}


Measured memory_bytes: 8444
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
// #pragma GCC optimize("O2")
typedef long long int ll;
typedef long double ld;
typedef map <ll,ll> mm;
typedef vector <ll> mv;
typedef pair <ll,ll> mp;
typedef set <ll> ms;
typedef multiset <ll> mms;
typedef queue <ll> mq;
typedef deque <ll> mdq;
typedef stack <ll> mst;
typedef priority_queue <ll> mpq;
typedef priority_queue <ll, vector<ll>, greater<ll> > mmh;
typedef complex<double> cd;
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define ordered_multiset tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define flush cout.flush();
#define all(v) v.begin(),v.end()
#define deb(x) cout << #x << " " << x << endl;
#define ff first
#define ss second
#define pb(v) push_back(v)
#define lb(v) lower_bound(v)
#define ub(v) upper_bound(v)
#define cn continue
#define forl(i,n) for(ll i=0;i<n;i++)
#define forlr(i,n) for(ll i=n-1;i>=0;i--)
#define rev(s) reverse(s.begin(),s.end())
void swap(ll &a,ll &b) {
	ll tmp=a;
	a=b;
	b=tmp;
}
ll atoistring(string s) {
	stringstream lol(s);
	ll x;
	lol>>x;
	return x;
}
void pv(mv v) {
	forl(i,v.size()) cout<<v[i]<<" ";
	cout<<"\n";
}
void pa(ll *v, ll size) {
	forl(i,size) cout<<v[i]<<" ";
	cout<<"\n";
}
void removeDups(mv &v) {
	sort(all(v));
	mv::iterator it = unique(v.begin(), v.end());
	v.resize(distance(v.begin(), it));
}
inline ld kthRoot(ld n, ll k) {
	return pow(k, (1.0 / k) * (log(n) / log(k)));
}
ll power(ll x, ll y, ll p) {
	ll res=1;
	x=x%p;
	while(y>0) {
		if(y&1) res = (res*x)%p;
		y=y>>1;
		x=(x*x)%p;
	}
	return res;
}
void checkmod(ll &x, ll mod) {
	if(x>=mod) x%=mod;
}

ll mod = 1e9 + 7;

mv adj[200005];
map < mp , bool > mapp;
bool donee[200005];

ll DFS(ll x) {
	if(donee[x]) return 0;
	ll cnt = 1;
	donee[x] = 1;
	for(auto v : adj[x]) cnt += DFS(v);
	return cnt;
}

void thisIsMain() {
	ll n, m;
	cin>>n>>m;
	forl(i,m) {
		ll x, y;
		cin>>x>>y;
		if(mapp[{x, y}] == 1) cn;
		adj[x].pb(y);
		adj[y].pb(x);
		mapp[{x, y}] = 1;
		mapp[{y, x}] = 1;
	}
	ll ans = 0;
	forl(i,n) if(donee[i + 1] == 0) ans = max(ans, DFS(i + 1));
	cout<<ans<<"\n";
}

int main(void)
{
	fastio
	ll t = 1;
	// cin>>t;
	while(t--) thisIsMain();
	return 0;
}

Measured memory_bytes: 46000
#include<iostream>
#include<sstream>
#include<string>
#include<cstring>
#include<stdio.h>
using namespace std;
const int MAX_M = 1010;
const int MAX_N = 10010;
#define REP(i, j) for(int i = 0; i < j; i++)
#define FOR(i, j, k) for(int i = j; i < k; i++)

int main(){
	int m, n;
	while(cin >>m >>n && (m || n)){
		int human[MAX_M] = {false};
		REP(i, m + 1) human[i] = true;
		human[0] = false;


		int h = m;
		int now = 1;
		FOR(i, 1, n + 1){
			string str; cin >>str;
			if(h == 1) continue;
			while(!human[now]){
				now++;
				if(now > m) now = 0;
			}
			if(i % 3 == 0 && i % 5 == 0){
				if(str != "FizzBuzz"){
					human[now] = false;
					h--;
				}
			} else if(i % 3 == 0){
				if(str != "Fizz"){
					human[now] = false;
					h--;
				}
			} else if(i % 5 == 0){
				if(str != "Buzz"){
					human[now] = false;
					h--;
				}
			} else{
				int sum = 0;
				sscanf(str.c_str(), "%d", &sum);
				/*
				bool okFlg = true;
				char num[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
				REP(j, str.length()){
					int flg = false;
					REP(k, 10){
						if(str[j] == num[k]) flg = true;
					}
					if(!flg) okFlg = false;
				}
				int sum = 0;
				for(int j = str.length() - 1; j >= 0; j--){
					sum *= 10;
					sum += (int)(str[j] - '0');
				}
				*/
				if(sum != i){
					human[now] = false;
					h--;
				}
			}
			now++;
		}
		stringstream ss;
		bool firFlg = true;
		REP(i, m + 1){
			if(human[i]){
				if(firFlg == true){
					ss <<i;
					firFlg = false;
				}
				else ss <<" " <<i;
			}
		}
		cout <<ss.str() <<endl;
	}
	return 0;
}

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


typedef long long ll;
using namespace std;
const int maxn=1007;

char s[10][10],b[10][10];
int sum1[10],sum2[10];
int h,w,k;

int check( int x ,int y )
{
	int cnt=0,n=h,m=w;
	 for (int i = 1; i <= n; i++) {
        if((((x>>(i - 1))&1))) continue;
        for (int j = 1; j <= m; j++) {
            if((((y>>(j - 1))&1))) continue;
            if(s[i][j] == '#') cnt++;
        }
    }
    
	return cnt==k;
}

int main() 
{
	
	cin>>h>>w>>k;
	int ans=0;
	int all=0;
	for( int i=1;i<=h;i++ )
	{
		cin>>s[i]+1;
	}
	
	for( int i=0;i<(1<<h);i++ )
	{
		for( int j=0;j<(1<<w);j++ ) ans+=check(i,j);
	}
	
	cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#define int ll
//#define slld(t) scanf("%lld",&t)
//#define sd(t) scanf("%d",&t)
//#define pd(t) printf("%d\n",t)
//#define plld(t) printf("%lld\n",t)
#define vec vector < int >
#define vecp vector < pair < int , int > >
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define pii pair < int , int >
#define pll pair < ll , ll > 
#define pdd pair<double , double>
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define mod  1000000007
#define N    50005
#define mod1 1000000007
#define mod2 998244353
#define bitcnt __builtin_popcountll
#define PI acos(-1)
#define mid  (l + r + 1)/2
#define s3   1.73205080757
const int inf = (int)1e18+10 ;
const int MAX= 1010;
vec v;
signed main(){
  fast;
  
   string s;
   cin >> s;
   int k;
   cin >> k;
   int ans = 0;
   int cnt = 1;
   int n = s.length();
   for(int i = 0 ; i < s.length()-1 ; i++){
   	    if(s[i] != s[i+1])
   	    	v.pb(cnt) , cnt = 1;
   	    else cnt++;
   }
   v.pb(cnt);
   if(v.size() == 1){
   	    cout << (k*v[0])/2 << endl;
   	    return 0;
   }
   int x = 0;
   if(s[0] == s[n-1]){
   	    x = (v[0] + v[v.size()-1])/2;
   }
   else
   	    x = (v[0]/2) + (v[v.size()-1]/2);
   ans = (k-1)*x;
   for(int i = 0 ; i <  v.size() ; i++){
   	    if(i == v.size() - 1 || i == 0)
   	    	ans += (v[i]/2);
   	    else ans += k*(v[i]/2);
   	    
   }
  cout << ans << endl;

 // check for n=1 edge case 
}


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


int main() {
	int N;
	cin >> N;
	int A[N];
	int A_sort[N];
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		A_sort[i] = A[i];
	}
	sort(A_sort, A_sort + N);
	for (int i = 0; i < N; i++) {
		cout << ((A[i] == A_sort[N-1]) ? A_sort[N-2] : A_sort[N-1]) << endl;
	}
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
#include <stdlib.h>
#include <string>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    ll r=a%b;
    while(r!=0){
        a=b;
        b=r;
        r=a%b;
    }
    return b;
}

int main(){
    string s;
    int q;
    bool flip=true;
    deque<char>d;
    cin >> s >> q;
    for(char x:s) d.push_back(x);
    rep(i,q){
        int t;
        cin >> t;
        if(t==1) flip=!flip;
        else{
            int f;
            char c;
            cin >> f >>c;
            if(flip){
                if(f==1)d.push_front(c);
                else d.push_back(c);
            }else{
                if(f==2)d.push_front(c);
                else d.push_back(c);
            }
        }
    }
    string ans;
    for(char x:d) ans+=x;
    if(!flip) reverse(ans.begin(),ans.end());
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1412
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1e9+7;
const ll LINF = 1LL<<60;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    int x, y;

    int a[] = {0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
    cin >> x >> y;
    cout << (a[x] == a[y] ? "Yes" : "No") << endl;

    return 0;
}

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

#define N 110
int n, k;
char s[N];

int main() {
	while (scanf("%d%d", &n, &k) != EOF) {
		scanf("%s", s + 1);
		s[k] += 32;
		printf("%s\n", s + 1);
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int N;
ll dp[51][51][21][28];
char table[50][21];
char base = 'a'-1;

ll recursive(int left,int right,int loc,int ch){

	if(dp[left][right][loc][ch] != -1)return dp[left][right][loc][ch];

	if(left >= right)return 1;

	if(ch == 27){

		return 0;

	}else if(loc == 20){

		if(left+1 == right){
			return dp[left][right][loc][ch] = 1;
		}else{
			return dp[left][right][loc][ch] = 0;
		}
	}

	ll ret = 0;
	ll tmp;

	for(int mid = left; mid <= right; mid++){

		if((mid != left) && ((table[mid-1][loc] != base+ch && table[mid-1][loc] != '?') ||
				(table[mid-1][loc] == '?' && ch == 0)))break;

		tmp = recursive(left,mid,loc+1,0)*recursive(mid,right,loc,ch+1);

		tmp %= MOD;
		ret += tmp;
		ret %= MOD;
	}

	return dp[left][right][loc][ch] = ret;
}


int main(){

	scanf("%d",&N);

	int length;

	for(int loop = 0; loop < N; loop++){

		scanf("%s",table[loop]);
		for(length = 0; table[loop][length] != '\0'; length++);

		for(int k = length; k < 20; k++){
			table[loop][k] = base;
		}
	}

	for(int i = 0; i <= N; i++){
		for(int k = 0; k <= N; k++){
			for(int a = 0; a < 21; a++){
				for(int b = 0; b < 28; b++){
					dp[i][k][a][b] = -1;
				}
			}
		}
	}

	printf("%lld\n",recursive(0,N,0,0));

	return 0;
}



Measured memory_bytes: 15188
#include<stdio.h>
int main(void)
{
 int a,b;
 scanf("%d %d",&a,&b);

 if (a>b) {
           printf("a > b\n");
 }else if (a<b) {
               printf("a < b\n");
 }else if (a=b) {
               printf("a == b\n");
 }

 return 0;
}

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

const int MAXN = 3e3 + 3;
int dp[MAXN][MAXN];
bool b[MAXN][MAXN];
string s, t;
int n, m;

void input();
void solve();

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

void input() {
	cin >> s >> t;
	n = s.size();
	m = t.size();
}

void solve() {
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
			if (s[i - 1] == t[j - 1]) {
				dp[i][j] = dp[i - 1][j - 1] + 1;
				b[i][j] = true;
			}
			//cout << dp[i][j] << " ";
		}
		//cout << endl;
	}
	string ans = "";
	while (dp[n][m] >= 1) {
		if (b[n][m]) {
			ans += s[n - 1];
			//cout << ans << " ";
			n--, m--;
			continue;
		}
		(dp[n - 1][m] > dp[n][m - 1])? n--: m--;
	}
	reverse(ans.begin(), ans.end());
	cout << ans;
}


Measured memory_bytes: 44288