akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <cmath>

using namespace std;

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

    int i = 1;

    for (int i = 1; i <= n; i++)
    {
        int x = i;
        if (x % 3 == 0)
        {
            cout << " " << i;
        }
        else
        {
            while (x % 10 != 3)
            {

                x /= 10;
                if (x)
                {
                    continue;
                }
                else
                {
                    break;
                }
            }
            if (x % 10 == 3)
            {
                cout << " " << i;
            }
        }
    }

    cout << endl;

    return 0;
}


Measured memory_bytes: 3112
using System;
using System.Linq;

class Program
{
  public static void Main(string[] args)
  {
    int n = int.Parse(Console.ReadLine());
    double sum = 0;
    for (int i = 0; i < n; i ++) {
      string[] s = Console.ReadLine().Split(' ').ToArray();
      double x = double.Parse(s[0]);
      string v = s[1];
      if (v == "BTC") x *= 380000;
      sum += x;
    }
    Console.WriteLine(sum);
  }
}


Measured memory_bytes: 13268
fun main(args: Array<String>) {
    val (A, B) = readLine()!!.split(" ").map(String::toInt)

    val diff = B - A

    for (i in 2..999) {
        val cur = (1..i).sum()
        val pre = (1..i - 1).sum()
        if (cur - pre == diff) {
            println(cur - B)
            return
        }
    }
}




Measured memory_bytes: 38064
n=int(input())
s=str(input())
ans=0

for i in range(n-1):
    n=i+1
    if s[n]=='E':
        ans=ans+1

cnt=ans

for i in range(n):
    if s[i:i+2]=='WW':
        cnt=cnt+1
    elif s[i:i+2]=='EE':
        cnt=cnt-1
    else:
        0
        
    #print('i,s[i:i+2],ans,cnt',i,s[i:i+2],ans,cnt)
    ans=min(ans,cnt)
print(ans)

Measured memory_bytes: 3700
// -*- coding:utf-8-unix -*-

use proconio::{input, fastout};

// ABC086C - Traveling
// https://atcoder.jp/contests/abs/fasks/arc089_a

#[fastout]
fn main() {
    input! {
        n: usize,
        a_vec: [isize; n],
    }

    // Pattern 1: resulting a_1 is positive
    let mut count1 = 0;
    let mut prevsum;
    if a_vec[0] <= 0 {
        count1 += a_vec[0].abs() + 1;
        prevsum = 1;
    } else {
        prevsum = a_vec[0];
    }
    let mut nowsum;
    for i in 1..n {
        nowsum = prevsum + a_vec[i];
        if nowsum*prevsum < 0 {
            prevsum = nowsum;
            continue;
        }
        if prevsum > 0 {
            // Make nowsum negative
            count1 += nowsum.abs() + 1;
            prevsum = -1;
        } else {// prevsum < 0
            // Make nowsum positive
            count1 += nowsum.abs() + 1;
            prevsum = 1;
        }
    }

    // Pattern 2: resulting a_1 is negative
    let mut count2 = 0;
    let mut prevsum;
    if a_vec[0] >= 0 {
        count2 += a_vec[0].abs() + 1;
        prevsum = -1;
    } else {
        prevsum = a_vec[0];
    }
    let mut nowsum;
    for i in 1..n {
        nowsum = prevsum + a_vec[i];
        if nowsum*prevsum < 0 {
            prevsum = nowsum;
            continue;
        }
        if prevsum > 0 {
            // Make nowsum negative
            count2 += nowsum.abs() + 1;
            prevsum = -1;
        } else {// prevsum < 0
            // Make nowsum positive
            count2 += nowsum.abs() + 1;
            prevsum = 1;
        }
    }

    println!("{}", count1.min(count2));
}


Measured memory_bytes: 3700
#include<iostream>
#include<cmath>
#include<string>
#include<vector>

using namespace std;

int main(){

int n;
int a,b;
int i,j;
int vect_a[100][100]={};             //????¬???????????????????????????????
int vect_b[100]={};                  //???????????????????????????
int vect_c[100]={};                  //?¨??????????????´???¨??????????????????????????????

cin >> a >> b;                       //???????????????????????????????\???

for(i=0;i<a;i++){
  for(j=0;j<b;j++){
    cin >> vect_a[i][j];              //????¬?????????????????´???????????´??????\???
  }
}

for(i=0;i<b;i++){
    cin >> vect_b[i];                //?????????????´???????????´??????\???
  }

for(i=0;i<a;i++){
  for(j=0;j<b;j++){
    vect_c[i] += vect_a[i][j] * vect_b[j];              //n??m????????¨m??1??????????¨???????????????????????´???¨??????????????£??\
  }
}

for(i=0;i<a;i++){
    cout << vect_c[i] << endl;                  //?¨???????????????¨???
}

return 0;

}

Measured memory_bytes: 1208
#pragma GCC optimize("O3")
#pragma GCC target("avx")
#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
#define repr(i ,n) for(int i=n;i>(int)(n);--i)
#define rep1(i ,n) for(int i=1;i<=(int)(n);++i)
#define ALL(a) a.begin(), a.end()
#define RSORT(a) sort(ALL(a),greater<>())
#define SORT(a) sort(ALL(a))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define PRINT(x) cout << (x) << endl;
#define ENDL cout << endl;
using namespace std;
typedef long long int i64;
typedef unsigned long long u64;
template<class T> using V = vector<T>;
using VI = V<int>;
const int INF = 2e9;
const i64 MOD = 1e9 + 7;

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;}
struct Init_On{
    Init_On(){
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(16);
    }
};

signed main(){
    u64 a;
    long double b;
    cin >> a >> b;
    cout << fixed <<static_cast<u64>(floor(static_cast<double>(a) * b )) << endl;
}

Measured memory_bytes: 3732
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
	t=0; char ch=getchar(); int f=1;
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
typedef long long ll;
const int maxn=(2.5e5)+10;
const ll mod=(1e9)+7;
const ll t1=998244353;
const ll t2=235723657;
int n,pos[maxn];
char s[maxn];
ll h1[maxn],h2[maxn];
ll m1[maxn*2],m2[maxn*2],a[maxn*2],ans,s1,s2;
ll iv1[maxn*2],iv2[maxn*2];
map<pair<ll,ll> ,int> M;
ll MI1(int x) {
	if (x>=0) return m1[x];
	return iv1[-x];
}
ll MI2(int x) {
	if (x>=0) return m2[x];
	return iv2[-x];
}
ll get1(int x) {
	return a[x+n]*MI1(x)%mod;
}
ll get2(int x) {
	return a[x+n]*MI2(x)%mod;
}
ll ksm(ll x,ll y) {
	ll res=1;
	while (y) {
		if (y&1) res=res*x%mod;
		x=x*x%mod; y>>=1;
	} return res;
}
void F(ll &x) {
	x=(x%mod+mod)%mod;
}
int main() {
	//freopen("1.txt","r",stdin);
	read(n);
	scanf("%s",s+1);
	m1[0]=m2[0]=1;
	for (int i=1;i<=n*2;i++) m1[i]=m1[i-1]*t1%mod,m2[i]=m2[i-1]*t2%mod;
	iv1[0]=iv2[0]=1;
	iv1[1]=ksm(t1,mod-2);
	iv2[1]=ksm(t2,mod-2);
	for (int i=2;i<=n*2;i++)
		iv1[i]=iv1[i-1]*iv1[1]%mod,
		iv2[i]=iv2[i-1]*iv2[1]%mod;
	for (int i=1;i<=n;i++) {
		h1[i]=h1[i-1]; h2[i]=h2[i-1]; pos[i]=pos[i-1];
		if (s[i]=='+') {
			h1[i]-=get1(pos[i]);
			h2[i]-=get2(pos[i]);
			a[pos[i]+n]++;
			h1[i]+=get1(pos[i]);
			h2[i]+=get2(pos[i]);
		} else if (s[i]=='-') {
			h1[i]-=get1(pos[i]);
			h2[i]-=get2(pos[i]);
			a[pos[i]+n]--;
			h1[i]+=get1(pos[i]);
			h2[i]+=get2(pos[i]);
		} else if (s[i]=='>') pos[i]++;
		else pos[i]--;
		F(h1[i]);
		F(h2[i]);
	}
	for (int i=n-1;i>=0;i--) {
		M[make_pair(h1[i+1],h2[i+1])]++;
		s1=h1[n]*MI1(pos[i])%mod+h1[i];
		s2=h2[n]*MI2(pos[i])%mod+h2[i];
		F(s1); F(s2);
		ans+=M[make_pair(s1,s2)];
	}
	printf("%lld\n",ans);
	return 0;
}
/*
  0. Enough array size? Enough array size? Enough array size? Interger overflow?
  
  1. Think TWICE, Code ONCE!
  Are there any counterexamples to your algo?
    
  2. Be careful about the BOUNDARIES!
  N=1? P=1? Something about 0?
    
  3. Do not make STUPID MISTAKES!
  Time complexity? Memory usage? Precision error?
*/

Measured memory_bytes: 56192
#include <stdio.h>
int main(){
    int n;
    int room[10][3][4]={};
    int i,j,k;
    int a,b,c,d;
    // ???????????£?¨???????int a[10]={}??¨???????¢¨???????????¨?????????????????????0??§???????????§?????????
    // ?????????????????????????????????????????????????????´???????????\?????§????????????
    // ?????????{}?????????????????´????????????????????????????????\??£???????????????????????????(?????????)
    // ???
    // int a[3]={};    -> a[0]=0, a[1]=0,a[2]=0
    // int a[3]={-1};  -> a[0]=-1,a[1]=0,a[2]=0
    // int a[3];       -> a[0]=?, a[1]=?,a[2]=?
    // int a[2][2]={};    -> a[0][0]=0,a[0][1]=0,a[1][0]=0,a[1][1]=0
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d %d %d %d",&a,&b,&c,&d);
        room[c-1][b-1][a-1]+=d;
    }
    for(i=0;i<4;i++){
        for(j=0;j<3;j++){
            for(k=0;k<10;k++){
                printf(" ");
                printf("%d",room[k][j][i]);
            }
            puts("");
        }
        if(i==3) break;
        for(j=0;j<20;j++) printf("#");
        puts("");
    }
    return 0;
}

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

# define REP(i,n) for (int i=0;i<(n);++i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

const ll longinf=1LL<<60;

struct LazySegmentTree{
private:
   int n;
   vector<ll> node,lazy;
public:
   LazySegmentTree(int sz,ll init=0){
      n=1;
      while(n<sz)n*=2;
      node.resize(2*n-1,init);
      lazy.resize(2*n-1,0);
   }
 
   void eval(int k,int l,int r){
      if(lazy[k]!=0)node[k]+=lazy[k];
      if(r-l>1){
          lazy[2*k+1]+=lazy[k];
          lazy[2*k+2]+=lazy[k];
      }
      lazy[k]=0;
   }
      //[a,b)にxを加算
   void add(int a,int b,ll x,int k=0,int l=0,int r=-1){
       if(r<0)r=n;
       eval(k,l,r);
       if(r<=a||b<=l)return;
       if(a<=l&&r<=b){
          lazy[k]+=x;
          eval(k,l,r);
       }
       else {
          add(a,b,x,2*k+1,l,(l+r)/2);
          add(a,b,x,2*k+2,(l+r)/2,r);
          node[k]=max(node[2*k+1],node[2*k+2]);
        }
   }
   //[a,b)でのmaxを返す
   ll get(int a,int b,int k=0,int l=0,int r=-1){
      if(r<0)r=n;
      eval(k,l,r);
      if(r<=a||b<=l)return 0;
      if(a<=l&&r<=b)return node[k];
      ll xl=get(a,b,2*k+1,l,(l+r)/2);
      ll xr=get(a,b,2*k+2,(l+r)/2,r);
      return max(xl,xr);
   }
};

// 終点でソートして考える

// dp[r] := rまで考慮して、rの位置を１とする時の最大スコア
// dp[r] は max(dp[0], dp[1], .... , dp[r-1]) + (rを1にすることによるスコア変化)
// である。

// dp[0] ~ dp[r-1]はrを見る時に更新されるが、最終的には正しい値になるので問題ない

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

	vector<P_ii> R[N];
	ll sum = 0;
	REP(i, M){
		int l, r, a;
		cin >> l >> r >> a;
		R[r-1].push_back({l-1, a});
		sum += a;
	}
    
	LazySegmentTree sg(N+1, 0);

	REP(i, N){
		ll now = sg.get(0, i);
		sg.add(i, i + 1, now);
		for(auto s : R[i]){
			sg.add(s.first, i + 1, s.second);
		}
	}
	cout << sg.get(0, N) << endl;

    return 0;
}

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

using namespace std;

#define DBG cerr << '!' << endl;
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(ll (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(ll (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(10)
#define INF 1000000000
#define PI 3.14159265359

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

int main()
{
	int n;cin >> n;
	vector<double> x(n),y(n);
	
	REP(i,n)
	{
		cin >> x[i] >> y[i];
	}
	
	REP(i,n)
	{
		vector<double> arg;
		REP(j,n)
		{
			if(i != j)
			{
				arg.PB(atan2(y[i] - y[j],x[i] - x[j]));
			}
		}
		
		sort(ALL(arg));
		
		double ma = 0;
		
		REP(j,arg.size()-1)
		{
			ma = max(ma,arg[j+1] - arg[j]);
		}
		ma = max(ma,arg[0]+2*PI - arg[arg.size()-1]);
		
		if(ma < PI)ma = 0;
		else
		{
			ma -= PI;
		}
		
		cout << Decimal << ma / (2*PI) << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;
#define N 200010
ll n,a[N];
int main(){
    cin>>n;
    bool ans=true;
    lol(i,n){
	cin>>a[i];
	if(a[i]>i)ans=false;
	if(i>0)if(a[i]>=a[i-1]+2)ans=false;
    }
    if(ans==false){
	cout<<-1<<endl;
	return 0;
    }
    ll sum=0;a[n]=-1;
    for(int i=n-1;i>=0;i--){
	if(a[i]!=a[i+1]-1)sum+=a[i];
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 1792
using System.Linq;
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        var asum = a.Sum();
        var m = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i < m; i++)
        {
            string[] line2 = Console.ReadLine().Trim().Split(' ');
            var p = int.Parse(line2[0]) - 1;
            var x = int.Parse(line2[1]);
            Console.WriteLine(asum - a[p] + x);
        }
    }
}

Measured memory_bytes: 13268
A,B,K=map(int,input().split())

for k in range(K):
    if k%2==0:
        if A%2==1:
            A-=1

        A,B=A//2,B+A//2

    else:
        if B%2==1:
            B-=1

        A,B=A+B//2,B//2

print(A,B)


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

int main() {
	int N, K;
	cin >> N >>K;
  if(N%K == 0){
    cout << 0 << endl;
  } else {
    cout << 1 << endl;
  }
}

Measured memory_bytes: 256
#coding : utf-8

import os
import sys

N = int(input())

A = []

for i in range(N):
	A.append(int(input()))


Amax = max(A)

i = A.index(Amax)
t = A[i]
A[i] = 0
A2nd = max(A)
A[i] = t

for i in range(N):
	if A[i] == Amax:
		print(A2nd)
	else:
		print(Amax)



Measured memory_bytes: 12512
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N = II()
max = 0
val = 0
if N != 1:
    for i in range(2, N+1):
        p = 2
        while val < N:
            if i ** p <= N:
                val = i ** p
                p += 1
            else:
                break
            if max < val:
                max = val
else:
    max = 1
print(max)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<set>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<map>
#include<queue>
#include<iomanip>
#define INF 1e9
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;
using namespace std;
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; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  return s;
}

template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
  s << vv[i] << endl;
  }
  return s;
}


int gcd(int a, int b) 
{ 
  if (a == 0) 
    return b; 
  return gcd(b % a, a); 
} 
int findGCD(vector<int> &arr, int n) 
{ 
  int result = arr[0]; 
  for (int i = 1; i < n; i++) 
    result = gcd(arr[i], result); 
  return result; 
}

int N,X;
vector<int> x;
signed main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> N >> X;
  x.resize(N);
  rep(i,N){
    int tmp;
    cin >> tmp;
    x[i] = abs(tmp - X);
  }

  cout << findGCD(x,N) << endl;


  return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define N 200005
#define M 600005
#define LL long long
#define INF (1LL<<60)
using namespace std;
int n,m,e,P,a[N]; LL sum;
struct Seg{
	LL A[M];
	int L(int t){ return t<<1;}
	int R(int t){ return (t<<1)|1;}
	void build(){ for(int i=e-1;i>=1;i--) A[i]=min(A[L(i)],A[R(i)]);}
	void modify(int t,LL d){
		t+=e,A[t]=d;
		for(int i=t>>1;i;i>>=1)
			A[i]=min(A[L(i)],A[R(i)]);
	  }
	LL query(int l,int r){
		LL res=INF;
		l=(l-1+e),r=(r+1+e);
		for(;l^r^1;l>>=1,r>>=1){
			if(~l&1) res=min(res,A[l^1]);
			if( r&1) res=min(res,A[r^1]);
		  }
		return res;
	  }
}F,G;
int main()
{
	int i; LL u,v;
	scanf("%d %d %d %d",&n,&m,&a[0],&P);
	for(i=1;i<=m;i++) scanf("%d",&a[i]);
	for(i=1;i<=m;i++) sum+=abs(a[i]-a[i-1]);
	for(e=1;e<=n+1;e<<=1);
	for(i=1;i<=n;i++) F.A[i+e]=G.A[i+e]=INF;
	F.A[P+e]=-P,G.A[P+e]=P;
	F.build(),G.build();
	for(i=1;i<=m;i++){
		u=min(F.query(1,a[i])+a[i],G.query(a[i],n)-a[i])-abs(a[i]-a[i-1]);
		v=F.A[a[i-1]+e]+a[i-1];
		if(u<v) F.modify(a[i-1],u-a[i-1]),G.modify(a[i-1],u+a[i-1]);
	  }
	LL ans=INF;
	for(i=1;i<=n;i++) ans=min(ans,sum+F.A[i+e]+i);
	cout<<ans;
	return 0;
}


Measured memory_bytes: 9344
#if defined(LOCAL)
#define PROBLEM_NAME "b"
const double _max_double_error = 1e-9;
#include "testutils.h"
#define L(x...) (debug(x, #x))
#define C(x...) CHECK(x)
#else
#define L(x, ...) (x)
#define C(x, ...) ;
#include <bits/stdc++.h>
#endif

using namespace std;
using vi = vector<int>; using vvi = vector<vi>;
using ii = pair<int,int>; using vii = vector<ii>;
using l = long long; using vl = vector<l>; using vvl = vector<vl>;
using ll = pair<l,l>; using vll = vector<ll>; using vvll = vector<vll>;
using lu = unsigned long long;
using vb = vector<bool>; using vvb = vector<vb>;
using vd = vector<double>; using vvd = vector<vd>;
using mll = unordered_map<l, l>;
const l INF = numeric_limits<l>::max();
const double EPS = 1e-10; static constexpr auto PI = acos(-1);
const l e0=1, e3=1000, e5=100000, e6=10*e5, e7=10*e6, e8=10*e7, e9=10*e8;
const char lf = '\n';
#define all(x) begin(x), end(x)
#define F(a,b,c) for (l a = l(b); a < l(c); a++)
#define B(a,b,c) for (l a = l(c) - 1; a >= l(b); a--)
#define MAX(a,b)({__typeof__(a)__x=(a);__typeof__(b)__y=(b);__x<__y?__y:__x;})
#define MIN(a,b)({__typeof__(a)__x=(a);__typeof__(b)__y=(b);__x<__y?__x:__y;})

void solve(istream& cin, ostream& cout) {
  l n; cin >> n;
  vl v(n); F(i, 0, n) cin >> v[i];
  l m; cin >> m;
  vl w(m); F(i, 0, m) cin >> w[i];
  sort(all(v)); sort(all(w));
  for (auto i : w) {
    l x = upper_bound(all(v), i) - lower_bound(all(v), i);
    l y = upper_bound(all(w), i) - lower_bound(all(w), i);
    if (y > x) {
      cout << "NO" << lf;
      return;
    }
  }
  cout << "YES" << lf;
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout << fixed << setprecision(15);
#if defined(LOCAL)
  // _generate_random_test = generate_random;
  // _solve_brute = solve_brute;
  // _player_b = player_b;
  // _custom_solution_checker = solution_checker;
  maybe_run_tests(cin, cout);
#else
  solve(cin, cout);
#endif
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define ld long double
#define pb push_back
#define all(x) (x).begin(), (x).end()
template <typename T> using ord_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 2e5 + 123;
int n, a[N], x;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		x ^= a[i];
	}
	for (int i = 0; i < n; i++) {
		cout << (x ^ a[i]) << ' ';
	}
}


Measured memory_bytes: 4424
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define INF 1000000000000000000

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

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

    int N, K;
    cin >> N >> K;
    vector<ll> A(N);

    rep(i, N) {
        cin >> A[i];
        if (A[i] == K) {
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }

    ll m = *max_element(all(A));
    ll gcd = A[0];
    rep(i, N) { gcd = GCD(gcd, A[i]); }

    if (m < K) {
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }

    if (gcd == 1) {
        cout << "POSSIBLE" << endl;
        return 0;
    }
    if (K % gcd == 0) {
        cout << "POSSIBLE" << endl;
        return 0;
    }

    cout << "IMPOSSIBLE" << endl;
    return 0;
}

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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int mn = a[0], mx = a[0];
    for (int i = 1; i < n; i++) {
        if (mn > a[i]) mn = a[i];
        if (mx < a[i]) mx = a[i];
    }
    cout << mx - mn << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
using namespace std;
using ll = long long;

int main(){
    int N, M;
    cin >> N >> M;
    int k[11];
    vector<vector<int>> s(M);
    for(int i = 0;i < M;i++){
        cin >> k[i];
        s[i].resize(k[i]);
        for(int j = 0;j < k[i];j++){
            cin>> s[i][j];s[i][j]--;
        }
    }
    int p[11];
    for(int i = 0;i < M;i++){
        cin >> p[i];
    }
    int ans = 0;
    for(int i = 0;i < (1<<N);i++){
        bool ok = true;
        for (int j = 0; j < M; j++) {
			int count = 0;
			for (int l : s[j]) {
				if ((i>>l) & 1) {
				    count++;
			    }
		    }
			count %= 2;
			if (count != p[j]) {
				ok = false;
			}
		}
        if(ok){
            ans++;
        }
    }
    cout << ans;
}

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

#define fast ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define int long long
#define endl '\n'

using namespace std;

const int N = 2e6 + 77 , mod = 1e9+7;
int A[N] , pre[N];

int32_t main(){
    int n ; cin >> n ;
    for(int i = 0 ; i < n ; ++i) cin >> A[i];
    reverse(A,A+n);
    int sum = 0 ;
    for(int i  = 0 ; i <  n ; ++i){
        sum += A[i];
        pre[i] = sum;
    }
    reverse(A,A+n);
    reverse(pre,pre+n);
    
    sum = 0;
    for(int i = 0 ; i < n-1 ;++i) {
        sum += (A[i] * (pre[i+1]%mod))%mod;
        sum = sum % mod;
    }
    cout << sum << endl;
    return 0;
}

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

#define loop(n) for(int i = 0;i < (int)(n);++i)
#define rep(i,n) for(int i = 0;i < (int)(n);++i)
#define all(vec) (vec).begin(),(vec).end()
#define sort(vec) std::sort(all(vec))
#define rev(vec) std::reverse(all(vec))

void input(){return;}
template<typename First,typename... Rest> void input(First &first,Rest&... rest){
    std::cin >> first;
    input(rest...);
}

void inputVector(){return;}
template<typename First,typename... Rest> void inputVector(std::vector<First> &first,Rest&... rest){
    int N = first.size();
    for(int i = 0;i < N;i++){
        std::cin >> first[i];
    }
    inputVector(rest...);
}


void calculate(){
    int N;
    input(N);
    rep(i,26){
        rep(j,15){
            int sum = 4 * i + 7 * j;
            if(sum == N){
                std::cout << "Yes\n";
                return;
            }
        }
    }
    std::cout << "No\n";
}

int main(int,char**){
    calculate();    
}




Measured memory_bytes: 256
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>

using namespace std;

#define rep(i, n) for (int i = 0, _n = (int)(n); i < _n; ++i)
const int N = (int) 0, mod = (int) 0;
char ch[] = {'.', '#'};
bool query(string a, string b) {
    cout << a << endl << b << endl;
    string x; cin >> x;
    if (x == "end") {
        exit(0);
    }
    return x[0] == 'T';
}
int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    string x = "", y = "";
    while (true) {
        int flag = 0;
        for (int i = 0; i < 2 && !flag; ++i)
            for (int j = 0; j < 2 && !flag; ++j) {
                string a = x; a += ch[i];
                string b = y; b += ch[j];
                if (query(a, b)) {
                    flag = 1;
                    x = a;
                    y = b;
                }
            }
        if (!flag) break;
    }
    while (true) {
        int flag = 0;
        for (int i = 0; i < 2 && !flag; ++i)
            for (int j = 0; j < 2 && !flag; ++j) {
                string a = ""; a += ch[i]; a += x;
                string b = ""; b += ch[j], b += y;
                if (query(a, b)) {
                    flag = 1;
                    x = a;
                    y = b;
                }
            }
        if (!flag) break;
    }


}


Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
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;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};

int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
int main() {
    ll N;
    string S;
    cin >>S;
    N=S.size();
    ll sum=0;
    rep(i,N){
        sum+=ctoi(S[i]);
    }
    if(sum%9==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }



    return 0;
    

}

Measured memory_bytes: 3716
S = input()

def judge(x):
  if "".join(list(reversed(x))) == x:
    return True
  else:
    return False
  
def solve(x):
  if judge(x) and judge(x[0:int((len(x)-1)/2)]) and judge(x[int((len(x)+1)/2):]):
    print("Yes")
  else:
    print("No")
    
    
solve(S)

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

#define MOD          (int)1e9+7
#define MAX          (int)1e5+5
#define ll           unsigned long long
#define pii          pair<ll,ll>
#define sf(a)        scanf("%d",&a)
#define pf(a)        printf("%d\n",a)
#define bug(a)       cerr << #a << " : " << a << endl;
#define mem(a,b)     memset(a,b,sizeof(a))
#define all(x)       x.begin(),x.end()
#define rall(x)      x.rbegin(),x.rend()
#define pb           push_back
#define F            first
#define S            second
#define Time()       cout<< "\nElapsed Time : " << (clock()*1.0) / CLOCKS_PER_SEC <<" sec"<< endl;
#define FastRead     ios_base::sync_with_stdio(false);cin.tie(NULL);

int main()
{
  int a,b;
  cin >> a >> b;
  int x = a+b , y = a-b , z = a*b;
  cout << max(x,max(y,z)) << endl;
}


Measured memory_bytes: 256
<?php
    list($H,$K) = array_map('intval',explode(" ",trim(fgets(STDIN))));

    $H_array = array_map('intval',explode(" ",trim(fgets(STDIN))));
    
    rsort($H_array);
    
    // for($i=1;$i<=$K;$i++){
    //     array_shift($H_array);
    // }
    // var_dump($H_array);
    
    $H_array = array_slice($H_array,$K);
    
    // var_dump($H_array);
    
    echo array_sum($H_array);
?>

Measured memory_bytes: 38180
#include<bits/stdc++.h>
using namespace std;
int a[100];
int main()
{
    int n, cnt = 0;
    cin >> n;
    if(n == 0)
    a[cnt++] = 0;
    while(n != 0){
        int r = n % (-2);
        n = n / (-2) ;
        if(r < 0)
        {
            n++;
            r = 1;
        }
        a[cnt++] = r;
    }
    for(int i = cnt - 1; i >= 0; i--)
        cout << a[i];
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
A, V = map(int,input().split())
B, W = map(int,input().split())
T = int(input())
if A > B:
  if A - (V * T) <= B - (W * T): print("YES")
  else: print("NO")
else: 
  if A + (V * T) >= B + (W * T): print("YES")
  else: print("NO")  
    

Measured memory_bytes: 61624
#include<iostream>
using namespace std;
int main(){
    int H,W,i,j;
    while(1)
    {
        cin>>H>>W;
        if(H==0 && W==0)break;
        else{
            for (i=0;i<H;i++){
                for(j=0;j<W;j++){
                    cout<<"#";
                }
                cout<<endl;
            }
            cout<<endl;
        }
    }
}


Measured memory_bytes: 3084
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    string s;
    cin >> s;

    int K;
    cin >> K;
    
    vector<string> A;
    A.reserve(s.length() * K);

    FOR(i, 0, s.length()){
        FOR(j, 1, K+1){
            string t = s.substr(i, j);
            A.push_back(t);
        }
    }

    sort(ALL(A));
    unique(ALL(A));

    p(A[K-1]);
    
    return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std;
#define ll long long
string s,t;

int main()
{
    int i;
    cin>>s>>t;
    if(s.size()+1!=t.size())cout<<"No\n";
    else
    {
        for(i=0; s[i]!='\0'; i++)
            if(s[i]!=t[i])break;
        if(i==s.size())cout<<"Yes\n";
        else cout<<"No\n";
    }
    return 0;
}


Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N_str = sc.next();
		String[] N_list = N_str.split("");
		int check = 0;
		for (int i = 0; i < N_list.length; i++) {
			check += Integer.parseInt(N_list[i]);
		}
		if(check%9==0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}

}


Measured memory_bytes: 54048
#include"bits/stdc++.h"

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;


int main() {
    int k,x;
    cin >> k >> x;
    for (int i = x - k + 1; i < x + k - 1; i++)cout << i << " ";
    cout << x + k - 1 << endl;
    return 0;
}


Measured memory_bytes: 256
M = int(input())
dc = [list(map(int, input().split())) for _ in range(M)]

ans = 0
t = 0
for i in range(M):
  ans += dc[i][1]
  t += dc[i][1] * dc[i][0]

ans -= 1
ans += (t - 1) // 9

print(ans)

Measured memory_bytes: 77784
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

bool bt (map<int,int> & curr, bool head )
{
	for (int i = 1; i <= 9; i++ ){
		if (curr[i] == 4 || curr[i] == 3 ){
			curr[i] -= 3;
			if (bt (curr, head ) ) return true;
			curr[i] += 3;
		} // end if
	} // end for

	for (int i = 1; i <= 7; i++ ){
		if (curr[i] >= 1 && curr[i+1] >= 1 && curr[i+2] >= 1 ){
			curr[i]--; curr[i+1]--; curr[i+2]--;
			if (bt (curr, head ) ) return true;
			curr[i]++; curr[i+1]++; curr[i+2]++;
		} // end if
	} // end for

	for (int i = 1; i <= 9; i++ ){
		if (curr[i] == 2 && !head ){
			curr[i] -= 2; head = true;
			if (bt (curr, head ) ) return true;
			curr[i] += 2; head = false;
		} // end if
	} // end for

	bool ok = true;
	for (int i = 1; i <= 9; i++ ){
		if (curr[i] == 0 ) continue;
		ok = false;
		break;
	} // end for

	if (ok && head ){
		return true;
	} // end if

	return false; 
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.Puzzle", "r", stdin );
	string str = "";
	while (getline (cin, str ) ){
		set<int> res;
		map<int,int> pai; pai.clear();
		int n = str.length();
		rep (i, n ){
			pai[(int)(str[i] - '0' )]++;
		} // end rep
		vector<int> cand; cand.clear();
		for (int i = 1; i <= 9; i++ ){
			if (pai[i] >= 0 && pai[i] < 4 ) cand.push_back (i );
		} // end for

		rep (i, cand.size() ){
			map<int,int> curr = pai;
			curr[cand[i]]++;
			if (bt (curr, false ) ){
				res.insert (cand[i] );
			} // end if
		} // end rep

		if (res.empty() ){
			cout << 0 << endl;
		}else{
			set<int>::iterator it = res.begin();
			for (int i = 0; it != res.end(); it++, i++ ){
				cout << (*it) << (i != res.size() - 1 ? ' ' : '\n' );
			} // end for
		} // end if
	} // end loop
		
	return 0;
}

Measured memory_bytes: 1204
import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in);
	static int n;
	static int[][] data;
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO ツ篠ゥツ督ョツ青カツ青ャツつウツづェツつスツδソツッツドツ・ツスツタツブ
		while(read()){
			slove();
		}
	}
	static boolean read(){
		n = sc.nextInt();
		if(n == 0)
			return false;
		
		data = new int[n][5];
		String[] line;
		for(int i = 0; i < n; i++){
			data[i][0] = sc.nextInt();
			data[i][1] = sc.nextInt();
			data[i][2] = sc.nextInt();
			data[i][3] = sc.nextInt();
			data[i][4] = sc.nextInt();
		}
		return true;
	}
	static void slove(){
		int max = 0, min = 0;
		for(int k = 0; k < 5; k++){
			max += data[0][k];
			min += data[0][k];
		}
		for(int i = 0; i < n; i++){
			int temp = 0;
			for(int j = 0; j < 5; j++){
				temp += data[i][j];
			}
			max = Math.max(max, temp);
			min = Math.min(min, temp);
			
		}
		System.out.print(max + " ");
		System.out.println(min);
	}
}

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

int main() {
  int N;
  int A;
  int B;
  
  cin >> N;
  cin >> A;
  B = N % 500;
  if (A < B)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
}


Measured memory_bytes: 3628
#include <stdio.h>

int main(void){
    int K, S, count=0;

    scanf("%i %i", &K,&S);

    for(int x=0; x<=K; x++){
        for(int y=0; y<=K; y++){
            int z=S-x-y;
                if (0<=z && z<=K) count++;
        }
    }   

    printf("%i\n", count);
    return 0;
}

Measured memory_bytes: 128
package main

import (
  "fmt"
)

func main() {
  var n int 
  fmt.Scan(&n)
  m := n
  s := 0
  for n > 0 {
    s += n % 10
    n /= 10
  }
  ans := "No"
  if m % s == 0 {
    ans = "Yes"
  }
  fmt.Println(ans)
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define endl "\n"
#define pi 3.14159265358979323846264338327950288
#define MOD 1000000007
#define INF -100000000000000
#define ordered_set tree<pair< ll int ,ll  int>, null_type,less<pair<ll int, ll int>>, rb_tree_tag,tree_order_statistics_node_update> 
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
using namespace std;
#define lld long double
using namespace __gnu_pbds;
int main()
{
    fast;	
  //  #ifndef ONLINE_JUDGE
  //  freopen("input.txt", "r", stdin);
  //  freopen("output.txt", "w", stdout);
  //  #endif
   ll int n,m,k;
   cin>>n>>m>>k;
   ll int a[n];
   ll int i;
   ll int left1[n],left[m];ll int s=0;ll int y=0;ll int ans=0;
   for(i=0;i<n;i++)
   {

   	cin>>a[i];s+=a[i];
   	if(s<=k)
   	{
   		ans=max(ans,i+1);
   	}
   	if(i==0)
   			left1[i]=a[i];
   		else
   			left1[i]=left1[i-1]+a[i];
}
   ll int b[m];
   vector<ll int> v;
   for(i=0;i<m;i++)
   	{
   		cin>>b[i];
   		s+=b[i];
   		y+=b[i];
   		if(y<=k)
   		{
   			ans=max(ans,i+1);
   		}
   		if(i==0)
   			left[i]=b[i];
   		else
   			left[i]=left[i-1]+b[i];
   		v.PB(left[i]);
   	}



   	if(k>=s)
   	{
   		cout<<n+m<<endl;exit(0);
   	}
   	else
   	{ll int z,q;
   		for(i=0;i<n;i++)
   		{
   			z=left1[i];
   			q=k-z;
   			if(q<0)
   				break;
   			auto w=upper_bound(v.begin(),v.end(),q);
   			if(w==v.end())
   			{
   				ans=max(ans,i+1+m);
   			}
   			else
   			{
   			ll int r=w-v.begin();	
   			ans=max(ans,i+1+r);
   			}
   		}
   		cout<<ans<<endl;
   	}
   }
  

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

int main(){
    string S,T;
    int K,A,B;
    int ans ,i = 1;
    cin >> S >> T;
    if(S == T.substr(0, S.size())){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3596
#include<cstdio>

using namespace std;

int main(){
  int M, N;
  char A[50][50], B[50][50];
  bool f1 = true, f2 = true;;

  scanf("%d %d", &N, &M);

  for(int l = 0; l < N; l++){
    scanf("%s", A[l]);
  }
  for(int l = 0; l < M; l++){
    scanf("%s", B[l]);
  }

  for(int i = 0; i <= (N-M) && f1; i++){
    for(int j = 0; j <= (N-M) && f1; j++){

      for(int k = 0; k < M && f2; k++){
        for(int l = 0; l < M && f2; l++){
          if(A[i+k][j+l] != B[k][l]){
            f2 = false;
          }
          //printf("A(%d,%d)%c B(%d,%d)%c\n", i+k, j+l, A[i+k][j+l], k, l, B[k][l]);
        }
      }
      if(f2){
        f1 = false;
      }
      f2 = true;

    }
  }

  if(!f1){
    printf("Yes");
  }else{
    printf("No");
  }

  return 0;

}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
using ll = long long;
 
int main() {
  string S, T;
  cin >> S >> T;
  int k = S.size();
  int ans = 0;
  rep(i, k) if(S.at(i) != T.at(i)) ans++;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> i_i;

#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((int)(x).size())

const double PI  = acos(-1.0);
const double EPS = 1e-9;
const ll INF = 1e9+10;
const ll mod = 998244353;
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; }
#define print(x) cerr << #x << " is " << x << endl;
//#define print(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; 

vector<pair<ll, ll> > pairs;

int main()
{
    string S;
    cin >> S;
    rep(i, S.size()){
        cout << "x";
    }
    return 0;    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(0);cin.tie(0);
#define all(v)    ((v.begin()),(v.end()))
#define sz(v)     ((int)(v.size()))
#define forv(i, v) for(int i = 0; i < sz(v); ++i)
#define forn(i,n)   for(int i = 0; i < (int)(n); i++)
using namespace std;

typedef long long       ll;
typedef long double     ld;
typedef vector<int>     vi;
typedef vector<double>  vd;
typedef vector< vi >    vii;
typedef vector< vd >    vdd;
typedef vector<string>  vs;


int main()
{
	int n;
	scanf("%d", &n);
	int h[n + 5];
	ll ans[n + 5];
	for (int i = 0; i < n; i++) {
		scanf("%d", &h[i]);
	}
	ans[0] = 0;
	ans[1] = abs(h[0] - h[1]);
	for (int i = 2; i < n + 3; i++) {

		ll r1 = abs(h[i] - h[i - 1]) + ans[i - 1];
		ll r2 = abs(h[i] - h[i - 2]) + ans[i - 2];
		ans[i] = min(r1, r2);
	}
	printf("%lld\n", ans[n - 1]);
	return 0;
}


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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string S;
  cin >> S;
  int N = S.size();
  vector<int> wCnt;
  int cnt = 0;
  for (int i = N - 1; i >= 0; i--)
  {
    if (S[i] == 'B')
      wCnt.push_back(cnt);
    else
      cnt++;
  }
  ll ans = accumulate(wCnt.begin(), wCnt.end(), 0LL);
  cout << ans << endl;
  return 0;
}

// 最終的にBは右に，Wは左に寄る．あるBの右側にあるWの数の総和が答えとなる．(Bの右にWがある限り，BとWの入れ替えは可能であるから)


Measured memory_bytes: 1680
// ToDo
// Link: https://atcoder.jp/contests/dp/tasks/dp_a
#include <iostream>
#include <climits>
#include <set>
#include <vector>
#include <stdio.h>
#include <map>
#include <stack>
#include <algorithm>
#include <unordered_map>
#define ll long long int
#define fastio ios_base::sync_with_stdio(false)
#define fastcin cin.tie(NULL)
using namespace std;
int main(){

	fastio;
	fastcin;	
	
    
    // freopen("small_input.txt", "r", stdin);
    
    // freopen("small_output.txt", "w", stdout);
    
	int n;
	cin>>n;

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

	if(n == 2){
		cout<<abs(a[1]-a[0]);
		return 0;
	}
	int* dp=new int[n];
	for(int i=0;i<n;i++){
		dp[i] = 0;
	}
	int ans = 0;
	dp[0] = 0;
	dp[1] = abs(a[1]-a[0]);
	for(int i=2;i<n;i++){
		dp[i] = min(dp[i-2]+abs(a[i]-a[i-2]),dp[i-1]+abs(a[i]-a[i-1]));
	}
	cout<<dp[n-1];

}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        long k = scanner.nextLong();
        long [] a = new long[n];
        long max = 0;
        for (int i = 0; i < n; ++i) {
            a[i] = scanner.nextLong();
            max = Math.max(max, a[i]);
        }
        if (max == 0) {
            System.out.println(k * n);
            return;
        }
        int length = 0;
        long copyK = Math.max(max, k);
        while (copyK > 0) {
            ++length;
            copyK /= 2;
        }
        int[][] num = new int[n][length];
        for (int i = 0; i < n; ++i) {
            long copy = a[i];
            int b = 0;
            while (copy > 0) {
                num[i][b] = (int)(copy % 2);
                copy /= 2;
                ++b;
            }
        }
        long result = 0;
        int lastOne = -1;
//        int [] zero = new int[length];
//        int [] one = new int[length];

        for (int b = length - 1; b >= 0; --b) {
            int num0 = 0;
            int num1 = 0;
            for (int i = 0; i < n; ++i) {
                if (num[i][b] == 0) {
                    ++num0;
                } else {
                    ++num1;
                }
            }
//            zero[b] = num0;
//            one[b] = num1;
    //        System.out.println("b: " + b + " num0: " + num0 + " num1: " + num1);
            if (num1 < num0) {
                long currentAdd = (long)Math.pow(2, b);
                if (result + currentAdd <= k) {
                    result += currentAdd;
                    lastOne = b;
                }
//                else {
//                    if (lastOne > 0 && zero[b] * Math.pow(2, b) >= zero[lastOne] * Math.pow(2, lastOne)) {
//                        result -= Math.pow(2, lastOne);
//                        result += currentAdd;
//                        lastOne = b;
//                    }
//                }
            }
        }
     //   System.out.println("result: " + result);
        long f = 0;
        for (int i = 0; i < n; ++i) {
            long xorRes = xor(result, a[i]);
            f += xorRes;
        }
        System.out.println(f);
//        for (int x = 0; x <= k; ++x) {
//            long f = 0;
//
//        for (int i = 0; i < n; ++i) {
//            long xorRes = xor(x, a[i]);
//            f += xorRes;
//        }
//        System.out.println("x: " + x + " f: " + f);
//        }

    }

    public static long xor(long a, long b) {
        long res = 0;
        int p = 0;
        while (a > 0 || b > 0) {
            if (a % 2 != b % 2) {
                res += (long) Math.pow(2, p);
            }
            a /= 2;
            b /= 2;
            ++p;
        }
        return res;
    }

}


Measured memory_bytes: 78300
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define sf scanf
#define pf printf
#define pb push_back
#define llu unsigned long long
#define U unsigned int
#define SIZE 100005
#define pie 3.14159265358979323
#define minuss 1e-6
#define pair pair<ll,ll>
#define fast_cin ios_base::sync_with_stdio(false);cin.tie(NULL)
#define BIG 1000000000
#define INF 1000000000000005
#define N 10000
#define NN 1e18
/*
std::cout << std::fixed;
std::cout << std::setprecision(1);
std::cout << VALUE NAME<<endl;
*/
ll tra[100006],tra1[100006];

int main()
{

    fast_cin;
    int lock=1;
    ll n;
    cin>>n;
    ll str[n+4];
    ll save=1;
    ld save1=1;
    for(int i=0; i<n; i++)
    {
        cin>>str[i];
        save*=str[i];
        save1*=str[i];
    }

    if(save>NN || save1>NN)
    {
        cout<<"-1"<<endl;
        return 0;
    }
    cout<<save<<endl;
}



Measured memory_bytes: 4400
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<vector<int>> Matrix;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
static const int INF = 2000000000;



int main(){
  int l;
  cin >> l;
  double a = (double)l / 3;
  double ans = a * a * a;
  cout << fixed << setprecision(7) << ans << endl;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
int main() {
	int A, B, i = 0;
	cin >> A >> B;
	bool flag = "true";
	while (flag) {
		if (B <= 1 + (A - 1)* i) {
			cout << i;
			flag = "false";
			break;
		}
		i++;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
#define INF 1000000007
using namespace std;
int a,b,c,cnt,aa[110000];
string s;
signed main()
{
	cin>>a;
	cout<<a*a*3;
}

Measured memory_bytes: 764
#include <iostream>

int partition(int* A, const int p, const int r) {
    int x = A[r];
    int i = p-1;
    for(int j=p; j<r; ++j) {
        if(A[j] <= x) {
            ++i;
            std::swap(A[i], A[j]);
        }
    }
    std::swap(A[i+1], A[r]);
    return i+1;
}

int main() {
    int n;
    int A[100010];

    std::cin >> n;

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

    int index = partition(A, 0, n-1);

    for(int i=0; i<n; ++i) {
        if(i == index) {
            std::cout << "[" << A[index] << "] ";
        } else if(i != n-1) {
            std::cout << A[i] << " ";
        } else {
            std::cout << A[i];
        }
    }

    std::cout << std::endl;
}


Measured memory_bytes: 3380