akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <sstream>
#include <iomanip>
#include <string>
#include <unordered_map>

using namespace std;
typedef long long LL;
template <typename S, typename T> ostream& operator<<(ostream& os, const pair<S,T>& x);
template <typename T> ostream& operator<<(ostream& os, const vector<T>& x);
template <typename T> ostream& operator<<(ostream& os, const set<T>& v);
template <typename T> ostream& operator<<(ostream& os, const multiset<T>& v);
template <typename S, typename T> ostream& operator<<(ostream& os, const unordered_map<S,T>& v);
template <typename S, typename T> ostream& operator<<(ostream& os, const map<S,T>& v);

vector<LL> readvec(LL length, LL off = 0);
#define ALL(x) x.begin(), x.end()
#define REP(x) for(LL repvar = 0; repvar < x; repvar++)

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string S; cin >> S;
    if(S == "RRR") cout << 3 << "\n";

    if(S == "RRS") cout << 2 << "\n";
    if(S == "RSR") cout << 1 << "\n";
    if(S == "SRR") cout << 2 << "\n";

    if(S == "SSR") cout << 1 << "\n";
    if(S == "SRS") cout << 1 << "\n";
    if(S == "RSS") cout << 1 << "\n";

    if(S == "SSS") cout << 0 << "\n";
}

















/*
Utilities
*/

template <typename S, typename T>
ostream& operator<<(ostream& os, const unordered_map<S,T>& v){
    os << "[";
    for(auto it = v.begin(); it != v.end(); it++) {
        if(it != v.begin()) os << ", ";
        os << it->first << ": " << it->second;
    }
    os << "]";
    return os;
}


template <typename S, typename T>
ostream& operator<<(ostream& os, const map<S,T>& v){
    os << "{";
    for(auto it = v.begin(); it != v.end(); it++) {
        if(it != v.begin()) os << ", ";
        os << it->first << ": " << it->second;
    }
    os << "}";
    return os;
}

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v){
    os << "[";
    for(auto it = v.begin(); it != v.end(); it++) {
        if(it != v.begin()) os << ", ";
        os << *it;
    }
    os << "]";
    return os;
}

template <typename T>
ostream& operator<<(ostream& os, const set<T>& v){
    os << "[";
    for(auto it = v.begin(); it != v.end(); it++) {
        if(it != v.begin()) os << ", ";
        os << *it;
    }
    os << "]";
    return os;
}

template <typename T>
ostream& operator<<(ostream& os, const multiset<T>& v){
    os << "[";
    for(auto it = v.begin(); it != v.end(); it++) {
        if(it != v.begin()) os << ", ";
        os << *it;
    }
    os << "]";
    return os;
}

template <typename S, typename T>
ostream& operator<<(ostream& os, const pair<S,T>& x){
    os << "(" << x.first << ", " << x.second << ")";
    return os;
}

vector<LL> readvec(LL length, LL off){
    vector<LL> v;
    for(LL i = 0; i < length; i++){
        LL x; cin >> x; v.push_back(x + off);
    }
    return v;
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int dp[2001],s,sum;
int main()
{
	dp[0]=1;
	for(int i=3;i<=2000;i++)dp[i]=(dp[i]+(sum=(sum+dp[i-3])%mod))%mod;
	scanf("%d",&s);
	printf("%d",dp[s]);
	return 0;
}

Measured memory_bytes: 3832
use std::cmp::*;
use std::io::*;

fn main() {
    let mut s: String = String::new();
    stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let a: Vec<usize> = (0..n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();

    let mut ans = 0;
    for &i in a.iter() {
        ans += i - 1;
    }
    println!("{}", ans);
}


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

using namespace std;

int a[100005];
int main()
{
    int n, c, k, x; int res = 0;
    cin >> n >> c >> k;
    for (int i = 1; i <= n; i++) cin >> a[i];
    sort(a+1, a+n+1);
    int dem = 1; int last = a[1];
    for (int i = 2; i <= n; i++)
    {
        int x = a[i];
        if (x - last > k || dem == c)
        {
            res++;
            last = x;
            dem = 1;
        }
        else dem++;
    }
    if (dem > 0) res++;
    cout <<res;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>    
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//using namespace __gnu_pbds; 
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl "\n"
#define int long long 
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N       = 1000 * 100 + 10;
const ll N2      = 70;
const ld PI  = 3.141592653589793;
//template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);} 
ll power(ll x,ll y,ll p = LLONG_MAX ){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
ll lcm(ll a , ll b){return (a*b)/gcd(a,b);}
void solve(){
  #ifndef ONLINE_JUDGE    
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
  #endif
}
signed main()
{
    fastio();
    //cout<<fixed<<setprecision(20);
    //CHECK for LONG LONG and LONG DOUBLE
    //*comment for all except cc/cf   
    ll x,n;
    cin>>x>>n; 
    bool c[110];
    fill(c,false);
    ll a[n];
    for(ll i=0;i<n;i++){
      cin>>a[i];
      c[a[i]]=true; 
    }
    ll l=x,r=x;
    while(1){
      if(c[l]==false){
        cout<<l<<endl; 
        break; 
      }
      if(c[r]==false){
        cout<<r<<endl; 
        break; 
      }
      l--,r++;
    }
    
    //printclock;
    return 0;
}
    


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

typedef long long ll;

const int mod=1e9+7;
const int mx=300007;
vector<ll> a(mx,-1);

// (a*b)%m
ll mul(ll a, ll b, ll m) {
	ll x=0, y=a%m;
	while(b>0) {
		if(b%2) x=(x+y)%m;
		y=(y*2)%m;
		b/=2;
	}
	return x%m;
}

int main() {
	int n; cin>>n;
	for (int i=0; i<n; i++)
		cin>>a[i];
	ll ret=0; 
	for (int i=0; i<60; i++) { 
		int zero=0, one=0;
		for (int j=0; j<n; j++) {
			if (a[j]%2) one++;
			else zero++;
			a[j]>>=1;
		} 
		ret=(ret+mul(mul(one,zero,mod),1LL<<i,mod))%mod;
	} 
	cout<<ret<<"\n";
	return 0; 
}

Measured memory_bytes: 2560
#!/usr/bin/env python3

import itertools
import bisect

N, M, K = map(int, input().split())
A = [0] + list(map(int, input().split()))
B = [0] + list(map(int, input().split()))

cumA = list(itertools.accumulate(A))
cumB = list(itertools.accumulate(B))
#print(cumA)
#print(cumB)

ans = 0

for i in range(N+1):
    cnt = i
    chk = K - cumA[i]
    if chk < 0:
        continue
    cnt += bisect.bisect_right(cumB,chk)-1
    ans = max(ans,cnt)
    #print(ans)
print(ans)

Measured memory_bytes: 131948
#include <iostream>

using namespace std;

int main(){
    int k, a, b, flag;
    flag = 0;
    cin >> k >> a >> b;
    
    for (int i = a; i<=b; i++){
        if (i % k == 0) {
            flag = 1;
            break;
        }
    }
    if (flag) cout << "OK" << endl;
    else cout << "NG" << endl;

    return 0;
}

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

// int/long:            -2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:      -9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define MOD 1000000007

#define Rep0(i, n)      for (auto i=0; i<n; i++)
#define Rep1(i, n)      for (auto i=1; i<=n; i++)
#define Sort(P) sort(P.begin(), P.end())
#define Rev(P)  reverse(P.begin(), P.end())

int     main() {
        int N, K;
        cin >>N >>K;
        vector<int> A(N, 0);
        Rep0(i, N)
                cin >>A.at(i);
        int l=0;
        int r=1000000000;
        while (r-l>1) {
                int m=(l+r+1)/2;
                int KK=0;
                Rep0(i, N)
                        KK +=(A.at(i)+m-1)/m-1;
                if (KK>K)
                        l=m;
                else
                        r=m;
        }
        cout <<r <<endl;
        return 0;
}


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

#define nl '\n'

using namespace std;

typedef long long ll;

void solve() {
  int n, k;
  cin >> n >> k;
  int p[n], c[n];
  for (int& i : p) {
    cin >> i;
    i--;
  }
  for (int& i : c)
    cin >> i;

  ll ans = -1e9 - 1;
  for (int i = 0; i < n; i++) {
    int square = i, cycleSize = 0;
    ll cycleSum = 0;
    do {
      cycleSize++;
      cycleSum += c[square];
      square = p[square];
    } while (square != i);

    int moves = 0;
    ll path = 0;
    square = i;
    do {
      if (moves >= k)
        break;
      moves++;
      square = p[square];
      path += c[square];
      int multiplier = (k - moves) / cycleSize;
      ll score = path + max(0ll, cycleSum) * multiplier;
      ans = max(ans, score);
    } while (square != i);
  }

  cout << ans << nl;
}

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

  // int t;
  // cin >> t;
  // while (t--) {
  solve();
  // }

  return 0;
}

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

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

    bool ans = false;
    int val;
    rep (i, 50000) {
        if (N == int(floor(i * 1.08))) {
            ans = true;
            val = i;
        }
    }

    if (ans) cout << val << endl;
    else cout << ":(" << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
#define rep_down(i,n) for (int i=n-1; i>=0;--i)
#define ALL(a)  (a).begin(),(a).end()
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;
const int INF = 1000000007;
int N;
int PF[102][102]; // 0始まりに注意
int Target[102];

map< int, int > prime_factor(int n) {
  map< int, int > ret;
  for(int i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

int calc(int num){
  int cnt = 0;
  rep(i, N){
    if (Target[i]>=num-1) cnt++;
  }
  return cnt;
}

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

  cin >> N;
  rep(i, N){
    for(auto p : prime_factor(i+1)) {
      while(p.second--){
        PF[i][p.first-1]++;
      }
    }
    rep(j, i+2){
      PF[i+1][j]=PF[i][j];
    }
  }

  rep(i, N) Target[i] = PF[N-1][i];
  int c_3 = calc(3);
  int c_5 = calc(5);
  cout << calc(75)+calc(25)*(c_3-1)+calc(15)*(c_5-1)+c_5*(c_5-1)*(c_3-2)/2 << "\n"; //最後に2で割っているのは2C1に依る
  return 0;
}

Measured memory_bytes: 256
let N = Int(readLine()!)!
let A1 = readLine()!.characters.split(" ").map{Int(String($0))!}
let A2 = readLine()!.characters.split(" ").map{Int(String($0))!}
var sumA1 = A1[0]
var sumA2 = A2.reduce(0){$0+$1}
var ans = sumA1 + sumA2
for i in 1..<N {
    sumA1 += A1[i]
    sumA2 -= A2[i-1]
    ans = max(sumA1 + sumA2, ans)
}
print(ans)

Measured memory_bytes: 4208
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define double long double
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Graph=vector<vector<int>>;
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T>inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
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(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N,SUM=0LL,T=0LL;
  cin>>N;
  bool CAN=true;
  
  ll A[2*N+1],X[N+1];
  RREP(i,N){
    cin>>A[i];
    A[i+N]=A[i];
    SUM+=A[i];
    X[i]=0LL;
  }
  
  if(SUM%(N*(N+1)/2)!=0) CAN=false;
  else T=2*SUM/(N*(N+1));
  
  RREP(i,N){
    if((T+A[i]-A[i+1]<0)||(T+A[i]-A[i+1])%N!=0) CAN=false;
    else X[i]=(T+A[i]-A[i+1])/N;
  }
  
  ll cnt=0LL;
  if(CAN){
    RREP(i,N) cnt+=X[i];
    if(cnt!=T) CAN=false;
  }
  
  if(CAN) COYE;
  else CONO;
  return 0;
}

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

const int nax = 1e5 + 5;
long long a[nax];

int main() {
 int n; cin >> n;
 for(int i=0; i<n; ++i) cin >> a[i];
 for(int i=0; i<n; ++i) {
   if(i==0) --a[i];
   else {
      if(a[i-1]  - a[i] > 0) {
        cout << "No\n";
        return 0;
      }
      else if(a[i-1] < a[i]) {
       --a[i];
      }
   }
 }
 cout << "Yes\n";
 return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include<string.h>
#include <algorithm>
#include<math.h>
#include<vector>
#include <queue>
#include <deque> 
#define ll long long
#define M 1000000007 
#define MM 998244353
using namespace std;
 
int main()
{
	long long int n;

	cin >> n;

	string s[n];
	long long int ac = 0, wa = 0, tle = 0, re = 0;

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

	for (int i = 0; i < n; i++)
	{
		if (s[i].compare("AC") == 0)
		{
			ac++;
		}
		else if (s[i].compare("WA") == 0)
		{
			wa++;
		}
		else if (s[i].compare("TLE") == 0)
		{
			tle++;
		}
		else if (s[i].compare("RE") == 0)
		{
			re++;
		}
	}

	cout << "AC" << " " << "x " << ac << endl;
	cout << "WA" << " " << "x " << wa << endl;
	cout << "TLE" << " " << "x " << tle << endl;
	cout << "RE" << " " << "x " << re << endl;

    return 0;
}

Measured memory_bytes: 6748
//om nama sivaya
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define pb push_back
using namespace std;

long double dp[305][305][305];

/*int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin>>n;
	ll cnt[4]={0,0,0,0};
	ll x;
	for(int i=0;i<n;i++){
		cin>>x;
		cnt[x]++;
	}
	dp[0][0][0]=0;
	for(ll three=0;three<=n;three++){
		for(ll two=0;two<=n;two++){
			for(ll one=0;one<=n;one++){
				ld i=three,j=two,k=one;
				ll zero=n-two-three-one;
				ld zero1=zero,n1=n;
				if(zero<0 || zero==n) continue;
				ld value=1.0;
				if(three>0) value+=(i/n1)*dp[three-1][two+1][one];
				if(two>0) value+=(j/n1)*dp[three][two-1][one+1];
				if(one>0) value+=(k/n1)*dp[three][two][one-1];
				//dp[three][two][one]=(value)/(1-1.0*zero/n);
				dp[three][two][one]=(value*n1)/(i+j+k);
			}
		}
	}
	ld ans=dp[cnt[3]][cnt[2]][cnt[1]];
	cout.precision(20);
	cout<<ans;
}*/

void solve(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    int x=0,y=0,z=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]==1)x++;
        else if(a[i]==2)y++;
        else z++;
    }
    long double va;
    dp[0][0][0]=0;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n;j++){
            for(int k=0;k<=n;k++){
                va=1.0;
                if((i+k+j)>n)continue;
                if(!(i) && !(j) && !(k))continue;
                if(i)
                va+=(dp[i-1][j+1][k]*((long double)i/n));
                if(j)
                va+=(dp[i][j-1][k+1]*((long double)j/n));
                if(k)
                va+=(dp[i][j][k-1]*((long double)k/n));
                dp[i][j][k]=((va*n)/((long double)i+j+k));
            }
        }
    }
    cout<<fixed<<setprecision(20)<<dp[z][y][x];
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tt=1;
    //cin>>tt;
    while(tt--){
        solve();
    }
}


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

void solve(int N, int M, vector<int> a, vector<int> b, vector<vector<int>> c)
{
    map<int, int> res;
    for (int i = 0; i < M; i++)
    {
        int si = 0;
        for (int j = 0; j < b.at(i); j++)
        {
            si += 1 << (c.at(i).at(j) - 1);
        }
        for (int sj = 0; sj < (1 << N); sj++)
        {
            if ((si & sj) == sj)
            {
                if (res.count(sj) == 0)
                    res[sj] = a.at(i);
                else
                    res.at(sj) = min(res.at(sj), a.at(i));
            }
        }
    }
    for (int i = 0; i < N; i++)
    {
        if (res.count(1 << i) == 0)
        {
            cout << -1 << endl;
            return;
        }
    }

    for (int si = 1; si < (1 << N); si++)
    {
        if (res.count(si) == 0)
            res[si] = INT_MAX;
        for (int sj = 1; sj < (1 << N); sj++)
        {
            if ((si & sj) == sj)
                res.at(si) = min(res.at(si), res.at(si ^ sj) + res.at(sj));
        }
    }
    cout << res.at((1 << N) - 1) << endl;
}

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> a(M), b(M);
    vector<vector<int>> c(M);
    for (int i = 0; i < M; i++)
    {
        cin >> a.at(i) >> b.at(i);
        c.at(i) = vector<int>(b.at(i));
        for (int j = 0; j < b.at(i); j++)
        {
            cin >> c.at(i).at(j);
        }
    }
    solve(N, M, move(a), move(b), move(c));
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

bool check(ll n)
{
	string s = to_string(n);
	REP(i, s.size() - 1)
	{
		if (s[i + 1] - s[i] != 1) return false;
	}
	return true;
}

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int n;
	cin >> n;
	vi v(n);
	REP(i, n) cin >> v[i];
	int ans = -1;
	REP(i, n)REP(j, i)
	{
		int tmp = v[i] * v[j];
		if (check(tmp)) chmax(ans, tmp);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3264
a,b,k=map(int,input().split())
count=1
while 1:
    count+=1
    if a%2==1:
        a-=1
    b+=a//2
    a=a//2
    if count>k:
        break
#    print(a,b)
    if b%2==1:
        b-=1
    a+=b//2
    b=b//2
    count+=1
    if count>k:
        break
#    print(a,b)
print(a,b)

Measured memory_bytes: 3064
#include <iostream>
#include <cmath>
#include <vector>
#include <map>

using namespace std;

int n, m, x;
int c[12];
int a[12][12];
int ans = -1;
bool b;
int temp[12];


void cal(int arr[12], int kai ,int nedan) {//kai 0 nasi
    if (kai > n) {
        b = true;
        for (int i = 0; i < m; i++) {
            if (arr[i] < x)b = false;
        }
        //cout << arr[0] << " " << arr[1] << " " << arr[2] << " " << kai << " " << nedan << " " << b << "\n";
        if (b == true) {
            if (ans == -1) {
                ans = nedan;
            }
            if (ans > nedan) {
                ans = nedan;
            }
        }
    } else {
        for (int i = 0; i < 12; i++) {
            temp[i] = arr[i];
        }
        kai++;
        cal(temp, kai, nedan);
        for (int i = 0; i < m; i++) {
            temp[i] += a[kai - 2][i];
        }
        nedan += c[kai - 2];
        cal(temp, kai, nedan);
        for (int i = 0; i < m; i++) {
            temp[i] -= a[kai - 2][i];
        }
    }
}

int main() {
    

    cin >> n >> m >> x;

    for (int i = 0; i < n; i++) {
        cin >> c[i];
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }
    int arr[12] = { 0,0,0,0,0,0,0,0,0,0,0,0 };

    cal(arr, 1, 0);

    cout << ans;




    return 0;
}

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

int main() {

    int a, b, c; cin >> a >> b >> c;
    int sum = a + b + c;
    if (22 <= sum) cout << "bust" << endl;
    else cout << "win" << endl;
    return 0;
}

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

int main() {
  int N,Q;
  ll K;
  cin>>N>>K>>Q;
  
  int x;
  vector<int> num(N, 0);
  for(int i=0; i<Q; i++){
    cin>>x;
    num.at(x-1)++;
  }
  ll y = Q-K;
  for(int i=0; i<N; i++){
    if(num.at(i)>y) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
}

Measured memory_bytes: 3764
import sys
N, = map(int, raw_input().split())
A = map(int, raw_input().split())
B = map(int, raw_input().split())
if sum(A)<sum(B):
  print -1
  sys.exit(0)
dl = []
dm = []
for i in xrange(N):
  d = A[i]-B[i]
  if d>0:
    dm.append(d)
  if d<0:
    dl.append(d)
dm.sort()
sdl=abs(sum(dl))
j=0
sdm=0
for dmj in dm[::-1]:
  if sdm>=sdl:
    break
  j+=1
  sdm+=dmj
print len(dl)+j

Measured memory_bytes: 14512
#pragma GCC optimize("O3")
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>
#include<vector>
#include<sstream>
#include<queue>
#include <iomanip>
#include <fstream>
#include<unordered_set>
#include<stack>
#include <map>
#include<time.h>
#include <chrono>
constexpr auto INF = 9223372036854775807;
typedef long long int ll;
typedef unsigned long long int ull;
typedef unsigned long int ul;
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i+=1)
#define rf(i,a,b) for(ll i=(ll)a;i>=(ll)b;i-=1)
#define endl '\n'
#define N 1000000007 // prime modulo value 
#define all(x) x.begin(),x.end()
using namespace std;
#define MAX 1000001 
#define M 998244353
ll inverse(ll n)
{
	ll modu = M;
	ll m = modu;
	ll a = 0, b = 1;
	if (modu == 1)
		return 0;
	while (n > 1)
	{
		ll quo = n / modu;
		ll temp = modu;
		modu = n % modu, n = temp;
		temp = a; 
		a = b - (quo * a);
		b = temp;
	}
	if (b < 0)
		b += m;
	return b;
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll n;
	cin >> n;
	string ans = "APPROVED";
	f(i, 0, n)
	{
		ll temp = 0;
		cin >> temp;
		if (temp % 2 == 0)
		{
			if (temp % 3 == 0 || temp % 5 == 0)
			{

			}
			else
				ans= "DENIED";
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rp(i,n) for (int i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define all_acc(x) (x).begin(), (x).end(), 0LL
#define int long long
#define absSort(v) sort(a.begin(), a.end(), [](int i, int j) -> bool { return abs(i) < abs(j); });
using namespace std;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
using ll = long long;
double pi=3.14159265359;

//出力するよ
void output_tate(vector<int> s){
    int n = s.size();
    for (int i = 0; i < n; i++){
        //if (i != 0)
        //    cout << " ";
        cout << s[i]<<endl;
    }
    //cout << endl;
}

void output_yoko(vector<int> s){
    int n = s.size();
    for (int i = 0; i < n; i++){
        if (i != 0)
            cout << " ";
        cout << s[i];//<<endl;
    }
    cout << endl;
}

int MOD = pow(10, 9) + 7;

int kaijou(int n){
    if(n==0) return 1;
    else{
        return ((n%MOD)*(kaijou(n-1)%MOD))%MOD;
    }
}


signed main() {
    int l,r,d; cin>>l>>r>>d;
    int ans=0;
    for(int i=l;i<=r;i++){
        if(i%d==0) ans++;
    }
    cout<<ans<<endl;
}


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

#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define REP(i,n) FOR(i,0,n)
#define REPD(i,n) FOR(i,n-1,0)
#define PB push_back
#define mod 1000000007


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin>>s;
    int n=s.size(),c=0,d=0,e=0;
    // string s1=strrev(s);
    for(int i=0;i<n;i++)
    {
        if(s[i]==s[n-i-1])
        c=0;
        else
        {
            c=1;
            break;
        }
    }
    int n1=(n-1)/2;
    for(int i=0;i<n1;i++)
    {
        if(s[i]==s[n1-i-1])
        d=0;
        else
        {
            d=1;
            break;
        }
    }
    int n2=(n2+3)/2;
    for(int i=n2-1;i<n;i++)
    {
        if(s[i]==s[n-i-1])
        e=0;
        else
        {
            e=1;
            break;
        }
    }
    if(c==0 && d==0 && e==0)
        cout<<"Yes";
    else
        cout<<"No";
    
    
    return 0;   
}

Measured memory_bytes: 256
use proconio::input;
use std::collections::VecDeque;
fn main() {
    input!{
        n: usize, // number of rooms
        m: usize, // number of routes
        arr: [(usize, usize); m],
    }
    let mut cave = vec![vec![]; n+1];
    let mut pre = vec![0; n+1];
    pre[1] = 1;
    for p in arr {
        cave[p.0].push(p.1);
        cave[p.1].push(p.0);
    }
    let mut que: VecDeque<usize> = VecDeque::new();
    que.push_back(1);
    while que.len() > 0 {
        let v = que.pop_front().unwrap();
        for &i in &cave[v] {
            if pre[i] != 0 {
                continue;
            }
            pre[i] = v;
            que.push_back(i);
        }
    }
    println!("Yes");
    for i in 2..n+1 {
        println!("{}", pre[i]);
    }
}

Measured memory_bytes: 15860
#!/bin/python3

import os
import sys
from collections import *
from queue import *
import math
def main():
	n = int(input())
	if n>=400 and n<= 599:
		print(8)
	elif n>=600 and n<= 799:
		print(7) 
	elif n>=800 and n<= 999:
		print(6)
	elif n>=1000 and n<= 1199:
		print(5)
	elif n>=1200 and n<= 1399:
		print(4)
	elif n>=1400 and n<= 1599:
		print(3)
	elif n>=1600 and n<= 1799:
		print(2)
	else:
		print(1)


if __name__ == '__main__':
	#sys.stdin = open("input","r")
	#sys.stdout = open("output","w")
	main()




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

int main() {
  int h, j, m, j1,m1, x, y;
  cin >> h >> j >> m >> j1 >> m1;

	if(j%j1 >= 1){
	x = j/j1 + 1;
}
        else{
	x = j/j1;
}

	if(m%m1 >= 1){
	y = m/m1 + 1;
}
        else{
	y = m/m1;
}

int z;
	if(x>=y){
	z = x;
	}

	if(y>x){
	z = y;
	}

  cout << h - z << endl;
  
  return 0;
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
#define ll                 long long int
#define mod                1000000007
#define pi                 3.14159265358979323846264338327950288419716939937510
#define setbit(x)          __builtin_popcountll(x)
#define db                 long double
#define pp(x)              pair<x,x>
#define ff                 first
#define ss                 second
#define FIO                ios_base::sync_with_stdio(false); cin.tie(NULL);
#define tc                 ll tc; cin>>tc; for(ll number = 1 ; number <= tc ; number ++ )
#define vv(x)              vector<x>
#define pb                 push_back
#define pob                pop_back
#define pf                 push_front
#define pof                pop_front
#define endl               "\n"
#define pq                 priority_queue
#define dbg(x)             { cout<< #x << ": " << (x) << endl; }
#define dbg2(x,y)          { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; }
#define bp                 ll kkk; cin >>kkk;
#define dbgArr(a,n)        cout<<"Array "<<#a<<endl; for(ll i=0 ; i<n ; i++) cout<<a[i]<<" "; cout<<endl;
#define maxE(a,n)          *max_element(a,a+n);
#define minE(a,n)          *min_element(a,a+n);
#define forn(i,s,n)        for(ll i=s ; i<n ; i++)
#define fornr(i,e,s)       for(ll i=e-1 ; i>=s ; i--)
#define arr(a,n)           for(ll i=0;i<n;i++){ cin>>a[i]; }
#define arr1(a,n)          for(ll i=1;i<=n;i++){ cin>>a[i]; }
#define file freopen("input.txt","r",stdin); freopen("output.txt","w",stdout)
#define print cout<<"Case #"<<number<<": "
#define all(x) x.begin(), x.end()
ll power(ll x, ll b,ll m) {ll p = 1;while (b > 0) {if(b&1) {p = p * x; p %= m;} b >>= 1; x *= x; x %= m;} return p % m;}
using namespace std;
# define INF 1e15
struct lex_compare {
    bool operator() (pp(ll) p1, pp(ll) p2){
        return p1.ff >= p2.ff;
    }
};



int main(){
    FIO;
    ll x; cin >> x;
    if(x >= 30){
        cout << "Yes" << endl;
    }else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<ctime>
#include<set>
#include<map>
#include<queue>
#include<stack>
#define sqr(x) ((x)*(x))
#define fz1(i,n) for ((i)=1;(i)<=(n);(i)++)
#define fd1(i,n) for ((i)=(n);(i)>=1;(i)--)
#define fz0g(i,n) for ((i)=0;(i)<=(n);(i)++)
#define fd0g(i,n) for ((i)=(n);(i)>=0;(i)--)
#define fz0k(i,n) for ((i)=0;(i)<(n);(i)++)
#define fd0k(i,n) for ((i)=(long long)((n)-1);(i)>=0;(i)--)
#define fz(i,x,y) for ((i)=(x);(i)<=(y);(i)++)
#define fd(i,y,x) for ((i)=(y);(i)>=(x);(i)--)
#define fzin fz1(i,n)
#define fzim fz1(i,m)
#define fzjn fz1(j,n)
#define fzjm fz1(j,m)
#define ff(c,itr) for (__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define rdst(st,len){static char ss[len];scanf(" %s",ss);(st)=ss;}
#define inc(x,y) {x+=(y);if(x>=mod)x-=mod;}
#define dec(x,y) {x-=(y);if(x<0)x+=mod;}
//#define T_ int
using namespace std;
//struct bit{T_ arr[1000005];int lowbit(int x){return x&(-x);}void add(int x,T_ y){for (int i=x;i<=n;i+=lowbit(i)) arr[i]+=y;}T_ query(int x){T_ s=0;for (int i=x;i>0;i-=lowbit(i)) s+=arr[i];return s;}};
//struct seg{struct treedot{int l,r;T_ sum,add;void update(T_ x){sum+=(r-l+1)*x; add+=x;}}c[800005];void pushdown(int id){if (c[id].add){c[id*2].update(c[id].add);c[id*2+1].update(c[id].add);c[id].add=0;}}void pushup(int id){c[id].sum=c[id*2].sum+c[id*2+1].sum;}void build(int id,int l,int r){if (l>r) return;c[id].l=l;c[id].r=r;c[id].sum=0;c[id].add=0;if (l==r) c[id].sum=0;else{int mid=l+(r-l)/2;build(id*2,l,mid);build(id*2+1,mid+1,r);pushup(id);}}void update(int id,int le,int ri,T_ x){if (le>c[id].r||ri<c[id].l) return;if (le<=c[id].l&&c[id].r<=ri) c[id].update(x);else{pushdown(id);update(id*2,le,ri,x);update(id*2+1,le,ri,x);pushup(id);}}T_ query(int id,int le,int ri){if (ri<c[id].l||c[id].r<le) return 0;if (le<=c[id].l&&c[id].r<=ri) return c[id].sum;T_ ans=0;pushdown(id);ans+=query(id*2,le,ri);ans+=query(id*2+1,le,ri);pushup(id);return ans;}};
//struct bit_2d{T_ a[2005][2005];int lowbit(int x){return x&(-x);}void add(int x,int y,T_ z){int i,j;for (i=x;i<=2000;i+=lowbit(i)){for (j=y;j<=2000;j+=lowbit(j)){a[i][j]+=z;}}}T_ query(int x,int y){int i,j;T_ s=0;for (i=x;i;i-=lowbit(i)){for (j=y;j;j-=lowbit(j)){s+=a[i][j];}}return s;}T_ query(int x,int y,int xx,int yy){return query(xx,yy)-query(x-1,yy)-query(xx,y-1)+query(x-1,y-1);}};
int n,m,i,j,a[55],b[55],ans=0x18181818;
void solve(int x,int y)
{
	if(!x&&!y) return;
	int s=0,i,j;
	fz1(i,n){
		fz1(j,n){
			if(a[i]==a[j]+x&&b[i]==b[j]+y){
				break;
			}
		}
		if(j>n) s++; 
	}
	ans=min(ans,s);
}
int main()
{
	scanf("%d",&n);
	if(n==1){
		puts("1");
		return 0;
	}
	fz1(i,n){
		scanf("%d%d",&a[i],&b[i]); 
	}
	fz1(i,n)fz1(j,n){
		solve(a[i]-a[j],b[i]-b[j]);
	}cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#n:数字の個数
#k:目標値になるpairの数
#s:最終的な合計の目標値

n,k,s=map(int,input().split())
result=[]
if s<10**9:
    for _ in range(k):
        result.append(str(s))
    for _ in range(n-k):
        result.append(str(10**9))
else:
    for _ in range(k):
        result.append(str(s))
    for _ in range(n-k):
        result.append(str(1))

print(" ".join(result))




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

using namespace std;
char s[5];
int maxx;
int main()
{
    cin>>s;
    if(strstr(s,"R"))
        maxx=1;
     if(strstr(s,"RR"))
        maxx=2;
         if(strstr(s,"RRR"))
        maxx=3;
        cout<<maxx;
    return 0;
}


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

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef long long ll;
typedef long double ld;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define fi first
#define se second

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

    ll n, d;
    cin >> n >> d;
    d *= d;

    int ans = 0;
    for(int i = 0; i < n; ++i)
    {
        ll x, y;
        cin >> x >> y;
        x *= x;
        y *= y;
        ans += (x+y<=d);
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define int long long
using namespace std;

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

    vector<int> A(N);
    for (int& x : A) cin >> x;

    vector<int> l(N), r(N);
    for (int i = 0; i < N - 1; i++) {
        l[i + 1] = __gcd(l[i], A[i]);
    }
    for (int i = N - 1; i > 0; i--) {
        r[i - 1] = __gcd(r[i], A[i]);
    }

    int ans = 1;
    for (int i = 0; i < N; i++) {
        ans = max(ans, __gcd(l[i], r[i]));
    }
    cout << ans << endl;
}


Measured memory_bytes: 2560
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
typedef long long lint;
const int N=1005;
const int mod=1e9+7;
int n,cnp,prm[N],buk[N];
bool npr[N];

namespace utils{
	template <class T> inline void apn(T &x,const T y){x>y?x=y:0;}
	template <class T> inline void apx(T &x,const T y){x<y?x=y:0;}
	inline int nxi(){
		int x=0;
		char c;
		while(((c=getchar())>'9'||c<'0')&&c!='-');
		const bool f=(c=='-')&&(c=getchar());
		while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
		return f?-x:x;
	}
}
using namespace utils;

void init(){
	npr[1]=1;
	for(int i=2; i<=n; ++i){
		if(!npr[i]) prm[++cnp]=i;
		for(int j=1; j<=cnp&&i*prm[j]<=n; ++j){
			npr[i*prm[j]]=1;
			if(i%prm[j]==0) break;
		}
	}
}

int main(){
	n=nxi();
	init();
	for(int i=1; i<=cnp; ++i){
		for(int t=prm[i]; t<=n; t*=prm[i]){
			buk[i]+=n/t;
		}
	}
	int ans=1;
	for(int i=1; i<=cnp; ++i){
		ans=(lint)ans*(buk[i]+1)%mod;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>

using namespace std;

const int xform[7][4] = {{0,1,0,1},{0,0,0,0},{0,1,2,3},{0,0,-1,-1},{0,1,1,2},{0,0,1,1},{0,1,0,-1}},
yform[7][4] = {{0,0,1,1},{0,1,2,3},{0,0,0,0},{0,1,1,2},{0,0,1,1},{0,1,1,2},{0,0,1,1}};

int main(void){
	int i, j, k, l, x, y;
	char str[8][9];
	while(scanf("%s",&str[0]) != EOF){
		for(i = 1;i < 8;i++){
			scanf("%s",str[i]);
		}
		for(i = 0;i < 8;i++){
			for(j = 0;j < 8;j++){
				if(str[i][j] == '1'){
					break;
				}
			}
			if(j != 8){
				break;
			}
		}
		x = j, y = i;
		for(i = 0;i < 7;i++){
			for(j = 0;j < 4;j++){
				if(0 > x + xform[i][j] || x + xform[i][j] >= 8 || 0 > y + yform[i][j] || y + yform[i][j] >= 8 || str[y + yform[i][j]][x + xform[i][j]] == '0')
					break;
			}
			if(j == 4){
				break;
			}
		}
		printf("%c\n",'A' + i);
		getchar();
		getchar();
	}
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;

#define FOR(i, begin, end) for(int i = (begin); i < (end); i++)
#define rep(i, n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define ZP(a, len) cout << setfill('0') << setw(len) << right << a << endl;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};

signed main() {
    int h, w;
    cin >> h >> w;

    vs f1 = vs(0);
    rep(i, h) {
        string s;
        cin >> s;
        for (auto c : s) {
            if (c == '#') {
                f1.push_back(s);
                break;
            }
        }
    }

    vs f2 = vs(0);
    rep(i, w) {
        string s = "";
        rep(j, f1.size()) {
            s += f1[j][i];
        }
        if (s.find('#') != s.npos) {
            f2.push_back(s);
        }
    }

    rep(i, f2[0].size()) {
        rep(j, f2.size()) {
            cout << f2[j][i];
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
use std::io::*;

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

fn main() {
    let s = read::<String>();
    let mut a = false;
    let mut b = false;
    let mut c = false;
    for x in s.chars() {
        if x =='a' {
            a = true;
        } else if x == 'b' {
            b = true;
        } else if x == 'c' {
            c = true;
        }
    }
    println!("{}",if a && b && c { "Yes" } else { "No" });
}


Measured memory_bytes: 4352
/*input
3 2
2
1 3
1
3
*/
#include "bits/stdc++.h"
using namespace std;
const long long md = 1e9 + 7;
long long a[1000005], n;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, k; cin >> n >> k;
	set<int> s;
	for(int i=0,x;i<k;++i){
		cin >> x;
		for(int q;x--;){
			cin >> q;
			s.insert(q);
		}
	}
	cout << n - s.size() << endl;
}

Measured memory_bytes: 3624
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() /4;
const ll linf = numeric_limits<ll>::max() /4;
const ull ulinf = numeric_limits<ull>::max()/4;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.end(), v.begin());
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////



int main(){
    int n,k;
    cin >> n >> k;
    int a[100005] = {};
    
    rep(i,0,n)cin >> a[i];
    sort(a,a+n);

    int l = a[0];
    rep(i,1,n){
        l = gcd(l,a[i]);
       // P(l);
    }
  //  P(l);
  //  P(a[n-1]);
    if(k%l == 0 && k <= a[n-1])P("POSSIBLE");
    else P("IMPOSSIBLE");
    
	return  0;
}

Measured memory_bytes: 640
#include"iostream"
using namespace std;

int gcd(int a, int b) 
{
	while (b!=0)
	{
		int i = a % b;
		a = b;
		b = i;
	}
	return a;
}

int main()
{
	int a, b,c;
	cin >> a >> b >> c;
	cout << (c%gcd(a, b) == 0 ? "YES" : "NO") << endl;
}

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

main(){
  int n,q;
  cin>>n;
  vector<int>v(n);
  r(i,n)cin>>v[i];
  v.erase(unique(v.begin(),v.end()),v.end());
  r(i,v.size()){
    if(i)cout<<' ';
    cout<<v[i];
  }
  cout<<endl;
}


Measured memory_bytes: 3112
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = []
for i in range(N):
    A.append(list(map(int, input().split())))

ans = 0
for i in range(N):
    tmp = 0
    for k in range(M):
        tmp += A[i][k] * B[k]
    if tmp > - C:
        ans += 1
print(ans)

Measured memory_bytes: 3064
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 1
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	aa := make([]int, n)
	sum := 0
	for i := 0; i < n; i++ {
		aa[i] = getNextInt(scanner)
		sum += aa[i]
		aa[i] *= n
	}

	mn := 100000
	ans := n
	for i := n - 1; i >= 0; i-- {
		ab := absint(sum - aa[i])
		if mn >= ab {
			mn = ab
			ans = i
		}
	}
	fmt.Fprintln(writer, ans)
}

func absint(a int) int {
	if a < 0 {
		a = -a
	}
	return a
}


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

using namespace std;

int main() {
    char b;
    cin >> b;
    if (b == 'A') cout << 'T' << endl;
    if (b == 'T') cout << 'A' << endl;
    if (b == 'G') cout << 'C' << endl;
    if (b == 'C') cout << 'G' << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int m,f,r;
    while(""){
        scanf("\n");
        scanf("%d %d %d",&m,&f,&r);
        if(m == -1 && f == -1 && r == -1)break;
        if(m == -1 || f == -1){
            printf("F\n");
        }else if(m+f >= 80){
            printf("A\n");
        }else if(65<=m+f && m+f<80){
            printf("B\n");
        }else if(50<=m+f && m+f<65){
            printf("C\n");
        }else if(30<=m+f && m+f<50){
            if(50<=r){
                printf("C\n");
            }else{
                printf("D\n");
            }
        }else{
            printf("F\n");
        }
    }
    return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 400000 + 10;
const LL MOD = 998244353;

int n;
char s[N], t[N];
LL pw[N], cnt[N];

LL cal(int x) {
	LL res = 0;
	for (int i = 1; i <= x / 2; i ++) {
		if (s[i] == '1')
			(res += pw[x/2 - i]) %= MOD;
	}
	for (int i = 1; i <= x / 2; i ++) t[i] = s[i];
	for (int i = x / 2 + 1; i <= 2 * n; i ++)
		t[i] = (char)((int)'0' + '1' - t[i - (x/2)]);
	//printf("%lld\n", res);
	//printf("%s\n", t + 1);
	bool ok = 1;
	for (int i = 1; i <= 2 * n; i ++)
		if (s[i] != t[i]) {
			if (t[i] > s[i]) {
				ok = false;
			}
			break;
		}
	if (ok) res ++;
	return res;
}
int main() {
	pw[0] = 1;
	for (int i = 1; i < N; i ++)
		pw[i] = pw[i-1] * 2 % MOD;

	scanf("%d%s", &n, s + 1);
	for (int i = 1; i <= n; i ++) {
		s[i + n] = (char)((int)'1' + '0' - s[i]);
	}
	for (int x = 1; x <= 2 * n; x ++) {
		if (2 * n % x == 0 && n % x) {
			cnt[x] = cal(x);
			//printf("cnt[%d] = %lld\n", x, cnt[x]);
		}
	}
	LL ans = 0;
	for (int i = 1; i <= 2 * n; i ++) {
		if (2 * n % i == 0 && n % i) {
			for (int j = i + i; j <= 2 * n; j += i) {
				cnt[j] -= cnt[i];
			}
			//printf("# cnt[%d] = %d\n", i, cnt[i]);
			cnt[i] = cnt[i] % MOD;
			ans += cnt[i] * i;
			ans = (ans % MOD + MOD) % MOD;
		}
	}
	cout << ans << endl;
}


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

char str[200005];

long long ten[200005];
long long cnt[2025] = {1};

int main () {
	int len;
	scanf ("%s", str);
	len = strlen (str);
	ten[0] = 1;
	for (int i = 1; i <= len; ++i) {
		ten[i] = ten[i-1] * 10;
		ten[i] %= 2019;
	}
	long long tmp = 0;
	for (int i = len-1; i >= 0; --i) {
		tmp = ((ten[len-1-i] * (str[i]-'0')) % 2019 + tmp) % 2019;
		++cnt[tmp];
	}
	long long ans = 0;
	for (int i = 0; i < 2019; ++i)
		ans += (cnt[i]-1) * cnt[i] / 2;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5416
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<iomanip>
using namespace std;
typedef long long ll;
const int INF=100000000;
const int MOD=1000000007;
 
int main()
{
 ll n, cur=1, ans=1;
 cin >> n;
 ll h[n];
 for(int i=0;i<n;i++) cin >> h[i];
 for(int i=1;i<n;i++){
   if(h[i]<=h[i-1]) cur++;
   else cur=1;
   ans=max(cur,ans);
 }
 cout << ans-1;
 return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const string ln = "\n";
constexpr int INF = 1001001001;
constexpr int MOD = 1000000007;

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

  ll n, k;
  cin >> n >> k;
  vector<ll> a(n + 10);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];  // 1 index
  }

  vector<ll> f(300000);  //何回目にどこにいるか
  f[0] = 1;              // 最初は1
  ll key = 0;
  set<ll> st;
  st.insert(1);
  for (int i = 0;; i++) {
    ll cur = f[i];
    ll to = a[cur];
    f[i + 1] = to;

    // はじめて同じ数がでたらbreak
    if (st.find(to) != st.end()) {
      key = to;
      break;
    }

    st.insert(to);
  }

  ll offset = 0;
  for (int i = 0; i < f.size(); i++) {
    if (f[i] == key) {
      break;
    } else {
      offset++;
    }
  }

  vector<ll> freqs;
  freqs.push_back(key);
  for (int i = offset + 1; i < f.size(); i++) {
    if (f[i] == key) {
      break;
    } else {
      freqs.push_back(f[i]);
    }
  }

  ll freq = freqs.size();

  ll ans = 0;

  if (k > offset) {
    k -= offset;
    ans = freqs[k % freq];
  } else {
    ans = f[k];
  }

  cout << ans << ln;

  return 0;
}

Measured memory_bytes: 17832