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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

void solve()
{
  int k;
  cin >> k;

  if (k % 2 == 0)
  {
    cout << -1;
    return;
  }

  ll num = 0;
  for(int i = 0; i < 1000000; ++i)
  {
    num = num * 10 + 7;
    num %= k;
    if (num == 0)
    {
      cout << i + 1;
      return;
    }
  }  
  cout<< -1;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3632
S = list(input())
ans = 0
for i in range(2,len(S)-1):
  if S[i] == "C":
    ans += 1
    S[i] = S[i].lower()
if S[0]=="A" and ans==1:
  S[0] = S[0].lower()
  s = ""
  for i in range(len(S)):
    s += S[i]
  if s.islower():
    print("AC")
  else:
    print("WA")
else:
  print("WA")

Measured memory_bytes: 3064
#coding: utf-8
from collections import Counter
N = int(input())
l = ["0", "3", "5", "7"]
ans = ["0" for _ in range(9)]
cnt = 0
for a in l:
    ans[0] = a
    for b in l:
        ans[1] = b
        for c in l:
            ans[2] = c
            for d in l:
                ans[3] = d
                for e in l:
                    ans[4] = e
                    for f in l:
                        ans[5] = f
                        for g in l:
                            ans[6] = g
                            for h in l:
                                ans[7] = h
                                for i in l:
                                    ans[8] = i
                                    ans_i = int("".join(ans))
                                    ans_c = Counter(str(ans_i))
                                    if ans_i <= N and "0" not in str(ans_i) and len(ans_c.keys()) == 3 and len(str(ans_i)) >= 3:
                                        cnt += 1
print(cnt)

Measured memory_bytes: 3436
def make_equation(i):
    key = i
    equation= ""
    for s in S[:-1]:
        equation += s
        if(key % 2 == 1):
            equation += "+"
        key = key // 2
    equation += S[-1]
    return equation

S = input().strip()
spaces = len(S) - 1
kinds = 2 ** spaces
ans = 0
for i in range(kinds):
    equation = make_equation(i)    
    ans += sum(map(int, equation.split("+")))
print(ans)

Measured memory_bytes: 3064
N,K = map(int,input().split())
num = [0]*(10**5+1)
for i in range(N):
    a,b = map(int,input().split())
    num[a] += b
for i in range(1,10**5+1):
    if K <= num[i]:
        print(i)
        exit()
    K -= num[i]


Measured memory_bytes: 5736
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define EPS (1e-10)
#define MOD 1000000007
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

char s[1000000];
int main() {
	int k; scanf("%s%d", s, &k);
	rep(i, strlen(s)) {
		if (s[i]!='a'&&s[i] + k > 'z') {
			k = k + s[i] - 'z' - 1;
			s[i] = 'a';
		}
	}
	if (k) {
		s[strlen(s) - 1] = (s[strlen(s) - 1] + k - 'a') % 26 + 'a';
	}
	printf("%s\n", s);
}

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

using namespace std;
typedef long long LL;
const double pi = acos(-1.0);
const double eps = 1e-7;
const LL N = 100010;

LL T,n,m,i,j,k,a[N],t,ans=0,cnt1=0,cnt2=0;

int main()
{
    scanf("%lld",&n);
    for(i=0;i<n;i++){
        scanf("%lld",&t);
        if(t==i+1){
            cnt1++;
        }else{
            if(cnt1){
                a[cnt2++]=cnt1;
                cnt1=0;
            }
        }
    }
    if(cnt1)a[cnt2++]=cnt1;
    for(i=0;i<cnt2;i++){
        ans+=(a[i]+1)>>1;
    }
    printf("%lld\n",ans);
    //system("pause");
    return 0;
}


Measured memory_bytes: 640
/**************************************************************************
Coded by: Saba Karimi(_VINTAGE)
Institution: AIT PUNE
***************************************************************************/
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back 
#define all(a) a.begin(),a.end()
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define ld long double
#define int long long int 
/**************************************************************************/
signed main()
{
    fast;
    int n,k;
    cin>>n>>k;
    int a[n+1];
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    int ans = 0;
    for(int i=50;i>=0;i--)
    {
        int cnt = 0;
        for(int j=1;j<=n;j++)
        {
            if(a[j]&((int)1<<i))
                cnt++;
        }
        if(cnt*2<n && (ans+((int)1<<i))<=k)
            ans+=((int)1<<i);
    }
    int q = 0;
    for(int i=1;i<=n;i++)
        q+=(ans^a[i]);
    cout<<q;
}

Measured memory_bytes: 1024
#include <numeric>
#include <iostream>
#include <array>
#include <string>
#include <vector>
#include <cassert>
#include <algorithm>
#include <math.h> 
#include <set>
#include <map>
#include <utility>
#include <deque>
#include <queue>
 
 
using namespace std;
 
#define ll long long int
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repp(i, n) for(ll i = 1; i <= n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define riverse(v) reverse((v).begin(), (v).end())
#define pb push_back
#define mp make_pair
#define all(a)  (a).begin(),(a).end()
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
const ll MOD = 1e9 + 7;
vi alphabet = { 'a','b','c','d','e','f','g','h','i','j','k','l','m',
               'n','o','p','q','r','s','t','u','v','w','x','y','z' };
 
 
ll func(ll m){
    ll s = m / 10;
    ll count5 = s;
    while (s > 1) {
        count5 += s / 5;
        s = s / 5;
    }
    return count5;
}
 
int main() {
    ll n;
    cin >> n;
    ll m = n;
    ll count2 = 0;
    ll count5 = 0;
    ll count10 = 0;
    if (n % 2 == 0 && n > 0) {
        while (n % 2 == 0) {
            count2 += n / 2;
            n = n / 2;
        }
    }
    if (m % 10 == 0 || m % 10 == 2 || m % 10 == 4 || m % 10 == 6 || m % 10 == 8) {
        count5 += func(m);
    }
    else if (m == 1 || m == 3) {
        count5 = 0;
    }
    else {
        while (m % 5 != 0) m -= 2;
        ll k = m;
        ll l = (m - 5) / 10;
        count5 += l + 1;
        m = m / 5;
        while (m > 1) {
            count5 += m / 5;
            m = m / 5;
        }
        count5 -= func(k);
    }
    cout << min(count2, count5) << endl;
}

Measured memory_bytes: 256
import scala.io.StdIn.{readLine, readInt}

object Main extends App {
  while (true) {
    val s = readLine
    if (s == "-") sys.exit()
    val n = readInt

    var deck = s.toCharArray
    for (_ <- 1 to n) {
      val shuffle = readInt
      val picked = deck.take(shuffle)
      val rest = deck.drop(shuffle)
      deck = rest ++ picked
    }
    println(deck.mkString)
  }

}


Measured memory_bytes: 44188
#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

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

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int c[25];

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n;
    cin >> n;
    vector<int> d(n);
    rep(i,n)cin >> d[i];
    c[0] = 1;
    sort(ALL(d));
    rep(i,n){
        if((i%2)==0){
            int a = d[i];
            int b = 24 - d[i];
            c[min(a,b)]++;
        }else{
            int a = d[i];
            int b = 24 - d[i];
            c[max(a,b)]++;
        }
    }
    int ans = 24;
    int cnt = 1;
    for(int i=1;i<24;i++){
        if(c[i]==0)cnt++;
        else{
            ans = min(ans,cnt);
            cnt = 1;
        }
    }
    
    ans = min(ans,cnt);
    if(d[0]==0)ans = 0;
    rep(i,24)if(c[i]>=2)ans = 0;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
const ll MOD = 1e9;

int main(){
  string a;
  cin>>a;
  if(a.size()==2)cout<<a<<endl;
  else cout<<a[2]<<a[1]<<a[0]<<endl;
  return 0;
}


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

int main(){
  int n, ans = 0; cin >> n;
  vector<int> num(n);
  rep(i, n){
    cin >> num.at(i);
  }  
  for(int i = 0; i < n - 2; i++){
    int a, b, c; 
    for(int j = i + 1; j < n - 1; j++){
      for(int k = j + 1; k < n; k++){
        a = num.at(i); b = num.at(j); c = num.at(k);
        if(a == b || b == c || a  == c) continue;
        if(a < b) swap(a, b);
        if(a < c) swap(a, c);
        if(b < c) swap(b, c);
        if(a + b > c && a - b < c) ans++;
      }
    }
  }  
  cout << ans << endl;
  return 0;
}  

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

using namespace std;

int main() {
  int N, A;
  cin >> N >> A;
  
  int ans1 = N % 500;
  int ans2 = A - ans1;
  if (ans2 >= 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

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

int main(){
  int n;
  cin >> n;
  long long a;
  cin >> a;
  for(int i=0; i<n-1; i++){
    long long b;
    cin >> b;
    a = gcd(a, b);
  }
  cout << a << endl;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

struct WeightedUnionFind {
    vector<int> data;
    vector<int> diff_weight;

    WeightedUnionFind(int sz) : data(sz, -1), diff_weight(sz, 0) {}

    bool unite(int x, int y, int w) {
        w += weight(x);
        w -= weight(y);
        x = find(x);
        y = find(y);
        bool is_union = (x != y);
        if (is_union) {
            if (data[x] > data[y]) {
                swap(x, y);
                w = -w;
            }
            data[x] += data[y];
            data[y] = x;
            diff_weight[y] = w;
        } else {
            if (diff(x, y) == w) return true;
        }
        return is_union;
    }

    int find(int x) {
        if (data[x] < 0) { 
            return x;
        } else {
            int par = data[x];
            data[x] = find(data[x]); 
            diff_weight[x] += diff_weight[par];
            return data[x];
        }
    }

    int weight(int x) {
        find(x);
        return diff_weight[x];
    }

    bool same(int x, int y) {
        return find(x) == find(y);
    }

    int diff(int x, int y) {
        return weight(y) - weight(x);
    }

    int size(int x) {
        return -data[find(x)];
    }
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	WeightedUnionFind wuf(n);
	int l, r, d;
	rep(i,m){
		cin >> l >> r >> d;
		if(!wuf.unite(l, r, d)){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 1024
// B - Two Anagrams
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(),(x).rend()

int main(){
	string s,t; cin>>s>>t;
	sort(all(s)); sort(allr(t));
	bool ret = s>=t? false: true;
	cout<< (ret? "Yes":"No") <<endl;

}

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

int main(){
  string str;
  cin >> str;
  bool chk = true;
  int index = 0;
  
  if(str.size() < 5){
    cout << "NO";
    return 0;
  }
  
  if(str.at(0) != 'A'){
    str = 'A' + str;
  }
  
  if(str.at(4) != 'A'){
    str = str.substr(0,4) + 'A' + str.substr(4);
  }
  
  if(str.at(6) != 'A'){
    str = str.substr(0,6) + 'A' + str.substr(6);
  }
  
  if(str.size() == 8){
    str = str + 'A';
  }

  if(str == "AKIHABARA") cout << "YES";
  else cout << "NO";
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main() {
    int H, W;
    int dx[] = {1, 1, 1, 0, 0, -1, -1, -1};
    int dy[] = {1, 0, -1, 1, -1, 1, 0, -1};
    string S[50];
    cin >> H >> W;
    for(int i = 0; i < H; i++) cin >> S[i];

    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            int cnt = 0;
            if(S[i][j] != '#'){
                for(int k = 0; k < 8; k++) {
                    if (0 <= i + dx[k] && i + dx[k] < H)
                        if (0 <= j + dy[k] && j + dy[k] < W) {
                            if (S[i + dx[k]][j + dy[k]] == '#')
                                cnt += 1;
                        }
                }
                cout << cnt;
            }else{
               cout << '#';
            }
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	ll n, k; cin >> n >> k;
	vector<vector<ll>> pk(2005, vector<ll>(2005, 0));
	pk[0][0] = 1;
	ll M = 1000000007;
	rep(i, 0, 2000)rep(j, 0, 2000)
	{
		pk[i + 1][j] = (pk[i][j] + pk[i + 1][j]) % M;
		pk[i][j + 1] = (pk[i][j] + pk[i][j + 1]) % M;
	}
	rep(i, 1, k)
	{
		if (n - k + 1 < i)cout << 0 << endl;
		else cout << pk[n - k + 1 - i][i] * pk[k - i][i - 1] % M << endl;
	}
}

Measured memory_bytes: 31872
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <iomanip>
//#pragma GCC optimize("Ofast")  //デバッグ時にoptimized-outされて邪魔だった
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define floatprec(dig) fixed << setprecision(dig)
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define invar(typ, var) typ var; cin >> var;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

signed main(void) {
  cin.tie(0); ios::sync_with_stdio(false);
  
  invar(int, N);
  vi A(N);
  rep(i, N) {
    cin >> A[i];
  }
  
  //値 => indexes
  vector<unordered_set<int>> s(N + 1, unordered_set<int>());
  //前処理
  rep(i, N) {
    s[A[i]].emplace(i);
  }
  
  ll allsum = 0;
  //合計
  for(auto ss : s) {
    allsum += (ll)ss.size() * ((ll)ss.size() - (ll)1) / (ll)2;
  }
  
  //各クエリ
  rep(i, N) {
    int v = A[i];
    ll orgnum = (ll)s[v].size() * ((ll)s[v].size() - (ll)1) / (ll)2;
    s[v].erase(i);
    ll afternum = (ll)s[v].size() * ((ll)s[v].size() - (ll)1) / (ll)2;
    ll res = allsum - orgnum + afternum;
    fin(res);
    s[v].emplace(i);
  }
  
}

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

ll f(ll n){
  ll cnt=0;
  for(ll x=1;x*x<=n/6;x++){
    for(ll z=sqrt(n/6);z*z+2*x*z+3*x<=n;z++){
      for(ll y=x;y<=z;y++){
        if(x*x+y*y+z*z+x*y+y*z+z*x==n){
          if(x!=y && y!=z &&z!=x) cnt+=6;
          else if(x==y && y!=z) cnt+=3;
          else if(y==z && z!=x) cnt+=3;
          else if(z==x && x!=y) cnt+=3;
          else cnt++;
        }
      }
    }
  }
  return cnt;
}

int main(){
  ll n;
  cin>>n;
  for(ll i=1;i<=n;i++){
    cout<<f(i)<<endl;
  }

  return 0;
}

Measured memory_bytes: 3576
import java.util.Scanner;
import java.util.Arrays;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextInt();
        long A = sc.nextInt();
        long i;
        while(N>=500){
            N=N-500;
        }
        if (A >=N) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21716
/*
ID: arthurc4
TASK: test
LANG: C++11
*/
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <queue>
#include <bitset>
#include <random>
#include <stack>
#include <deque>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++)
#define REPb(j, d, c) \
for (int j = int(d); j >= int(c); j--)
#define ff \
first
#define ss \
second
#define pb \
push_back
int main()
{
	//ifstream cin("input.txt");
	//ifstream cin("test.in");
	//ofstream cout("test.out");

	map<char,int> mappy;

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

	REP(i,0,n-1)
	{
		mappy[s[i]]++;
	}

	ll counter=1;

	for(auto x:mappy)
	{
		//cout << x.ff << " " << x.ss << endl;
		counter*=(1+x.ss);
		counter%=(ll(1e9)+7);
	}

	cout << counter-1 << endl;

	return 0;
}

Measured memory_bytes: 512
n, d = list(map(int, input().split()))
points = [list(map(int, input().split())) for i in range(n)]

ans = 0

for i in range(n):
  for j in range(i+1, n):
    dis_2 = 0
    for k in range(d):
      dis_2 += (points[i][k] - points[j][k]) ** 2
    if (dis_2 ** 0.5) == int(dis_2 ** 0.5):
      ans += 1

print(ans)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
 
string to_string(string s) { return '"' + s + '"'; }
string to_string(bool b) { return b ? "true" : "false"; }
template <size_t N> string to_string(bitset<N> bs) {
  string res;
  for (size_t i = 0; i < N; ++i) res += '0' + bs[i];
  return res;
}
string to_string(vector<bool> v) {
  string res = "{";
  for (bool e : v) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p);
template <class C> string to_string(C c) {
  string res = "{";
  for (auto e : c) res += to_string(e) + ", ";
  return res += "}";
}
template <class T, class U> string to_string(pair<T, U> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug() { cerr << '\n'; }
template <class Head, class... Tail> void debug(Head head, Tail... tail) {
  cerr << '\t' << to_string(head), debug(tail...);
}
#ifdef LOCAL
#define DEBUG(...) cerr << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
#else
#define DEBUG(...)
#endif
 
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, k, c;
  cin >> n >> k >> c;
  string s;
  cin >> s;
  vector<int> b(n, -1);
  {
    int i = 0;
    for (int t = 0; t < k; ++t) {
      while (s[i] == 'x') {
        ++i;
      }
      b[i] = t;
      i += c + 1;
    }
  }
  DEBUG(b);
  vector<int> dp(3 * n);
  for (int i = n; i--; ) {
    dp[i] = dp[i + 1];
    if (s[i] == 'o') {
      dp[i] = max(dp[i], 1 + dp[i + c + 1]);
    }
  }
  DEBUG(dp);
  for (int i = 0; i < n; ++i) {
    if (b[i] != -1 and b[i] + dp[i + 1] < k) {
      cout << i + 1 << '\n';
    }
  }
}

Measured memory_bytes: 5140
# ビット全探索
from itertools import product

N = int(input())

evidences = [[] for _ in range(N)]
for i in range(N):
    A = int(input())
    for _ in range(A):
        x, y = map(int, input().split())
        evidences[i].append((x - 1, y))

result = 0
for i in product([0, 1], repeat=N):
    consistent = True
    for j in range(N):
        if i[j] == 0:
            continue
        for x, y in evidences[j]:
            if i[x] != y:
                consistent = False
                break
        if not consistent:
            break
    if consistent:
        result = max(result, i.count(True))
print(result)


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

float temperature(int t, int x) {
	return t - x * 0.006;
}

float dist(float x, float y) {
	if (x > y) return x-y;
	else return y-x;
}

int main() {
	int n, t, a;
	cin >> n >> t >> a;
	int ans = 0;
	float min = 1000000;
	for (int i = 1; i <= n; i++) {
		int h;
		cin >> h;
		float d = dist(a, temperature(t, h));
		if (d < min) {
			ans = i;
			min = d;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <iomanip>
#include <cmath>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define ll long long
using namespace std;
const int N = 200042;
const int m = 1e9 + 7;
int add(int x, int y) {
  x += y;
  while(x >= m) x -= m;
  while(x < 0) x += m;
  return x;
}
ll mul(ll x, ll y) {
  ll ans = (x * 1ll * y) % m;
  while(ans < 0) ans += m;
  return ans;
}
int binpow(int x, int y) {
  int z = 1;
  while(y) {
    if(y & 1) z = mul(z, x);
    x = mul(x, x);
    y >>= 1;
  }
  return z;
}
int inv(int x) {
  return binpow(x, m - 2);
}
int divide(int x, int y) {
  return mul(x, inv(y));
}
int fact[N];
void precalc() {
  fact[0] = 1;
  for(int i = 1; i < N; i++) fact[i] = mul(fact[i - 1], i);
}
int C(int n, int k) {
  return divide(fact[n], mul(fact[k], fact[n - k]));
}
int A(int n, int m) {
  return divide(fact[n], fact[n - m]);
}
int main() {

  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

  precalc();

  int n = 0, k = 0, ans = 0, one = 0;

  cin >> n >> k;

  vector<int> toadd(k + 1);

  for(int i = 1; i <= k; i++) toadd[i] = i;

  for(int i = 1; i <= k; i++) {
    for(int j = 2 * i; j <= k; j += i) toadd[j] -= toadd[i];
  }

  for(int i = 1; i <= k; i++) ans = add(ans, mul(toadd[i], binpow(k / i, n)));

  cout << ans;

  return 0;
}
/*

*/


Measured memory_bytes: 4524
#include<bits/stdc++.h>
#define FAST std::ios::sync_with_stdio(false);
#define endl '\n'
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MAX_N 100005
#define Mem(a,b) memset(a,b,sizeof(a))
#define FREI freopen("in.txt","r",stdin)
#define FREO freopen("out.txt","w",stdout)
using namespace std;
const ll mod=1e9+7;
ll a[MAX_N],b[MAX_N];
ll apow(int n){
   ll ans=1;
   for(int i=1;i<=n;i++)
      ans*=2;
   return ans;
}
int main() {
   FAST;
   //FREI;
    ll n,k;
    cin>>n>>k;
    for(int i=0;i<n;i++)
      cin>>a[i]>>b[i];
   vector<ll>vec;
   int cnt=0;
   ll tmp=k;
   vec.push_back(k);
   while(tmp){
      if(tmp&1){
      tmp>>=1;
      //cout<<tmp<<" "<<cnt<<endl;
      vec.push_back(tmp*apow(cnt+1)+apow(cnt)-1);
      }
      else{
         tmp>>=1;
      }
      cnt++;
   }
   ll ans=0;
   ll res=0;
   for(int i=0;i<vec.size();i++){
         res=0;
      for(int j=0;j<n;j++){
         tmp=vec[i];
         //cout<<vec[i]<<endl;
         ll tmp0=a[j];
         while(tmp&&tmp0){
            if((tmp&1)==0&&(tmp0&1)==1)
               break;
            tmp>>=1;
            tmp0>>=1;
         }
         if(tmp>=0&&tmp0==0&&(!((tmp&1)==0&&(tmp0&1)==1))){
            //cout<<j<<" "<<tmp<<" "<<tmp0<<endl;
            res+=b[j];
         }
      }
   ans=max(res,ans);
   }
   cout<<ans<<endl;
   return 0;
}


Measured memory_bytes: 1792
#pragma GCC optimize("O3", "unroll-loops")

// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <limits>
#include <ext/rope>

using namespace std;
using namespace __gnu_cxx;

const int inf = (1 << 30) + 9e8;
const int MAXN = 1e5;
const int MAXN2 = 1e4;
const int P = 131;
const long long MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;
typedef vector<bool> vb;

#define FAST ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define all(a) a.begin(), a.end()
#define pb push_back
#define files(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)
#define ppb pop_back
#define ppf pop_front
#define fs first
#define sd second
#define eb emplace_back

template<class T> inline void sort(T &a) { sort(all(a)); }
template<class T> inline istream& operator>>(istream& str, vector<T> &a) { for (auto &i : a) str >> i; return str; }
std::mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

void solve() {
    int n;
    cin >> n;
    vi a(n), b(n), c(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i] >> c[i];
    }
    vvi dp(n, vi(3, 0));
    dp[0][1] = a[0];
    dp[0][2] = b[0];
    dp[0][3] = c[0];
    for (int i = 1; i < n; ++i) {
        for (int j = 1; j <= 3; ++j) {
            if (j == 1) {
                dp[i][j] = max(dp[i - 1][j + 1], dp[i - 1][j + 2]) + a[i];
            } else if (j == 2) {
                dp[i][j] = max(dp[i - 1][j + 1], dp[i - 1][j - 1]) + b[i];
            } else {
                dp[i][j] = max(dp[i - 1][j - 1], dp[i - 1][j - 2]) + c[i];
            }
        }
    }
    // for (int i = 0; i < n; ++i) {
    //     for (int j = 1; j <= 3; ++j) {
    //         cout << dp[i][j] << ' ';
    //     }
    //     cout << '\n';
    // }
    cout << max({dp[n - 1][1], dp[n - 1][2], dp[n - 1][3]});
}

signed main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    FAST;
    int q = 1;
    // cin >> q;
    // int st = clock();
    while (q--) {
        solve();
    }
    // int en = clock();
    // cout << en - st << "ms.";
    return 0;
}


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

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

   int cousya[4][3][10] = {};
   for(int i=0;i<n;i++){
      int b, f, r, v;
      cin>>b>>f>>r>>v;
      cousya[b-1][f-1][r-1] += v;
   }

   for(int i=0;i<4;i++){
       if(i) cout<<"####################"<<endl;

       for(int j=0;j<3;j++){
           for(int k=0;k<10;k++){
              cout<<" "<<cousya[i][j][k];
           }
           cout<<endl;
       }
   } 
 
   return 0;
}


Measured memory_bytes: 3072
#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <functional>

using namespace std;
int main(){
    string s;
    cin  >> s;
   // int count=0;
   // char reg='0';
    int i=3;
    vector<int> vec(s.size()+10);
    vec[0]=1;
    if(s[0]==s[1]){
        vec[1]=1;
        vec[2]=2;
    }else{
        vec[1]=2;
        if(s[1]==s[2]){
            vec[2]=2;
        }else{
            vec[2]=3;
        }
    }
    
    while(i<s.size()){
        if(s[i-1]==s[i]){
            vec[i]=vec[i-3]+2;
        }else{
            vec[i]=vec[i-1]+1;
        }
        i++;
    }
    cout<<vec[s.size()-1]<<endl;
}

Measured memory_bytes: 1412
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define all(v) begin(v), end(v)
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;
const ll inf = (ll)1e18;
const ll MOD{ (ll)1e9 + 7 };

int n;
ll b[200010];

int main()
{
	cin >> n;
	rep(i, n) {
		ll a;
		cin >> a;
		b[i] = a - (i + 1);
	}
	sort(b, b + n);
	ll mid = b[n / 2];
	ll sum = 0LL;
	rep(i, n) {
		sum += labs(b[i] - mid);
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define ll long long
#define ull unsigned long long
#define ld long double
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rbf(a, x) for (auto& a : x)
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define drep(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define pll pair<long long,long long>
#define pb emplace_back
#define mp make_pair
#define mt make_tuple
#define vvc vector<vector<char>>
#define vc vector<char>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define Maxe(x) *max_element(all(x))
#define Mine(x) *min_element(all(x))
#define Size(x) ((ll)(x).size())
#define umap unordered_map
const long long INF = 1LL << 60;
const long double pi = 3.1415926535897932;
#define Fi first
#define Se second
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

    template<typename Num>
        constexpr Num mypow(Num a, long long b) {
            if(b==0)return 1;
            if (a==0)return 0;
            Num x = 1;
              while (b > 0) {
                if(b & 1)x*=a;
                a*=a;
                b >>= 1;
              }
              return x;
        }

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

    ll nCr(ll n, ll r) {
        ll ans = 1;
         for (ll i = n; i > n - r; --i) {
           ans = ans*i;
        }
        for (ll i = 1 ; i < r + 1; ++i) {
           ans = ans / i;
        }
        return ans;
    }


    signed main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        ll n;
        cin>>n;
        vl A(n);
        rep(i,n)cin>>A[i];
        vl s(n+1,0);
        rep(i,n){
            s[i+1]=s[i]+A[i];
        }
        sort(all(s));
        ll now=100000000000;
        ll res=0;
        ll cou=0;
        rep(i,n+1){
            if(now!=s[i]){
                res+=nCr(cou,2);
                cou=0;
            }
            now=s[i];
            cou++;
        }
        res+=nCr(cou,2);
        cout<<res<<endl;
    }

Measured memory_bytes: 6368
using System;

public class Program {

        public static void Main(string[] args) {

            string[] strArray = Console.ReadLine().Split(' ');

            int[] intArray = { int.Parse(strArray[0]), int.Parse(strArray[1]), int.Parse(strArray[2]) };

            Array.Sort(intArray);

            if(intArray[0] == 5 && intArray[1] == 5 && intArray[2] == 7) {

                Console.WriteLine("YES");

            } else {

                Console.WriteLine("NO");

            }

        }

    }

Measured memory_bytes: 13140
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
#define llMAX 9223372036854775807
#define llMIN -9223372036854775808
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;

//mapの使い方
#include <map>
    /*
    for (auto it : nums) {
        long long num = it.second; // it.first が it.second 個ある
        res += num * (num - 1) / 2;
    }
    */


int main(){
  ll ans=0;
  cin >> n ;
  map<string, long long> nums;
  string s;
  REP(i,n){
    cin>>s;
    nums[s]+=1;
  }
  cout<<nums.size()<<endl;
  return 0;
}

Measured memory_bytes: 19064
N,K = map(int, input().split())
A = list(map(int, input().split()))
min_idx = A.index(1)

buff = []
for i in range(K):
    before = min_idx - i
    after = N - (min_idx+1) - (K-1 - i)

    b = int(before / (K-1))
    a = int(after / (K-1))
    if (before % (K-1)) != 0:
        b += 1
    if (after % (K-1))!= 0:
        a += 1

    buff.append(a + b + 1)
print(min(buff))

Measured memory_bytes: 13812
/**************************
*                         *
*  Nothing Is Impossible  *
*                         *
**************************/
#include <algorithm>
#include <pthread.h>
#include <iostream>
#include <fstream>
#include <ctype.h>
#include <string>
#include <vector>
#include <thread>
#include <math.h>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <set>
#include <map>
#define GetRand(Min, Max) ((rand()%(int)(((Max) + 1)-(Min))) + (Min))
#define Rep(i, min, max) for(int64_t i = min; i < max; ++i)
#define PB push_back
#define MP make_pair
typedef long long ll;
typedef long double ld;
using namespace std;

void solve(){
	string s;	cin >> s;
	int n = s[s.size()-1]-'0';
	if(n == 3){
		puts("bon");
	}else if(n == 0 || n == 1 || n == 6 || n == 8){
		puts("pon");
	}else{
		puts("hon");
	}
}

int main(){
    ios::sync_with_stdio(NULL);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //int t;  cin >> t;
    while(t--){
        solve();
    }
    return 0;
}

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

typedef unsigned uint;
typedef long long INT;
typedef unsigned long long UINT;
const int INF = 1001001001;
const INT INFLL = 1001001001001001001LL;

 int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
INT lin() { INT x; scanf("%lld", &x); return x; }

int main(){
    int a, b, c;
    double fa, fb, fc;
    char S[128], sa[128], sb[128], sc[128];
    // int N = in();
    // int K = in();
    // scanf("%s", S);

    int N = in();
    int W = in();




    printf( W >= N ? "unsafe" : "safe");

    return 0;
}







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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;


void ABC146F()
{
	int N, M;
	cin >> N >> M;
	vi grid(N + 1);
	string S;
	cin >> S;
	for (int i = 0; i < N + 1; ++i)
	{
		grid[i] = S[i] == '0' ? 0 : 1;
	}

	int current = N;
	int prev = N;
	vi steps;
	while (current > 0)
	{
		current = max(0,prev - M);
		if (0 == current)
		{
			steps.push_back(prev - current);
			break;
		}
		for (; current < prev; ++current)
		{
			if (grid[current] == 0)
			{
				steps.push_back(prev - current);
				break;
			}
		}

		if (current != prev)
		{
			prev = current;
			continue;
		}

		cout << -1 << endl;
		return;
	}

	for (int i = steps.size() - 1; i > -1; --i)
	{
		cout << steps[i];
		if (i > 0)
			cout << ' ';
	}
	cout << endl;
}
int main()
{
	ABC146F();
	return 0;
}

Measured memory_bytes: 1528
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(int i=l;i<=r;i++)
#define in(x) scanf("%d",&x)
#define out(x) printf("%d\n",x)
#define ll long long

struct node{
	string s;
	int a,num;
}stu[1005];
bool cmp(node a,node b){
	if(a.s!=b.s)return a.s<b.s;
	return a.a>b.a;
}
int n;
signed main(){
	in(n);
	FOR(i,1,n){
		cin>>stu[i].s;
		cin>>stu[i].a;
		stu[i].num=i;
	}
	sort(stu+1,stu+1+n,cmp);
	FOR(i,1,n)
	out(stu[i].num);
	return 0;
} 

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)

static const ll MOD = 1e9 + 7;
static const ll INF = (ll)1 << 62;

static const ll MAX_N = 100001;
static const ll MAX_M = 200001;

int main() {
	ll h, w, n; cin >> h >> w >> n;
	ll a[10000] = {};
	rep(i, 0, n)cin >> a[i];

	ll c[100][100];
	bool r = true;
	ll curH = 0;
	ll curW = 0;
	rep(i, 0, n) {
		rep(k, 0, a[i]) {
			c[curH][curW] = i + 1;
			if (r) {
				curW++;
			}
			else {
				curW--;
			}

			if (curW == w) {
				curW--;
				curH++;
				r = !r;
			}
			else if (curW < 0) {
				curW++;
				curH++;
				r = !r;
			}
			else {}
		}
	}

	rep(i, 0, h) {
		rep(j, 0, w) {
			cout << c[i][j];
			if (j != w - 1) {
				cout << " ";
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 384
import java.io.IOException;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String I = sc.nextLine();
		int max = 0;
		int count = 0;
		for(int i=0; i<I.length(); i++) {
			if(I.charAt(i) == 'A' || I.charAt(i) == 'C' || I.charAt(i) == 'G' || I.charAt(i) == 'T') {
				count++;
			} else {

				max = Math.max(max, count);
				count = 0;
			}
		}
		max = Math.max(max, count);
		System.out.println(max);
	}
}


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

using namespace std;

#define LIMIT 100
#define MOD 1000000007ll
#define INF 1e9
typedef long long ll;
typedef pair<ll, ll> ii;
int gcd(ll a, ll b) { return (b==0)?a:gcd(b, a%b); }
int lcm(ll a, ll b) { ll i=(a/gcd(a,b))*b; assert(i>0); return i; }

//  ***** MAIN *****
int main(){

  //ios::sync_with_stdio(false);
  cin.tie(NULL);

  int n; cin >> n;
  string s;
  vector<vector<string>> v(5, vector<string> ());
  for (int i = 0; i < n; ++i) {
    cin >> s;
    if(s[0] == 'M') v[0].push_back(s);
    if(s[0] == 'A') v[1].push_back(s);
    if(s[0] == 'R') v[2].push_back(s);
    if(s[0] == 'C') v[3].push_back(s);
    if(s[0] == 'H') v[4].push_back(s);
  }

  ll t = 0;
  for(int i = 0; i < (1<<5); ++i){
    int bitcount = 0;

    for (int j = 0; j < 5; ++j) {
      if(i&(1<<j)) bitcount++;
    }

    if(bitcount == 3){
      ll temp = 1;
      for (int j = 0; j < 5; ++j) {
        if(i&(1<<j)){
          temp *= v[j].size();
        }
      }
      t+= temp;
    }
  }


  std::cout << t << std::endl;


  return 0;
}



Measured memory_bytes: 5748
#include <algorithm>
#include <cmath>
#include <climits>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

constexpr int kNumArms = 31;
constexpr long kMax = std::pow(2, kNumArms);

int main() {
  int N; std::cin >> N;
  int u[1000], v[1000];

  for (int i = 0; i < N; i++) {
    int x, y; std::cin >> x >> y;
    u[i] = x + y; v[i] = x - y;
  }

  bool even = (std::abs(u[0])%2 == 0);
  std::vector<std::string> ops;
  std::string offset_arm;
  for (int i = 0; i < N; ++i) {
    char offset_op;
    // offset value if even.
    if (even) {
      offset_arm = " 1";
      if (u[i]>0) {
        u[i]--;
        v[i]--;
        offset_op = 'R';
      } else {
        u[i]++;
        v[i]++;
        offset_op = 'L';
      }
    }

    // check possible or not
    int abs_u = std::abs(u[i]);
    if (abs_u % 2 != 1) {
      std::cout << -1 << std::endl;
      return 0;
    }

    // create operation
    long new_u = (kMax -1 + u[i])/2;
    long new_v = (kMax -1 + v[i])/2;
    std::vector<bool> bin_u, bin_v;
    for (int keta = 0; keta < kNumArms; ++keta) {
      bin_u.push_back((new_u % 2) == 1);
      bin_v.push_back((new_v % 2) == 1);

      new_u /= 2;
      new_v /= 2;
    }

    std::string op;
    for (size_t k = 0; k < kNumArms; ++k) {
      if (bin_u[k]&&bin_v[k])        op += 'R';
      else if (!bin_u[k]&&!bin_v[k]) op += 'L';
      else if (bin_u[k]&&!bin_v[k])  op += 'U';
      else                           op += 'D';
    }

    if (even) ops.push_back(op + offset_op);
    else      ops.push_back(op);
  }

  if (!even) {
    std::cout << kNumArms << std::endl;
  } else {
    std::cout << kNumArms + 1 << std::endl;
  }

  long len = 1;
  std::cout << len;
  for (int keta = 1; keta < kNumArms; ++keta) {
    len *= 2;
    std::cout << " " << len;
  }
  std::cout << offset_arm << std::endl;

  for (auto& op : ops) {
    std::cout << op << std::endl;
  }
}


Measured memory_bytes: 384
N = int(input())
A = list(map(int, input().split()))

souwa = 0
cnt = 0
keep = 1e10

for i in range(N):
    if A[i] < 0:
        cnt += 1
        A[i] *= (-1)

    souwa += A[i]
    keep = min(keep, A[i])

print(souwa - 2 * keep * (cnt % 2))


Measured memory_bytes: 19964
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
import collections

mod = 10 ** 9 + 7
N = int(input())
S = (input())
prev_c = S[0]
count = 1
for s in S[1:]:
    if (prev_c == s):
        continue
    else:
        prev_c = s
        count += 1
print(count)


Measured memory_bytes: 12600
#include <iostream>
#include <iomanip>
#include <vector>

using ldouble = long double;

ldouble f(int n) {
    if (n == 1) return n;
    return 1 + ldouble(n + 1) / n * f(n - 1);
}

int main() {
    int n;
    ldouble d, x;
    std::cin >> n >> d >> x;
    d += x * (n * 2 - 1) / 2;

    std::cout << std::fixed << std::setprecision(20)
              << f(n) * d << std::endl;
    return 0;
}


Measured memory_bytes: 6528
/*--ILRS-- sr4saurabh  */
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
#define pb push_back 
#define popb pop_back
#define mp make_pair
#define ve vector
#define vii vector < int >
#define vll vector < ll > 
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpl vector < pll >
#define fi first
#define sz size 
#define len length 
#define se second 
//const ll mod=998244353;
const ll mod = 1000000000+7;
const ll N=10000000+6;
#define M_PI           3.14159265358979323846
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //#ifndef ONLINE_JUDGE
      // freopen ("INPUT.txt" , "r" , stdin);
       //freopen ("OUTPUT.txt", "w" , stdout);
    //#endif

    int n,k;
    cin>>n>>k;
    int arr[n+1]={0};
    while(k--)
    {
      int g;
      cin>>g;
      while(g--)
      {
        int v;cin>>v;
        arr[v]++;
      }
    }
    ll ans=0;
    for(int h=1;h<=n;h++)
      if(arr[h]==0)
        ans++;

      cout<<ans<<endl;
  














return 0;
}

Measured memory_bytes: 3656
#include<stdio.h>
 
int a[101][101];
 
int main(void){
    int sum,weight,height,i,j,r,c;
 
    scanf("%d %d",&r,&c);
 
    for(i = 0;i < r;i++){
        for(j = 0;j < c;j++){
            scanf("%d",&a[i][j]);
        }
    }
 
    sum = 0;
    for(i = 0;i < r;i++){
        weight = 0;
        for(j = 0;j < c;j++){
            weight += a[i][j];
            printf("%d ",a[i][j]);
        }
        sum += weight;
        printf("%d\n",weight);
    }
 
    for(i = 0;i < c;i++){
        height = 0;
        for(j = 0;j < r;j++)
            height += a[j][i];
        printf("%d ",height);
    }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 2052
import sys
from collections import deque
N,M=map(int,input().split())
s=input()
table=[]
for i in range(M):
    x,y=map(int,input().split())
    table.append((x-1,y-1))
edge=[[]for i in range(2*N)]
visit=[0]*(2*N)
for x,y in table:
    if x==y:
        edge[2*x].append(2*x+1)
        visit[2*x+1]+=1
        continue
    if s[x]==s[y]:
        edge[2*x].append(2*y+1)
        edge[2*y].append(2*x+1)
        visit[2*x+1]+=1
        visit[2*y+1]+=1
        continue
    edge[2*x+1].append(2*y)
    edge[2*y+1].append(2*x)
    visit[2*x]+=1
    visit[2*y]+=1
S=set()
L=deque()

for i in range(2*N):
    if visit[i]==0:
        L.append(i)

while L:
    x=L.pop()
    S.add(x)
    for y in edge[x]:
        visit[y]-=1
        if visit[y]==0:
            L.append(y)
if len(S)!=2*N:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 112804
#include<bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  bool flip = false, judge = false;
  for(int i = 0; i < S.size(); i++) {
    if(S[i] == 'A' && !flip) flip ^= true;
    else if(S[i] == 'Z' && flip) flip ^= true, judge = true, cout << "AZ";
  }
  if(!judge) cout << -1;
  cout << endl;
}

Measured memory_bytes: 1180
#include <iostream>
#include <vector>
#include <algorithm>
 
using namespace std;
typedef long long ll;
 
int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for(int i = 0; i < N; i++) {
    cin >> A[i];
  }
  vector<ll> acc(N + 1);
  for(int i = 0; i < N; i++) {
    acc[i + 1] = acc[i] + A[i];
  }

  ll ans = 1LL << 62;
  for(int j = 2; j < N; j++) {
    int i1 = lower_bound(acc.begin(), acc.begin() + j, acc[j] / 2) - acc.begin();
    int i2 = i1 - 1;
    int k1 = lower_bound(acc.begin() + j, acc.end(), (acc[N] - acc[j]) / 2 + acc[j]) - acc.begin();
    int k2 = k1 - 1;
    vector<int> I = {i1}, K = {k1};
    if (i2 > 0) I.push_back(i2);
    if (k2 > j) K.push_back(k2);
    for(int ii = 0; ii < I.size(); ii++) {
      for(int kk = 0; kk < K.size(); kk++) {
        int i = I[ii], k = K[kk];
        vector<ll> area;
        area.push_back(acc[i]);
        area.push_back(acc[j] - acc[i]);
        area.push_back(acc[k] - acc[j]);
        area.push_back(acc[N] - acc[k]);
        sort(area.begin(), area.end());
        ans = min(ans, area.back() - area[0]);
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3328
#include <stdio.h>
int main()
{int i,j,s,a[100],n;
  while(~scanf("%d",&n))
  {s=0;
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);
    for(i=0;i<n-1;i++)
      for(j=i+1;j<n;j++)
       s+=a[i]*a[j];
       printf("%d\n",s);
     
  }
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
int main()

{ int k;
    string s;
    cin>>k;
    cin>>s;
    long long  i,a;
    if(s.size()>k)
    {
        for(i=0;i<k;i++)
        {
            cout<<s[i];
        }
        cout<<"..."<<endl;
    }
    else
    {
        cout<<s;
    }

}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, l, r) for(register int i = l; i < r; i++)
#define hrp(i, l, r) for(register int i = l; i <= r; i++)
#define rev(i, r, l) for(register int i = r; i >= l; i--)
#define pb push_back
#define int ll
#ifndef JOEON
#define D(...)
#define R(x, l)
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
template<typename tn> inline tn next(void);
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v);
set<int> st;
signed main(void)
{
	#ifdef JOEON
//		freopen("C:\Users\Joeon\Desktop\IN.txt", "r", stdin);
//		freopen("C:\Users\Joeon\Desktop\OUT.txt", "w", stdout);
	#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n = next<int>();
	rep(i, 0, n) st.insert(next<int>());
	if (st.size() == n) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}
template<typename tn> inline tn next(void)
{
	tn k;
	cin>>k;
	return k;
}
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v)
{
	rep(i, 0, v.size()) os<<v[i]<<' ';
	return os;
}

Measured memory_bytes: 9600