akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stdio.h>
using namespace std;

int main()
{
	int a, b;
	int d, r;
	double f;

	cin >> a >> b;

	d = a / b;
	r = a % b;
	f = (double)a / b;

	printf("%d %d %.5f\n", d, r, f);

	return 0;
}

Measured memory_bytes: 3192
#include <stdio.h>

int main(){
 int N,H[30];
  scanf("%d",&N);
  int i,ret=0;
  for(i=0;i<N;i++){
    scanf("%d",&H[i]);
  }
  int max = -1;
  for(i=0;i<N;i++){
   if(max<=H[i]){
     max = H[i];
     ret++;
   }
  }
  printf("%d\n",ret);
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>

int time,n,g[100][100] = {0};
int d[100],f[100],iro[100] = {0};

void dfs(void);
void visit(int);

int main(){
  int i,j,x,y,z;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d %d",&x,&y);
    for(j=0;j<y;j++){
      scanf("%d",&z);
      g[x-1][z-1] = 1;
    }
  }

  dfs();
  return 0;
}

void dfs(){
  int a;

  time = 0;

  for(a=0;a<n;a++)
    if(iro[a] == 0)visit(a);

  for(a=0;a<n;a++)
    printf("%d %d %d\n",a+1,d[a],f[a]);
}

void visit(int x){
  int y;

  iro[x] = 1;
  d[x] = ++time;

  for(y=0;y<n;y++){
    if(g[x][y] == 0)continue;
    if(iro[y] ==0)visit(y);
  }

  iro[x] = 2;
  f[x] = ++time;
}



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


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    int l,r;
    int out=0;
    cin >> n;
    while(n--){
        cin >> l >> r;
        out+=(r-l+1);
    }
    cout << out;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <tuple>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <cctype>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    char c;
    cin >> c;
    cout << char(c+1) << endl;
}


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

lli n;

int main(void){
	cin >> n;
	vector<lli> a(n+1);
	deque<lli> b;
	rep(i, n) cin >> a[i];
	rep(i, n){
		if(i%2 == (n-1)%2) b.push_front(a[i]);
		else b.push_back(a[i]);
	}
	rep(i, n) cout << b[i] << " ";
	cout << endl;
	return 0;
}


Measured memory_bytes: 6380
#include <math.h>
#include <algorithm>
#include <set>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <string>
#include <cstring>
#include <functional>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <chrono>
#include <climits>
#include <bitset>
using namespace std ;
#define ld long double
#define int long long
#define ii pair<int,int>
#define FAST_IO ios_base::sync_with_stdio(false) ;cin.tie(NULL);cout.tie(NULL); clock_t beg = clock()
#define dbg(x) cerr << #x << " is " << x << endl;
#define ms(x,a) memset(x,(int)(a),sizeof(x))
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define vi vector<int >
#define pb push_back
#define endl '\n'
#define ff first
#define ss second
const int N = 3e5+7 ;
const int INF = 1e18 ;
const int MOD = 1e9 + 7 ;
string s ;
int a[N] ;
int b[N] ;
/* Print pair */
template <typename T,typename S>
ostream & operator << (ostream &os , const pair<T,S> &v) {
    os << "(" ;
    os << v.first << "," << v.second << ")" ;
    return os ;
}
/* Print vector */
template <typename T>
ostream & operator << (ostream &os , const vector<T> &v) {
    os << "[" ;
    int sz = v.size() ;
    for(int i = 0 ; i < sz ; ++i) {
        os << v[i] ;
        if(i!=sz-1)os << "," ;
    }
    os << "]\n" ;
    return os ;
}
/* Print set */
template <typename T>
ostream & operator << (ostream &os , const set<T> &v) {
    T last = *v.rbegin() ;
    os << "[" ;
    for(auto it : v) {
        os << it  ;
        if(it != last) os << "," ;
    }
    os << "]\n" ;
    return os ;
}
/* Print Map */
template <typename T,typename S>
ostream & operator << (ostream &os , const map<T,S> &v) {
    for(auto it : v) {
        os << it.first << " : " << it.second << "\n" ;
    }
    return os ;
}
//debug
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif


void solve(){
	int n , k , c ;
	cin >> n >> k >> c ;
	cin >> s ;
	for(int i = 0 ; i < n ;i++){
		if(s[i] == 'o'){
			a[i+1] = a[i]+1 ;
			int j = i , z = 0 ;
			while(j<n && z<c) z++ , j++ , a[j+1] = a[j] ;
			i = j ;
		}
		else a[i+1] = a[i] ;
	}
	for(int i = n -1 ; i >= 0 ; i--){
		if(s[i] == 'o'){
			b[i] = b[i+1]+1 ;
			int j = i , z = 0 ;
			while(j>=0 && z<c) j-- , z++ , b[j] = b[j+1] ;
			i = j ;
		}
		else b[i] = b[i+1] ;
	}
    for(int i=0; i<n; i++){
        if(s[i]=='x') continue;
        if(a[i]+b[i+1]<k){
            cout<<i+1<<endl;
        }
    }
}

int32_t main(){
	FAST_IO ;
	int t = 1 ;
//	cin >> t ;
	while(t--){
		solve() ;
	}
    cerr << "\nExecution time: " << (clock() - beg) / 1000 << '\n';
}


Measured memory_bytes: 5396
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
#include <array>
#include <numeric>
#include <regex>
#include <bitset>
#include <deque>
#include <cassert>

using namespace std;
typedef long long ll;
typedef pair<int, int> p_ii;

const int INF = 1e9;
const double PI = acos(-1.0);
const ll MOD = 1e9 + 7;

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << ": " << x << endl;
#define popcnt __builtin_popcount


int main() {
    int n; cin>>n;
    vector<ll> a(n+1, 0);
    a[0]=2, a[1]=1;

    for (int i = 2; i < n+1; i++) {
        a[i]=a[i-1]+a[i-2];
    }
    cout<<a[n]<<endl;

    return 0;
}

Measured memory_bytes: 256
n = int(input())
# n < 100000
res = n

for i in range(n+1):
    c = 0
    t = i
    while t > 0:
        c += t % 6
        t //= 6
    t = n - i
    while t > 0:
        c += t % 9
        t //= 9
    if res > c:
        res = c

print(res)


Measured memory_bytes: 9136
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

s = input()

g = s.count("g")
p = s.count("p")
print(len(s)//2 - p)

Measured memory_bytes: 3956
from itertools import product

D,G=map(int,input().split())
p,c=[],[]

for _ in range(D):
  pi,ci=map(int,input().split())
  p.append(pi)
  c.append(ci)
  
ans=10**4
  
for cpls in product(range(2),repeat=D):
  num=0#回答数
  tensu=0#各cplsの得点
  for i,v in enumerate(cpls,start=1):
    if v==1:
      tensu+=i*100*p[i-1]+c[i-1]
      num+=p[i-1]
  if tensu>=G:
    ans=min(ans,num)
    continue
  for i,v in reversed(list(enumerate(cpls,start=1))):
    if v==0:
      for _ in range(p[i-1]-1):
        tensu+=100*i
        num+=1
        if tensu>=G:
          ans=min(ans,num)
          break
print(ans)
      
  
  



Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
char s[100010];
int main(){
    scanf("%s",&s);
    int k=strlen(s);
    if(k%2!=0){//如果项数是奇数，则一定不是镜像字符串 
        printf("No");
        return 0;
    }
    for(int i=0;i<k/2;i++){
    	int u=abs(s[i]-s[k-i-1]);
        if(u!=1&&u!=2){//两项的差要么为1，要么为2 
        	printf("No");//两项之差不为1，不为2，说明不是镜像字符串 
            return 0;
        }
    }
    printf("Yes");//到这里程序还没结束，则是镜像字符串 
    return 0;
}

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

using namespace std;

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

    int count = 0;
    int answer = 0;
    for (int i = 1; i <= n; i++)
    {
        int tmp = i;
        int tmp_count = 0;
        bool isbreak = true;
        while (isbreak)
        {
            if(tmp%2!=0)
            {
                isbreak = false;
            }
            tmp /= 2;
            tmp_count++;
        }
        if (count < tmp_count)
        {
            count = tmp_count;
            answer = i;
        }
    }

    cout << answer << endl;
}


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

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

  rep (i, N) {
      if (A[i] % 2 == 0 && A[i] % 3 != 0 && A[i] % 5 != 0) {
        cout << "DENIED" << endl;
        return 0;
      }
  }
  cout << "APPROVED" << endl;

  return 0;
}

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

// using ll = long long;
#define int long long

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
int in() {int x; cin>>x; return x;}
string stin() {string s; cin>>s; return s;}
/***** MAIN *****/
signed main() {
  int n = in();
  string s = stin();
  deque<char> que(ALL(s));
  int counter = 0;
  for(int i = 0; i < n; ++i) {
    if(s[i] == '(') ++counter;
    else {
      if(counter) --counter;
    }
  }
  while(counter) {
    que.push_back(')');
    --counter;
  }
  for(int i = n-1; i >= 0; --i) {
    if(s[i] == ')') ++counter;
    else {
      if(counter) --counter;
    }
  }
  while(counter) {
    que.push_front('(');
    --counter;
  }
  while(!que.empty()) {
    cout << que.front();
    que.pop_front();
  }
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 256
package main

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

const mod = 1000000007

// 1MB
const ioBufferSize = 1 * 1024 * 1024

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	a, b := nextInt(), nextInt()

	if a <= 0 && b >= 0 || a >= 0 && b <= 0 {
		fmt.Println("Zero")
	} else if a < 0 && b < 0 {
		if (b-a+1)%2 == 0 {
			fmt.Println("Positive")
		} else {
			fmt.Println("Negative")
		}
	} else {
		fmt.Println("Positive")
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << "(" << P.first << "," << P.second << ")";}

// #define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
typedef long long ll;
typedef double ld;
#define pll pair<ll,ll>
#define pii pair<int, int>
#define pb push_back
#define mp(x, y) make_pair((x), (y))
#define F first
#define S second
#define I insert
#define vi vector<int>
#define vll vector<ll>
#define vpll vector<pll>
#define all(x) (x).begin(), (x).end()
#define sz(x) (ll)(x).size()
   
const ll Mod = 1e9 + 7;
const int N = 2005;

ll dp[N][N];

ll nCr(ll n , ll r){
    if(r > n || r < 0)
        return 0;
    else if(r == 0)
        return 1;
    if(dp[n][r] != 0)
        return dp[n][r];
    else{
        dp[n][r] = nCr(n-1 , r-1) + nCr(n-1 , r);
        dp[n][r] %= Mod;
        return dp[n][r];
    }
}
ll mult(ll a , ll b){
    return (a*b)%Mod;   
}

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

    for(int i = 1 ;i <= k ; i++){
        if(n == k){
            if(i == 1)
                cout << 1 << endl;
            else
                cout << 0 << endl;
        }
        else
        cout << mult(nCr(k-1 , i-1) , nCr(n-k-1 , i) + 2*nCr(n-k-1 , i-1) + nCr(n-k-1 , i-2) ) << endl;
    }
    return 0;
}

Measured memory_bytes: 29824
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(x) (x).begin(),(x).end()
#define dup(x,y) (((x)+(y)-1)/(y))
#define sz(x) (int)(x).size()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    cout << a*b/2 << endl;
    return 0;
}

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

#define pb push_back
#define mp make_pair
#define fs first
#define se second
#define pi 2*acos(0)
#define PI 3.14159265358979323846264338

typedef long long ll;
typedef unsigned long long ull;
typedef pair < int , int > pii;
typedef pair < ll , ll > pll;
const int N = 1000010;
const int MX = 123456;
const int mod = (int)1e9 + 7;
const int base = 1023456789;
const ull BS1 = 10000019ULL;
const int INF = (1 << 30);

template < class T > inline void fastScan(T &x){
    register char c = getchar();
    int neg = 0; x = 0;
    for(   ; (c < 48 || c > 57) && (c != '-'); c = getchar());
    if(c == '-') { neg = 1; c = getchar(); }
    for(   ; c > 47 && c < 58; c = getchar()){
        x = (x << 1) + (x << 3) + c - 48;
    }
    if(neg) x = -x;
}

int fx[]={1,-1,0,0};
int fy[]={0,0,-1,1};

char s[N];

int dp[1 << 26];

int main(){
    scanf("%s", s);
    int len = strlen(s);
    for(int i = 0; i < (1 << 26); i++){
        dp[i] = 1e9;
    }
    dp[0] = 0;
    int hand = 0;
    for(int i = 0; i < len; i++){
        hand = hand ^ (1 << (s[i] - 'a'));
        int res = dp[hand] + 1;
        for(int j = 0; j < 26; j++){
            res = min(res, dp[hand ^ (1 << j)] + 1);
        }
        if(i + 1 == len){
            printf("%d\n", res);
        }
        dp[hand] = min(dp[hand], res);
    }
    return 0;
}


Measured memory_bytes: 262656
#include <bits/stdc++.h>
using namespace std;
int mx = 1e5;
class disjoint_set {
  int n;
  vector<int> prt;
  public:
    vector<int> hor;
    vector<int> ver;
    disjoint_set (int n)
      : n(n), prt(n, -1), hor(n, 0), ver(n, 0)
      {
        for (int i = 0; i < mx; i++) {
          hor[i] = 1;
          ver[mx + i] = 1;
        }
      }
      inline bool is_root (int x) const {
        return prt[x] < 0;
      }
      inline int size (int x) {
        return -prt[find(x)];
      }
      inline bool equiv (int x, int y) {
        return find(x) == find(y);
      }
      int find (int x) {
        return (is_root(x) ? x : (prt[x] = find(prt[x])));
      }
      inline bool unite (int x, int y) {
        x = find(x); y = find(y);
        if (x == y) return false;
        if (size(x) < size(y)) swap(x, y);
        prt[x] += prt[y];
        hor[x] += hor[y];
        ver[x] += ver[y];
        prt[y] = x;
        return true;
      }
};
int main() {
  cin.tie(0); cin.sync_with_stdio(false);
  int n;
  cin >> n;
  disjoint_set djs(2 * mx);
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    x--; y--;
    djs.unite(x, mx + y);
  }
  long long ret = 0;
  for (int i = 0; i < 2 * mx; i++) {
    if (!djs.is_root(i)) continue;
    if (djs.hor[i] == 0) continue;
    if (djs.ver[i] == 0) continue;
    ret += (long long)djs.hor[i] * djs.ver[i];
  }
  ret -= n;
  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 2560
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int M = 0;
    int D = 0;
    
    cin >> M;
    cin >> D;
    
    int d1 = 0;
    int d10 = 0;
    
    int k = 0;
    for( int i = 1; i <= M; i++ )
    {
        for( int j = 1; j <= D; j++ )
        {
            d1 = j % 10;
            d10 = j / 10;
            
            if( d1 < 2 or d10 < 2) continue;
            
            if( d1 * d10 == i )
            {
                k++;
            }
            
        }
    }
    
    cout << k;
}


Measured memory_bytes: 888
const input = require("fs").readFileSync("/dev/stdin", "utf8")

;(input => {
    const [A, B, N] = input.split(' ').map(n => n - 0)
    let x = 0
    if (N >= B) {
        x = B - 1
    } else {
        x = N
    }
    const res = Math.floor(A * x / B)
    console.log(res)
})(input)


Measured memory_bytes: 29612
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=200010;
const ll mod=1e9+7;



int main(){
  int l;
  cin>>l;
  int ansnode=0;
  vector <pair<P,int>> ansv;
  
  int kasu=l;
  int longe=floor(log2(l));

  int cnt=0;
  while(cnt<longe){
    ansv.push_back({{cnt+1,cnt+2},0});
    ansv.push_back({{cnt+1,cnt+2},pow(2,cnt)});
    cnt++;
  }

  ansnode=cnt+1;
    
  int mpass=ansnode-1;
  int mainpass=pow(2,longe);
  while(kasu>mainpass){
    if(kasu-pow(2,mpass)>=mainpass){
      ansv.push_back({{mpass+1,ansnode},kasu-pow(2,mpass)});
      kasu=kasu-pow(2,mpass);
    }
    mpass--;
  }

  cout << ansnode << " " <<ansv.size() <<endl;
  rep(i,ansv.size()){
    cout << ansv[i].F.F << " " <<ansv[i].F.S << " " << ansv[i].S << endl;
  }
  return 0;
}
  


Measured memory_bytes: 256
import java.util.*;
import static java.lang.Integer.*;
//import static java.lang.Long.*;
//import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int n = parseInt(sc.next());
		sc.close();
		out.printf("ABC%03d%n", n);
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
typedef  long long  ll;
ll inf=1000000000000000000,mod=1000000007,BS,k;
ll fun(ll l,ll r){
    if(l>r)return 0;
    ll num;
    num=(r-l)/3+1;
    return num;
}
int main(){
    ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin);
            freopen("output.txt","w",stdout);
        #endif
        ll arr[5];
        for(ll i=0;i<5;i++){
            cin>>arr[i];

        }
        for(ll i=0;i<5;i++)
        if(arr[i]==0)
        cout<<i+1;
}


Measured memory_bytes: 3604
s = input()

c = 0
l = 0
r = len(s) - 1
while l < r:
    if s[l] == s[r]:
        l += 1
        r -= 1
    elif s[l] == 'x':
        l += 1
        c += 1
    elif s[r] == 'x':
        r -= 1
        c += 1
    else:
        c = -1
        break

print(c)


Measured memory_bytes: 3316
#include<iostream>
using namespace std;
int main(){
  int n;
  cin>>n;
  int temp;
  int count=0;
  
  for(int i=1;i<=n;i++){
    cin>>temp;
    if(temp!=i) count++;
  }
if(count==2 or count==0) cout<<"YES\n";
  else cout<<"NO\n";
}


Measured memory_bytes: 384
use std::io::*;
use std::str::FromStr;

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

fn main(){
	let r: u32 = read();
    let g: u32 = read();
    let b: u32 = read();
	
	let ans = if (100*r + 10*g + b) % 4 == 0 {"YES"} else {"NO"};
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long

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

ll pow(ll a, ll b, ll m)
{
    ll  ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

bool vis[1001][1001];
char a[1001][1001];
ll b[1001][1001];
int h,w;

int dfs(int r,int c){
    
    if(a[r][c]=='#')
       return 0;
    if(r==0&&c==0){ vis[0][0]=true; return 1;}
    if(b[r][c]>0||vis[r][c]) return b[r][c];
    vis[r][c]=true;
    if(r-1>=0)
      b[r][c]+=dfs(r-1,c);
    if(c-1>=0) b[r][c]+=dfs(r,c-1);
    b[r][c]=b[r][c]%MOD;
    return b[r][c];
}


int main()
{
	IOS;
	int t=1; //cin>>t;
	while(t--){
	  cin>>h>>w;
	  for(int i=0;i<h;i++){
	      for(int j=0;j<w;j++){ cin>>a[i][j]; b[i][j]=0; vis[i][j]=false;}
	  }
	  dfs(h-1,w-1);
	  cout<<b[h-1][w-1];
	  cout<<"\n";
	}    

}

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

int main() {
 int n, m;
 cin >> n >> m;
 vector<int> A(n);
 vector<int> B(m);
 vector<int> C(m);

 priority_queue<pair<int, int> > P;
 for (int i = 0; i <= n-1; i++) {
  cin >> A[i];
  P.push(make_pair(A[i], 1));
 }

 for (int i = 0; i<= m-1; i++) {
  cin >> B[i] >> C[i];
  P.push(make_pair(C[i], B[i]));
 }

 unsigned long long ans = 0;

 for (int i = 0; i <= n-1; i++) {
  auto p = P.top();
  P.pop();
  ans += p.first;

  if (p.second > 1) {
   p.second--;
   P.push(p);
  }
 }

 cout << ans << endl;
}

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

int main()
{
    char str1[3];
    char str2[7][4]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
    cin>>str1;
    int i;
    for(i=0;i<7;i++)
    if(strcmp(str1,str2[i])==0)
    break;
    cout<<7-i;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int i,j,ct=0,flag=0,n;
  scanf("%d",&n);
  for(j=1;j<=n;j++){
    for(i=1;i<=j;i++){
      if(j%i==0){
        ct+=1;
      }
    }
    if(ct==8 && j%2==1){
      flag+=1;
    }
    ct=0;
  }
    printf("%d\n",flag);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;

int main() {
  ll N, M; cin>>N>>M;
  ll ans = 1;
  for(ll n = 1; n*n <= M; n++) {
    if(M % n == 0) {
      ll m = M / n;
      if(n >= N) ans = max(ans, m);
      if(m >= N) ans = max(ans, n);
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main() {

	int a,v,b,w,t,rv,rt;
	scanf("%d%d%d%d%d",&a,&v,&b,&w,&t);
	rv=v-w;
	if(rv>0){
        rt=abs(a-b);
        long double ans,rt2,rv2;
        rt2=rt; rv2=rv; ans=rt2/rv2;
        if(ans<=t) printf("YES\n");
        else printf("NO\n");
	}
	else printf("NO\n");
	return 0;
}


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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

int main(){
  int n;
  cin >> n;
  vector<string> S(n);
  REP(i,n) cin >> S[i];

  vector<int> hst(26, 100);
  REP(i,n) {
    vector<int> tmp(26, 0);
    REP(j,S[i].length()) ++tmp[S[i][j] - 'a'];
    REP(i,26) hst[i] = min(hst[i], tmp[i]);
  }

  string res;
  REP(i,26)REP(j,hst[i]) res += 'a' + i;
  cout << res << endl;
  return 0;
}



Measured memory_bytes: 256
fun main(args: Array<String>) {
    val N = readInputLine().toInt()
    
    val set = mutableSetOf<Int>()
    
    for (i in 1..N) {
        val A = readInputLine().toInt()
        
        if (!set.remove(A)) {
            set.add(A)
        }
    }
    
    println(set.size)
}

fun readInputLine(): String {
    return readLine()!!
}



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

using namespace std;

int main()
{
	int m, f, b;
	cin >> m >> f >> b;
	if (m + f < b)
		cout << "NA" << endl;
	else
		cout << max(0,b - m) << endl;

	return 0;
}



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



int main(){
    int n, ax, ay;
    ll H;
    cin >> n;
    vector<ll> x(n), y(n), h(n);
    rep(i,n){
        cin >> x[i];
        cin >> y[i];
        cin >> h[i];
    }
    rep(cy, 101){
        rep(cx, 101){
            bool flag = true;
            rep(i,n){
                if (h[i]>0) H = h[i] + abs(x[i] - cx) + abs(y[i] - cy);
            }
            rep(i,n){
                if (h[i] != max(H - abs(x[i] - cx) - abs(y[i] - cy), ll(0))) flag = false;
            }
            if (flag){
                cout << cx << " " << cy << " " << H << endl;
            }
        }
    }
}

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

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

    bool ans = true;

    for (int i = 0; i < n - 1; i++) {
        if (V[i].back() != V[i + 1].front())
            ans = false;
    }

    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (V[i] == V[j])
                ans = false;
        }
    }

    if (ans)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

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

int main(){

    int n;
    cin >> n;

    map<string, int> s;
    for(int i = 0; i < n; i++){ 
        string input;
        cin >> input;

        if(s.count(input)){
            s[input]++;
        }
        else{
            s[input] = 1;
        }
    }

    int max = 0;
    for(auto x : s){
        if(x.second > max){
            max = x.second;
        }
    }

    for(auto x : s){
        if(x.second == max){
            cout << x.first << endl;
        }
    }

    
}

Measured memory_bytes: 25216
#include <bits/stdc++.h>
#include <vector>
#include<queue>
#include<stack>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair 
#define gogogo ios::sync_with_stdio(0);cin.tie(0);

int solve(){
   string s1;
  cin>>s1;
  int cnt=0,ans=0;
  for(int i=0;i<3;i++){
    if(s1[i]=='R')cnt++;
    else cnt=0;
    ans=max(ans,cnt);
  }
       return(ans);
   
}
int main(){
    gogogo;
    int t=1;
   // cin>>t;
    while(t--){
     auto c=solve();
    cout<<c<<endl;
     
    }
}

Measured memory_bytes: 3604
N = int(input())
cn = [0]*4 #AC, WA, TLE, RE
for i in range(N):
  x = input()
  if x == "AC":
    cn[0] += 1
  elif x == "WA":
    cn[1] += 1
  elif x == "TLE":
    cn[2] += 1
  elif x == "RE":
    cn[3] += 1
print("AC x",cn[0])
print("WA x",cn[1])
print("TLE x",cn[2])
print("RE x",cn[3])

Measured memory_bytes: 9232
n, k = gets.chomp.split.map(&:to_i)
s = gets.chomp.split('')

memory = []
memory_size = 0

max = 0
count = 0
flag = 1
n.times do |i|
  count += 1
  if s[i] == '1'
    if flag == 0
      memory << i
      memory_size += 1
    end
    flag = 1
  else
    if flag == 1
      count = i - memory.shift + 1 if memory_size >= k
    end
    flag = 0
  end
  max = count if max <= count
end

puts(max)

Measured memory_bytes: 9852
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

using namespace std;

#define MAX 3000
#define INF 2140000000
#define MOD 1000000007

int dp[MAX][MAX] = {0};

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> s(n + 1), t(m + 1);

	for (int i = 0; i < n; ++i) {
		cin >> s[i + 1];
	}

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

	long long ans = 1;

	for (int i = 0; i < MAX; ++i) {
		dp[0][i] = dp[i][0] = 1;
	}

	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= m; ++j) {
			if (s[i] == t[j]) {
				dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
			}
			else {
				dp[i][j] = (dp[i - 1][j] + dp[i][j - 1] - dp[i - 1][j - 1]) % MOD;
			}
		}
	}

	if (dp[n][m] < 0) {
		dp[n][m] += MOD;
	}
	cout << dp[n][m] << endl;
	return 0;
}

Measured memory_bytes: 35200
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

using namespace std;

class EMaxGCD {

vector<int64_t> factorize(int64_t n){
    vector<int64_t> A;

    for (int i = 1; i * i <= n; i++){
        if (n % i == 0){
            A.emplace_back(i);
            if (i * i != n)
                A.emplace_back(n / i);
        }
    }

    return A;

}

public:
void solve(std::istream& cin, std::ostream& cout) {
    int64_t n, k;
    cin >> n >> k;
    vector<int64_t> A(n);
    for (auto &a: A) cin >> a;

    int64_t S = accumulate(A.begin(), A.end(), 0LL);

    vector<int64_t> B = factorize(S);
    sort(B.begin(), B.end());

    int64_t ans = 1;

    for (int i = B.size() - 1; i >= 0; i--) {
        vector<int64_t> C;
        for (const auto& a: A)
            C.emplace_back(a % B[i]);
        sort(C.begin(), C.end());

        vector<int64_t> D(n + 1);
        D[0] = 0;
        partial_sum(C.begin(), C.end(), D.begin() + 1);

        int left = 0, right = n + 1;
        while (right - left > 1){
            int mid = (left + right) / 2;
            if (D[mid] <= (n - mid) * B[i] - (D[n] - D[mid]))
                left = mid;
            else
                right = mid;
        }

        if (D[left] == (n - left) * B[i] - (D[n] - D[left]) && D[left] <= k){
            ans = B[i];
            break;
        }


    }
    cout << ans << endl;
}
};

int main() {
	EMaxGCD solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

// inf
constexpr ll infl = 10000000000000000LL;
constexpr int inf = 1000000000;

int h, w;
bool isInInside(tuple<int, int, int> p) {
    return 0 <= get<0>(p) && get<0>(p) < h && 0 <= get<1>(p) && get<1>(p) < w;
}

int main() {
    cin >> h >> w;
    vector<vector<int>> grid(h, vector<int>(w, 0));
    vector<vector<bool>> visited(h, vector<bool>(w, false));
    queue<tuple<int, int, int>> que;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            char c;
            cin >> c;

            if (c == '#') {
                grid[i][j] = 0;
                que.push({i, j, -1});
            } else {
                grid[i][j] = inf;
            }
        }
    }

    while (!que.empty()) {
        auto &p = que.front();
        que.pop();

        int i = get<0>(p);
        int j = get<1>(p);

        if (!isInInside(p) || visited[i][j])
            continue;

        visited[i][j] = true;

        grid[i][j] = get<2>(p) + 1;

        que.push({i + 1, j, grid[i][j]});
        que.push({i, j + 1, grid[i][j]});
        que.push({i - 1, j, grid[i][j]});
        que.push({i, j - 1, grid[i][j]});
    }

    int ans = 0;
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            ans = max(ans, grid[i][j]);
        }
    }
    cout << ans << endl;
    return 0;
}

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

long long extGCD(long long a, long long b, long long *px, long long *py){
    if(b == 0){
        *px = 1;
        *py = 0;
        return a;
    }
    long long d = extGCD(b, a%b, py, px);
    *py -= a/b * (*px);
    return d;
}

int main(){
    //input
    long long N,K;
    cin >> N >> K;
    long long A[N], A_MAX=0;
    long long i;
    for(i=0; i<N; i++){
        cin >> A[i];
        A_MAX=max(A_MAX,A[i]);
    }

    //calc
    long long g=A[0];
    long long x, y;
    for(i=1; i<N; i++){
        g=extGCD(g,A[i],&x,&y);
    }

    //output
    if((K<=A_MAX)&&(K%g==0)){
        cout << "POSSIBLE" << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }
    system("pause");
    return 0;
}

Measured memory_bytes: 4380
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

const ll INF = 1e+18 + 1;
const ll BASE = 1e+9 + 9;

int n, m;
ll k;
char strs[110][210];
int lens[110];
ll dp[2310];
ll num[2310];
char ans[2310];

inline ll Plus(ll lhs, ll rhs) {
  if (lhs + rhs >= INF) { return INF; }
  return lhs + rhs;
}

inline ll Mul(ll lhs, ll rhs) {
  if (rhs == 0) { return 0; }
  if (lhs * rhs / rhs != lhs || lhs * rhs >= INF) { return INF; }
  return lhs * rhs;
}

ll cnts[300];
void CalcNum1(int l) {
  MEMSET(cnts, 0);
  num[l] = 0;
  REP(i, n) {
    ull powBase = 1;
    ull h1 = 0;
    ull h2 = 0;
    ull prev = 0;
    REP(j, min(lens[i], l)) {
      int rest = m - (l - j - 1 + lens[i]);
      ull next = strs[i][j];
      h1 = h1 * BASE + strs[i][j];
      h2 = h2 - prev + next + ans[l - j - 1] * powBase;
      powBase *= BASE;
      prev = next;
      if (h1 != h2 || rest < 0) { continue; }
      ll cnt1 = dp[rest];
      ll cnt2 = num[l - j - 1];
      cnts[next] = Plus(cnts[next], Mul(cnt1, cnt2));
    }
  }
}

void CalcNum2(int l) {
  num[l] = 0;
  REP(i, n) {
    if (lens[i] > l) { continue; }
    ull powBase = 1;
    ull h1 = 0;
    ull h2 = 0;
    REP(j, min(lens[i], l)) {
      h1 = h1 * BASE + strs[i][j];
      h2 = h2 + ans[l - j - 1] * powBase;
      powBase *= BASE;
    }
    if (h1 != h2) { continue; }
    num[l] = Plus(num[l], num[l - lens[i]]);
  }
}

void calc(int depth, ll need) {
  if (depth == m) { return; }
  CalcNum1(depth + 1);
  FOREQ(c, 'a', 'z') {
    ans[depth] = c;
    ll cnt = cnts[c];
    if (cnt >= need) { break; }
    need -= cnt;
  }
  CalcNum2(depth + 1);
  calc(depth + 1, need);
}

int main() {
  while (scanf("%d %d %lld", &n, &m, &k) > 0) {
    MEMSET(ans, 0);
    MEMSET(dp, 0);
    MEMSET(num, 0);
    dp[0] = 1;
    num[0] = 1;
    REP(i, n) {
      scanf("%s", strs[i]);
      lens[i] = strlen(strs[i]);
    }
    FOR(i, 1, 2010) {
      REP(j, n) {
        if (i - lens[j] < 0) { continue; }
        ll cnt = dp[i - lens[j]];
        dp[i] = Plus(dp[i], cnt);
      }
    }
    if (dp[m] < k) {
      puts("-");
      continue;
    }
    calc(0, k);
    printf("%s\n", ans);
  }
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

ll n, i;
double h, w;

vector< pair<double, ll> > vp;

double BMI(double h, double w){
	return w / (h*0.01*h*0.01);
}

int main(){
	while (cin >> n&&n){
		REP(j, n){
			cin >> i >> h >> w;
			double a = fabs(BMI(h, w) - 22.0);
			vp.push_back(pair<double, ll>(a, i));
			//if (a < -EPS){
			//	bmi = BMI(h, w);
			//	index = i;
			//}
			//if (fabs(a) < EPS){
			//	index = min(i, index);
			//}
		}
		sort(ALL(vp));
		cout << vp[0].second << endl;
		vp.clear();
	}
}

Measured memory_bytes: 1264
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
 
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;
}

int main(){
    int n;
    cin >> n;
    map<string,int> mp;
    rep(i,n){
        string s;
        cin >> s;
        mp[s]++;
    }
    int mx = 0;
    for(auto x:mp){
        chmax(mx,x.second);
    }
    for(auto x:mp){
        if(x.second==mx){
            cout << x.first << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 17664
#include <bits/stdc++.h>
using namespace std;
using ll = __int128;
const ll b = 1713302033171ll;

ll Pow(ll x, ll n) {
	ll res = 1;
	while (n) {
		if (n & 1) {
			res = (res * x) % b;
		}
		x = (x * x) % b;
		n >>= 1;
	}
	return res;
}

int main()
{
	vector<ll> prime;
	for (ll i = 100000;prime.size() < 26; i++) {
		bool flag = true;
		for (ll j = 2; j * j <= i; j++) {
			if (i % j == 0) {
				flag = false;
				break;
			}
		}
		if (flag) {
			prime.push_back(i);
		}
	}

	string s1, s2;
	cin >> s1 >> s2;
	int n1 = s1.size(), n2 = s2.size();
	vector<ll> rh1(n1 + 1), rrh1(n1 + 1), rh2(n2 + 1), rrh2(n2 + 1);
	rh1[0] = rrh1[0] = rh2[0] = rrh2[0] = 1;
	for (int i = 1; i <= n1; i++) {
		rh1[i] = (rh1[i - 1] * prime[s1[i - 1] - 'a']) % b;
		rrh1[i] = Pow(rh1[i], b - 2);
	}
	for (int i = 1; i <= n2; i++) {
		rh2[i] = (rh2[i - 1] * prime[s2[i - 1] - 'a']) % b;
		rrh2[i] = Pow(rh2[i], b - 2);
	}
	bool fini = true;
	for (int k = min(n1, n2); k > 0; k--) {
		bool can = false;
		vector<ll> hs(n1 - k + 1);
		for (int i = 0; i + k <= n1; i++) {
			hs[i] = (rrh1[i] * rh1[i + k]) % b;
		}
		sort(hs.begin(), hs.end());
		for (int j = 0; j + k <= n2; j++) {
			if (binary_search(hs.begin(), hs.end(), (rrh2[j] * rh2[j + k]) % b)) {
				can = true;
				break;
			}
		}
		if (can) {
			fini = false;
			cout << k << endl;
			break;
		}
	}
	if (fini) {
		cout << 0 << endl;
	}
	return 0;
}

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


void solve(long long x){
  ll q = x/11;
  ll r = x%11;
  if (r==0) std::cout << q*2 << std::endl;
  else if(1<=r and r<=6)
    std::cout << q*2+1 << std::endl;
  else
    std::cout << q*2+2 << std::endl;
}

int main(){
    long long x;
    scanf("%lld",&x);
    solve(x);
    return 0;
}


Measured memory_bytes: 3776
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<bitset>
#define endl "\n"
using namespace std;

int main() 
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  vector<int> a(3);
  cin >> a[0] >> a[1] >> a[2];
  sort(a.begin(), a.end());
  cout << a[0] * a[1] / 2 << endl;
}




Measured memory_bytes: 256
#include <cstdio>
#include <cmath>

typedef long long int64;

int main()
{
    int64 S;
    scanf("%lld",&S);
    int t=ceil(sqrt(S));
    printf("0 0\n");
    int x1=t,y2=t;
    int64 k=(int64)t*t-S;
    int x2=1,y1=k;
    printf("%d %d\n%d %d\n",x1,y1,x2,y2);
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main() {
	int a,  b,c;
	char op;
	while (cin >> a >> op >> b) {
		if (op == '+') { c = a + b; }
		else if (op == '-') { c = a - b; }
		else if (op == '*') { c = a*b; }
		else if (op == '/') { c = a / b; }
		else { break; }
		cout << c << endl;
	}
	return 0;
}

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


using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for(int i = (int)(n); i > 0; --i)
#define all(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define rall(f,x,...) ([&](decltype((x)) whole) { return (f)(rbegin(whole), rend(whole), ## __VA_ARGS__); })(x)
#define sz(a) (int)(a).size()
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr ll mod = static_cast<ll>(1e9 + 7);

int n;
ll k, a[2005], num[2005], num2[2005];
void solve() {
    cin >> n >> k;

    rep(i, n)
        cin >> a[i];


    rep(i, n) rep(j, n) {
        if (a[i] > a[j]) {
            if (i < j)
                num[i] += 1;
            if (i > j)
                num2[i] += 1;
        }

    }


    ll ans = 0;
    rep(i, n) {
        auto kk = (k - 1) * k / 2 % mod;
        auto nums = num[i] + num2[i];

        ans += num[i] * k % mod + nums * kk % mod;
        ans %= mod;
    }

    cout << ans << endl;

    return;
}


int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);

    solve();

    return 0;
}


Measured memory_bytes: 256
#include<iostream>>
using namespace std;
static const int N = 100;

int main() {
	int M[N][N];
	int n, u, k, v;

	cin >> n;

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++)M[i][j] = 0;
	}

	for (int i = 0; i < n; i++) {
		cin >> u >> k;
		u--;
		for (int j = 0; j < k; j++) {
			cin >> v;
			v--;
			M[u][v] = 1;
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (j)cout << " ";
			cout << M[i][j];
		}
		cout << endl;
	}

	return 0;
}


Measured memory_bytes: 3124
#include <stdio.h>
#include<string.h>

int main(void) {

char S[26];
scanf("%s", S);
int n = strlen(S);
int i, j;
int a = 0;

for(i = 0; i <= n; ++i){
  for(j = i + 1; j <= n; ++j){
     if(S[i]==S[j]){
        a = a + 1;
     }
  }
}
  
if(a > 0)
 printf("no\n");
else
 printf("yes\n");
return 0;
}



Measured memory_bytes: 128
#include<cstdio>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<vector>
#include<queue>
#include<cmath>
#include<map> 
#define ll long long
using namespace std;
map<ll,int> mp;
ll area;
ll s1=0,s2=0;
int main()
{
   //freopen("data.in","r",stdin);
   //freopen("data.out,"w",stdout);
   ll temp;
   int n;
   cin>>n;
   for(int i=1;i<=n;i++)
   {
   	  cin>>temp;
   	  if(mp[temp]%2==1)
   	  {
   	  	if(temp>s1)
   	  	{
   	        s2=s1;
			s1=temp;		
	    }
	    else if(temp>s2)
	    {
	    	s2=temp;
		}
		
	  }
	  mp[temp]++;
   }
   cout<<(ll)s1*s2<<endl;
   return 0;
}


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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//typedef vector<vector<ll>> Graph;

const ll mod = 1e9 + 7;
//const ll mod = 998244353;

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define spa << " " <<
#define fi first
#define se second

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

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<endl;}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<endl;};

string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    return bit;
}

ll Combination(ll C, ll D){
    ll DP[C][D+1];
    for (int i=0;i<C;i++){
        for (int j=0;j<min(i+2,(int)(D+1));j++){
            if(j==0) DP[i][j] = 1;
            else if(j==(i+1)) DP[i][j] = 1;
            else DP[i][j] = (DP[i-1][j] + DP[i-1][j-1]);
        }
    }
    return DP[C-1][D];
}

int main(){

    ll N, A, B;
    cin >> N >> A >> B;
    vector<ll> v(N);
    REP(i, N) cin >> v[i];

    sort(v.rbegin(), v.rend());
    ll S = 0;
    REP(i, A){
        S += v[i];
    }

    double res = 1.0*S/A;
    printf("%.10f\n", res);

    ll mi = (1ll<<60);
    REP(i, A){
        chmin(mi, v[i]);
    }
    ll cnt1 = 0, cnt2 = 0;
    REP(i, N) if(v[i]==mi) cnt1++;
    REP(i, A) if(v[i]==mi) cnt2++;

    ll res2 = 0;
    if(v[0] == mi){
        for(int i=A;i<=B;i++){
            if(i<=cnt1) res2 += Combination(cnt1, i);
        }
    }else{
        res2 += Combination(cnt1, cnt2);
    }

    cout << res2 << endl;
    return 0;
}

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

int main() {
    string ans = "",s;cin >> s;
    int sl=s.length();
    if (sl==1) ans=s[0];
    else {
        string pre= s.substr(0,1);
        int l=1,id = 1;
        while (id<sl) {
            if (pre==s.substr(id,l)) {
                if (id+l-1>=sl-1) {ans += pre+s.substr(id,1);break;}
                else l=2;
            }
            else {
                ans += pre + "|";
                pre = s.substr(id,l);
                if (id+l>sl-1) {ans += s.substr(id,l);break;}
                else id+=l;
                l=1;
            }
        }
    }
    //cout << ans << endl;
    cout << count(ans.begin(),ans.end(),'|')+1 << endl;
    return 0;
}

Measured memory_bytes: 1032
#include <iostream>
#include <algorithm>
int h[1000005];
int a[200005], n, ans, m;

int main() {
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(0), std::cout.tie(0);
	std::cin >> n;
	for(int i = 1; i <= n; ++i) {
		std::cin >> a[i];
		++h[a[i]];
		m = std::max(m, a[i]);
	}
	std::sort(a + 1, a + n + 1);
	n = std::unique(a + 1, a + n + 1) - a - 1;
	for(int i = 1; i <= m; ++i) {
		if(h[i] > 1)
			h[i] = false;
		else if(h[i] == 1)
			++ans;
	}
	for(int i = 1; i <= n; ++i) {
		for(int j = (a[i] << 1); j <= m; j += a[i]) {
			if(h[j] > 0) {
				h[j] = false;
				--ans;
			}
		}
	}
	std::cout << ans;
	return 0;
}

Measured memory_bytes: 8180